diff --git a/frontend/src/components/common/AppShell.vue b/frontend/src/components/common/AppShell.vue index fe7c007..2b1ac95 100644 --- a/frontend/src/components/common/AppShell.vue +++ b/frontend/src/components/common/AppShell.vue @@ -73,7 +73,7 @@ defineExpose({ openCitation }) flex-direction: column; height: 100vh; width: 100vw; - background: var(--color-background-primary); + background: var(--color-background-secondary); color: var(--color-text-primary); } @@ -89,5 +89,6 @@ defineExpose({ openCitation }) min-width: 0; overflow: hidden; background: var(--color-background-primary); + isolation: isolate; } diff --git a/frontend/src/components/common/CommandPalette.vue b/frontend/src/components/common/CommandPalette.vue index 33e238d..9ab6aa5 100644 --- a/frontend/src/components/common/CommandPalette.vue +++ b/frontend/src/components/common/CommandPalette.vue @@ -89,13 +89,17 @@ onBeforeUnmount(() => window.removeEventListener('keydown', handleKeydown)) diff --git a/frontend/src/components/common/PrimarySidebar.vue b/frontend/src/components/common/PrimarySidebar.vue index 5ac01c4..052f0b4 100644 --- a/frontend/src/components/common/PrimarySidebar.vue +++ b/frontend/src/components/common/PrimarySidebar.vue @@ -60,13 +60,14 @@ function toggleExpanded() { diff --git a/frontend/src/components/common/SecondarySidebar.vue b/frontend/src/components/common/SecondarySidebar.vue index 4cd09c3..00509c2 100644 --- a/frontend/src/components/common/SecondarySidebar.vue +++ b/frontend/src/components/common/SecondarySidebar.vue @@ -53,7 +53,7 @@ const showSkillToggle = computed(() => routeName.value === 'skills' || routeName diff --git a/frontend/src/components/common/StatusBar.vue b/frontend/src/components/common/StatusBar.vue index cb897c2..992191e 100644 --- a/frontend/src/components/common/StatusBar.vue +++ b/frontend/src/components/common/StatusBar.vue @@ -107,8 +107,8 @@ const showEditorInfo = computed(() => route.name === 'workspace') display: flex; align-items: center; justify-content: space-between; - padding: 0 var(--space-md); - background: var(--color-background-secondary); + padding: 0 var(--space-lg); + background: var(--color-surface-secondary); border-top: 1px solid var(--color-border-subtle); font-size: var(--font-size-xs); color: var(--color-text-secondary); @@ -129,6 +129,7 @@ const showEditorInfo = computed(() => route.name === 'workspace') gap: 6px; white-space: nowrap; cursor: default; + transition: color var(--motion-fast); &:hover { color: var(--color-text-primary); @@ -140,6 +141,7 @@ const showEditorInfo = computed(() => route.name === 'workspace') height: 6px; border-radius: 50%; flex-shrink: 0; + box-shadow: 0 0 0 2px var(--color-surface-secondary); } .agent-status { @@ -162,4 +164,9 @@ const showEditorInfo = computed(() => route.name === 'workspace') .provider-info { color: var(--color-text-tertiary); } + +@media (max-width: 760px) { + .statusbar-left, .statusbar-right { gap: var(--space-sm); } + .provider-info { display: none; } +} diff --git a/frontend/src/components/common/TitleBar.vue b/frontend/src/components/common/TitleBar.vue index bfd5043..e004ecf 100644 --- a/frontend/src/components/common/TitleBar.vue +++ b/frontend/src/components/common/TitleBar.vue @@ -71,8 +71,8 @@ const isDirty = computed(() => editorStore.saveStatus === 'dirty' || editorStore display: flex; align-items: center; justify-content: space-between; - padding: 0 var(--space-md); - background: var(--color-background-secondary); + padding: 0 var(--space-lg); + background: var(--color-surface-secondary); border-bottom: 1px solid var(--color-border-subtle); font-size: var(--font-size-sm); flex-shrink: 0; @@ -129,7 +129,13 @@ const isDirty = computed(() => editorStore.saveStatus === 'dirty' || editorStore } .app-name { - font-weight: 500; + padding: 3px 10px; + border: 1px solid var(--color-border-subtle); + border-radius: var(--radius-full); + background: var(--color-surface-primary); + color: var(--color-text-secondary); + font-weight: 650; + letter-spacing: .04em; } .titlebar-right { @@ -141,8 +147,8 @@ const isDirty = computed(() => editorStore.saveStatus === 'dirty' || editorStore } .icon-btn { - width: 28px; - height: 28px; + width: 30px; + height: 30px; display: flex; align-items: center; justify-content: center; @@ -150,11 +156,12 @@ const isDirty = computed(() => editorStore.saveStatus === 'dirty' || editorStore color: var(--color-text-secondary); font-size: 14px; -webkit-app-region: no-drag; - transition: background var(--motion-fast); + transition: background-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast); &:hover { background: var(--color-background-hover); color: var(--color-text-primary); + transform: rotate(8deg); } } @@ -179,7 +186,7 @@ const isDirty = computed(() => editorStore.saveStatus === 'dirty' || editorStore color: var(--color-text-secondary); border-radius: var(--radius-sm); cursor: pointer; - transition: background var(--motion-fast); + transition: background-color var(--motion-fast), color var(--motion-fast); &:hover { background: var(--color-background-hover); @@ -190,4 +197,10 @@ const isDirty = computed(() => editorStore.saveStatus === 'dirty' || editorStore color: white; } } + +@media (max-width: 760px) { + .titlebar-left, .titlebar-right { min-width: 0; } + .titlebar-center, .window-controls { display: none; } + .file-name { max-width: 42vw; } +} diff --git a/frontend/src/features/agent/AgentView.vue b/frontend/src/features/agent/AgentView.vue index 06b5aa3..a7f41fd 100644 --- a/frontend/src/features/agent/AgentView.vue +++ b/frontend/src/features/agent/AgentView.vue @@ -108,16 +108,22 @@ function eventText(event: AgentEvent) { diff --git a/frontend/src/features/search/SearchView.vue b/frontend/src/features/search/SearchView.vue index d078c0e..f1bb835 100644 --- a/frontend/src/features/search/SearchView.vue +++ b/frontend/src/features/search/SearchView.vue @@ -66,13 +66,16 @@ async function openResult(result: SearchResult) { diff --git a/frontend/src/features/workspace/WorkspaceView.vue b/frontend/src/features/workspace/WorkspaceView.vue index 82e2853..05ada11 100644 --- a/frontend/src/features/workspace/WorkspaceView.vue +++ b/frontend/src/features/workspace/WorkspaceView.vue @@ -59,6 +59,11 @@ onMounted(() => { .empty-content { text-align: center; + padding: var(--space-3xl); + border: 1px dashed var(--color-border-default); + border-radius: var(--radius-xl); + background: var(--color-background-secondary); + animation: workspace-empty-in var(--motion-normal) both; h2 { font-size: 18px; @@ -75,4 +80,6 @@ onMounted(() => { font-size: 48px; opacity: 0.5; } + +@keyframes workspace-empty-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } } diff --git a/frontend/src/styles/features.css b/frontend/src/styles/features.css index 10ea4b9..782c0c2 100644 --- a/frontend/src/styles/features.css +++ b/frontend/src/styles/features.css @@ -1,9 +1,18 @@ .feature-page { height: 100%; overflow: auto; - padding: var(--space-2xl); - background: var(--color-background-primary); + padding: clamp(var(--space-lg), 3vw, var(--space-3xl)); + background: + radial-gradient(circle at 92% -8%, var(--color-accent-soft) 0, transparent 28%), + var(--color-background-primary); user-select: text; + scrollbar-gutter: stable; + animation: page-in var(--motion-normal) both; +} + +.chat-page, +.workspace-view { + animation: page-in var(--motion-normal) both; } .feature-header { @@ -11,13 +20,15 @@ align-items: flex-start; justify-content: space-between; gap: var(--space-lg); - margin-bottom: var(--space-xl); + margin: 0 auto var(--space-2xl); + max-width: 1180px; } -.feature-header h1 { font-size: var(--font-size-3xl); line-height: 1.2; } -.feature-header p { margin-top: var(--space-xs); color: var(--color-text-secondary); } +.feature-header h1 { font-size: clamp(var(--font-size-2xl), 2.3vw, 30px); line-height: 1.15; letter-spacing: -.025em; } +.feature-header p { max-width: 680px; margin-top: var(--space-sm); color: var(--color-text-secondary); } .feature-actions, .inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-sm); } -.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-lg); } +.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-lg); max-width: 1180px; margin-inline: auto; } +.feature-page > .panel { max-width: 1180px; margin-inline: auto; } .split-view { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.7fr); gap: var(--space-lg); min-height: 0; } .panel, .item-card { @@ -27,10 +38,13 @@ box-shadow: var(--shadow-sm); } -.panel { padding: var(--space-xl); } -.item-card { padding: var(--space-lg); transition: border-color var(--motion-fast), transform var(--motion-fast); } -.item-card:hover { border-color: var(--color-accent-secondary); } -.item-card.selected { border-color: var(--color-accent-primary); box-shadow: 0 0 0 2px var(--color-accent-soft); } +.panel { padding: clamp(var(--space-lg), 2.2vw, var(--space-2xl)); } +.item-card { + padding: var(--space-lg); + transition: border-color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast), background-color var(--motion-fast); +} +.item-card:hover { border-color: var(--color-accent-secondary); box-shadow: var(--shadow-md); transform: translateY(-2px); } +.item-card.selected { border-color: var(--color-accent-primary); box-shadow: 0 0 0 3px var(--color-accent-soft), var(--shadow-md); } .panel-title { margin-bottom: var(--space-md); font-size: var(--font-size-xl); } .muted { color: var(--color-text-secondary); } .subtle { color: var(--color-text-tertiary); font-size: var(--font-size-sm); } @@ -41,14 +55,18 @@ border: 1px solid transparent; border-radius: var(--radius-md); font-weight: 600; + line-height: 1; + transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast); } -.button-primary { background: var(--color-accent-primary); color: var(--color-text-inverse); } -.button-primary:hover { background: var(--color-accent-primary-hover); } +.button-primary { background: var(--color-accent-primary); color: var(--color-text-inverse); box-shadow: 0 4px 12px color-mix(in srgb, var(--color-accent-primary) 24%, transparent); } +.button-primary:hover { background: var(--color-accent-primary-hover); transform: translateY(-1px); box-shadow: 0 7px 18px color-mix(in srgb, var(--color-accent-primary) 28%, transparent); } .button-secondary { border-color: var(--color-border-default); background: var(--color-surface-primary); } -.button-secondary:hover, .icon-button:hover { background: var(--color-background-hover); } +.button-secondary:hover, .icon-button:hover { border-color: var(--color-accent-secondary); background: var(--color-background-hover); color: var(--color-accent-primary); transform: translateY(-1px); } .button-danger { background: var(--color-error-soft); color: var(--color-error); } -button:disabled { cursor: not-allowed; opacity: .55; } +.button-danger:hover { transform: translateY(-1px); box-shadow: 0 5px 14px color-mix(in srgb, var(--color-error) 18%, transparent); } +button:active:not(:disabled) { transform: translateY(0); } +button:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; transform: none; } .field { display: grid; gap: var(--space-xs); } .field label { color: var(--color-text-secondary); font-size: var(--font-size-sm); font-weight: 600; } @@ -59,10 +77,12 @@ button:disabled { cursor: not-allowed; opacity: .55; } outline: none; background: var(--color-background-primary); color: var(--color-text-primary); + transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background-color var(--motion-fast); } -.input, .select { height: 36px; padding: 0 var(--space-md); } +.input, .select { height: 38px; padding: 0 var(--space-md); } .textarea { min-height: 100px; padding: var(--space-md); resize: vertical; } -.input:focus, .select:focus, .textarea:focus { border-color: var(--color-border-focus); box-shadow: 0 0 0 2px var(--color-accent-soft); } +.input:hover, .select:hover, .textarea:hover { border-color: var(--color-text-tertiary); } +.input:focus, .select:focus, .textarea:focus { border-color: var(--color-border-focus); box-shadow: 0 0 0 3px var(--color-accent-soft); background: var(--color-surface-primary); } .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-md); } .badge { @@ -75,6 +95,7 @@ button:disabled { cursor: not-allowed; opacity: .55; } color: var(--color-text-secondary); font-size: var(--font-size-xs); font-weight: 600; + letter-spacing: .01em; } .badge.success { background: var(--color-success-soft); color: var(--color-success); } .badge.warning { background: var(--color-warning-soft); color: var(--color-warning); } @@ -82,25 +103,45 @@ button:disabled { cursor: not-allowed; opacity: .55; } .badge.info { background: var(--color-info-soft); color: var(--color-info); } .tag-list { display: flex; flex-wrap: wrap; gap: var(--space-xs); } -.empty-state { display: grid; place-items: center; min-height: 220px; padding: var(--space-2xl); text-align: center; color: var(--color-text-secondary); } +.empty-state { display: grid; place-items: center; min-height: 220px; padding: var(--space-3xl); border: 1px dashed var(--color-border-default); border-radius: var(--radius-xl); background: color-mix(in srgb, var(--color-background-secondary) 74%, transparent); text-align: center; color: var(--color-text-secondary); } .empty-state strong { display: block; margin-bottom: var(--space-xs); color: var(--color-text-primary); font-size: var(--font-size-xl); } -.error-banner { margin-bottom: var(--space-lg); padding: var(--space-md); border-radius: var(--radius-md); background: var(--color-error-soft); color: var(--color-error); } -.notice-banner { margin-bottom: var(--space-lg); padding: var(--space-md); border-radius: var(--radius-md); background: var(--color-info-soft); color: var(--color-info); } +.error-banner, .notice-banner { border: 1px solid transparent; animation: notice-in var(--motion-normal) both; } +.error-banner { margin-bottom: var(--space-lg); padding: var(--space-md) var(--space-lg); border-color: color-mix(in srgb, var(--color-error) 22%, transparent); border-radius: var(--radius-md); background: var(--color-error-soft); color: var(--color-error); } +.notice-banner { margin-bottom: var(--space-lg); padding: var(--space-md) var(--space-lg); border-color: color-mix(in srgb, var(--color-info) 22%, transparent); border-radius: var(--radius-md); background: var(--color-info-soft); color: var(--color-info); } .sidebar-panel { padding: var(--space-md); } .sidebar-panel .input, .sidebar-panel .select { margin-bottom: var(--space-sm); } .sidebar-list { display: grid; gap: var(--space-xs); } -.sidebar-list-item { padding: var(--space-sm); border-radius: var(--radius-md); cursor: pointer; } -.sidebar-list-item:hover, .sidebar-list-item.active { background: var(--color-background-hover); } +.sidebar-list-item { padding: 9px var(--space-sm); border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; transition: color var(--motion-fast), background-color var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast); } +.sidebar-list-item:hover { background: var(--color-background-hover); transform: translateX(2px); } +.sidebar-list-item.active { border-color: color-mix(in srgb, var(--color-accent-primary) 18%, transparent); background: var(--color-accent-soft); color: var(--color-accent-primary); } -.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-xl); background: var(--color-background-overlay); } -.modal { width: min(560px, 100%); max-height: 85vh; overflow: auto; padding: var(--space-xl); border-radius: var(--radius-lg); background: var(--color-surface-elevated); box-shadow: var(--shadow-xl); } +.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-xl); background: var(--color-background-overlay); animation: backdrop-in var(--motion-fast) both; } +.modal { width: min(560px, 100%); max-height: 85vh; overflow: auto; padding: var(--space-2xl); border: 1px solid var(--color-border-default); border-radius: var(--radius-xl); background: var(--color-surface-elevated); box-shadow: var(--shadow-xl); animation: modal-in var(--motion-normal) both; } .modal h2 { margin-bottom: var(--space-lg); } .modal form { display: grid; gap: var(--space-md); } -.settings-nav { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: var(--space-xl); border-bottom: 1px solid var(--color-border-default); } -.settings-nav button { padding: var(--space-sm) var(--space-md); border-bottom: 2px solid transparent; color: var(--color-text-secondary); } -.settings-nav button.active { border-color: var(--color-accent-primary); color: var(--color-accent-primary); } +.settings-nav { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: var(--space-xl); padding: var(--space-xs); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); background: var(--color-background-secondary); } +.settings-nav button { padding: 8px var(--space-md); border-radius: var(--radius-md); color: var(--color-text-secondary); transition: color var(--motion-fast), background-color var(--motion-fast), box-shadow var(--motion-fast); } +.settings-nav button:hover { color: var(--color-text-primary); background: var(--color-background-hover); } +.settings-nav button.active { background: var(--color-surface-primary); color: var(--color-accent-primary); box-shadow: var(--shadow-sm); } + +@keyframes page-in { + from { opacity: 0; transform: translateY(6px); } + to { opacity: 1; transform: translateY(0); } +} + +@keyframes notice-in { + from { opacity: 0; transform: translateY(-4px); } + to { opacity: 1; transform: translateY(0); } +} + +@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } } + +@keyframes modal-in { + from { opacity: 0; transform: translateY(8px) scale(.985); } + to { opacity: 1; transform: translateY(0) scale(1); } +} @media (max-width: 900px) { .feature-page { padding: var(--space-lg); } diff --git a/frontend/src/styles/motion.spec.ts b/frontend/src/styles/motion.spec.ts new file mode 100644 index 0000000..083a9d4 --- /dev/null +++ b/frontend/src/styles/motion.spec.ts @@ -0,0 +1,27 @@ +/// + +import { readFileSync } from 'node:fs' +import { describe, expect, it } from 'vitest' + +const globalStyles = [ + new URL('./tokens.css', import.meta.url), + new URL('./features.css', import.meta.url), +].map((path) => readFileSync(path, 'utf8')).join('\n') + +describe('轻量动效基线', () => { + it('为减少动态效果偏好提供全局回退', () => { + expect(globalStyles).toContain('@media (prefers-reduced-motion: reduce)') + }) + + it('不使用全属性过渡或高成本模糊滤镜', () => { + expect(globalStyles).not.toMatch(/transition:\s*all\b/) + expect(globalStyles).not.toMatch(/(?:backdrop-)?filter\s*:/) + }) + + it('页面入场只改变透明度和变换', () => { + const pageAnimation = globalStyles.match(/@keyframes page-in\s*{[\s\S]*?\n}/)?.[0] ?? '' + expect(pageAnimation).toContain('opacity') + expect(pageAnimation).toContain('transform') + expect(pageAnimation).not.toMatch(/(?:width|height|margin|padding|top|left)\s*:/) + }) +}) diff --git a/frontend/src/styles/tokens.css b/frontend/src/styles/tokens.css index 8e3156b..5703776 100644 --- a/frontend/src/styles/tokens.css +++ b/frontend/src/styles/tokens.css @@ -45,16 +45,16 @@ --color-border-disabled: #eef0f3; /* Shadow */ - --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04); - --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08); - --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12); - --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16); + --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.05), 0 1px 5px rgba(31, 35, 40, 0.03); + --shadow-md: 0 8px 22px rgba(31, 35, 40, 0.08), 0 2px 6px rgba(31, 35, 40, 0.04); + --shadow-lg: 0 16px 36px rgba(31, 35, 40, 0.11), 0 4px 12px rgba(31, 35, 40, 0.05); + --shadow-xl: 0 24px 64px rgba(31, 35, 40, 0.18), 0 8px 20px rgba(31, 35, 40, 0.08); /* Radius */ - --radius-sm: 4px; - --radius-md: 6px; - --radius-lg: 10px; - --radius-xl: 14px; + --radius-sm: 6px; + --radius-md: 9px; + --radius-lg: 13px; + --radius-xl: 18px; --radius-full: 9999px; /* Spacing */ @@ -100,16 +100,16 @@ --z-titlebar: 500; /* Motion */ - --motion-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1); - --motion-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1); - --motion-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1); + --motion-fast: 120ms cubic-bezier(0.2, 0, 0, 1); + --motion-normal: 190ms cubic-bezier(0.2, 0, 0, 1); + --motion-slow: 260ms cubic-bezier(0.2, 0, 0, 1); /* Layout */ - --titlebar-height: 38px; - --sidebar-primary-width: 52px; + --titlebar-height: 42px; + --sidebar-primary-width: 58px; --sidebar-primary-width-expanded: 180px; - --sidebar-secondary-width: 260px; - --statusbar-height: 26px; + --sidebar-secondary-width: 272px; + --statusbar-height: 28px; } [data-theme='dark'] { @@ -221,6 +221,25 @@ button { color: inherit; } +button, +a, +input, +textarea, +select { + -webkit-tap-highlight-color: transparent; +} + +input[type='checkbox'], +input[type='radio'], +input[type='range'] { + accent-color: var(--color-accent-primary); +} + +:focus-visible { + outline: 2px solid var(--color-border-focus); + outline-offset: 2px; +} + input, textarea, select { @@ -261,7 +280,25 @@ ol { color: var(--color-accent-primary); } +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + scroll-behavior: auto !important; + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} + [data-theme='dark'] ::selection { background: var(--color-accent-primary); color: var(--color-text-inverse); } + +@media (max-width: 900px) { + :root { + --sidebar-primary-width-expanded: 160px; + --sidebar-secondary-width: 224px; + } +}