diff --git a/CHANGELOG.md b/CHANGELOG.md
index 72740fc2..2bea462e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -70,6 +70,7 @@
- 🧭 **新增「线索收集」Tab:把文件、飞书任务/文档、GitHub issue 与 PR 收进一处,用统一浮窗预览与编辑**:右侧栏多出一个 tab,顶部一条来源分段(本地文件 / GitHub Issues / GitHub Pull requests / 飞书文档 / 飞书任务,最后选中的来源会记住),其下是范围栏(当前仓库或工作区,可切换)与共享 `SearchField`;列表行 30px,行内动作只在悬停或键盘聚焦时出现(触控恒显且 44px)。
+ - **资料类型随栏宽切换**:宽栏横排显示各来源的图标和名称;窄栏保留紧凑下拉。资料浏览和包内添加共用这套控件,调整栏宽不会切换来源。
- **资料与资料包采用 VS Code 式可调分区**:多个区块可各自展开、同时显示;用鼠标、触控或键盘上下调整分隔柄。布局写入插件设置,折叠不丢失搜索、列表位置和草稿。
- **统一浮窗**:详情、包管理、添加成员、来源配置、新建包与分享都由同一个 `windows` 宿主承载(`FloatingWindow` 记忆位置与尺寸、支持最大化)。详情里预览与编辑是两个页签,读取与写入分两条路径:打开只读预览,`clues.loadEdit` 只在点「编辑」时发生,保存永远基于编辑文档自己的基线。
- **稳定引用**:tab 内与输入框里的 @ 都只落 `[[dsh-clue:…]]` / `[[dsh-cluepack:…]]` / `[[dsh-clue-snapshot:…]]` 这类稳定 token,跨会话、跨工作区都能解析回同一条线索。
diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md
index c1b61297..2160a9f1 100644
--- a/CHANGELOG_EN.md
+++ b/CHANGELOG_EN.md
@@ -72,6 +72,7 @@
- 🧭 **New Clues tab: local files, Feishu tasks/docs and GitHub issues/PRs in one place, previewed and edited in one host window**: the right column gains a tab whose top row is a source segment (local files / GitHub issues / GitHub pull requests / Feishu docs / Feishu tasks, remembering the last choice), followed by a scope row (the current repository or workspace) and the shared `SearchField`. Rows are 30px, with row actions only on hover or keyboard focus (always visible at 44px on touch).
+ - **Resource types adapt to the column width**: wide panes show source icons and names in a row; narrow panes use a compact menu. Resizing the browser or pack member picker keeps the selected source.
- **Resources and Collections use resizable VS Code-style sections**: expand several together and drag the horizontal dividers, or resize with the keyboard. The layout is remembered, and collapsing a section preserves its search, scroll position, and drafts.
- **One window host**: detail, pack management, add-member, source configuration, new pack and sharing all go through the same `windows` host (`FloatingWindow` remembers position and size and supports maximize). A detail's preview and edit are two tabs over two separate paths: opening reads a preview only, `clues.loadEdit` runs only when Edit is chosen, and a save always uses the edit document's own baseline.
- **Stable references**: an @ pick inside the tab or in the composer only ever produces `[[dsh-clue:…]]` / `[[dsh-cluepack:…]]` / `[[dsh-clue-snapshot:…]]` tokens, so a reference resolves back to the same clue across sessions and workspaces.
diff --git a/src/client/clues/tab/browser-shared.tsx b/src/client/clues/tab/browser-shared.tsx
index 75a5de52..7bcac4d7 100644
--- a/src/client/clues/tab/browser-shared.tsx
+++ b/src/client/clues/tab/browser-shared.tsx
@@ -20,7 +20,7 @@ import type {
import { BUILTIN_SOURCE_IDS } from '../../../clues/types.ts'
import { parseGithubRepoRef } from '../../../clues/sources/github/url.ts'
import { t } from '../../locales.ts'
-import { Field, SelectMenu, TextInput } from '../../ui/index.ts'
+import { Field, SourceSwitcher, TextInput } from '../../ui/index.ts'
import css from './clues-tab.module.css'
/** Stable row key of one candidate (the locator is source-normalized JSON). */
@@ -78,34 +78,18 @@ export function SourceNavigation(props: {
onChange(sourceId: string): void
}): ReactNode {
const { sources, displays, activeId, onChange } = props
- if (sources.length === 0) return null
- const options = sources.map(source => {
+ const items = sources.map(source => {
const label = source.sourceId === BUILTIN_SOURCE_IDS.files
? t('clueLocalFilesName')
: displays.find(display => display.sourceId === source.sourceId)?.name ?? source.name
return {
value: source.sourceId,
label,
- title: label,
icon: sourceIcon(source.sourceId, displays, 14),
}
})
return (
-
-
-
+
)
}
diff --git a/src/client/clues/tab/clues-tab.module.css b/src/client/clues/tab/clues-tab.module.css
index 0707cd30..e84e8ce4 100644
--- a/src/client/clues/tab/clues-tab.module.css
+++ b/src/client/clues/tab/clues-tab.module.css
@@ -103,23 +103,13 @@
min-height: 30px;
padding: 4px var(--ds-sidebar-gutter) 2px;
}
-.sourceNav {
- display: inline-flex;
- flex: 0 1 auto;
- min-width: 0;
- max-width: 52%;
-}
-.sourceSelect {
- min-height: 26px;
- padding: 2px 6px;
- border-color: var(--dsw-alias-border-l1);
- background: transparent;
- font-size: 12px;
- line-height: 16px;
- font-weight: 500;
-}
-@media (pointer: coarse) {
- .sourceSelect { min-height: 44px; }
+.sourceNav { flex: 0 1 148px; min-width: 0; max-width: 52%; }
+
+/* A 520px source strip plus the two 12px Clues gutters. Give it the
+ whole first row, so range labels and action buttons never clip the tabs. */
+@container (min-width: 544px) {
+ .browserToolbar { flex-wrap: wrap; }
+ .sourceNav { flex: 1 0 100%; max-width: none; }
}
.commandSpacer { flex: 1 1 0; min-width: 0; }
.browser {
diff --git a/src/client/clues/windows/pack.module.css b/src/client/clues/windows/pack.module.css
index 09558176..efe38520 100644
--- a/src/client/clues/windows/pack.module.css
+++ b/src/client/clues/windows/pack.module.css
@@ -147,6 +147,9 @@
gap: 4px;
min-width: 0;
}
+@container (min-width: 544px) {
+ .addToolbar { flex-wrap: wrap; }
+}
.toolbarSpacer { flex: 1 1 0; min-width: 0; }
.scopeTrigger {
display: inline-flex;
diff --git a/src/client/ui/SourceSwitcher.tsx b/src/client/ui/SourceSwitcher.tsx
index 740abaad..0614c60f 100644
--- a/src/client/ui/SourceSwitcher.tsx
+++ b/src/client/ui/SourceSwitcher.tsx
@@ -70,7 +70,6 @@ export function SourceSwitcher({ items, value, onChange, ariaLabel, className }:
value={value}
onChange={onChange}
ariaLabel={ariaLabel}
- title={ariaLabel}
options={items.map(item => ({
value: item.value,
label: item.label,
diff --git a/src/client/ui/source-switcher.module.css b/src/client/ui/source-switcher.module.css
index 5eaba136..fce90c71 100644
--- a/src/client/ui/source-switcher.module.css
+++ b/src/client/ui/source-switcher.module.css
@@ -3,13 +3,28 @@
.wide { display: block; min-width: 0; }
.narrow { display: none; min-width: 0; }
-.tabs { width: 100%; }
+.tabs { box-sizing: border-box; width: 100%; }
+/* Size each segment to its label before distributing the remaining space. */
+.tabs > [role='tab'] { flex-basis: auto; font-size: 12px; }
.tabLabel { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; max-width: 100%; }
.tabIcon { display: inline-flex; flex: none; align-items: center; }
.tabIcon svg { display: block; }
.tabText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
-.select { display: flex; width: 100%; min-height: 28px; justify-content: flex-start; }
+.select {
+ display: flex;
+ width: 100%;
+ min-height: 26px;
+ padding: 2px 6px;
+ gap: 4px;
+ justify-content: flex-start;
+ border-color: var(--dsw-alias-border-l1);
+ background: transparent;
+ font-size: 12px;
+ font-weight: 500;
+ line-height: 16px;
+}
+.select > svg:last-child { margin-inline-start: auto; }
@media (hover: none), (pointer: coarse) {
.select { min-height: 44px; }
}
diff --git a/tests/clues-tab-css.spec.ts b/tests/clues-tab-css.spec.ts
index 4b9f66f8..6cea2180 100644
--- a/tests/clues-tab-css.spec.ts
+++ b/tests/clues-tab-css.spec.ts
@@ -4,7 +4,7 @@
* The native sidebar is a COLUMN whose width is independent of the browser
* viewport, so the tab owns its own container. Sections are VSCode-style
* disclosures (28px bars, mounted bodies), sources are one segmented track that
- * becomes a select below 520px, and rows are a compact 30px with hover-only
+ * becomes a select below 520px of available width, and rows are 30px with hover-only
* actions. The native search field is the shared 32px recipe.
*/
import { readFileSync } from 'node:fs'
diff --git a/tests/e2e/clues-uiux.e2e.ts b/tests/e2e/clues-uiux.e2e.ts
index 9d77da5f..808cf126 100644
--- a/tests/e2e/clues-uiux.e2e.ts
+++ b/tests/e2e/clues-uiux.e2e.ts
@@ -188,11 +188,14 @@ test('clues workbench stays usable across column widths and host themes', async
await clueView(tab, 'browse')
const composer = page.getByRole('textbox', { name: /^(Describe what you want to build|Message or run a task|描述你想要构建)/ })
const sourceNavigation = browser.locator('[data-clue-source-navigation]')
- // The approved form is always one compact select, never a clipped tab row.
+ // The startup width belongs to the native host. Check whichever form is
+ // visible now, then exercise both explicitly in the width sweep.
const sourceSelect = sourceNavigation.getByRole('button', { name: 'Source', exact: true })
- await expect(sourceSelect).toBeVisible()
- await expect(sourceSelect).toContainText('Local files')
- await expect(sourceSelect.locator('svg').first()).toBeVisible()
+ const sourceTabs = sourceNavigation.getByRole('tablist', { name: 'Source', exact: true }).getByRole('tab')
+ const activeSourceControl = sourceSelect.or(sourceTabs.filter({ hasText: 'Local files' }))
+ await expect(activeSourceControl).toBeVisible()
+ await expect(activeSourceControl).toContainText('Local files')
+ await expect(activeSourceControl.locator('svg').first()).toBeVisible()
await expect(sourceNavigation).toHaveAttribute('data-source-count', '5')
await expect(browser.getByRole('combobox', { name: 'Source', exact: true })).toHaveCount(0)
await expect(browser.getByRole('search')).toHaveCSS('height', '32px')
@@ -273,6 +276,11 @@ test('clues workbench stays usable across column widths and host themes', async
expect(Math.abs(box.width - tabBox.width)).toBeLessThanOrEqual(1)
expect(box.height).toBeGreaterThan(tabBox.height * 0.7)
await expectNoOverflow(active)
+ if (view === 'browse') {
+ await expect(sourceTabs).toHaveCount(5)
+ await expect(sourceTabs.first()).toBeVisible()
+ await expect(sourceSelect).toHaveCount(0)
+ }
await tab.screenshot({ path: testInfo.outputPath('clues-wide-1100-' + theme + '-' + view + '.png') })
}
}
@@ -302,8 +310,20 @@ test('clues workbench stays usable across column widths and host themes', async
const insert = first.getByRole('button', { name: /^Insert / }).first()
await expect(insert.locator('svg')).toHaveCount(1)
expect((await insert.innerText()).trim()).toBe('')
- await expect(sourceNavigation.getByRole('button', { name: 'Source', exact: true })).toBeVisible()
- await expect(sourceNavigation.getByRole('tab')).toHaveCount(0)
+ if (width < 544) {
+ await expect(sourceSelect).toBeVisible()
+ await expect(sourceTabs).toHaveCount(0)
+ } else {
+ await expect(sourceTabs).toHaveCount(5)
+ await expect(sourceSelect).toHaveCount(0)
+ const rows = await sourceTabs.evaluateAll(nodes => new Set(nodes.map(node => node.getBoundingClientRect().top)).size)
+ expect(rows).toBe(1)
+ const clipped = await sourceTabs.evaluateAll(nodes => nodes.some(node => {
+ const label = node.firstElementChild?.lastElementChild ?? null
+ return label !== null && label.scrollWidth > label.clientWidth + 1
+ }))
+ expect(clipped).toBe(false)
+ }
// Progressive results end in a scroll sentinel, not a pager.
await expect(browser.locator('[data-clue-result-sentinel]')).toBeAttached()
} else {
@@ -359,8 +379,20 @@ test('clues workbench stays usable across column widths and host themes', async
await query.fill('architecture')
await query.press('Enter')
await expect(browser.locator('[data-clue-browser-state="page"] li').first()).toContainText('architecture')
- await selectClueSource(browser, 'builtin.github.issues')
+ const localSource = sourceNavigation.getByRole('tab', { name: 'Local files', exact: true })
+ const githubSource = sourceNavigation.getByRole('tab', { name: 'GitHub Issues', exact: true })
+ const pullSource = sourceNavigation.getByRole('tab', { name: 'GitHub Pull requests', exact: true })
+ await localSource.press('End')
+ await expect(pullSource).toBeFocused()
+ await pullSource.press('ArrowLeft')
+ await expect(githubSource).toBeFocused()
+ await expect(githubSource).toHaveAttribute('aria-selected', 'true')
await expect(sourceNavigation).toHaveAttribute('data-clue-active-source', 'builtin.github.issues')
+ await tab.evaluate(node => { (node as HTMLElement).style.width = '390px' })
+ await expect(sourceSelect).toBeVisible()
+ await expect(sourceSelect).toContainText('GitHub Issues')
+ await tab.evaluate(node => { (node as HTMLElement).style.width = '640px' })
+ await expect(githubSource).toHaveAttribute('aria-selected', 'true')
// The scope editor is still a locally owned floating task window.
const scopeWindow = (): Locator => page.locator('[data-floating-window]')
.filter({ has: page.locator('[data-clue-scope-window]') })
@@ -724,7 +756,12 @@ test('clues workbench stays usable across column widths and host themes', async
await expect(addPage.getByRole('button', { name: 'Add members', exact: true })).toHaveCount(0)
await expect(addPage.locator('[data-clue-pins-region]')).toHaveCount(0)
await expect(addPage.getByRole('button', { name: 'Add selected', exact: true })).toHaveCount(0)
+ const addNav = addPage.locator('[data-clue-source-navigation]')
+ const beforeWide = await packWindow.evaluate(node => (node as HTMLElement).style.width)
+ await packWindow.evaluate(node => { (node as HTMLElement).style.width = '680px' })
+ await expect(addNav.getByRole('tablist')).toBeVisible()
await selectClueSource(addPage, 'builtin.files')
+ await packWindow.evaluate((node, width) => { (node as HTMLElement).style.width = width }, beforeWide)
const addSearch = addPage.getByRole('textbox').first()
await expect(addSearch.locator('..')).toHaveCSS('height', '32px')
await expect(addSearch).toHaveCSS('font-size', '13px')
@@ -742,6 +779,8 @@ test('clues workbench stays usable across column widths and host themes', async
await expect(addAction).toBeVisible()
const originalPackSize = await packWindow.evaluate(node => ({ width: (node as HTMLElement).style.width, height: (node as HTMLElement).style.height }))
await packWindow.evaluate(node => { (node as HTMLElement).style.width = '320px'; (node as HTMLElement).style.height = '240px' })
+ await expect(addNav.getByRole('button', { name: 'Source', exact: true })).toContainText('Local files')
+ await expect(addNav.getByRole('tablist')).toHaveCount(0)
const compactPackBounds = (await packWindow.boundingBox())!
const compactAddBounds = (await addAction.boundingBox())!
expect(compactAddBounds.y).toBeGreaterThanOrEqual(compactPackBounds.y)
diff --git a/tests/e2e/global-uiux.e2e.ts b/tests/e2e/global-uiux.e2e.ts
index 5892ca08..4a3d4969 100644
--- a/tests/e2e/global-uiux.e2e.ts
+++ b/tests/e2e/global-uiux.e2e.ts
@@ -257,8 +257,9 @@ for (const touch of [false, true]) {
await clueView(clues, 'browse')
const sourceNavigation = clues.locator('[data-clue-source-navigation]')
await expect(sourceNavigation).toBeVisible({ timeout: 30_000 })
- // The approved form is one compact select at every width; it must be
- // reachable and dismissible from the keyboard like every other control.
+ // Exercise the compact menu in a narrow column regardless of the
+ // native panel's starting width.
+ await clues.evaluate(node => { node.style.maxWidth = '390px' })
const sourceSelect = sourceNavigation.getByRole('button', { name: 'Source', exact: true })
await expect(sourceSelect).toBeVisible()
metrics.cluesTab = await controlStyle(sourceSelect)
@@ -270,6 +271,7 @@ for (const touch of [false, true]) {
await expect(page.getByRole('menu')).toHaveCount(0)
await expect(sourceSelect).toBeFocused()
await expect(sourceNavigation).toHaveAttribute('data-clue-active-source', 'builtin.files')
+ await clues.evaluate(node => { node.style.maxWidth = '' })
const resourceRow = clues.locator('[data-clue-browser-state="page"] li').filter({ has: page.getByRole('button', { name: 'acceptance.md', exact: true }) }).first()
await expect(resourceRow).toBeVisible()
// The actual context handler receives four viewport corners; placement may
diff --git a/tests/e2e/ui-helpers.ts b/tests/e2e/ui-helpers.ts
index 0325c6fb..46d4657a 100644
--- a/tests/e2e/ui-helpers.ts
+++ b/tests/e2e/ui-helpers.ts
@@ -60,9 +60,13 @@ export async function selectClueSource(scope: Locator, sourceId: string): Promis
const navigation = scope.locator('[data-clue-source-navigation]')
const name = sourceNames[sourceId]!
const select = navigation.getByRole('button', { name: 'Source', exact: true })
- await expect(select).toBeVisible()
- await select.click()
- await scope.page().getByRole('menuitem', { name, exact: true }).click()
+ const tab = navigation.getByRole('tab', { name, exact: true })
+ await expect(tab.or(select)).toBeVisible()
+ if (await tab.isVisible()) await tab.click()
+ else {
+ await select.click()
+ await scope.page().getByRole('menuitem', { name, exact: true }).click()
+ }
await expect(navigation).toHaveAttribute('data-clue-active-source', sourceId)
}