diff --git a/electron-builder.yml b/electron-builder.yml index 4ac59a6..a77106d 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -9,7 +9,6 @@ files: linux: target: - AppImage - - deb category: Network icon: resources/icon.png win: diff --git a/package.json b/package.json index 539d27f..355c6cb 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,10 @@ "name": "aero-mail", "version": "0.1.0", "description": "Desktop email client built with Vue 3 + Electron", + "author": { + "name": "d.a.kolesov", + "email": "d.a.kolesov@s7.ru" + }, "main": "./out/main/index.js", "scripts": { "dev": "electron-vite dev", diff --git a/resources/icon.png b/resources/icon.png new file mode 100644 index 0000000..16a1cb4 Binary files /dev/null and b/resources/icon.png differ diff --git a/resources/icon.svg b/resources/icon.svg new file mode 100644 index 0000000..2e92ffb --- /dev/null +++ b/resources/icon.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/index.ts b/src/main/index.ts index fb3d330..195ba59 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, shell, ipcMain, dialog, Menu } from 'electron' +import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut } from 'electron' import { join } from 'node:path' import { AccountManager } from './services/account-manager' import { registerAccountHandlers } from './ipc/accounts.handler' @@ -9,11 +9,16 @@ import { registerOAuthHandlers } from './ipc/oauth.handler' const accountManager = new AccountManager() function createWindow(): BrowserWindow { + const iconPath = app.isPackaged + ? join(process.resourcesPath, 'icon.png') + : join(app.getAppPath(), 'resources/icon.png') + const mainWindow = new BrowserWindow({ width: 1280, height: 800, minWidth: 900, minHeight: 600, + icon: iconPath, backgroundColor: '#1e1e1e', webPreferences: { preload: join(__dirname, '../preload/index.js'), @@ -25,6 +30,10 @@ function createWindow(): BrowserWindow { accountManager.setMainWindow(mainWindow) + globalShortcut.register('F12', () => { + mainWindow.webContents.toggleDevTools() + }) + // Open external links in browser mainWindow.webContents.setWindowOpenHandler(({ url }) => { shell.openExternal(url) diff --git a/src/renderer/src/components/messages/MessageList.vue b/src/renderer/src/components/messages/MessageList.vue index d0f1136..0031782 100644 --- a/src/renderer/src/components/messages/MessageList.vue +++ b/src/renderer/src/components/messages/MessageList.vue @@ -157,9 +157,9 @@ onMounted(restartAutoCheck) onUnmounted(() => { if (autoCheckTimer) clearInterval(autoCheckTimer) }) // ── Pull-to-refresh ─────────────────────────────────────── -const PULL_THRESHOLD = 130 // расстояние для срабатывания -const PULL_FACTOR = 0.16 // базовая чувствительность -const PULL_RUBBER = 0.55 // rubber-band: сопротивление у порога +const PULL_THRESHOLD = 220 // расстояние для срабатывания +const PULL_FACTOR = 0.14 // базовая чувствительность +const PULL_RUBBER = 0.65 // rubber-band: сопротивление у порога const pullY = ref(0) const pullRefreshing = ref(false) @@ -182,11 +182,15 @@ function onWheel(event: WheelEvent): void { if (delta < 4) return // trackpad-шум if (event.deltaY < 0 && !pullRefreshing.value && !messagesStore.loading) { - if (pullDecayTimer) { clearTimeout(pullDecayTimer); pullDecayTimer = null } // rubber-band: чем ближе к порогу — тем тяжелее тянуть const resistance = 1 - (pullY.value / PULL_THRESHOLD) * PULL_RUBBER pullY.value = Math.min(PULL_THRESHOLD, pullY.value + delta * PULL_FACTOR * resistance) - if (pullY.value >= PULL_THRESHOLD) triggerPullRefresh() + if (pullY.value >= PULL_THRESHOLD) { + triggerPullRefresh() + } else { + // Запускаем таймер возврата — если пользователь отпустит трекпад, он сработает + schedulePullDecay() + } } else if (event.deltaY > 0 && pullY.value > 0) { schedulePullDecay() } @@ -795,43 +799,52 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis height: calc(var(--progress, 0) * 56px); overflow: hidden; flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; } .pull-indicator-wrap.releasing { transition: height 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .pull-indicator { - height: 56px; - display: flex; + display: inline-flex; align-items: center; - justify-content: center; - gap: 8px; + gap: 7px; + padding: 6px 14px 6px 10px; font-size: 11.5px; font-weight: 500; - /* цвет интерполируется от muted к accent по мере тяги */ - color: color-mix(in srgb, var(--accent) calc(var(--pull-progress, 0) * 100%), var(--text-muted)); - background: - linear-gradient(180deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.012) 100%), - rgba(10, 10, 18, 0.65); - backdrop-filter: blur(20px) saturate(1.5); - -webkit-backdrop-filter: blur(20px) saturate(1.5); - border-bottom: 1px solid rgba(255, 255, 255, 0.06); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); letter-spacing: 0.2px; + color: color-mix(in srgb, var(--accent) calc(var(--pull-progress, 0) * 100%), var(--text-muted)); + + background: + linear-gradient(145deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.04) 100%), + rgba(12, 12, 20, 0.72); + backdrop-filter: blur(28px) saturate(1.8); + -webkit-backdrop-filter: blur(28px) saturate(1.8); + border: 1px solid rgba(255, 255, 255, 0.10); + border-radius: 999px; + box-shadow: + inset 0 1px 0 rgba(255, 255, 255, 0.14), + 0 4px 16px rgba(0, 0, 0, 0.30); + transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; } /* Достигнут порог — accent-подсветка */ .pull-indicator.ready { - border-bottom-color: color-mix(in srgb, var(--accent) 35%, transparent); + border-color: color-mix(in srgb, var(--accent) 35%, rgba(255,255,255,0.10)); box-shadow: - inset 0 1px 0 rgba(255, 255, 255, 0.09), - 0 2px 16px color-mix(in srgb, var(--accent) 10%, transparent); + inset 0 1px 0 rgba(255, 255, 255, 0.16), + 0 4px 20px color-mix(in srgb, var(--accent) 18%, rgba(0,0,0,0.30)); } .pull-indicator.refreshing { color: var(--accent); - border-bottom-color: color-mix(in srgb, var(--accent) 25%, transparent); + border-color: color-mix(in srgb, var(--accent) 30%, rgba(255,255,255,0.10)); + box-shadow: + inset 0 1px 0 rgba(255, 255, 255, 0.16), + 0 4px 20px color-mix(in srgb, var(--accent) 18%, rgba(0,0,0,0.30)); } /* Обёртка иконки: вращение по прогрессу */ diff --git a/src/renderer/src/components/preview/MessageBody.vue b/src/renderer/src/components/preview/MessageBody.vue index 78c2e48..fa62064 100644 --- a/src/renderer/src/components/preview/MessageBody.vue +++ b/src/renderer/src/components/preview/MessageBody.vue @@ -18,8 +18,9 @@ function rgbMatch(s: string): [number, number, number, number] | null { return [+m[1], +m[2], +m[3], m[4] !== undefined ? parseFloat(m[4]) : 1] } -function isNearWhiteRgb(r: number, g: number, b: number): boolean { - return r >= 200 && g >= 200 && b >= 200 +// Воспринимаемая яркость (0–255) +function brightness(r: number, g: number, b: number): number { + return (r * 299 + g * 587 + b * 114) / 1000 } function fixIframeColors(): void { @@ -28,30 +29,31 @@ function fixIframeColors(): void { const view = iframeRef.value?.contentWindow if (!doc?.body || !view) return - // Для каждого элемента: если getComputedStyle говорит что цвет текста - // близок к белому — ищем эффективный фон вверх по дереву. - // Если фон тоже светлый или прозрачный (дефолт белый) → делаем текст тёмным. - function effectiveBg(el: HTMLElement): [number, number, number] | null { + // Поднимаемся по дереву в поисках непрозрачного фона + function effectiveBgBrightness(el: HTMLElement): number | null { let node: HTMLElement | null = el while (node) { const c = rgbMatch(view.getComputedStyle(node).backgroundColor) - if (c && c[3] > 0.05) return [c[0], c[1], c[2]] + if (c && c[3] > 0.05) return brightness(c[0], c[1], c[2]) node = node.parentElement } - return null + return null // нет явного фона → тёмное стекло } const all = doc.body.querySelectorAll('*') for (const el of all) { const fg = rgbMatch(view.getComputedStyle(el).color) if (!fg || fg[3] < 0.3) continue - if (!isNearWhiteRgb(fg[0], fg[1], fg[2])) continue - // Текст белый — проверяем эффективный фон - const bg = effectiveBg(el) - if (!bg || isNearWhiteRgb(bg[0], bg[1], bg[2])) { - // Белый на белом/прозрачном → тёмный текст + const fgBright = brightness(fg[0], fg[1], fg[2]) + const bgBright = effectiveBgBrightness(el) ?? 10 // нет фона → тёмное (~10) + + if (fgBright > 180 && bgBright > 180) { + // Светлый текст на светлом фоне → тёмный el.style.setProperty('color', 'rgba(20, 20, 30, 0.88)', 'important') + } else if (fgBright < 140 && bgBright < 80) { + // Тёмный текст на тёмном/прозрачном фоне → светлый + el.style.setProperty('color', 'rgba(218, 218, 228, 0.88)', 'important') } } } catch { /* sandbox или cross-origin */ } diff --git a/src/renderer/src/components/sidebar/AccountSwitcher.vue b/src/renderer/src/components/sidebar/AccountSwitcher.vue index d508f06..2953f0b 100644 --- a/src/renderer/src/components/sidebar/AccountSwitcher.vue +++ b/src/renderer/src/components/sidebar/AccountSwitcher.vue @@ -38,12 +38,12 @@ function getAccountColor(index: number): string { -
- +
+ @@ -56,7 +56,7 @@ function getAccountColor(index: number): string { flex-direction: column; align-items: center; padding: 10px 0; - gap: 2px; + gap: 6px; height: 100%; } diff --git a/src/renderer/src/components/sidebar/FolderTreeItem.vue b/src/renderer/src/components/sidebar/FolderTreeItem.vue index c056594..742dbd3 100644 --- a/src/renderer/src/components/sidebar/FolderTreeItem.vue +++ b/src/renderer/src/components/sidebar/FolderTreeItem.vue @@ -90,8 +90,8 @@ function toggleExpand(event: Event): void { gap: 6px; border-radius: 8px; margin: 1px 6px; - border: 1px solid rgba(255, 255, 255, 0.04); - background: rgba(255, 255, 255, 0.025); + border: 1px solid transparent; + background: transparent; position: relative; text-align: left; transition: diff --git a/src/shared/types/ipc.ts b/src/shared/types/ipc.ts index 12e5894..0089590 100644 --- a/src/shared/types/ipc.ts +++ b/src/shared/types/ipc.ts @@ -12,7 +12,7 @@ export interface IpcChannelMap { 'folders:list': [{ accountId: string }, FolderListResult] 'messages:list': [ - { accountId: string; folderId: string; offset: number; limit: number }, + { accountId: string; folderId: string; offset: number; limit: number; unseenOnly?: boolean }, MessageListResult ] 'messages:body': [