From 13e8ca59a452f66e81c8a5b8a4611fe53cc1337d Mon Sep 17 00:00:00 2001 From: yudshj Date: Thu, 29 Oct 2026 13:24:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(sidebar):=20=E4=BB=85=E5=9C=A8=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=B7=B2=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=AA=E7=83=81?= =?UTF-8?q?=E5=B9=B6=E5=87=8F=E5=BC=B1=E5=85=89=E6=99=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/tests/file-browser.e2e.ts | 5 ++-- docs/subsystems/sidebar-right.i18n.yaml | 4 +-- docs/subsystems/sidebar-right.md | 2 +- docs/subsystems/sidebar-right.zh.md | 2 +- .../client/ui-sidebar-right/README.i18n.yaml | 4 +-- packages/client/ui-sidebar-right/README.md | 4 +-- packages/client/ui-sidebar-right/README.zh.md | 4 +-- .../ui-sidebar-right/src/client/service.ts | 15 ++++++++--- .../src/client/shell/SidebarRight.module.css | 27 ++++++++++--------- .../tests/open-destination.client.spec.ts | 5 +++- .../tests/seat.client.spec.tsx | 9 ++++--- 11 files changed, 49 insertions(+), 32 deletions(-) diff --git a/apps/web/tests/file-browser.e2e.ts b/apps/web/tests/file-browser.e2e.ts index 0739aad0e0..0032ed22ef 100644 --- a/apps/web/tests/file-browser.e2e.ts +++ b/apps/web/tests/file-browser.e2e.ts @@ -113,13 +113,12 @@ it('browses workspace files in tabs that share one pane tree', async () => { expect(await column.locator(`[data-dockkit-tab="${pageTab}"]`).count()).toBe(1) expect(await column.locator('[data-dockkit-pane]').count()).toBe(1) expect(await toggle.getAttribute('aria-expanded')).toBe('false') - // Picking the open file again from the page reveals it and outlines its pane once. + // Picking the open file again from the page switches back to its tab, which is the visible change, so nothing glows. const flash = column.locator('[data-sidebar-right-flash]') await column.locator(`[data-dockkit-tab="${pageTab}"]`).click() await navigator.getByRole('button', { name: 'a.txt', exact: true }).click() await expect.poll(() => path.textContent()).toContain('a.txt') - await expect.poll(() => flash.count()).toBe(1) - await expect.poll(() => flash.count()).toBe(0) + expect(await flash.count()).toBe(0) expect(await tabs.count()).toBe(tabCount + 1) // The preview's toggle shows the pane's tree without changing the files page. await toggle.click() diff --git a/docs/subsystems/sidebar-right.i18n.yaml b/docs/subsystems/sidebar-right.i18n.yaml index 1897d9925b..482969fe6c 100644 --- a/docs/subsystems/sidebar-right.i18n.yaml +++ b/docs/subsystems/sidebar-right.i18n.yaml @@ -15,8 +15,8 @@ en: b7b8a7b411aee94d zh: 7298c20000945d97 /right-sidebar/navigation-ctx-sidebarright: - en: d7a4b0e0f828bb3b - zh: aef2ef684345ad50 + en: 2a2b3a33df9e0749 + zh: 629c791cd2ae50ba /right-sidebar/slots-and-owner-props: en: 6b5faaed58ab5fb1 zh: 2118439d3403a735 diff --git a/docs/subsystems/sidebar-right.md b/docs/subsystems/sidebar-right.md index e319b8bd45..00a0671bae 100644 --- a/docs/subsystems/sidebar-right.md +++ b/docs/subsystems/sidebar-right.md @@ -75,7 +75,7 @@ export function apply(ctx: Context): void { ## Navigation: `ctx.sidebarRight` -Two opens are the navigation controller, and every way into the column calls one of them: `openResource(address, options?)` for a `dsh-resource://` address — the conversation's file links, a tool row's line reference, a file tree's rows — and `openTab(kind, options?)` for a page — the strip's add control, a guide entry box, or an HTTP(S) link in Assistant Markdown. Both run four steps as one history entry — claim (the registry ranks the resource's types, or the named `kind`'s implementation in force answers); focus a tab already showing the same `(kind, address)`; otherwise seat a new tab; expand the column — and then record the navigation in the Tab domain ([service](../../packages/client/ui-sidebar-right/README.md#ctxsidebarright)). Content the user cannot see is not opened, so a collapsed column expands in the same step, unless the open replaces a floating tab or reveals a tab in a floating panel. A reveal makes the pane holding the revealed tab glow once, for every tab type, and only while its Session is on screen. `openResource` throws for an address outside `dsh-resource://` or one no type claims; `openTab` throws for a kind nothing registered: both are wiring mistakes, not user errors. +Two opens are the navigation controller, and every way into the column calls one of them: `openResource(address, options?)` for a `dsh-resource://` address — the conversation's file links, a tool row's line reference, a file tree's rows — and `openTab(kind, options?)` for a page — the strip's add control, a guide entry box, or an HTTP(S) link in Assistant Markdown. Both run four steps as one history entry — claim (the registry ranks the resource's types, or the named `kind`'s implementation in force answers); focus a tab already showing the same `(kind, address)`; otherwise seat a new tab; expand the column — and then record the navigation in the Tab domain ([service](../../packages/client/ui-sidebar-right/README.md#ctxsidebarright)). Content the user cannot see is not opened, so a collapsed column expands in the same step, unless the open replaces a floating tab or reveals a tab in a floating panel. A reveal of a tab already on screen makes the pane holding it glow once, for every tab type, and only while its Session is on screen; a reveal that switches tabs or expands the column does not glow. `openResource` throws for an address outside `dsh-resource://` or one no type claims; `openTab` throws for a kind nothing registered: both are wiring mistakes, not user errors. | Option | Meaning | |---|---| diff --git a/docs/subsystems/sidebar-right.zh.md b/docs/subsystems/sidebar-right.zh.md index 4157de734d..72c6db445f 100644 --- a/docs/subsystems/sidebar-right.zh.md +++ b/docs/subsystems/sidebar-right.zh.md @@ -75,7 +75,7 @@ export function apply(ctx: Context): void { ## 导航:`ctx.sidebarRight` -两种打开构成导航控制器,进入这一列的每条路都调用其一:`openResource(address, options?)` 打开 `dsh-resource://` 地址——会话区的文件链接、工具行的行号引用、文件树的行;`openTab(kind, options?)` 打开页面——tab 条的新增控件、引导页入口框或 Assistant Markdown 中的 HTTP(S) 链接。两者都以一条历史记录走完四步——认领(注册表为资源排候选,或点名 `kind` 的生效实现应答);聚焦已显示同一 `(kind, address)` 的 tab;否则落一个新 tab;展开这一列——然后把导航记入 Tab 域([服务](../../packages/client/ui-sidebar-right/README.zh.md#ctxsidebarright))。用户看不见的内容不算打开,所以折叠的列会在同一步展开;替换浮动 tab、或揭示浮窗中的 tab 时除外。揭示时,存放被揭示 tab 的格发光提示一次,对所有 tab 类型都一样,且只在其会话位于屏幕上时播放。`openResource` 对 `dsh-resource://` 之外的地址或无人认领的地址抛错;`openTab` 对无人注册的 kind 抛错:二者都是接线错误,不是用户错误。 +两种打开构成导航控制器,进入这一列的每条路都调用其一:`openResource(address, options?)` 打开 `dsh-resource://` 地址——会话区的文件链接、工具行的行号引用、文件树的行;`openTab(kind, options?)` 打开页面——tab 条的新增控件、引导页入口框或 Assistant Markdown 中的 HTTP(S) 链接。两者都以一条历史记录走完四步——认领(注册表为资源排候选,或点名 `kind` 的生效实现应答);聚焦已显示同一 `(kind, address)` 的 tab;否则落一个新 tab;展开这一列——然后把导航记入 Tab 域([服务](../../packages/client/ui-sidebar-right/README.zh.md#ctxsidebarright))。用户看不见的内容不算打开,所以折叠的列会在同一步展开;替换浮动 tab、或揭示浮窗中的 tab 时除外。揭示一个已在屏幕上显示的 tab 时,存放它的格发光提示一次,对所有 tab 类型都一样,且只在其会话位于屏幕上时播放;需要切换 tab 或展开该列的揭示不发光。`openResource` 对 `dsh-resource://` 之外的地址或无人认领的地址抛错;`openTab` 对无人注册的 kind 抛错:二者都是接线错误,不是用户错误。 | 选项 | 含义 | |---|---| diff --git a/packages/client/ui-sidebar-right/README.i18n.yaml b/packages/client/ui-sidebar-right/README.i18n.yaml index 38dda8ca08..17ac7a98fc 100644 --- a/packages/client/ui-sidebar-right/README.i18n.yaml +++ b/packages/client/ui-sidebar-right/README.i18n.yaml @@ -30,8 +30,8 @@ en: 9533f5af50898daf zh: 78d3b77c25962145 /deepseek-ai-dsh-client-ui-sidebar-right/ctx-sidebarright: - en: 0453308cad649ce7 - zh: 8ccfe731373ab6d0 + en: ce5622d6d18ed8d1 + zh: 292932d8edb6e1c3 /deepseek-ai-dsh-client-ui-sidebar-right/the-tab-domain: en: 717b86e05b44ebdd zh: 0f4f694d0ea1d7f8 diff --git a/packages/client/ui-sidebar-right/README.md b/packages/client/ui-sidebar-right/README.md index 884cf29169..a5eae492e0 100644 --- a/packages/client/ui-sidebar-right/README.md +++ b/packages/client/ui-sidebar-right/README.md @@ -92,13 +92,13 @@ Two more seats extend what is already there: `sidebar.right.tab.guide` (chain) r ## `ctx.sidebarRight` -`openResource(address, options?)` and `openTab(kind, options?)` are the navigation controller, and every way into the column calls one of them: the conversation's file links and a tool row's line reference (`openResource(fileAddress, { params: { line } })`), the strip's add control and a guide entry box (`openTab`), a file tree's rows (`tab.actions.openResource`). A resource address is a `dsh-resource:///…` URI; without `options.kind` the registry claims it (globs and `canOpen`, best band wins), with it that kind's type in force opens it. A page is named by kind; the tab is recorded under an address this package composes and nobody else spells (`contract/seed.ts`). Both run the same steps as one history entry: a resource tab already showing the same (kind, contentId) is focused wherever it sits unless `revealIfOpened: false`; ordinary page tabs always deduplicate within the target pane, regardless of that option; otherwise a new tab takes the place of `options.replaceTab` (closing that tab, described below), else in `options.paneId`, else in the active docked pane, which is the first docked pane while a floating pane is active. The panel expands, because content the user cannot see is not opened, unless the new tab replaces a floating one or the open reveals a tab in a floating panel. A reveal makes the pane holding the revealed tab glow once for about 600ms, whatever opened it and whatever type the tab is; providers do nothing for it. A docked pane glows inward, above its content's sticky bars such as code banners; a floating panel glows outward over its own shadow. The glow uses the accent colour in light mode and white in dark mode. A repeated reveal restarts the glow, the pane carries `data-sidebar-right-flash` while it shows, and with reduced motion the glow holds steady for the same time instead of fading. Each reveal plays once and only while its Session is on screen: hiding the Session ends a glow in progress, a reveal made while it is hidden is dropped rather than played on return, and a Sidebar mounted later does not replay an earlier reveal. Then the Tab domain records the navigation — `params` reach the body as `navigation.params`, with `revision` stepped — outside the layout history. `params` is typed by what is opened: a viewer for a resource type merges its entry into `SidebarRightResourceParamsMap` (the text preview declares `{ line?: number }`); a page type that takes parameters merges into `SidebarRightTabParamsMap` under its kind; values are JSON-shaped by convention, unchecked at run time. An address outside `dsh-resource://`, one no type claims, or a kind nothing registered throws: that is a wiring mistake, not a user error. +`openResource(address, options?)` and `openTab(kind, options?)` are the navigation controller, and every way into the column calls one of them: the conversation's file links and a tool row's line reference (`openResource(fileAddress, { params: { line } })`), the strip's add control and a guide entry box (`openTab`), a file tree's rows (`tab.actions.openResource`). A resource address is a `dsh-resource:///…` URI; without `options.kind` the registry claims it (globs and `canOpen`, best band wins), with it that kind's type in force opens it. A page is named by kind; the tab is recorded under an address this package composes and nobody else spells (`contract/seed.ts`). Both run the same steps as one history entry: a resource tab already showing the same (kind, contentId) is focused wherever it sits unless `revealIfOpened: false`; ordinary page tabs always deduplicate within the target pane, regardless of that option; otherwise a new tab takes the place of `options.replaceTab` (closing that tab, described below), else in `options.paneId`, else in the active docked pane, which is the first docked pane while a floating pane is active. The panel expands, because content the user cannot see is not opened, unless the new tab replaces a floating one or the open reveals a tab in a floating panel. A reveal of a tab that was already on screen — the active tab of a floating panel, or of a docked pane while the column is expanded — makes the pane holding it glow once for about 600ms, whatever opened it and whatever type the tab is; providers do nothing for it. A reveal that switches to a background tab or expands the column does not glow, because that change is already visible. A docked pane glows inward, above its content's sticky bars such as code banners; a floating panel glows outward over its own shadow. The glow uses the accent colour in light mode and white in dark mode. A repeated reveal restarts the glow, the pane carries `data-sidebar-right-flash` while it shows, and with reduced motion the glow holds steady for the same time instead of fading. Each reveal plays once and only while its Session is on screen: hiding the Session ends a glow in progress, a reveal made while it is hidden is dropped rather than played on return, and a Sidebar mounted later does not replay an earlier reveal. Then the Tab domain records the navigation — `params` reach the body as `navigation.params`, with `revision` stepped — outside the layout history. `params` is typed by what is opened: a viewer for a resource type merges its entry into `SidebarRightResourceParamsMap` (the text preview declares `{ line?: number }`); a page type that takes parameters merges into `SidebarRightTabParamsMap` under its kind; values are JSON-shaped by convention, unchecked at run time. An address outside `dsh-resource://`, one no type claims, or a kind nothing registered throws: that is a wiring mistake, not a user error. `preferNewPane: true` first asks the target docked pane to split under the normal two-pane and room rules, then falls back to that pane when no split is available. `replaceTab` takes precedence and disables this preference. `replaceTab` names the tab new content takes the place of (`tab.actions` passes `replaceTab: true` for its own tab). A docked tab lends its pane and strip slot and closes. A floating tab is replaced in its panel: the new tab keeps the panel's pane id, rectangle, and stacking order and takes focus, raising the panel as a focus does, and the column is not expanded. Content already open is revealed by the rules above, and the named tab stays open; a page is looked up only in the named tab's pane, so a floating guide that opens a page shown in a docked pane becomes that page in its panel. The replaced tab's close handler runs before it is removed. Where new content lands, `replaceTab` takes precedence over `paneId` and `preferNewPane`; a named tab that has closed since is ignored. -`openResource`, `openResourceIn`, and `tab.actions.openResource` also accept `destination: 'sidebar' | 'float'`, which names the host instead of a pane and takes precedence over `paneId`, `preferNewPane`, `replaceTab`, and `revealIfOpened`; `tab.actions` then passes neither its own pane nor itself for replacement, and no tab closes. Matching uses the Session, the claimed kind, and the content id. A copy already in the requested host is revealed and glows. Otherwise one copy from the other host moves there, keeping its tab id, occurrence, signal, and body state such as scroll position; its close handler does not run. Otherwise a new tab opens there. `'sidebar'` uses the active docked pane (the first docked pane while a floating pane is active), never splits, and expands the column; an empty collapsed root takes the tab without a default page beside it. `'float'` uses a new floating panel at the next cascade position and leaves the column's expansion as it is, for a new tab as for a move; a docked tab that leaves its pane follows the usual empty-pane rules. Other copies stay open. Every open still delivers its `params` and steps `revision`, and the whole open, including a move, is one history entry. Without `destination`, placement follows the rules above unchanged. +`openResource`, `openResourceIn`, and `tab.actions.openResource` also accept `destination: 'sidebar' | 'float'`, which names the host instead of a pane and takes precedence over `paneId`, `preferNewPane`, `replaceTab`, and `revealIfOpened`; `tab.actions` then passes neither its own pane nor itself for replacement, and no tab closes. Matching uses the Session, the claimed kind, and the content id. A copy already in the requested host is revealed, and glows when it was already on screen. Otherwise one copy from the other host moves there, keeping its tab id, occurrence, signal, and body state such as scroll position; its close handler does not run. Otherwise a new tab opens there. `'sidebar'` uses the active docked pane (the first docked pane while a floating pane is active), never splits, and expands the column; an empty collapsed root takes the tab without a default page beside it. `'float'` uses a new floating panel at the next cascade position and leaves the column's expansion as it is, for a new tab as for a move; a docked tab that leaves its pane follows the usual empty-pane rules. Other copies stay open. Every open still delivers its `params` and steps `revision`, and the whole open, including a move, is one history entry. Without `destination`, placement follows the rules above unchanged. `close(tabId)` closes a tab; `hide(tabId)` closes a floating tab or collapses its docked column; `active()` reads the active tab. `isExpanded()` and `toggleExpanded()` read and drive the column's expansion; `toggleFullscreen(target)` applies the panel control’s display-mode action to a captured dock pane. Layout operations, for callers that arrange the column programmatically, each recorded like the gesture it stands in for: `focus(tabId)` focuses a tab and its pane; `split(paneId?)` splits a docked pane (the active one by default) under the same pane budget and room rule as the strip's control and returns the new pane's id, or `undefined` — recording nothing — when it cannot; `float(tabId, rect?)` takes a docked tab out into a panel; `dock(paneId)` returns a floating panel to the active docked pane and expands the column, as the panel's dock control does. A tab or pane that does not exist, or already is where the call would put it, is left alone. The face exposes operations only: no layout snapshot, no operation log, no lookup by address. `_undo()` / `_redo()` step the on-screen surface's history; they are `@internal` — the sequence has no user-facing control, and these exist for tests. Commands act on the on-screen Session through its adopted store; with no Session on screen, or before the runtime mints its store, they throw rather than write into a surface nobody draws. `mounted` is the observable of the Session on screen: the selected Session while the Conversation fills the main column, `undefined` while a global panel replaces it or no Session is selected. The plugin derives it from the Session selection and `ctx.layout.panelInfo`, and it changes before React renders the change that causes it, so a component rendered in that commit reads the arriving Session and may act on it from its effects: the frame renders that Session's seat in the same pass, which mints its store. Seats never publish it; each reports only what it renders with: the room its docking kit measured, which `split` and `preferNewPane` apply to that Session's panes (unmeasured panes have room), and whether its frame width presents the panel fullscreen automatically, which the fullscreen command applies. The plan review's automatic open reads `mounted` through a bound hook. diff --git a/packages/client/ui-sidebar-right/README.zh.md b/packages/client/ui-sidebar-right/README.zh.md index 833b2a839f..7e5319e477 100644 --- a/packages/client/ui-sidebar-right/README.zh.md +++ b/packages/client/ui-sidebar-right/README.zh.md @@ -92,13 +92,13 @@ tab 类型分两阶段注册,随包发布的引导类型走的正是别的包 ## `ctx.sidebarRight` -`openResource(address, options?)` 与 `openTab(kind, options?)` 是导航控制器,进入该列的每条路都调用其中之一:会话区的文件链接与工具行的行号引用(`openResource(fileAddress, { params: { line } })`),tab 条的添加控件与引导入口框(`openTab`),文件树的行(`tab.actions.openResource`)。资源地址是 `dsh-resource:///…` URI;不带 `options.kind` 时由注册表认领(glob 与 `canOpen`,最高档胜出),带它时由该 kind 生效的类型打开。页按 kind 命名;tab 记录在本包拼出、别处无人书写的地址下(`contract/seed.ts`)。两者以同一组步骤作为一条历史运行:已展示同一 (kind, contentId) 的资源 tab 被聚焦,不限所在分栏,除非 `revealIfOpened: false`;页 tab 始终只在目标分栏内去重,不受该选项影响;否则新 tab 取代 `options.replaceTab` 的位置(并关掉那个 tab,见下文),再退而落到 `options.paneId`,再退而落到活跃停靠格;活动格是浮窗时为第一个停靠格。面板展开,因为用户看不到的内容不算打开;新 tab 替换浮动 tab、或这次打开揭示的是浮窗中的 tab 时除外。揭示时,存放被揭示 tab 的格发光提示一次,约 600ms,与由谁打开、tab 是什么类型无关,提供方无需做任何事。停靠格向内发光,位于其内容的吸顶栏(如代码块标题栏)之上;浮窗在自身阴影之上向外发光。浅色模式用强调色,深色模式用白色。再次揭示会重新开始发光,发光期间该格带有 `data-sidebar-right-flash`;减少动态效果时发光在同样时长内保持不变而不淡出。每次揭示只在其会话位于屏幕上时播放一次:隐藏该会话会结束进行中的发光,会话隐藏期间的揭示直接丢弃、不在切回时补播,之后挂载的侧栏也不会重放先前的揭示。随后 Tab 域记录这次导航——`params` 以 `navigation.params` 抵达正文,`revision` 递增——不进布局历史。`params` 按所开之物定型:某资源类型的查看器把自己那项并入 `SidebarRightResourceParamsMap`(文本预览声明 `{ line?: number }`);接受参数的页类型按其 kind 并入 `SidebarRightTabParamsMap`;值约定为 JSON 形状,运行时不校验。`dsh-resource://` 之外的地址、无人认领的地址、或未注册的 kind 都会 throw:那是接线错误,不是用户错误。 +`openResource(address, options?)` 与 `openTab(kind, options?)` 是导航控制器,进入该列的每条路都调用其中之一:会话区的文件链接与工具行的行号引用(`openResource(fileAddress, { params: { line } })`),tab 条的添加控件与引导入口框(`openTab`),文件树的行(`tab.actions.openResource`)。资源地址是 `dsh-resource:///…` URI;不带 `options.kind` 时由注册表认领(glob 与 `canOpen`,最高档胜出),带它时由该 kind 生效的类型打开。页按 kind 命名;tab 记录在本包拼出、别处无人书写的地址下(`contract/seed.ts`)。两者以同一组步骤作为一条历史运行:已展示同一 (kind, contentId) 的资源 tab 被聚焦,不限所在分栏,除非 `revealIfOpened: false`;页 tab 始终只在目标分栏内去重,不受该选项影响;否则新 tab 取代 `options.replaceTab` 的位置(并关掉那个 tab,见下文),再退而落到 `options.paneId`,再退而落到活跃停靠格;活动格是浮窗时为第一个停靠格。面板展开,因为用户看不到的内容不算打开;新 tab 替换浮动 tab、或这次打开揭示的是浮窗中的 tab 时除外。揭示一个原本就在屏幕上的 tab(浮窗的活动 tab,或该列展开时停靠格的活动 tab)时,存放它的格发光提示一次,约 600ms,与由谁打开、tab 是什么类型无关,提供方无需做任何事。揭示需要切到后台 tab 或展开该列时不发光,因为这一变化本身已经可见。停靠格向内发光,位于其内容的吸顶栏(如代码块标题栏)之上;浮窗在自身阴影之上向外发光。浅色模式用强调色,深色模式用白色。再次揭示会重新开始发光,发光期间该格带有 `data-sidebar-right-flash`;减少动态效果时发光在同样时长内保持不变而不淡出。每次揭示只在其会话位于屏幕上时播放一次:隐藏该会话会结束进行中的发光,会话隐藏期间的揭示直接丢弃、不在切回时补播,之后挂载的侧栏也不会重放先前的揭示。随后 Tab 域记录这次导航——`params` 以 `navigation.params` 抵达正文,`revision` 递增——不进布局历史。`params` 按所开之物定型:某资源类型的查看器把自己那项并入 `SidebarRightResourceParamsMap`(文本预览声明 `{ line?: number }`);接受参数的页类型按其 kind 并入 `SidebarRightTabParamsMap`;值约定为 JSON 形状,运行时不校验。`dsh-resource://` 之外的地址、无人认领的地址、或未注册的 kind 都会 throw:那是接线错误,不是用户错误。 `preferNewPane: true` 会先按普通的两格上限与空间规则尝试分割目标停靠格,无法分栏时回退到该格。`replaceTab` 优先并会禁用这项偏好。 `replaceTab` 指定新内容所取代的 tab(`tab.actions` 对自己的 tab 传 `replaceTab: true`)。停靠 tab 把所在格与条上位置让给新 tab 并关闭。浮动 tab 在浮窗内被原位替换:新 tab 沿用浮窗的 pane id、矩形与叠放顺序并获得焦点(与任何聚焦一样会把该浮窗提到最上层),且不展开这一列。内容已打开时按上文规则揭示,被指定的 tab 保持打开;页只在被指定 tab 所在的格里查找,因此打开某个停靠格已展示的页的浮动引导页,会在其浮窗内变成那个页。被替换 tab 的关闭处理器在其移除之前运行。决定新内容落在哪里时,`replaceTab` 优先于 `paneId` 与 `preferNewPane`;已关闭的指定 tab 被忽略。 -`openResource`、`openResourceIn` 与 `tab.actions.openResource` 还接受 `destination: 'sidebar' | 'float'`:它指定宿主位置而非分栏,优先于 `paneId`、`preferNewPane`、`replaceTab` 与 `revealIfOpened`;此时 `tab.actions` 既不传自己所在的格,也不把自己作为被替换的 tab,不会关闭任何 tab。匹配依据会话、认领的 kind 与 content id。请求的宿主里已有副本时揭示它并发光提示。否则把另一宿主中的一份副本移过去,保留其 tab id、occurrence、signal 及滚动位置等正文状态,不运行其关闭处理器。否则在该宿主新开 tab。`'sidebar'` 使用活跃停靠格(活动格是浮窗时为第一个停靠格),从不分栏,并展开该列;空的收起根格直接接收该 tab,旁边不补默认页。`'float'` 在下一个级联位置新建浮窗,新开和移动都不改变该列的展开状态;停靠 tab 离开所在格后按通常的空格规则处理。其他副本保持打开。每次打开仍交付 `params` 并递增 `revision`,整次打开(含移动)是一条历史。不传 `destination` 时,落位规则与上文相同。 +`openResource`、`openResourceIn` 与 `tab.actions.openResource` 还接受 `destination: 'sidebar' | 'float'`:它指定宿主位置而非分栏,优先于 `paneId`、`preferNewPane`、`replaceTab` 与 `revealIfOpened`;此时 `tab.actions` 既不传自己所在的格,也不把自己作为被替换的 tab,不会关闭任何 tab。匹配依据会话、认领的 kind 与 content id。请求的宿主里已有副本时揭示它,该副本原本就在屏幕上时发光提示。否则把另一宿主中的一份副本移过去,保留其 tab id、occurrence、signal 及滚动位置等正文状态,不运行其关闭处理器。否则在该宿主新开 tab。`'sidebar'` 使用活跃停靠格(活动格是浮窗时为第一个停靠格),从不分栏,并展开该列;空的收起根格直接接收该 tab,旁边不补默认页。`'float'` 在下一个级联位置新建浮窗,新开和移动都不改变该列的展开状态;停靠 tab 离开所在格后按通常的空格规则处理。其他副本保持打开。每次打开仍交付 `params` 并递增 `revision`,整次打开(含移动)是一条历史。不传 `destination` 时,落位规则与上文相同。 `close(tabId)` 关闭一个 tab;`hide(tabId)` 关闭浮动 tab 或收起其停靠列;`active()` 读取活动 tab。`isExpanded()` 与 `toggleExpanded()` 读取并驱动该列的展开;`toggleFullscreen(target)` 对捕获的停靠分栏执行面板控件的显示模式操作。布局操作供以编程方式安排该列的调用方使用,每个都像它替代的手势一样被记录:`focus(tabId)` 聚焦一个 tab 及其格;`split(paneId?)` 在与 tab 条控件相同的格预算与空间规则下分栏一个停靠格(默认活跃格),返回新格的 id,做不到时返回 `undefined`——且不记录任何东西;`float(tabId, rect?)` 把停靠 tab 浮出为浮窗;`dock(paneId)` 把浮窗放回活跃停靠格并展开该列,与浮窗的收回控件一致。不存在的 tab 或格、或已处于调用目标状态的,都原样不动。该接口只暴露操作:没有布局快照、没有操作日志、没有按地址查找。`_undo()` / `_redo()` 步进屏幕上停靠面的历史;它们是 `@internal`——序列没有面向用户的控件,这两个只为测试存在。命令通过屏幕上会话已采用的 store 作用于该会话;没有会话在屏幕上、或运行时尚未创建它的 store 时,命令 throw,而不是写进一个没人绘制的面里。`mounted` 是「屏幕上的会话」的可观察值:Conversation 占据主栏时为选中的会话,全局面板替代它或没有选中会话时为 `undefined`。插件从会话选择与 `ctx.layout.panelInfo` 推导它,它在 React 渲染引起变化的那次更新之前就已改变,因此同一次提交里渲染的组件读到的是到来的会话,并可以在自己的 effect 里对它行动:框架在同一轮渲染里渲染该会话的席位,席位随之创建它的 store。席位从不发布它;每个席位只上报它渲染时依据的事实:停靠套件测得的空间,`split` 与 `preferNewPane` 把它用于该会话的分栏(未测量的分栏视为有空间);以及框架宽度是否让面板自动全屏,全屏命令据此执行。计划审阅的自动打开通过绑定的 hook 读取 `mounted`。 diff --git a/packages/client/ui-sidebar-right/src/client/service.ts b/packages/client/ui-sidebar-right/src/client/service.ts index 1ade52db8a..8e53ba2f5a 100644 --- a/packages/client/ui-sidebar-right/src/client/service.ts +++ b/packages/client/ui-sidebar-right/src/client/service.ts @@ -36,7 +36,7 @@ import { sidebarTargetFromElement, type SidebarRightTarget } from './focus.ts' import { randomUUID } from '@deepseek-ai/dsh-util-crypto' import { createSnapshotStore, type ObservableSnapshot, type SnapshotStore } from '@deepseek-ai/dsh-client-store' -import type { FloatRect, PaneId, TabId, TabRecord } from '@deepseek-ai/dsh-client-ui-dockkit' +import type { FloatRect, LayoutState, PaneId, TabId, TabRecord } from '@deepseek-ai/dsh-client-ui-dockkit' import { activeDockPaneId, canSplit, findContentTab, findPaneContentTab, dockPaneIds, findTabPane, getPane } from '@deepseek-ai/dsh-client-ui-dockkit' import type { BoundActions } from '@deepseek-ai/dsh-client-ui-slots' import type { SessionId } from '@deepseek-ai/dsh-session/types' @@ -467,7 +467,7 @@ export class SidebarRightController implements ISidebarRight { const revealed = layout === undefined ? undefined : findHostContentTab(layout, destination, claim.contentId, claim.kind) actions.openContent(sessionId, { kind: claim.kind, contentId: claim.contentId, title: claim.title, destination }, (tabId) => { this.tabDomain.navigate(sessionId, tabId, { address, params }) }) - if (layout !== undefined && revealed !== undefined) this.flash(sessionId, findTabPane(layout, revealed).id) + if (layout !== undefined && revealed !== undefined) this.flashShowing(sessionId, layout, revealed) } /** Place a page type in one session at the address pages are recorded under; an unregistered kind throws. */ @@ -527,7 +527,7 @@ export class SidebarRightController implements ISidebarRight { if (replaced === undefined || revealed !== undefined) commit() else this.removeAfterCleanup(sessionId, replaced, commit) // A reveal focuses the tab where it is. - if (layout !== undefined && revealed !== undefined) this.flash(sessionId, findTabPane(layout, revealed).id) + if (layout !== undefined && revealed !== undefined) this.flashShowing(sessionId, layout, revealed) } /** @@ -550,6 +550,15 @@ export class SidebarRightController implements ISidebarRight { return source } + /** + * Flash the pane holding a revealed tab only when that tab was already on screen; a reveal that switches + * tabs or expands the column is its own visible change. + */ + private flashShowing(sessionId: SessionId, layout: LayoutState, tabId: TabId): void { + const pane = findTabPane(layout, tabId) + if (pane.activeTabId === tabId && (pane.host === 'float' || layout.expanded)) this.flash(sessionId, pane.id) + } + /** Ask a Session's seat to highlight the pane holding a revealed tab. */ private flash(sessionId: SessionId, paneId: PaneId): void { const source = this.flashSource(sessionId) diff --git a/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css b/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css index 0d15729000..02da4aad58 100644 --- a/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css +++ b/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css @@ -200,8 +200,10 @@ /* * An open that reveals an existing tab makes the pane holding it glow once - * (`flash.ts`), in the files navigator card's glow (ui-sidebar-files - * FilesBody `.push`): brand-colored in light mode, white in dark mode. The + * (`flash.ts`), a softer, tighter version of the files navigator card's glow + * (ui-sidebar-files FilesBody `.push`): brand-colored in light mode, white in + * dark mode. Only a reveal of a tab already on screen glows; a reveal that + * switches tabs or expands the column is visible on its own. The * marker alternates between two values with their own keyframes, so a * repeated reveal restarts the glow; the marker goes when the animation ends. * Reduced motion holds the glow steady for the same duration instead of @@ -217,8 +219,9 @@ .panel :global([data-dockkit-pane][data-sidebar-right-flash]), .panel :global([data-dockkit-float][data-sidebar-right-flash]) { --sidebar-right-flash-color: var(--dsw-alias-brand-primary-new-colorprimary-new-color); - --sidebar-right-flash-near: color-mix(in srgb, var(--sidebar-right-flash-color) 32%, transparent); - --sidebar-right-flash-far: color-mix(in srgb, var(--sidebar-right-flash-color) 24%, transparent); + --sidebar-right-flash-ring: color-mix(in srgb, var(--sidebar-right-flash-color) 48%, transparent); + --sidebar-right-flash-near: color-mix(in srgb, var(--sidebar-right-flash-color) 16%, transparent); + --sidebar-right-flash-far: color-mix(in srgb, var(--sidebar-right-flash-color) 10%, transparent); } :global(body[data-ds-dark-theme]) .panel :global([data-dockkit-pane][data-sidebar-right-flash]), @@ -237,22 +240,22 @@ z-index: 7; pointer-events: none; --sidebar-right-flash-from: - inset 0 0 0 1px var(--sidebar-right-flash-color), - inset 0 3px 8px 0 var(--sidebar-right-flash-near), - inset 0 0 20px 0 var(--sidebar-right-flash-far); + inset 0 0 0 1px var(--sidebar-right-flash-ring), + inset 0 2px 4px 0 var(--sidebar-right-flash-near), + inset 0 0 10px 0 var(--sidebar-right-flash-far); --sidebar-right-flash-to: - inset 0 0 0 1px transparent, inset 0 3px 8px 0 transparent, inset 0 0 20px 0 transparent; + inset 0 0 0 1px transparent, inset 0 2px 4px 0 transparent, inset 0 0 10px 0 transparent; } .panel :global([data-dockkit-float][data-sidebar-right-flash]) { --sidebar-right-flash-from: var(--dsw-elevation-prominent), - 0 0 0 1px var(--sidebar-right-flash-color), - 0 3px 8px 0 var(--sidebar-right-flash-near), - 0 0 20px 0 var(--sidebar-right-flash-far); + 0 0 0 1px var(--sidebar-right-flash-ring), + 0 2px 4px 0 var(--sidebar-right-flash-near), + 0 0 10px 0 var(--sidebar-right-flash-far); --sidebar-right-flash-to: var(--dsw-elevation-prominent), - 0 0 0 1px transparent, 0 3px 8px 0 transparent, 0 0 20px 0 transparent; + 0 0 0 1px transparent, 0 2px 4px 0 transparent, 0 0 10px 0 transparent; } .panel :global([data-dockkit-pane][data-sidebar-right-flash])::after, diff --git a/packages/client/ui-sidebar-right/tests/open-destination.client.spec.ts b/packages/client/ui-sidebar-right/tests/open-destination.client.spec.ts index 4e89169806..024113b4ff 100644 --- a/packages/client/ui-sidebar-right/tests/open-destination.client.spec.ts +++ b/packages/client/ui-sidebar-right/tests/open-destination.client.spec.ts @@ -73,7 +73,7 @@ describe('openResource with a destination — six transitions', () => { expect(h.layout().expanded).toBe(true) }) - it('3. reveals a docked copy where it is and flashes its pane', () => { + it('3. reveals a docked copy where it is and flashes its pane once it is on screen', () => { const h = harness() h.controller.openResource(A, { destination: 'sidebar' }) h.controller.openResource(B, { destination: 'sidebar' }) @@ -84,6 +84,9 @@ describe('openResource with a destination — six transitions', () => { expect(getPane(h.layout(), h.layout().activePaneId).activeTabId).toBe(a) expect(h.occurrence(a)).toBe(held) expect(held.navigation.getSnapshot()).toEqual({ address: A, params: { line: 9 }, revision: 2 }) + // Switching to the tab is the visible change; only a reveal of the tab already on screen flashes. + expect(h.controller.flashOf(SESSION).getSnapshot()).toBeUndefined() + h.controller.openResource(A, { destination: 'sidebar' }) expect(h.controller.flashOf(SESSION).getSnapshot()).toEqual({ paneId: findTabPane(h.layout(), a).id, serial: 1 }) }) diff --git a/packages/client/ui-sidebar-right/tests/seat.client.spec.tsx b/packages/client/ui-sidebar-right/tests/seat.client.spec.tsx index 52df7387cd..c6ae78c2e8 100644 --- a/packages/client/ui-sidebar-right/tests/seat.client.spec.tsx +++ b/packages/client/ui-sidebar-right/tests/seat.client.spec.tsx @@ -1117,12 +1117,15 @@ it('keeps a resource tab and reports a synchronous cleanup failure from its clos }) describe('the reveal glow', () => { - it('marks the pane of a revealed tab, docked or floating, restarts on a repeat, and clears when the animation ends', async () => { + it('marks the pane of a revealed tab already on screen, docked or floating, restarts on a repeat, and clears when the animation ends', async () => { const h = await mountSeat() const a = h.open('a.txt') h.open('b.txt') const marked = (): HTMLElement[] => [...document.querySelectorAll('[data-sidebar-right-flash]')] expect(marked()).toEqual([]) + // Switching back to a background tab is the visible change and marks nothing. + h.open('a.txt') + expect(marked()).toEqual([]) h.open('a.txt') const pane = document.querySelector(`[data-dockkit-pane="${h.layout().activePaneId}"]`)! expect(marked()).toEqual([pane]) @@ -1146,7 +1149,7 @@ describe('the reveal glow', () => { h.open('a.txt') h.open('b.txt') const marked = (): HTMLElement[] => [...document.querySelectorAll('[data-sidebar-right-flash]')] - h.open('a.txt') + h.open('b.txt') expect(marked()).toHaveLength(1) act(() => { h.runtime.panelInfo.set({ activePanelId: 'other-panel' as MainPanelId }) }) expect(marked()).toEqual([]) @@ -1154,7 +1157,7 @@ describe('the reveal glow', () => { expect(marked()).toEqual([]) // A request whose Session is hidden in the same commit is dropped, not deferred. act(() => { - h.controller.openResource('dsh-resource://file/session/s-test/a.txt') + h.controller.openResource('dsh-resource://file/session/s-test/b.txt') h.runtime.panelInfo.set({ activePanelId: 'other-panel' as MainPanelId }) }) expect(marked()).toEqual([])