Merge feature/sidebar-liquid-glass: liquid glass сайдбар + динамическое свечение
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
99215dd53f
6 changed files with 184 additions and 90 deletions
|
|
@ -1,3 +1,11 @@
|
|||
/* Регистрируем glow-компоненты как анимируемые свойства */
|
||||
@property --glow-r { syntax: '<number>'; initial-value: 0; inherits: true; }
|
||||
@property --glow-g { syntax: '<number>'; initial-value: 0; inherits: true; }
|
||||
@property --glow-b { syntax: '<number>'; initial-value: 0; inherits: true; }
|
||||
@property --glow-a { syntax: '<number>'; initial-value: 0; inherits: true; }
|
||||
@property --glow-x { syntax: '<number>'; initial-value: 75; inherits: true; }
|
||||
@property --glow-y { syntax: '<number>'; initial-value: 50; inherits: true; }
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
|
|
@ -18,12 +26,20 @@ body {
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
user-select: none;
|
||||
|
||||
/* Rich gradient base — accent-glow is set dynamically via JS */
|
||||
/* Rich gradient base — accent-glow и content-glow выставляются через JS */
|
||||
background:
|
||||
radial-gradient(ellipse 60% 50% at 15% 15%, var(--accent-glow, rgba(168,230,0,0.08)) 0%, transparent 70%),
|
||||
radial-gradient(ellipse 95% 85% at calc(var(--glow-x) * 1%) calc(var(--glow-y) * 1%), rgba(var(--glow-r), var(--glow-g), var(--glow-b), var(--glow-a)) 0%, transparent 100%),
|
||||
radial-gradient(ellipse 45% 55% at 88% 90%, rgba(0, 110, 220, 0.05) 0%, transparent 70%),
|
||||
radial-gradient(ellipse 60% 40% at 50% 50%, rgba(80, 0, 160, 0.04) 0%, transparent 100%),
|
||||
#09090e;
|
||||
|
||||
/* Плавный переход между цветами свечения */
|
||||
transition:
|
||||
--glow-r 400ms ease,
|
||||
--glow-g 400ms ease,
|
||||
--glow-b 400ms ease,
|
||||
--glow-a 400ms ease;
|
||||
}
|
||||
|
||||
#app {
|
||||
|
|
|
|||
|
|
@ -130,13 +130,13 @@ function stopResize(): void {
|
|||
position: relative;
|
||||
z-index: 3;
|
||||
background: rgba(255, 255, 255, 0.035);
|
||||
backdrop-filter: blur(28px) saturate(1.6);
|
||||
-webkit-backdrop-filter: blur(28px) saturate(1.6);
|
||||
backdrop-filter: blur(16px) saturate(180%);
|
||||
-webkit-backdrop-filter: blur(16px) saturate(180%);
|
||||
overflow-y: auto;
|
||||
min-width: 180px;
|
||||
max-width: 400px;
|
||||
border-right: 1px solid var(--glass-border);
|
||||
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.06);
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
||||
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
.message-pane {
|
||||
|
|
|
|||
|
|
@ -331,12 +331,8 @@ onUnmounted(() => {
|
|||
|
||||
/* Карточка «всплывает» когда письмо выбрано — через :has() */
|
||||
.swipe-wrapper:has(.message-item.selected) {
|
||||
border-color: color-mix(in srgb, var(--accent) 35%, transparent);
|
||||
box-shadow:
|
||||
inset 0 1px 0 color-mix(in srgb, var(--accent) 20%, transparent),
|
||||
0 6px 24px rgba(0, 0, 0, 0.5),
|
||||
0 2px 6px rgba(0, 0, 0, 0.3),
|
||||
0 0 0 0.5px color-mix(in srgb, var(--accent) 22%, transparent);
|
||||
border-color: rgba(255, 255, 255, 0.18);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
|
|
@ -389,40 +385,33 @@ onUnmounted(() => {
|
|||
#0c0c14;
|
||||
}
|
||||
|
||||
/* Выбранное письмо: акцентный тинт + полоска слева через ::before */
|
||||
/* Выбранное письмо: liquid glass */
|
||||
.message-item.selected {
|
||||
background:
|
||||
linear-gradient(180deg,
|
||||
color-mix(in srgb, var(--accent) 13%, transparent) 0%,
|
||||
color-mix(in srgb, var(--accent) 6%, transparent) 100%
|
||||
),
|
||||
#0d0d18;
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
rgba(255, 255, 255, 0.10) 0%,
|
||||
rgba(255, 255, 255, 0.06) 100%
|
||||
);
|
||||
backdrop-filter: blur(14px) saturate(200%) brightness(1.08);
|
||||
-webkit-backdrop-filter: blur(14px) saturate(200%) brightness(1.08);
|
||||
padding-left: 4px;
|
||||
box-shadow:
|
||||
inset 0 1px 0 color-mix(in srgb, var(--accent) 22%, transparent),
|
||||
inset 0 -1px 0 color-mix(in srgb, var(--accent) 8%, transparent);
|
||||
}
|
||||
|
||||
/* Акцентная полоска — через ::before, работает с border-radius wrapper'а */
|
||||
.message-item.selected::before {
|
||||
/* Specular highlight */
|
||||
.message-item.selected::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 18%;
|
||||
height: 64%;
|
||||
width: 2.5px;
|
||||
border-radius: 0 3px 3px 0;
|
||||
background: var(--accent);
|
||||
box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 65%, transparent);
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.50);
|
||||
}
|
||||
|
||||
.message-item.selected:hover {
|
||||
background:
|
||||
linear-gradient(180deg,
|
||||
color-mix(in srgb, var(--accent) 17%, transparent) 0%,
|
||||
color-mix(in srgb, var(--accent) 8%, transparent) 100%
|
||||
),
|
||||
#0d0d18;
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
rgba(255, 255, 255, 0.13) 0%,
|
||||
rgba(255, 255, 255, 0.08) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.message-item.checked {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref, onMounted, watch } from 'vue'
|
||||
import { computed, ref, watch, onUnmounted } from 'vue'
|
||||
import type { MessageBody } from '@shared/types/message'
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
@ -109,6 +109,76 @@ const plainTextHtml = computed(() => {
|
|||
})
|
||||
|
||||
const srcdoc = computed(() => processedHtml.value ?? plainTextHtml.value ?? '')
|
||||
|
||||
// ── Ambient glow: извлекаем доминирующий цвет фона письма ──
|
||||
|
||||
function parseRgb(color: string): { r: number; g: number; b: number; a: number } | null {
|
||||
const m = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/)
|
||||
if (!m) return null
|
||||
return { r: +m[1], g: +m[2], b: +m[3], a: m[4] !== undefined ? +m[4] : 1 }
|
||||
}
|
||||
|
||||
function setContentGlow(r: number, g: number, b: number, a: number): void {
|
||||
const root = document.documentElement
|
||||
root.style.setProperty('--glow-r', String(r))
|
||||
root.style.setProperty('--glow-g', String(g))
|
||||
root.style.setProperty('--glow-b', String(b))
|
||||
root.style.setProperty('--glow-a', String(a))
|
||||
}
|
||||
|
||||
function clearContentGlow(): void {
|
||||
setContentGlow(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
function updateGlowPosition(): void {
|
||||
const el = iframeRef.value
|
||||
if (!el) return
|
||||
const rect = el.getBoundingClientRect()
|
||||
const x = ((rect.left + rect.width / 2) / window.innerWidth) * 100
|
||||
const y = ((rect.top + rect.height / 2) / window.innerHeight) * 100
|
||||
document.documentElement.style.setProperty('--glow-x', x.toFixed(1))
|
||||
document.documentElement.style.setProperty('--glow-y', y.toFixed(1))
|
||||
}
|
||||
|
||||
const resizeObserver = new ResizeObserver(updateGlowPosition)
|
||||
|
||||
function onIframeLoad(): void {
|
||||
updateGlowPosition()
|
||||
if (iframeRef.value) resizeObserver.observe(iframeRef.value)
|
||||
try {
|
||||
const doc = iframeRef.value?.contentDocument
|
||||
const view = iframeRef.value?.contentWindow
|
||||
if (!doc?.body || !view) return
|
||||
|
||||
// Пробуем body напрямую
|
||||
const bodyColor = parseRgb(view.getComputedStyle(doc.body).backgroundColor)
|
||||
if (bodyColor && bodyColor.a > 0.1 && bodyColor.r + bodyColor.g + bodyColor.b > 60) {
|
||||
setContentGlow(bodyColor.r, bodyColor.g, bodyColor.b, 0.26)
|
||||
return
|
||||
}
|
||||
|
||||
// Многие HTML-письма кладут фон в первый <table> или <td>
|
||||
const firstEl = doc.body.querySelector<HTMLElement>('table, td, [bgcolor]')
|
||||
if (firstEl) {
|
||||
const raw = firstEl.getAttribute('bgcolor') ?? view.getComputedStyle(firstEl).backgroundColor
|
||||
const c = parseRgb(raw)
|
||||
if (c && c.a > 0.1 && c.r + c.g + c.b > 60) {
|
||||
setContentGlow(c.r, c.g, c.b, 0.26)
|
||||
return
|
||||
}
|
||||
}
|
||||
} catch { /* cross-origin или sandbox */ }
|
||||
|
||||
clearContentGlow()
|
||||
}
|
||||
|
||||
// Сбрасываем свечение при смене письма
|
||||
watch(() => props.body, () => clearContentGlow())
|
||||
|
||||
onUnmounted(() => {
|
||||
clearContentGlow()
|
||||
resizeObserver.disconnect()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -119,6 +189,7 @@ const srcdoc = computed(() => processedHtml.value ?? plainTextHtml.value ?? '')
|
|||
:srcdoc="srcdoc"
|
||||
sandbox="allow-same-origin"
|
||||
class="body-frame"
|
||||
@load="onIframeLoad"
|
||||
/>
|
||||
<div v-else class="no-body">
|
||||
<span>Содержимое письма недоступно</span>
|
||||
|
|
|
|||
|
|
@ -38,11 +38,12 @@ const accountsStore = useAccountsStore()
|
|||
}
|
||||
|
||||
.folder-header {
|
||||
padding: 10px 12px 6px;
|
||||
padding: 10px 14px 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
letter-spacing: 0.2px;
|
||||
letter-spacing: 0.4px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.loading,
|
||||
|
|
|
|||
|
|
@ -85,44 +85,81 @@ function toggleExpand(event: Event): void {
|
|||
.folder-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: calc(100% - 8px);
|
||||
padding: 5px 8px 5px 6px;
|
||||
width: calc(100% - 12px);
|
||||
padding: 6px 8px;
|
||||
gap: 6px;
|
||||
border-radius: var(--radius-sm);
|
||||
margin: 1px 4px;
|
||||
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
||||
text-align: left;
|
||||
border-radius: 8px;
|
||||
margin: 1px 6px;
|
||||
border: 1px solid transparent;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
transition:
|
||||
background var(--transition-fast),
|
||||
border-color var(--transition-fast);
|
||||
}
|
||||
|
||||
.folder-item:hover {
|
||||
background: var(--glass-bg-hover);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.07);
|
||||
}
|
||||
|
||||
/* ── Активное состояние: liquid glass ────────────────────── */
|
||||
.folder-item.active {
|
||||
background: color-mix(in srgb, var(--accent) 10%, transparent);
|
||||
box-shadow:
|
||||
inset 0 1px 0 color-mix(in srgb, var(--accent) 15%, transparent),
|
||||
inset 0 -1px 0 color-mix(in srgb, var(--accent) 5%, transparent);
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
rgba(255, 255, 255, 0.10) 0%,
|
||||
rgba(255, 255, 255, 0.06) 100%
|
||||
);
|
||||
backdrop-filter: blur(14px) saturate(200%) brightness(1.08);
|
||||
-webkit-backdrop-filter: blur(14px) saturate(200%) brightness(1.08);
|
||||
border-color: rgba(255, 255, 255, 0.18);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.folder-item.active::before {
|
||||
/* Specular highlight */
|
||||
.folder-item.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -4px;
|
||||
top: 15%;
|
||||
height: 70%;
|
||||
width: 3px;
|
||||
background: var(--accent);
|
||||
border-radius: 0 3px 3px 0;
|
||||
box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
|
||||
inset: 0;
|
||||
border-radius: inherit;
|
||||
box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.50);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ── Иконка папки ────────────────────────────────────────── */
|
||||
.folder-icon {
|
||||
flex-shrink: 0;
|
||||
color: var(--text-muted);
|
||||
transition: color var(--transition-fast);
|
||||
}
|
||||
|
||||
.folder-item:hover .folder-icon {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.folder-item.active .folder-icon {
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
}
|
||||
|
||||
/* ── Название папки ──────────────────────────────────────── */
|
||||
.folder-name {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
min-width: 0;
|
||||
color: var(--text-secondary);
|
||||
transition: color var(--transition-fast);
|
||||
}
|
||||
|
||||
.folder-item:hover .folder-name {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.folder-item.active .folder-name {
|
||||
color: var(--accent);
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ── Кнопка разворачивания ───────────────────────────────── */
|
||||
.expand-btn {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
|
@ -143,24 +180,7 @@ function toggleExpand(event: Event): void {
|
|||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.folder-icon {
|
||||
flex-shrink: 0;
|
||||
width: 18px;
|
||||
color: var(--text-muted);
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.folder-name {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
min-width: 0;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.folder-item:hover .folder-name {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* ── Бейдж непрочитанных ─────────────────────────────────── */
|
||||
.unread-badge {
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
|
|
@ -169,28 +189,25 @@ function toggleExpand(event: Event): void {
|
|||
min-height: 18px;
|
||||
line-height: 18px;
|
||||
border-radius: var(--radius-full);
|
||||
background: rgba(210, 45, 45, 0.55);
|
||||
border: 1px solid rgba(255, 100, 100, 0.3);
|
||||
background: rgba(200, 40, 40, 0.55);
|
||||
border: 1px solid rgba(255, 100, 100, 0.25);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 160, 160, 0.18),
|
||||
0 1px 5px rgba(180, 30, 30, 0.3);
|
||||
backdrop-filter: blur(6px);
|
||||
-webkit-backdrop-filter: blur(6px);
|
||||
inset 0 1px 0 rgba(255, 160, 160, 0.2),
|
||||
0 2px 6px rgba(180, 30, 30, 0.3);
|
||||
backdrop-filter: blur(8px);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
flex-shrink: 0;
|
||||
min-width: 18px;
|
||||
text-align: center;
|
||||
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
.folder-item:hover .unread-badge {
|
||||
background: rgba(210, 45, 45, 0.7);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 160, 160, 0.22),
|
||||
0 2px 8px rgba(180, 30, 30, 0.4);
|
||||
background: rgba(210, 45, 45, 0.70);
|
||||
}
|
||||
|
||||
.folder-item.active .unread-badge {
|
||||
background: rgba(200, 40, 40, 0.65);
|
||||
border-color: rgba(255, 100, 100, 0.4);
|
||||
border-color: rgba(255, 100, 100, 0.35);
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in a new issue