fix(glass): keep dashboard hover on the same material contour

This commit is contained in:
InfinityPacer
2026-09-07 11:19:07 +08:00
parent 05ace80900
commit 35f54fcc35
3 changed files with 15 additions and 12 deletions
@@ -4,6 +4,18 @@ import { cwd } from 'node:process'
import { describe, expect, it } from 'vitest' import { describe, expect, it } from 'vitest'
describe('glass overlay material styles', () => { describe('glass overlay material styles', () => {
it('keeps dashboard hover on one contour instead of restoring legacy inset lines', () => {
const legacy = readFileSync(resolve(cwd(), 'src/styles/themes/glass.scss'), 'utf8')
const surfaces = readFileSync(resolve(cwd(), 'src/styles/themes/_glass-v3.scss'), 'utf8')
expect(legacy).not.toContain(
'.dashboard-grid-item-content > .dashboard-grid-auto-size > .dashboard-grid-content-measure > .v-card:hover',
)
expect(surfaces).toMatch(
/--glass-v3-rim: clamp\(0\.2,[\s\S]*?box-shadow: var\(--glass-v3-surface-edge\), var\(--glass-v3-shadow\) !important/u,
)
})
it('shares the soft contour between content cards and detached navigation', () => { it('shares the soft contour between content cards and detached navigation', () => {
const styles = readFileSync(resolve(cwd(), 'src/styles/themes/_glass-v3.scss'), 'utf8') const styles = readFileSync(resolve(cwd(), 'src/styles/themes/_glass-v3.scss'), 'utf8')
+3
View File
@@ -238,6 +238,9 @@
.dashboard-grid-content-measure > :first-child > .v-card:hover { .dashboard-grid-content-measure > :first-child > .v-card:hover {
--glass-v3-rim: clamp(0.2, calc(0.22 + var(--glass-reflection, 0.38) * 0.36), 0.54); --glass-v3-rim: clamp(0.2, calc(0.22 + var(--glass-reflection, 0.38) * 0.36), 0.54);
--glass-v3-shadow: 0 16px 34px rgba(0, 0, 0, 0.18); --glass-v3-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
// 悬停沿用静态轮廓,只增强其受光和投影,不切换到独立的硬质描边。
box-shadow: var(--glass-v3-surface-edge), var(--glass-v3-shadow) !important;
} }
} }
} }
-12
View File
@@ -448,18 +448,6 @@ html[data-theme='glass'] {
box-shadow: var(--glass-dashboard-shadow) !important; box-shadow: var(--glass-dashboard-shadow) !important;
} }
@media (hover: hover) {
// Dashboard 悬停沿左上来光增强顶部高光,并在右下背光面保留轻吸收。
.dashboard-grid-item-content > .dashboard-grid-auto-size > .dashboard-grid-content-measure > .v-card:hover,
.dashboard-grid-item-content
> .dashboard-grid-auto-size
> .dashboard-grid-content-measure
> :first-child
> .v-card:hover {
box-shadow: var(--glass-dashboard-shadow-hover) !important;
}
}
.layout-navbar { .layout-navbar {
border-color: var(--glass-border-raised) !important; border-color: var(--glass-border-raised) !important;
-webkit-backdrop-filter: var(--glass-raised-backdrop-filter); -webkit-backdrop-filter: var(--glass-raised-backdrop-filter);