diff --git a/apps/web/tests/session-panel-layout.e2e.ts b/apps/web/tests/session-panel-layout.e2e.ts index 7036560cb6..0ad06d4e3f 100644 --- a/apps/web/tests/session-panel-layout.e2e.ts +++ b/apps/web/tests/session-panel-layout.e2e.ts @@ -393,7 +393,7 @@ describe.skipIf(MODE === 'record')('web e2e: Session panel layout', () => { await expect.poll(order, { timeout: 20_000 }).toEqual(registered) // At rest the handle does not show and takes no room: the title's trailing count runs to the row's 6px padding. - // Over the title row the handle shows on the rows' More column, and the count stays where it was and fades under it. + // Over the title row the handle shows on the rows' More column in place of the count, which keeps its box. await page.mouse.move(5, 5) const handle = (id: string) => head(id).evaluate((element) => { const button = element.querySelector('[data-session-panel-grip]')! @@ -407,14 +407,14 @@ describe.skipIf(MODE === 'record')('web e2e: Session panel layout', () => { center: box.right - (target.left + target.width / 2), trailing: trailing.textContent, trailingEnd: box.right - trailing.getBoundingClientRect().right, - faded: getComputedStyle(trailing).maskImage !== 'none', + shown: getComputedStyle(trailing).visibility === 'visible', } }) const resting = { cursor: 'grab', target: [24, 24], center: 14, trailing: '1 external', trailingEnd: 6 } - expect(await handle('subagents')).toEqual({ ...resting, opacity: '0', faded: false }) + expect(await handle('subagents')).toEqual({ ...resting, opacity: '0', shown: true }) await head('subagents').hover() await expect.poll(async () => (await handle('subagents')).opacity).toBe('1') - expect(await handle('subagents')).toEqual({ ...resting, opacity: '1', faded: true }) + expect(await handle('subagents')).toEqual({ ...resting, opacity: '1', shown: false }) expect(await grip('background-jobs').evaluate(element => getComputedStyle(element).opacity)).toBe('0') // Drag Background jobs by its title row onto the upper half of Environment. diff --git a/packages/client/ui-session-panel/README.i18n.yaml b/packages/client/ui-session-panel/README.i18n.yaml index ff7630a902..2e4b208700 100644 --- a/packages/client/ui-session-panel/README.i18n.yaml +++ b/packages/client/ui-session-panel/README.i18n.yaml @@ -24,11 +24,11 @@ en: 275d7ee3241b5cb4 zh: c3823108af08a10e /deepseek-ai-dsh-client-ui-session-panel/use-this-package/section-order: - en: 8827dc803c305d40 - zh: e6f53d1888351f8b + en: efea92a8d3819117 + zh: 3a561c0e4d2e305f /deepseek-ai-dsh-client-ui-session-panel/use-this-package/contribute-a-section: - en: 2d4b89484e2bbd35 - zh: 8eeee872b5a4c78e + en: 586f8438f37de0ff + zh: b3f9b8f2fd104e58 /deepseek-ai-dsh-client-ui-session-panel/understand-the-implementation: en: 45a4a1e0170077bc zh: 864a924066f14b76 diff --git a/packages/client/ui-session-panel/README.md b/packages/client/ui-session-panel/README.md index f8d5c1fa3c..d6050a68c6 100644 --- a/packages/client/ui-session-panel/README.md +++ b/packages/client/ui-session-panel/README.md @@ -47,14 +47,14 @@ Pinning also sets the docking preference, so pinning a panel that the toggle had ### Section order -Sections show in ascending `order` until the reader arranges them. Each section's title row is a drag source: over it the pointer is a grab cursor and a drag handle shows over the row's end, in the column of the rows' More buttons. The handle takes no room in the row: the title's trailing content, such as a count, runs to the row's end, stays in place when the handle shows, and fades out under it. The handle shows while the pointer is over the title row, while it has keyboard focus, and during a drag. Dragging the row dims its section, and the section under the pointer shows a 2px line on its top or bottom edge, whichever half the pointer is over; a drop moves the dragged section there. +Sections show in ascending `order` until the reader arranges them. Each section's title row is a drag source: over it the pointer is a grab cursor and a drag handle shows over the row's end, in the column of the rows' More buttons. The handle takes no room in the row: the title's trailing content, such as a count, runs to the row's end. The row's end shows one of the two: the trailing content at rest, and the handle in its place while the pointer is over the title row, while the handle has keyboard focus, and during a drag. Dragging the row dims its section, and the section under the pointer shows a 2px line on its top or bottom edge, whichever half the pointer is over; a drop moves the dragged section there. The handle is a button named “Reorder” with the section's title, and its tooltip says how to reorder. With focus on it, the up and down arrow keys move the section past the nearest section that shows, and focus stays on the handle. The order is one preference for every Session, persisted in `localStorage` under `dsh.sessionPanel.sectionOrder` as the ids of every live section, including the ones with nothing to show. A section registered after the reader arranged the others follows the section it follows in the registered order. ### Contribute a section -A section is one `conversation.session.panel.section` list registration: `id` addresses it, `order` sorts it ascending until the reader [arranges the sections](#section-order), and the required `label` is its title, which the panel draws in the active locale. The section component receives `presentation` (`docked` or `overlay`) and `dismissOverlay()` as owner props; it renders its body and renders nothing when it has nothing to show, which hides its title too. Register trailing title content, such as a count, in the keyed `conversation.session.panel.section.actions` slot under the section's `id`; the [drag handle](#section-order) covers its last 20px while the title row is hovered, so a control placed there keeps clear of the row's end. A section without a label is reported to the console and not shown. The shipped sections are Environment (`order: 0`), Change requests from the [forge bundle](../../experimental/client-ui-forge/README.md) (`100`), [Subagents](../ui-subagent/README.md) (`200`), [Shared tasks](../ui-agent-team/README.md) (`250`), and [Background jobs](../ui-jobs/README.md) (`300`). +A section is one `conversation.session.panel.section` list registration: `id` addresses it, `order` sorts it ascending until the reader [arranges the sections](#section-order), and the required `label` is its title, which the panel draws in the active locale. The section component receives `presentation` (`docked` or `overlay`) and `dismissOverlay()` as owner props; it renders its body and renders nothing when it has nothing to show, which hides its title too. Register trailing title content, such as a count, in the keyed `conversation.session.panel.section.actions` slot under the section's `id`; the [drag handle](#section-order) shows in its place while the title row is hovered, so it holds what the reader reads, not a control they press. A section without a label is reported to the console and not shown. The shipped sections are Environment (`order: 0`), Change requests from the [forge bundle](../../experimental/client-ui-forge/README.md) (`100`), [Subagents](../ui-subagent/README.md) (`200`), [Shared tasks](../ui-agent-team/README.md) (`250`), and [Background jobs](../ui-jobs/README.md) (`300`). Plugins share a title by registering rows in a section owner's row slot. The built-in Environment section (`id: 'environment'`, `order: 0`) declares `conversation.session.panel.environment.row`, whose rows receive the same owner props as a section; its `project` row (`order: 0`) shows the Session's working folder: the current directory from the `workingDirectory` projection, or, before the projection arrives or when it records none, the directory the Session was created in, then the directory of the Workspace that lists the Session. The row shows the folder name followed by its parent folder in tertiary ink, which clips with an ellipsis; its tooltip, shown after 500ms of hover, names the working folder and gives the full path. Both abbreviate the Host home to `~`. Right-clicking the row or pressing its More button opens the shared `directory` context menu. The forge bundle adds its checkout and local changes rows at orders 20 and 30. A plugin that owns a shared section declares its own row slot the same way. diff --git a/packages/client/ui-session-panel/README.zh.md b/packages/client/ui-session-panel/README.zh.md index ccf5c2ffa0..ea814432e4 100644 --- a/packages/client/ui-session-panel/README.zh.md +++ b/packages/client/ui-session-panel/README.zh.md @@ -47,14 +47,14 @@ kind: "package-reference" ### 分栏顺序 -用户调整之前,分栏按 `order` 升序显示。每个分栏的标题行都可以拖动:指针移到标题行上时变为抓手,拖动图标浮现在行末,位于各行「更多」按钮所在的那一列。图标不占用标题行的空间:标题行末尾的内容(例如计数)一直排到行末,图标出现时位置不变,被图标盖住的部分渐隐。图标在指针位于标题行上、获得键盘焦点以及拖动期间显示。拖动标题行时,该分栏变淡,指针下方的分栏在上边缘或下边缘显示一条 2px 的线,取决于指针位于它的上半还是下半;松开后被拖动的分栏移到那里。 +用户调整之前,分栏按 `order` 升序显示。每个分栏的标题行都可以拖动:指针移到标题行上时变为抓手,拖动图标浮现在行末,位于各行「更多」按钮所在的那一列。图标不占用标题行的空间:标题行末尾的内容(例如计数)一直排到行末。行末只显示两者之一:平时显示末尾的内容;指针位于标题行上、图标获得键盘焦点以及拖动期间,图标取而代之。拖动标题行时,该分栏变淡,指针下方的分栏在上边缘或下边缘显示一条 2px 的线,取决于指针位于它的上半还是下半;松开后被拖动的分栏移到那里。 拖动图标是一个按钮,名称为「调整」加分栏标题,提示文字说明调整顺序的方式。焦点在它上面时,上下方向键让分栏越过最近一个显示着的分栏,焦点留在图标上。顺序是所有会话共用的一个偏好,以全部有效分栏(包括当前没有内容的分栏)的 id 列表存放在 `localStorage` 的 `dsh.sessionPanel.sectionOrder` 中。用户调整之后才注册的分栏,排在按注册顺序位于它前面的那个分栏之后。 ### 贡献分栏 -一个分栏是 `conversation.session.panel.section` 列表里的一次注册:`id` 用于寻址,`order` 在用户[调整分栏顺序](#section-order)之前决定升序排列,必填的 `label` 是标题,面板按当前语言绘制。分栏组件通过 owner props 收到 `presentation`(`docked` 或 `overlay`)和 `dismissOverlay()`;它负责渲染正文,没有内容时什么都不渲染,标题随之隐藏。标题尾部的内容(例如计数)注册到以分栏 `id` 为键的 keyed slot `conversation.session.panel.section.actions`;悬停标题行时,[拖动图标](#section-order)会盖住它末尾的 20px,因此放在那里的控件要避开行末。缺少 label 的分栏会报告到控制台,并且不显示。内置的分栏依次是「环境」(`order: 0`)、[forge 套件](../../experimental/client-ui-forge/README.zh.md)的「变更请求」(`100`)、[「子智能体」](../ui-subagent/README.zh.md)(`200`)、[「共享任务」](../ui-agent-team/README.zh.md)(`250`)和[「后台任务」](../ui-jobs/README.zh.md)(`300`)。 +一个分栏是 `conversation.session.panel.section` 列表里的一次注册:`id` 用于寻址,`order` 在用户[调整分栏顺序](#section-order)之前决定升序排列,必填的 `label` 是标题,面板按当前语言绘制。分栏组件通过 owner props 收到 `presentation`(`docked` 或 `overlay`)和 `dismissOverlay()`;它负责渲染正文,没有内容时什么都不渲染,标题随之隐藏。标题尾部的内容(例如计数)注册到以分栏 `id` 为键的 keyed slot `conversation.session.panel.section.actions`;悬停标题行时,[拖动图标](#section-order)取而代之显示,因此这里放供阅读的内容,不放需要点击的控件。缺少 label 的分栏会报告到控制台,并且不显示。内置的分栏依次是「环境」(`order: 0`)、[forge 套件](../../experimental/client-ui-forge/README.zh.md)的「变更请求」(`100`)、[「子智能体」](../ui-subagent/README.zh.md)(`200`)、[「共享任务」](../ui-agent-team/README.zh.md)(`250`)和[「后台任务」](../ui-jobs/README.zh.md)(`300`)。 多个插件共用一个标题时,把行注册到分栏拥有者的行 slot 中。内置「环境」分栏(`id: 'environment'`,`order: 0`)声明 `conversation.session.panel.environment.row`,其中的行与分栏收到相同的 owner props;其 `project` 行(`order: 0`)显示会话的工作目录:`workingDirectory` 投影记录的当前目录;投影尚未送达或没有记录时,依次取会话创建时所在的目录、列出本会话的工作区目录。该行先显示目录名,再以三级文字色显示父目录,放不下时以省略号截断;悬停 500ms 后出现的提示写明工作目录并给出完整路径。两处都把宿主家目录缩写为 `~`。右键该行或点其「更多」按钮会打开共享的 `directory` 上下文菜单。forge 套件在 order 20 与 30 处添加检出行与本地变更行。拥有共享分栏的插件用同样方式声明自己的行 slot。 diff --git a/packages/client/ui-session-panel/src/client/SessionPanel.module.css b/packages/client/ui-session-panel/src/client/SessionPanel.module.css index e1a2fbc697..86adb8bfe0 100644 --- a/packages/client/ui-session-panel/src/client/SessionPanel.module.css +++ b/packages/client/ui-session-panel/src/client/SessionPanel.module.css @@ -237,9 +237,11 @@ /* The drag handle lies over the end of the title row, in the column of the rows' More buttons: a 24px target whose center is 14px from the row's end. It takes no room in the row, so the title's trailing content runs to - the row's end as it does without the handle. The handle shows while the - pointer is over the title row, while it has keyboard focus, and during a - drag; the trailing content then fades out under it. */ + the row's end as it does without the handle. The row's end shows one of + the two: the trailing content at rest, and the handle in its place while + the pointer is over the title row, while the handle has keyboard focus, + and during a drag. The hidden content keeps its box, so the title does not + move. */ .grip { position: absolute; top: 0; @@ -268,11 +270,9 @@ opacity: 1; } -/* The trailing content ends 6px from the row's end and the handle reaches - 26px from it: transparent across the handle, opaque 16px further in. */ .head:has(> .grip:focus-visible) > .actions, .section[data-dragging] > .head > .actions { - mask-image: linear-gradient(to left, transparent 20px, #000 36px); + visibility: hidden; } @media (hover: hover) { @@ -281,7 +281,7 @@ } .head:hover > .actions { - mask-image: linear-gradient(to left, transparent 20px, #000 36px); + visibility: hidden; } .grip:hover { diff --git a/packages/client/ui-session-panel/src/client/slots.ts b/packages/client/ui-session-panel/src/client/slots.ts index 1aa5053bf2..05309e3dca 100644 --- a/packages/client/ui-session-panel/src/client/slots.ts +++ b/packages/client/ui-session-panel/src/client/slots.ts @@ -28,8 +28,8 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { } /** * Trailing content of one section title, such as a count, keyed by the - * section's `id`. The section's drag handle covers its last 20px while the - * title row is hovered, and the content fades out under it. + * section's `id`. The section's drag handle shows in its place while the + * title row is hovered, so it holds content to read, not a control to press. */ 'conversation.session.panel.section.actions': { kind: 'keyed'; scope: 'session' } /** diff --git a/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts b/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts index d6d5b0d6b7..bde758b96c 100644 --- a/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts +++ b/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts @@ -115,15 +115,15 @@ describe('SessionPanel.module.css section reordering', () => { }) }) - it('shows the handle on title-row hover, keyboard focus, and during a drag, and fades the trailing content under it', () => { - const fade = 'linear-gradient(to left, transparent 20px, #000 36px)' + it('shows the handle in place of the trailing content on title-row hover, keyboard focus, and during a drag', () => { expect(declarationsOf('.grip:focus-visible, .section[data-dragging] .grip')).toEqual({ opacity: '1' }) + // Hidden, not removed: the trailing content keeps its box, so the title beside it does not move. expect(declarationsOf('.head:has(> .grip:focus-visible) > .actions, .section[data-dragging] > .head > .actions')) - .toEqual({ 'mask-image': fade }) + .toEqual({ visibility: 'hidden' }) // The pointer rules stay inside the hover media query, so a touch that latches hover shows no handle. const hover = [...css.matchAll(/@media \(hover: hover\) \{([\s\S]*?)\n\}/g)].map(block => block[1]).join('\n') expect(hover).toMatch(/\.head:hover > \.grip \{\s*opacity: 1;/) - expect(hover).toContain(`.head:hover > .actions {\n mask-image: ${fade};`) + expect(hover).toMatch(/\.head:hover > \.actions \{\s*visibility: hidden;/) }) it('dims the dragged section and draws the landing line on the edge of the section under the pointer', () => { diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index f9fa4f6363..1f79874571 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -2604,7 +2604,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ kind: 'keyed', scope: 'session', summary: 'Trailing content of one section title, such as a count, keyed by the section\'s `id`.', - doc: 'Trailing content of one section title, such as a count, keyed by the\nsection\'s `id`. The section\'s drag handle covers its last 20px while the\ntitle row is hovered, and the content fades out under it.', + doc: 'Trailing content of one section title, such as a count, keyed by the\nsection\'s `id`. The section\'s drag handle shows in its place while the\ntitle row is hovered, so it holds content to read, not a control to press.', registerOptions: [ { name: 'key',