diff --git a/README.md b/README.md index 93db59d..ba12d99 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ Oxfmt 不负责代码质量,Oxlint 不负责 Vue 的完整类型推导;Vue S - 项目列表采用固定表头表格;剧本、分镜、身份与生产页的目录和详情独立滚动,其他工作区只滚动内容区。 - 目录、详情、执行记录、折叠操作区、图片历史和 JSON 查看区统一使用 Naive UI `NScrollbar`;外层只负责尺寸与裁切,不再设置原生 `overflow: auto`。内边距与横向排列放在 `content-class` 内容层,避免双滚动条。 - 剧集正文按编号连续展示全部已写入剧集;点击目录定位正文,滚动正文同步高亮并保持当前目录项可见。目录分行显示集数和完整标题,执行记录可按需展开。切换角色/世界观等标签不会销毁阅读器或重置位置。 +- 主体身份、分镜设计和镜头生产共用 `DirectoryItem`:编号、完整标题和状态分层展示,桌面目录为 240–280px,窄屏改为可横向滚动的条目。目录标题与筛选固定,只有列表滚动。拆解结果的导出按钮与标签同排右对齐;形态图片筛选按内容区宽度自动排成一行或两列网格。 - 生成配置与批量操作放在可折叠区域,回执到达后自动展开;查询错误始终可见,不隐藏在折叠内容中。 - 右上角提供浅色、暗黑、跟随系统三种模式,默认跟随系统,选择保存在本机浏览器。存储被禁用时仍可在当前会话切换。 - 以黑白灰为主,仅错误、警告、成功等语义状态保留辅助色。Naive UI 和业务内容共用主题;加载前应用偏好,减少主题闪烁。 diff --git a/src/admin.css b/src/admin.css index 81f6e79..a9c5c37 100644 --- a/src/admin.css +++ b/src/admin.css @@ -261,6 +261,11 @@ body { align-items: stretch; overflow: hidden; } +.production-workspace, +.identity-workspace, +.storyboard-workspace { + grid-template-columns: clamp(240px, 22%, 280px) minmax(0, 1fr); +} .production-shot-list { max-height: none; overflow: hidden; @@ -271,15 +276,6 @@ body { min-height: 0; overscroll-behavior: contain; } -.identity-workspace > aside { - display: flex; - flex-direction: column; - min-height: 0; - overflow: hidden; -} -.identity-workspace { - grid-template-columns: 220px minmax(0, 1fr); -} .identity-workspace > div { min-height: 0; overflow: hidden; @@ -301,6 +297,193 @@ body { height: 100%; max-height: none; } +/* 目录统一为固定标题/筛选区和独立滚动列表;不再依赖按钮的默认行高与内边距。 */ +.directory-panel { + display: flex; + flex-direction: column; + min-width: 0; + min-height: 0; + padding: 0; + overflow: hidden; + background: var(--app-subtle); +} +.directory-heading { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + flex-shrink: 0; + gap: 8px; + padding: 18px 16px 14px; + font-size: 11px; + color: var(--app-muted); +} +.directory-heading h3 { + font-size: 13px; + font-weight: 600; + color: var(--app-ink); +} +.directory-heading h3 span { + margin-left: 8px; + font-size: 11px; + font-weight: 400; + color: var(--app-muted); +} +.directory-filters { + display: grid; + gap: 10px; + padding: 0 12px 12px; + flex-shrink: 0; + border-bottom: 1px solid var(--app-border); +} +.directory-filters > * { + min-width: 0; +} +.directory-scroll { + flex: 1; +} +.directory-list-content { + display: flex; + flex-direction: column; + gap: 8px; + padding: 8px 10px 16px; +} +.directory-group-heading { + flex-shrink: 0; + padding: 14px 6px 2px; + font: + 11px/1.6 ui-monospace, + monospace; + color: var(--app-muted); +} +.directory-group-heading:first-child { + padding-top: 2px; +} +.n-button.directory-item { + display: flex; + flex-shrink: 0; + width: 100%; + height: auto; + min-height: 88px; + padding: 12px 14px; + border-radius: 5px; + white-space: normal; + text-align: left; +} +.n-button.directory-item .n-button__content { + display: block; + width: 100%; + min-width: 0; +} +.directory-item-body { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 7px; + min-width: 0; +} +.directory-item-eyebrow { + font: + 11px/1.5 ui-monospace, + monospace; + color: var(--app-muted); + overflow-wrap: anywhere; +} +.directory-item-title { + font-size: 13px; + line-height: 1.7; + font-weight: 500; + color: var(--app-ink); + overflow-wrap: anywhere; +} +.directory-item-meta { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 6px 8px; + color: var(--app-muted); + font-size: 11px; + line-height: 1.7; + overflow-wrap: anywhere; +} +.directory-status { + display: inline-flex; + align-items: center; + gap: 5px; + padding: 1px 5px; + border: 1px solid var(--app-border); + border-radius: 3px; +} +.directory-status svg { + flex-shrink: 0; +} +.n-button.directory-item.selected { + background: var(--app-surface); + box-shadow: inset 3px 0 var(--app-ink); +} +.n-button.directory-item:focus-visible { + outline: 2px solid var(--app-ink); + outline-offset: -2px; +} +/* Tabs 的默认整行宽度限制在左侧网格内,导出按钮始终处于同一行右端。 */ +.result-toolbar { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + gap: 16px; +} +.result-toolbar > .n-tabs { + min-width: 0; +} +.result-toolbar > .n-button { + justify-self: end; + white-space: nowrap; +} +.result-toolbar .n-tabs-tab__label { + display: inline-flex; + gap: 6px; +} +/* 筛选按内容区的实际宽度换行,避免侧栏展开后下拉框把其他控件挤到下一行。 */ +.form-image-filter-region { + container-type: inline-size; + margin-block: 16px; +} +.form-image-filters { + display: grid; + grid-template-columns: minmax(200px, 360px) 152px minmax(260px, 1fr) auto; + align-items: center; + gap: 12px 16px; +} +.form-image-filters > * { + min-width: 0; +} +.filter-toggles { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 10px 16px; + font-size: 12px; +} +.filter-toggles .n-checkbox__label { + white-space: nowrap; +} +.filter-result-count { + justify-self: end; + color: var(--app-muted); + font-size: 12px; + white-space: nowrap; +} +@container (max-width: 900px) { + .form-image-filters { + grid-template-columns: minmax(0, 1fr) 152px; + } +} +@container (max-width: 460px) { + .form-image-filters { + grid-template-columns: minmax(0, 1fr) 120px; + column-gap: 10px; + } +} .content-with-history { height: clamp(360px, 66dvh, 850px); min-height: 0; @@ -483,28 +666,9 @@ body { .shot-list { padding: 0; } -.production-shot-list-content { - padding-block: 8px; -} -.shot-list-content { - padding: 0 8px 20px; -} .history-content { padding: 23px 21px; } -.production-shot-list-content, -.shot-list-content, -.identity-subject-list-content { - display: flex; - flex-direction: column; -} -.n-button.production-shot-link, -.n-button.shot-link, -.n-button.identity-subject-item { - display: flex; - width: 100%; - flex-shrink: 0; -} .image-history.n-scrollbar, .table-scroll.n-scrollbar { height: auto; @@ -608,21 +772,11 @@ body { .n-button:disabled { opacity: 1; } -.n-button.shot-link, -.n-button.production-shot-link, -.n-button.identity-subject-item, .n-button.casting-item, .n-button.image-history-item { height: auto; white-space: normal; } -.n-button.shot-link .n-button__content { - width: 100%; - justify-content: flex-start; - text-align: left; -} -.n-button.production-shot-link .n-button__content, -.n-button.identity-subject-item .n-button__content, .n-button.image-history-item .n-button__content { display: block; width: 100%; @@ -633,11 +787,6 @@ body { width: 100%; justify-content: space-between; } -.n-button.shot-link .n-button__border, -.n-button.production-shot-link .n-button__border, -.n-button.identity-subject-item .n-button__border { - display: none; -} .search-field { padding: 0; border: 0; @@ -724,46 +873,39 @@ body { .workspace-heading .production-controls { grid-template-columns: minmax(100px, 1fr) 80px; } - .production-workspace { + .production-workspace, + .storyboard-workspace { grid-template-columns: minmax(0, 1fr); - grid-template-rows: 110px minmax(0, 1fr); + grid-template-rows: 184px minmax(0, 1fr); } - .production-shot-list { - display: block; - overflow: hidden; - height: 110px; + .directory-panel { + height: 100%; + border-right: 0; + border-bottom: 1px solid var(--app-border); } - .production-shot-list-content { + .directory-heading { + padding: 12px 14px 8px; + } + .directory-list-content { flex-direction: row; width: max-content; + align-items: stretch; + padding-bottom: 12px; } - .n-button.production-shot-link { - width: 180px; - min-height: 98px; + .n-button.directory-item { + width: 228px; + min-height: 104px; + } + .directory-group-heading { + display: none; } .identity-workspace { grid-template-columns: minmax(0, 1fr); - grid-template-rows: 180px minmax(0, 1fr); + grid-template-rows: 250px minmax(0, 1fr); gap: 10px; } - .identity-workspace > aside { - display: grid; - grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); - grid-template-rows: auto auto minmax(0, 1fr) auto; - gap: 6px 8px; - padding: 10px; - } - .identity-workspace > aside > * { - margin-top: 0; - min-width: 0; - } - .identity-workspace > aside > h3, - .identity-workspace > aside > .identity-subject-list, - .identity-workspace > aside > .n-button { - grid-column: 1 / -1; - } - .storyboard-workspace { - grid-template-columns: 120px minmax(0, 1fr); + .directory-filters { + grid-template-columns: minmax(0, 1fr) 120px; } .storyboard-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); diff --git a/src/components/ui/DirectoryItem.test.ts b/src/components/ui/DirectoryItem.test.ts new file mode 100644 index 0000000..4dabb28 --- /dev/null +++ b/src/components/ui/DirectoryItem.test.ts @@ -0,0 +1,63 @@ +import { mount, type VueWrapper } from '@vue/test-utils' +import { afterEach, describe, expect, it, vi } from 'vitest' +import { NButton } from 'naive-ui' +import { readFileSync } from 'node:fs' +import DirectoryItem from './DirectoryItem.vue' + +let wrapper: VueWrapper | undefined +afterEach(() => wrapper?.unmount()) + +describe('统一目录条目', () => { + it('编号、长标题和多项状态各占独立层级,沿用 Naive 按钮', () => { + const title = '雨夜霓虹街全景与记忆当铺外的人群和闪烁灯牌' + wrapper = mount(DirectoryItem, { + props: { active: false }, + slots: { + eyebrow: 'BEAT 2 / SHOT 3', + default: title, + meta: '设计已保存待状态' + } + }) + expect(wrapper.getComponent(NButton).props()).toMatchObject({ quaternary: true, block: true }) + expect(wrapper.get('button').attributes('type')).toBe('button') + expect(wrapper.get('.directory-item-eyebrow').text()).toBe('BEAT 2 / SHOT 3') + expect(wrapper.get('.directory-item-title').text()).toBe(title) + expect(wrapper.get('.directory-item-meta').findAll('.directory-status')).toHaveLength(2) + expect(wrapper.find('.truncate').exists()).toBe(false) + expect(wrapper.findAll('.directory-item-body > span')).toHaveLength(3) + }) + + it('点击透传给业务层,选中态与无障碍属性保持同步', async () => { + const onClick = vi.fn<() => void>() + wrapper = mount(DirectoryItem, { props: { active: false }, attrs: { onClick }, slots: { default: '林默' } }) + await wrapper.get('button').trigger('click') + expect(onClick).toHaveBeenCalledOnce() + expect(wrapper.attributes('aria-current')).toBeUndefined() + await wrapper.setProps({ active: true }) + expect(wrapper.get('button').classes()).toContain('selected') + expect(wrapper.attributes('aria-current')).toBe('true') + expect(wrapper.find('.directory-item-eyebrow').exists()).toBe(false) + expect(wrapper.find('.directory-item-meta').exists()).toBe(false) + }) + + it('显式保护最小高度、留白、换行和窄屏横向条目,避免旧按钮样式重新挤压目录', () => { + // DOM 环境不计算视觉几何;这些约束不能替代浏览器验收。 + const css = readFileSync('src/admin.css', 'utf8') + expect(css).toMatch(/\.n-button\.directory-item\s*\{[^}]*min-height:\s*88px;[^}]*padding:\s*12px 14px/) + expect(css).toMatch(/\.directory-item-body\s*\{[^}]*flex-direction:\s*column;[^}]*gap:\s*7px/) + expect(css).toMatch(/\.directory-item-title\s*\{[^}]*overflow-wrap:\s*anywhere/) + expect(css).toMatch(/\.directory-list-content\s*\{[^}]*flex-direction:\s*row;[^}]*width:\s*max-content/) + expect(css).toContain('grid-template-columns: clamp(240px, 22%, 280px) minmax(0, 1fr)') + }) + + it('导出工具栏与筛选器使用受约束的网格,不让 Tabs 和 Select 默认宽度强制换行', () => { + const css = readFileSync('src/admin.css', 'utf8') + expect(css).toMatch(/\.result-toolbar\s*\{[^}]*grid-template-columns:\s*minmax\(0, 1fr\) auto/) + expect(css).toMatch( + /\.form-image-filters\s*\{[^}]*grid-template-columns:\s*minmax\(200px, 360px\) 152px minmax\(260px, 1fr\) auto/ + ) + expect(css).toMatch( + /@container \(max-width: 900px\)\s*\{\s*\.form-image-filters\s*\{[^}]*minmax\(0, 1fr\) 152px/ + ) + }) +}) diff --git a/src/components/ui/DirectoryItem.vue b/src/components/ui/DirectoryItem.vue new file mode 100644 index 0000000..ee0ca02 --- /dev/null +++ b/src/components/ui/DirectoryItem.vue @@ -0,0 +1,22 @@ + + + diff --git a/src/components/ui/index.ts b/src/components/ui/index.ts index b71a11f..1bc8fa8 100644 --- a/src/components/ui/index.ts +++ b/src/components/ui/index.ts @@ -3,3 +3,4 @@ export { default as AppDialog } from './AppDialog.vue' export { default as EmptyState } from './EmptyState.vue' export { default as StatusBadge } from './StatusBadge.vue' export { default as AssetImage } from './AssetImage.vue' +export { default as DirectoryItem } from './DirectoryItem.vue' diff --git a/src/features/breakdown/BreakdownPage.vue b/src/features/breakdown/BreakdownPage.vue index 4728261..0bc5cb9 100644 --- a/src/features/breakdown/BreakdownPage.vue +++ b/src/features/breakdown/BreakdownPage.vue @@ -314,7 +314,7 @@ function exportResult() {
-
+
{{ option.label diff --git a/src/features/production/ProductionPage.vue b/src/features/production/ProductionPage.vue index 0084ea2..3efc899 100644 --- a/src/features/production/ProductionPage.vue +++ b/src/features/production/ProductionPage.vue @@ -13,7 +13,7 @@ import { } from 'naive-ui' import { computed, ref, watch } from 'vue' import { ArrowLeft, CheckCircle2, CircleAlert, Film, Image, MessageSquareText, RefreshCw } from '@lucide/vue' -import { EmptyState, StatusBadge } from '../../components/ui' +import { DirectoryItem, EmptyState, StatusBadge } from '../../components/ui' import ConfirmAction from '../workflows/ConfirmAction.vue' import { issueLabel, productionStatusLabel } from './model' import { useProduction } from './useProduction' @@ -344,55 +344,65 @@ watch( {{ shots.length }} 个正式镜头
- diff --git a/src/features/storyboard/StoryboardPage.vue b/src/features/storyboard/StoryboardPage.vue index f613f53..bab44dd 100644 --- a/src/features/storyboard/StoryboardPage.vue +++ b/src/features/storyboard/StoryboardPage.vue @@ -15,7 +15,7 @@ import { } from 'naive-ui' import { computed, ref, watch } from 'vue' import { ArrowLeft, Download, RefreshCw } from '@lucide/vue' -import { EmptyState } from '../../components/ui' +import { DirectoryItem, EmptyState } from '../../components/ui' import { downloadText } from '../../lib/format' import ConfirmAction from '../workflows/ConfirmAction.vue' import GenerationReceipt from './components/GenerationReceipt.vue' @@ -310,31 +310,35 @@ watch( 正在读取正式分镜数据……
-