diff --git a/docs/design/system.md b/docs/design/system.md new file mode 100644 index 0000000..53fe5df --- /dev/null +++ b/docs/design/system.md @@ -0,0 +1,45 @@ +# Дизайн-система «Тихая сцена» + +Один визуальный язык для Android, Windows, macOS и Linux. Классический вид и Material 3 +остаются в настройках. По умолчанию включена «Тихая сцена» (`html[data-style="stage"]`, +`ui/css/stage.css`). + +Макет, по которому сверялись экраны, лежит в `docs/design/proposal/` и в приложение не встроен. + +## Цвет + +Светлая тема: фон `#f3f0e8`, низ страницы `#e7e2d6`, карточка `#fffcf7`, текст `#1c1915`, +вторичный текст `#5c564c`. Тёмная: фон `#121410`, карточка `#22261f`, текст `#f4f1ea`. + +Акцент не зашит в стиль. Его выбирает человек в настройках; по умолчанию зелёный. +Палитра в настройках по-прежнему меняет акцент. Фон и карточки «Тихой сцены» не следуют +за палитрой: иначе у темы не было бы одного узнаваемого нейтрального цвета. +Текст на акцентной кнопке — `#f4fff9` на светлом и `#10241b` на тёмном, чтобы контраст +оставался читаемым. + +Опасное действие — существующий `--danger`. Линии — 10% текста, не отдельная серая шкала. + +## Типографика + +Текст интерфейса — системный шрифт (`--font`): SF, Segoe UI, Inter. Заголовки экранов, +названия полок и заголовок навигации — наборный шрифт (`--font-display`): Iowan Old Style, +затем Palatino. Размер текста по-прежнему масштабируется настройкой «Размер текста». + +## Отступы и форма + +Шкала `--s-xs` … `--s-section` (4–32 px) не менялась. Поле страницы на компьютере — 20 px, +как у карточек, чтобы заголовок и карточка начинались на одной линии. На телефоне поле — 16 px. +Карточки и мини-плеер скруглены на 18 px. Строка трека — 56 px, на Material 3 телефоне +по-прежнему 64 px. Зона нажатия кнопок не меньше 44 px. + +## Движение + +Те же длительности, что у всего приложения: нажатие 60 ms, страница 260 ms, лист 420 ms. +Кривая `--ease-ios`. При `prefers-reduced-motion: reduce` анимации отключаются прежними +правилами. Списки треков не анимируют строки. + +## Компоненты + +Кнопки, поля, переключатели, строки треков, док, боковая колонка и полоса плеера — те же +элементы, что уже есть в `ui/css`. «Тихая сцена» меняет их цвет и заголовок, а не разметку. +Так телефон и компьютер остаются одним интерфейсом. diff --git a/ui-tests/interface-regressions.test.js b/ui-tests/interface-regressions.test.js index b4ddd4e..d2a06f7 100644 --- a/ui-tests/interface-regressions.test.js +++ b/ui-tests/interface-regressions.test.js @@ -5,6 +5,22 @@ import {openApp} from './harness.js'; const config={signedIn:true,catalogMixes:true}; async function player(page){await page.locator('.stage-cta').click();await page.locator('.player .now').click();await page.locator('.np:not([hidden])').waitFor();} +test('quiet stage is the default: warm page, serif titles, previous styles still selectable',async()=>{ + const app=await openApp({config}); + try{const {page}=app; + await page.waitForFunction(()=>document.documentElement.dataset.style==='stage'); + const look=await page.evaluate(()=>{const h=document.querySelector('h1');const s=getComputedStyle(h);return {bg:getComputedStyle(document.body).backgroundColor,font:s.fontFamily,weight:s.fontWeight};}); + assert.equal(look.bg,'rgb(243, 240, 232)',JSON.stringify(look)); + assert.match(look.font,/Iowan|Palatino/); + await page.locator('.nav [data-view="settings"]').click(); + await page.getByRole('combobox',{name:'Вид приложения',exact:true}).selectOption('premium'); + await page.waitForFunction(()=>document.documentElement.dataset.style==='premium'); + const classic=await page.evaluate(()=>getComputedStyle(document.body).backgroundColor); + assert.notEqual(classic,'rgb(243, 240, 232)'); + assert.deepEqual(app.problems,[]); + }finally{await app.close();} +}); + test('titles: desktop title follows the active section and resets on sign out',async()=>{ const app=await openApp({config}); try{const {page}=app;await page.waitForFunction(()=>document.title==='Моя музыка — Private Music'); diff --git a/ui/css/music.css b/ui/css/music.css index c7bc650..ec8fa56 100644 --- a/ui/css/music.css +++ b/ui/css/music.css @@ -186,12 +186,12 @@ html[data-layout="phone"] .lib-grid { grid-template-columns: repeat(auto-fill, m html .hero-art:has(.art-box:is([data-art="missing"], [data-art="error"])) { display: none; } /* With no cover, the classic design keeps the title and controls as the player content; the default and Material designs show a tonal tile with a note glyph the size of a cover (as Apple Music and YouTube Music do). */ -html:not([data-style="premium"], [data-style="material"]) .np-cover:has(.np-placeholder) { visibility: hidden; box-shadow: none; background: transparent; } -html:not([data-style="premium"], [data-style="material"]) .np[data-mode="off"] .np-main:has(.np-placeholder) { display: flex; flex-direction: column; justify-content: center; } -html:not([data-style="premium"], [data-style="material"]) .np[data-mode="off"] .np-cover:has(.np-placeholder) { display: none; } -html:is([data-style="premium"], [data-style="material"]) .np-cover:has(.np-placeholder) { background: color-mix(in srgb, var(--np-fg) 8%, transparent); box-shadow: none; } -html:is([data-style="premium"], [data-style="material"]) .np-placeholder { color: color-mix(in srgb, var(--np-fg) 45%, transparent); } -html:is([data-style="premium"], [data-style="material"]) .np-placeholder svg { width: 32%; height: auto; } +html:not([data-style="premium"], [data-style="material"], [data-style="stage"]) .np-cover:has(.np-placeholder) { visibility: hidden; box-shadow: none; background: transparent; } +html:not([data-style="premium"], [data-style="material"], [data-style="stage"]) .np[data-mode="off"] .np-main:has(.np-placeholder) { display: flex; flex-direction: column; justify-content: center; } +html:not([data-style="premium"], [data-style="material"], [data-style="stage"]) .np[data-mode="off"] .np-cover:has(.np-placeholder) { display: none; } +html:is([data-style="premium"], [data-style="material"], [data-style="stage"]) .np-cover:has(.np-placeholder) { background: color-mix(in srgb, var(--np-fg) 8%, transparent); box-shadow: none; } +html:is([data-style="premium"], [data-style="material"], [data-style="stage"]) .np-placeholder { color: color-mix(in srgb, var(--np-fg) 45%, transparent); } +html:is([data-style="premium"], [data-style="material"], [data-style="stage"]) .np-placeholder svg { width: 32%; height: auto; } html[data-layout="phone"] .stage:has(.art-box[data-art="missing"], .art-box[data-art="error"]) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chip" "title" "start" "controls"; } html[data-layout="phone"] .stage-art:has(.art-box[data-art="missing"], .art-box[data-art="error"]) { display: none; } /* A short loading label avoids decorative skeletons and continuous repainting. */ diff --git a/ui/css/stage.css b/ui/css/stage.css new file mode 100644 index 0000000..c9456ef --- /dev/null +++ b/ui/css/stage.css @@ -0,0 +1,105 @@ +/* Тихая сцена: тёплый фон, наборный заголовок, те же компоненты на всех платформах. + Включается атрибутом data-style="stage". Акцент по-прежнему берётся из настроек. */ + +html[data-style="stage"], +html[data-style="stage"][data-palette] { + --page-top: #f3f0e8; + --page-bottom: #e7e2d6; + --surface: #fffcf7; + --text: #1c1915; + --text-2: #5c564c; + --text-3: #8a8376; + --font-display: "Iowan Old Style", Palatino, "Palatino Linotype", "Times New Roman", serif; + --r-card: 18px; + --r-compact: 14px; + --r-control: 12px; + --sh-card: 0 10px 28px rgb(28 25 21 / 0.07); + --sh-bar: 0 8px 24px rgb(28 25 21 / 0.08); + --line: rgb(28 25 21 / 0.1); + --hover: rgb(28 25 21 / 0.05); + --pressed: rgb(28 25 21 / 0.09); + --gutter: 20px; +} +html[data-style="stage"][data-layout="phone"] { --gutter: 16px; } + +@media (prefers-color-scheme: dark) { + html[data-style="stage"]:not([data-theme="light"]), + html[data-style="stage"][data-palette]:not([data-theme="light"]) { + --page-top: #121410; + --page-bottom: #1a1d18; + --surface: #22261f; + --text: #f4f1ea; + --text-2: #c8c2b4; + --text-3: #8f897c; + --line: rgb(244 241 234 / 0.12); + --hover: rgb(244 241 234 / 0.06); + --pressed: rgb(244 241 234 / 0.1); + --sh-card: 0 10px 28px rgb(0 0 0 / 0.35); + --accent: var(--a-d); + } +} + +html[data-style="stage"][data-theme="dark"], +html[data-style="stage"][data-palette][data-theme="dark"] { + color-scheme: dark; + --page-top: #121410; + --page-bottom: #1a1d18; + --surface: #22261f; + --text: #f4f1ea; + --text-2: #c8c2b4; + --text-3: #8f897c; + --line: rgb(244 241 234 / 0.12); + --hover: rgb(244 241 234 / 0.06); + --pressed: rgb(244 241 234 / 0.1); + --sh-card: 0 10px 28px rgb(0 0 0 / 0.35); + --accent: var(--a-d); +} + +html[data-style="stage"][data-theme="light"], +html[data-style="stage"][data-palette][data-theme="light"] { + color-scheme: light; + --page-top: #f3f0e8; + --page-bottom: #e7e2d6; + --surface: #fffcf7; + --text: #1c1915; + --text-2: #5c564c; + --accent: var(--a-l); +} + +html[data-style="stage"] :is(h1, h2.shelf-title, .nav-title, .stage-headline, .profile-name) { + font-family: var(--font-display); + font-weight: 560; + letter-spacing: -0.03em; +} +/* Полный плеер остаётся чёрным или белым: обложка под ним, а не тёплый фон страницы. */ +html[data-style="stage"] .np-title { color: #000; font-family: var(--font); font-weight: 700; letter-spacing: -0.02em; } +html[data-style="stage"][data-theme="dark"] .np-title, +html[data-style="stage"][data-palette][data-theme="dark"] .np-title { color: #fff; } +@media (prefers-color-scheme: dark) { + html[data-style="stage"]:not([data-theme="light"]) .np-title { color: #fff; } +} + +html[data-style="stage"] .sidebar { + background: #e7e2d6; +} +html[data-style="stage"][data-theme="dark"] .sidebar, +html[data-style="stage"]:not([data-theme="light"]) .sidebar { + background: var(--page-bottom); +} +@media (prefers-color-scheme: light) { + html[data-style="stage"]:not([data-theme]) .sidebar { background: #e7e2d6; } +} + +html[data-style="stage"] .nav button[aria-current="page"] { + background: var(--surface); + color: var(--text); + box-shadow: var(--sh-card); +} + +html[data-style="stage"] .view-header, +html[data-style="stage"] .set-card, +html[data-style="stage"] .dl-summary, +html[data-style="stage"] .mini, +html[data-style="stage"] .player { + border-radius: var(--r-card); +} diff --git a/ui/js/mobile/style.js b/ui/js/mobile/style.js index cc89be5..6238d6c 100644 --- a/ui/js/mobile/style.js +++ b/ui/js/mobile/style.js @@ -1,8 +1,9 @@ -// App style on every platform: "premium" (the default design, css/premium.css), "ios" (the classic look shared with -// the iPhone app) or "material" (Material 3). Выбор хранится на устройстве и ставится на . +// App style on every platform. "stage" is the default (docs/design/system.md, css/stage.css). +// "premium" is the previous default, "ios" the classic look, "material" Material 3. +// Выбор хранится на устройстве и ставится на . const KEY = "pm-style"; -export const STYLES = ["premium", "ios", "material"]; -export const DEFAULT_STYLE = "premium"; +export const STYLES = ["stage", "premium", "ios", "material"]; +export const DEFAULT_STYLE = "stage"; export function currentStyle() { try { const value = localStorage.getItem(KEY); return STYLES.includes(value) ? value : DEFAULT_STYLE; } catch { return DEFAULT_STYLE; } diff --git a/ui/js/views/settings.js b/ui/js/views/settings.js index eab4c0f..616f506 100644 --- a/ui/js/views/settings.js +++ b/ui/js/views/settings.js @@ -22,7 +22,7 @@ import { DEFAULT_CUSTOM_ACCENT, customAccentPair } from "../accent-custom.js"; import { NP_THEMES, currentNpTheme, setNpTheme } from "../mobile/np-theme.js"; import { openDiagnostics } from "../diagnostics.js"; addStrings({ ru: { "set.nptheme": "Фон плеера", "set.nptheme.cover": "Обложка", "set.nptheme.aurora": "Аврора", "set.nptheme.plain": "Однотонный" }, en: { "set.nptheme": "Player background", "set.nptheme.cover": "Cover", "set.nptheme.aurora": "Aurora", "set.nptheme.plain": "Plain" } }); -addStrings({ ru: { "set.style": "Вид приложения", "set.accent.custom": "Свой цвет", "set.style.ios": "Классический", "set.style.material": "Material 3", "set.style.premium": "Основной", "set.style.note": "Основной — новый дизайн приложения: цвета от выбранного акцента, тёмная карточка волны и плеер. Классический — прежний вид, Material 3 — в стиле Android. Работает на всех устройствах." }, en: { "set.style": "App style", "set.accent.custom": "Custom colour", "set.style.ios": "Classic", "set.style.material": "Material 3", "set.style.premium": "Default", "set.style.note": "Default: the new app design, colours from your accent, a dark mix card and player. Classic: the previous look. Material 3: Android style. Works on every device." } }); +addStrings({ ru: { "set.style": "Вид приложения", "set.accent.custom": "Свой цвет", "set.style.stage": "Тихая сцена", "set.style.ios": "Классический", "set.style.material": "Material 3", "set.style.premium": "Прежний основной", "set.style.note": "Тихая сцена — тёплый фон и наборные заголовки на всех устройствах. Прежний основной, классический и Material 3 остаются в списке." }, en: { "set.style": "App style", "set.accent.custom": "Custom colour", "set.style.stage": "Quiet stage", "set.style.ios": "Classic", "set.style.material": "Material 3", "set.style.premium": "Previous default", "set.style.note": "Quiet stage: warm background and serif titles on every device. The previous default, classic and Material 3 stay in the list." } }); const IS_MAC = /Mac/i.test(navigator.platform || navigator.userAgent); const MOD = IS_MAC ? "⌘" : "Ctrl"; diff --git a/ui/styles.css b/ui/styles.css index ec16ead..b69dab1 100644 --- a/ui/styles.css +++ b/ui/styles.css @@ -41,3 +41,4 @@ @import url("css/music.css"); @import url("css/premium.css"); +@import url("css/stage.css");