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,
|
*::before,
|
||||||
*::after {
|
*::after {
|
||||||
|
|
@ -18,12 +26,20 @@ body {
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
/* Rich gradient base — accent-glow is set dynamically via JS */
|
/* Rich gradient base — accent-glow и content-glow выставляются через JS */
|
||||||
background:
|
background:
|
||||||
radial-gradient(ellipse 60% 50% at 15% 15%, var(--accent-glow, rgba(168,230,0,0.08)) 0%, transparent 70%),
|
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 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%),
|
radial-gradient(ellipse 60% 40% at 50% 50%, rgba(80, 0, 160, 0.04) 0%, transparent 100%),
|
||||||
#09090e;
|
#09090e;
|
||||||
|
|
||||||
|
/* Плавный переход между цветами свечения */
|
||||||
|
transition:
|
||||||
|
--glow-r 400ms ease,
|
||||||
|
--glow-g 400ms ease,
|
||||||
|
--glow-b 400ms ease,
|
||||||
|
--glow-a 400ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
|
|
|
||||||
|
|
@ -130,13 +130,13 @@ function stopResize(): void {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
background: rgba(255, 255, 255, 0.035);
|
background: rgba(255, 255, 255, 0.035);
|
||||||
backdrop-filter: blur(28px) saturate(1.6);
|
backdrop-filter: blur(16px) saturate(180%);
|
||||||
-webkit-backdrop-filter: blur(28px) saturate(1.6);
|
-webkit-backdrop-filter: blur(16px) saturate(180%);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
min-width: 180px;
|
min-width: 180px;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
border-right: 1px solid var(--glass-border);
|
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.06);
|
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35);
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-pane {
|
.message-pane {
|
||||||
|
|
|
||||||
|
|
@ -331,12 +331,8 @@ onUnmounted(() => {
|
||||||
|
|
||||||
/* Карточка «всплывает» когда письмо выбрано — через :has() */
|
/* Карточка «всплывает» когда письмо выбрано — через :has() */
|
||||||
.swipe-wrapper:has(.message-item.selected) {
|
.swipe-wrapper:has(.message-item.selected) {
|
||||||
border-color: color-mix(in srgb, var(--accent) 35%, transparent);
|
border-color: rgba(255, 255, 255, 0.18);
|
||||||
box-shadow:
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
|
||||||
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);
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -389,40 +385,33 @@ onUnmounted(() => {
|
||||||
#0c0c14;
|
#0c0c14;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Выбранное письмо: акцентный тинт + полоска слева через ::before */
|
/* Выбранное письмо: liquid glass */
|
||||||
.message-item.selected {
|
.message-item.selected {
|
||||||
background:
|
background: linear-gradient(
|
||||||
linear-gradient(180deg,
|
145deg,
|
||||||
color-mix(in srgb, var(--accent) 13%, transparent) 0%,
|
rgba(255, 255, 255, 0.10) 0%,
|
||||||
color-mix(in srgb, var(--accent) 6%, transparent) 100%
|
rgba(255, 255, 255, 0.06) 100%
|
||||||
),
|
);
|
||||||
#0d0d18;
|
backdrop-filter: blur(14px) saturate(200%) brightness(1.08);
|
||||||
|
-webkit-backdrop-filter: blur(14px) saturate(200%) brightness(1.08);
|
||||||
padding-left: 4px;
|
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'а */
|
/* Specular highlight */
|
||||||
.message-item.selected::before {
|
.message-item.selected::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
inset: 0;
|
||||||
top: 18%;
|
pointer-events: none;
|
||||||
height: 64%;
|
box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.50);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-item.selected:hover {
|
.message-item.selected:hover {
|
||||||
background:
|
background: linear-gradient(
|
||||||
linear-gradient(180deg,
|
145deg,
|
||||||
color-mix(in srgb, var(--accent) 17%, transparent) 0%,
|
rgba(255, 255, 255, 0.13) 0%,
|
||||||
color-mix(in srgb, var(--accent) 8%, transparent) 100%
|
rgba(255, 255, 255, 0.08) 100%
|
||||||
),
|
);
|
||||||
#0d0d18;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-item.checked {
|
.message-item.checked {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<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'
|
import type { MessageBody } from '@shared/types/message'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
@ -109,6 +109,76 @@ const plainTextHtml = computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const srcdoc = computed(() => processedHtml.value ?? plainTextHtml.value ?? '')
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -119,6 +189,7 @@ const srcdoc = computed(() => processedHtml.value ?? plainTextHtml.value ?? '')
|
||||||
:srcdoc="srcdoc"
|
:srcdoc="srcdoc"
|
||||||
sandbox="allow-same-origin"
|
sandbox="allow-same-origin"
|
||||||
class="body-frame"
|
class="body-frame"
|
||||||
|
@load="onIframeLoad"
|
||||||
/>
|
/>
|
||||||
<div v-else class="no-body">
|
<div v-else class="no-body">
|
||||||
<span>Содержимое письма недоступно</span>
|
<span>Содержимое письма недоступно</span>
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,12 @@ const accountsStore = useAccountsStore()
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-header {
|
.folder-header {
|
||||||
padding: 10px 12px 6px;
|
padding: 10px 14px 8px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
letter-spacing: 0.2px;
|
letter-spacing: 0.4px;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading,
|
.loading,
|
||||||
|
|
|
||||||
|
|
@ -85,44 +85,81 @@ function toggleExpand(event: Event): void {
|
||||||
.folder-item {
|
.folder-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: calc(100% - 8px);
|
width: calc(100% - 12px);
|
||||||
padding: 5px 8px 5px 6px;
|
padding: 6px 8px;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
border-radius: var(--radius-sm);
|
border-radius: 8px;
|
||||||
margin: 1px 4px;
|
margin: 1px 6px;
|
||||||
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
border: 1px solid transparent;
|
||||||
text-align: left;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
text-align: left;
|
||||||
|
transition:
|
||||||
|
background var(--transition-fast),
|
||||||
|
border-color var(--transition-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-item:hover {
|
.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 {
|
.folder-item.active {
|
||||||
background: color-mix(in srgb, var(--accent) 10%, transparent);
|
background: linear-gradient(
|
||||||
box-shadow:
|
145deg,
|
||||||
inset 0 1px 0 color-mix(in srgb, var(--accent) 15%, transparent),
|
rgba(255, 255, 255, 0.10) 0%,
|
||||||
inset 0 -1px 0 color-mix(in srgb, var(--accent) 5%, transparent);
|
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: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -4px;
|
inset: 0;
|
||||||
top: 15%;
|
border-radius: inherit;
|
||||||
height: 70%;
|
box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.50);
|
||||||
width: 3px;
|
pointer-events: none;
|
||||||
background: var(--accent);
|
}
|
||||||
border-radius: 0 3px 3px 0;
|
|
||||||
box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
|
/* ── Иконка папки ────────────────────────────────────────── */
|
||||||
|
.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 {
|
.folder-item.active .folder-name {
|
||||||
color: var(--accent);
|
color: rgba(255, 255, 255, 0.92);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Кнопка разворачивания ───────────────────────────────── */
|
||||||
.expand-btn {
|
.expand-btn {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
|
@ -143,24 +180,7 @@ function toggleExpand(event: Event): void {
|
||||||
flex-shrink: 0;
|
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 {
|
.unread-badge {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
@ -169,28 +189,25 @@ function toggleExpand(event: Event): void {
|
||||||
min-height: 18px;
|
min-height: 18px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
border-radius: var(--radius-full);
|
border-radius: var(--radius-full);
|
||||||
background: rgba(210, 45, 45, 0.55);
|
background: rgba(200, 40, 40, 0.55);
|
||||||
border: 1px solid rgba(255, 100, 100, 0.3);
|
border: 1px solid rgba(255, 100, 100, 0.25);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255, 160, 160, 0.18),
|
inset 0 1px 0 rgba(255, 160, 160, 0.2),
|
||||||
0 1px 5px rgba(180, 30, 30, 0.3);
|
0 2px 6px rgba(180, 30, 30, 0.3);
|
||||||
backdrop-filter: blur(6px);
|
backdrop-filter: blur(8px);
|
||||||
-webkit-backdrop-filter: blur(6px);
|
-webkit-backdrop-filter: blur(8px);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
min-width: 18px;
|
min-width: 18px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
transition: background var(--transition-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-item:hover .unread-badge {
|
.folder-item:hover .unread-badge {
|
||||||
background: rgba(210, 45, 45, 0.7);
|
background: rgba(210, 45, 45, 0.70);
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgba(255, 160, 160, 0.22),
|
|
||||||
0 2px 8px rgba(180, 30, 30, 0.4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-item.active .unread-badge {
|
.folder-item.active .unread-badge {
|
||||||
background: rgba(200, 40, 40, 0.65);
|
background: rgba(200, 40, 40, 0.65);
|
||||||
border-color: rgba(255, 100, 100, 0.4);
|
border-color: rgba(255, 100, 100, 0.35);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue