fix(web): limit the drop target to the right sidebar's area
Co-authored-by: liukx0205 <[email protected]> Co-authored-by: Yifffan <[email protected]>
This commit is contained in:
1 parent
d03be2bf85
commit
7bcd87c7c6
6 files changed
+23
-25
No files matched your search
@@ -15,8 +15,8 @@
|
||||
en: d152484eb41ac6b4
|
||||
zh: 09388d293f9be9cb
|
||||
/deepseek-ai-dsh-client-ui-subagent/use-this-package:
|
||||
en: 7e3eece5a469ece5
|
||||
zh: 806e7485183135b1
|
||||
en: 2496fa7cbacfd5a5
|
||||
zh: 6cb7d74396aad203
|
||||
/deepseek-ai-dsh-client-ui-subagent/use-this-package/browsing-the-tree:
|
||||
en: da87d582146106c4
|
||||
zh: f640b3a3fcc11209
|
||||
|
||||
@@ -29,7 +29,7 @@ The session header uses the session title for ordinary breadcrumbs. Subagent bre
|
||||
|
||||
This package registers the `dsh-resource://subagentchat/session/<child>?parent=<parent>&mode=<mode>` resource and builtin Sidebar tab type. The resource retains the child `SessionReference` directly from its address without refreshing the parent catalog, and releases the reference when the tab record closes. The tab renders the shared `conversation.content` Factory through `sidebar.chat.conversation`, fixes the local View to Chat, and omits the main Conversation header and width controls. A Workspace picked in a blank child's Hero opens that Workspace's blank Session as the main Session and moves the draft to it, as the main Conversation does.
|
||||
|
||||
Dragging a root Session row from the Session list shows a drop target while another Session is on screen. The target blurs the whole window to the right of the navigation column or narrow-window drawer that the row left and accepts the drop anywhere there; its highlighted card sits at the right edge, as wide as the right Sidebar would open, with an 8px inset on every side. The target stacks above the drawer's mask. Dropping there opens the dragged Session as `dsh-resource://subagentchat/session/<id>`, an address without a query, in the on-screen Session's Sidebar column, or reveals the tab that already shows it. Its Conversation accepts follow-up prompts like the main Conversation, and the tab is saved with that Session's browser-local Sidebar layout. The tab title is the Session's display title.
|
||||
Dragging a root Session row from the Session list shows a drop target while another Session is on screen. The target covers the area the right Sidebar would open in, as wide as that Sidebar and never left of the navigation column or narrow-window drawer that the row left, so the chat area stays uncovered; its card has an 8px inset on every side. When the Sidebar width is unknown, the target covers the whole window right of that column. The target stacks above the drawer's mask. Dropping there opens the dragged Session as `dsh-resource://subagentchat/session/<id>`, an address without a query, in the on-screen Session's Sidebar column, or reveals the tab that already shows it. Its Conversation accepts follow-up prompts like the main Conversation, and the tab is saved with that Session's browser-local Sidebar layout. The tab title is the Session's display title.
|
||||
|
||||
The section's title control (`conversation.session.panel.section.actions`, key `subagents`) shows direct-member progress: completed, in progress, not running, and external counts in that order, with zero counts omitted and the separator matching the input task list. External tasks never count as running or completed. The section lists running subagents first, the most recently started first, and then the others, the most recently updated first. It shows five rows and then the Session panel's fold control, “Show {count} more”, which shows the rest and then reads “Show less”; the list folds only when that holds back two rows or more, the choice holds for the Session, also after the panel is hidden and shown again, and an expanded branch's own rows all show. The section hides with its title while the Session has no subagents and no failed catalog read. While direct subagents run and the panel does not show, a blue dot on the panel toggle (`conversation.session.panel.indicator`) says so and names their number for assistive technology; external tasks do not count. The Session panel scrolls the section; the tree has no nested scrolling. The breadcrumb switcher menu is 360px wide with 6px outer padding, constrained to fit the layout viewport, and only the menu scrolls. In WebKit-compatible browsers, its native 5px scrollbar sits in the right 6px inset with inset track ends and a stable gutter, preserving content width when scrolling becomes necessary. Other browsers retain their standard native scrollbar.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ kind: "package-reference"
|
||||
|
||||
本包注册 `dsh-resource://subagentchat/session/<child>?parent=<parent>&mode=<mode>` 资源与 builtin Sidebar tab 类型。资源直接根据地址保留 child 的 `SessionReference`,不刷新 parent 目录,并在 tab 记录关闭时释放 reference。tab 通过 `sidebar.chat.conversation` 渲染共享 `conversation.content` Factory,把局部 View 固定为 Chat,并省略主 Conversation 的 Header 与宽度控制。在空白 child 的 Hero 中选择工作区时,与主 Conversation 一样,把该工作区的空白 Session 打开为主 Session,并把草稿移过去。
|
||||
|
||||
从会话列表拖拽根 Session 行时,如果屏幕上正显示另一个 Session,会显示放置目标。放置目标将该行被拖出的导航栏或窄窗口抽屉右侧的整个窗口区域模糊处理,并在该区域内任意位置接受放置;其高亮卡片位于右边缘,宽度与右侧侧边栏打开时的宽度相同,四边均内缩 8px。放置目标显示在抽屉遮罩之上。在此放下后,会在屏幕上那个 Session 的 Sidebar 栏中把被拖拽的 Session 打开为 `dsh-resource://subagentchat/session/<id>`(不带查询参数的地址);如果已有 tab 显示该 Session,则改为显示该 tab。其 Conversation 与主 Conversation 一样接受后续提示词,该 tab 随屏幕上那个 Session 的浏览器本地 Sidebar 布局保存。tab 标题为该 Session 的显示标题。
|
||||
从会话列表拖拽根 Session 行时,如果屏幕上正显示另一个 Session,会显示放置目标。放置目标覆盖右侧侧边栏打开时所占的区域,宽度与该侧边栏相同,且始终位于该行被拖出的导航栏或窄窗口抽屉的右侧,因此聊天区域不被覆盖;其卡片四边均内缩 8px。侧边栏宽度未知时,放置目标覆盖该栏右侧的整个窗口区域。放置目标显示在抽屉遮罩之上。在此放下后,会在屏幕上那个 Session 的 Sidebar 栏中把被拖拽的 Session 打开为 `dsh-resource://subagentchat/session/<id>`(不带查询参数的地址);如果已有 tab 显示该 Session,则改为显示该 tab。其 Conversation 与主 Conversation 一样接受后续提示词,该 tab 随屏幕上那个 Session 的浏览器本地 Sidebar 布局保存。tab 标题为该 Session 的显示标题。
|
||||
|
||||
分栏的标题控件(`conversation.session.panel.section.actions`,键为 `subagents`)显示直接成员进度:依次为已完成、进行中、未运行和外部任务数量;省略零值,分隔符与输入区任务列表一致。外部任务不计入运行中或已完成数量。分栏把运行中的子智能体排在最前,最近开始的在前,然后是其余的,最近更新的在前。它只显示五行,然后是会话面板的收起控件「显示其余 {count} 个」,点击后显示其余的行并变为「收起」;只有能收起两行及以上时列表才收起,这个选择在 Session 内保持,隐藏后再次显示面板也不变;展开某个分支后,该分支自己的行全部显示。会话没有子智能体且目录读取未失败时,分栏连同标题一起隐藏。直接子智能体运行中且面板未显示时,面板开关上的蓝点(`conversation.session.panel.indicator`)会提示这一状态,并向辅助技术说明数量;外部任务不计入。会话面板负责分栏滚动,目录树不单独滚动。面包屑切换器菜单宽度为 360px,外层内边距为 6px,并受布局视口可用宽度约束,仅菜单本身滚动。在兼容 WebKit 的浏览器中,其原生 5px 滚动条位于右侧 6px 内边距内,轨道两端内缩,并保留稳定的滚动条空间,使内容在需要滚动时保持原有宽度。其他浏览器保留标准原生滚动条。
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/* The drop target covers the window right of the navigation column the row
|
||||
left (its left edge is set inline) with the dock kit's blurred drop-hint
|
||||
ground, and accepts the drop anywhere on it. The dashed card that takes the
|
||||
accent while the pointer is over the target sits at the right edge with an
|
||||
8px inset on every side, as wide as the right Sidebar would open (set
|
||||
inline), or across the whole target when that width is unknown. It stacks
|
||||
above the narrow-window drawer (71) and its mask (70), below menus and
|
||||
toasts. */
|
||||
/* The drop target covers the area the right Sidebar would open in: as wide
|
||||
as that Sidebar (measured values set inline), never left of the navigation column
|
||||
or narrow-window drawer the row came from, and that whole area right of the
|
||||
column when the Sidebar width is unknown. It leaves the chat area uncovered
|
||||
and draws the dock kit's drop hint with an 8px inset on every side: a blurred
|
||||
ground under a dashed card that takes the accent while the pointer is over
|
||||
it. It stacks above the narrow-window drawer (71) and its mask (70), below
|
||||
menus and toasts. */
|
||||
.zone {
|
||||
position: fixed;
|
||||
z-index: 72;
|
||||
left: max(var(--session-drop-inset), calc(100vw - var(--session-drop-width, 100vw)));
|
||||
top: var(--dsh-frame-chrome-top, 0px);
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 8px;
|
||||
pointer-events: auto;
|
||||
background: color-mix(in srgb, var(--dsw-alias-bg-base) 72%, transparent);
|
||||
@@ -25,8 +25,6 @@
|
||||
.card {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Drop target that opens a Session dragged from the Session list in the right Sidebar. */
|
||||
import { useState, type DragEvent } from 'react'
|
||||
import { useState, type CSSProperties, type DragEvent } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { IconPanelLeftOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import type { HostObservable, InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
@@ -16,7 +16,7 @@ export interface SessionDrag {
|
||||
readonly sessionId: SessionId
|
||||
/** Right edge of the navigation column the row left, in px; the target covers the window to its right. */
|
||||
readonly inset: number
|
||||
/** Width of the on-screen Session's right Sidebar, in px, which the highlighted card takes; zero when unknown. */
|
||||
/** Width of the on-screen Session's right Sidebar, in px, which the target takes; zero when unknown. */
|
||||
readonly width: number
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ function DropTarget({ inset, width, label, onDrop }: {
|
||||
return createPortal(
|
||||
<div
|
||||
className={css.zone}
|
||||
style={{ left: inset }}
|
||||
style={{ '--session-drop-inset': `${String(inset)}px`, ...(width > 0 ? { '--session-drop-width': `${String(width)}px` } : {}) } as CSSProperties}
|
||||
data-session-drop-zone=""
|
||||
data-active={over || undefined}
|
||||
onDragEnter={accept}
|
||||
@@ -80,7 +80,7 @@ function DropTarget({ inset, width, label, onDrop }: {
|
||||
onDrop()
|
||||
}}
|
||||
>
|
||||
<div className={css.card} style={width > 0 ? { flex: `0 1 ${String(width - 16)}px` } : undefined}>
|
||||
<div className={css.card}>
|
||||
<IconPanelLeftOutlineRegular className={css.icon} aria-hidden="true" />
|
||||
<span className={css.label}>{label}</span>
|
||||
</div>
|
||||
|
||||
@@ -74,7 +74,7 @@ describe('Session drag tracking', () => {
|
||||
frame.append(column, overlay)
|
||||
document.body.append(frame)
|
||||
column.getBoundingClientRect = () => ({ right: 279.6 }) as DOMRect
|
||||
// The on-screen Session's right Sidebar panel sets the highlighted card's width; another Session's is ignored.
|
||||
// The on-screen Session's right Sidebar panel sets the target's width; another Session's is ignored.
|
||||
const panel = document.createElement('div')
|
||||
panel.setAttribute('data-sidebar-right-panel', 'push')
|
||||
panel.setAttribute('data-sidebar-right-session', MAIN)
|
||||
@@ -136,9 +136,9 @@ describe('Session drop zone', () => {
|
||||
// The zone portals to the body so it stacks above the narrow-window drawer mask.
|
||||
const zone = document.querySelector<HTMLElement>('[data-session-drop-zone]')!
|
||||
expect(zone.parentElement).toBe(document.body)
|
||||
expect(zone.style.left).toBe('280px')
|
||||
// The highlighted card is as wide as the Sidebar would open, inside the 8px inset.
|
||||
expect((zone.firstElementChild as HTMLElement).style.flex).toBe('0 1 500px')
|
||||
// The target is as wide as the Sidebar would open, and never reaches left of the navigation column.
|
||||
expect(zone.style.getPropertyValue('--session-drop-inset')).toBe('280px')
|
||||
expect(zone.style.getPropertyValue('--session-drop-width')).toBe('516px')
|
||||
expect(view.container.innerHTML).toBe('')
|
||||
expect(zone.hasAttribute('data-active')).toBe(false)
|
||||
|
||||
@@ -163,9 +163,9 @@ describe('Session drop zone', () => {
|
||||
expect(view.openAside).toHaveBeenCalledExactlyOnceWith(OTHER)
|
||||
expect(zone.hasAttribute('data-active')).toBe(false)
|
||||
|
||||
// Without a known Sidebar width the card spans the whole target.
|
||||
// Without a known Sidebar width the target spans the window right of the navigation column.
|
||||
view.set(MAIN)
|
||||
expect((document.querySelector('[data-session-drop-zone]')!.firstElementChild as HTMLElement).style.flex).toBe('')
|
||||
expect(document.querySelector<HTMLElement>('[data-session-drop-zone]')!.style.getPropertyValue('--session-drop-width')).toBe('')
|
||||
|
||||
view.set(undefined)
|
||||
expect(document.querySelector('[data-session-drop-zone]')).toBeNull()
|
||||
|
||||
Reference in new issue
Block a user