diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 0ee02d99..d94707c3 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -21,6 +21,14 @@ Changes in SHiNE: - Twemoji SVG graphics are used only as a visual rendering layer in the web UI. - The UI loads Twemoji SVG assets from the pinned `twitter/twemoji@14.0.2` package via jsDelivr. +## Source Serif 4 + +SHiNE UI uses the Source Serif 4 typeface for the end-to-end encryption notice in direct messages (`shine-UI/assets/fonts/source-serif-4-*.woff2`). + +- Copyright: © 2014 - 2021 Adobe Systems Incorporated, with Reserved Font Name 'Source' +- License: SIL Open Font License 1.1, https://openfontlicense.org +- Source: https://github.com/adobe-fonts/source-serif, unmodified Cyrillic and Latin files as distributed by Google Fonts + ## QR Code Generator SHiNE UI includes `shine-UI/js/vendor-qrcode-generator.js`. diff --git a/VERSION.properties b/VERSION.properties index 363fe813..821da855 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.21.13 +client.version=1.21.18 server.version=1.17.8 diff --git a/docs/UI-Design/DESIGN.md b/docs/UI-Design/DESIGN.md index fff81a69..0d022044 100644 --- a/docs/UI-Design/DESIGN.md +++ b/docs/UI-Design/DESIGN.md @@ -252,7 +252,7 @@ Safe area учитывается ровно один раз владельцем | Элемент | Реализация | | --- | --- | | Строка | Блок как соседний «Сменить профиль»: `surface`, `border-subtle`, `radius-lg`, высота 64 px; по центру `♡ 0.30★ · ↗ 0.50★ · ✦ 1.00★ ⌄` кеглем `--text-lg` (до 380 px — `--text-md`, строка без переноса и на 320 px). Пока данных нет — неактивна и показывает «Загрузка…»/«Недоступна». Скринридер слышит всю сводку (`screens.support_phase2.summary`) | -| Раскрытие | Строка и карточка лежат в одной ячейке друг на друге; высоту блока ведёт только карточка (`grid-template-rows` 0fr↔1fr, 240 мс), строка всегда 64 px. Слои сменяются последовательно: уходящий гаснет (карточка 120 мс, суммы строки 80 мс), потом проявляется другой — тексты не накладываются. Только CSS-переходы: повторный тап разворачивает их с текущего места. **Не возвращать** два ряда одной сетки (1fr 0fr ↔ 0fr 1fr): их сумма всегда равна высоте карточки, блок не сжимается, а строка растягивается пустым прямоугольником. Раскрывает вся плашка, сворачивает вся шапка карточки от края до края. Пока карточка выезжает, она подкручивается в видимую область (блок стоит внизу профиля, иначе уходил бы под панель навигации); так же подтягиваются записи открытой истории. `aria-expanded`/`aria-controls`; скрытая часть `inert`; фокус переходит на заголовок «Поддержка ⌃» и обратно на строку | +| Раскрытие | Строка и карточка лежат в одной ячейке друг на друге; высоту блока ведёт только карточка (`grid-template-rows` 0fr↔1fr: раскрытие 240 мс, сворачивание мягче — 360 мс), строка всегда 64 px. Анимируется только то, что карточка добавляет к строке (`--ps-line`), поэтому высота плавно приходит ровно к строке; сжатие «до нуля» упиралось в неё на полном ходу. Слои сменяются последовательно: уходящий гаснет (карточка 180 мс, суммы строки 80 мс), потом проявляется другой — тексты не накладываются. Только CSS-переходы: повторный тап разворачивает их с текущего места. **Не возвращать** два ряда одной сетки (1fr 0fr ↔ 0fr 1fr): их сумма всегда равна высоте карточки, блок не сжимается, а строка растягивается пустым прямоугольником. Раскрывает вся плашка, сворачивает вся шапка карточки от края до края. Пока карточка выезжает, она подкручивается в видимую область (блок стоит внизу профиля, иначе уходил бы под панель навигации); так же подтягиваются записи открытой истории. `aria-expanded`/`aria-controls`; скрытая часть `inert`; фокус переходит на заголовок «Поддержка ⌃» и обратно на строку | | Поверхность | Полупрозрачный градиент из `surface-raised`/`surface`, `backdrop-filter: blur(24px)` (только у стоящей карточки: в движении его пересчёт даёт рывки), радиус 20 px; грань — металлический кант 1 px из `text-primary` маской (блики на правом верхнем и левом нижнем углах, внутренняя фаска inset-тенью; интерьер не подсвечивается). Ночью тёмное стекло, днём светлое матовое — без отдельных констант цвета | | Иконки | Общий `ui-icon.js`: `heart`, `trend-up`, `sparkle`, валюта — залитая `star`; толщина штриха общая для приложения (1.75). Emoji из подписей убраны | | Суммы | Число + SVG-звезда; скринридер получает «0.10 ⭐» (`.sr-only`). В строке иконка, число и звезда — в цвете метрики; в карточке цветные иконка и звезда, число — `text-primary`. Нулевая сумма приглушена `text-secondary` | @@ -284,9 +284,14 @@ Safe area учитывается ровно один раз владельцем | Фон чата | Меню «⋮» → «Изменить фон» → шторка с плитками (`js/components/dm-background-sheet.js`): нажатие сразу меняет чат за шторкой, «Без фона» возвращает обычный вид. Выбор — для одного чата, на этом устройстве (`docs/Personal_Messages/README.md`) | | Стекло | С фоном заливка пузырей и поля становится полупрозрачной (66–68% и 55%), затемнения оболочки у шапки и поля ввода убираются. **Размытие — только одно, у панели ввода**: под каждым пузырём оно тормозит прокрутку, а на мягком фоне не видно | | Слой фона | `.dm-chat-bg` — `position: fixed` внутри `.app-shell`, высота `100lvh`: при открытой клавиатуре картинка не прыгает | -| Первый фон | «Туманность» — свой рисунок по цветам референса, тёмный и светлый варианты по 16–17 КБ, меняются вместе с темой | +| «Туманность» | Свой рисунок по цветам референса, тёмный и светлый варианты по 16–17 КБ, меняются вместе с темой. Оттенок сообщений обычный — из палитры | +| «Затмение» | Световые дуги с резким краем, 31–33 КБ; тянется на весь экран (`background-size: 100% 100%`), чтобы дуги не обрезались. Вспышки почти белые, поэтому у справки о шифровании, времени эмодзи и подписи «Новые сообщения» есть подложка | +| «Гроза» | Облачные потоки с молниями, 23 КБ. У сообщений на кромке отблески молний (две прозрачные картинки по 4 КБ, только ночью: днём на светлом стекле они читаются пятном), у отправленных голосовых фиолетовые кнопка и волна | +| Светящиеся сообщения | У фонов с `glow` («Затмение», «Гроза») сообщения, голосовые и поле ввода подхватывают свет фона: у исходящих свечение от краёв внутрь, входящие и поле — серо-синие. Общий блок `.has-dm-glow`, у каждого фона только пять цветов `--dm-tint-*` на тему; цвета от картинки, а не от акцента | +| Справка о шифровании | Вверху каждого личного чата: замок — общий значок `lock` в стеклянном круге (оттенок `accent`, на светящихся фонах — их цвет), текст шрифтом Source Serif 4 (свои файлы в `assets/fonts/`, лицензия OFL). Это единственное место с отдельным шрифтом; остальное приложение — системный `--font-main` | +| Срок вложения | «Вложение доступно ещё N дн.» и время — в одной строке во всех чатах; не влезают — время переносится ниже | -**Как добавить фон:** запись в `js/services/dm-chat-backgrounds.js`, подпись `screens.dm_background.` в обоих словарях и две вертикальные картинки в `img/chat-backgrounds/` (тёмная и светлая, до 250 КБ). Рисунок мягкий и неконтрастный: справка о шифровании и время эмодзи лежат прямо на фоне, их контраст с самым неудачным местом — не ниже 4.5:1. `id` не переименовывать: он сохранён у пользователей. Набор проверяет `tests/dm-chat-background.test.mjs`. +**Как добавить фон:** запись в `js/services/dm-chat-backgrounds.js`, подпись `screens.dm_background.` в обоих словарях и две вертикальные картинки в `img/chat-backgrounds/` (тёмная и светлая, до 250 КБ). Справка о шифровании и время эмодзи лежат прямо на фоне: их контраст с самым неудачным местом — не ниже 4.5:1, иначе нужна подложка, как у «Затмения». Чтобы сообщения светились оттенком фона, добавить в запись `glow: true` и блок `[data-dm-bg='']` с пятью `--dm-tint-*` для каждой темы в `styles/features/dm-background.css`. `id` не переименовывать: он сохранён у пользователей. Набор проверяет `tests/dm-chat-background.test.mjs`. ## 12. Допущения и отложенные решения @@ -335,3 +340,4 @@ Safe area учитывается ровно один раз владельцем | 22.09.2026 | 0.2 | Специфицированы семантические цвета двух тем, общие компоненты, состояния, адаптация, правила расширения и матрица приёмки. Это документация будущего переноса, не выполненное изменение приложения | | 26.11.2026 | 0.3 | «Поддержка» в профиле (§11.3): блок-строка с суммами под «Сменить профиль» (размером с соседний блок) раскрывается в стеклянную карточку «Ethereal Monochrome» и сворачивается по заголовку. Отклонения: цвета метрик, дыхание иконок 4 с, одноразовое сияние («пополнение» кометами со счётом сумм и искрами, блик по рамке со вспышкой в углу, орбита), вдавливание карточки 0.4 с, жидкий свет истории 0.8 с; постоянное свечение текста и тёмные константы цвета не переносятся | | 03.12.2026 | 0.4 | Личный чат (§11.4): объёмные, слегка зеркальные сообщения, голосовые и поле ввода; фон отдельного чата из меню «⋮», первый — «Туманность» в двух темах | +| 03.12.2026 | 0.5 | Фоны «Затмение» и «Гроза» (§11.4): сообщения, голосовые и поле ввода подстраиваются под их оттенок; срок вложения и время — в одной строке. Карточка «Поддержка» (§11.3) сворачивается мягче, без рывка в конце | diff --git a/shine-UI/assets/fonts/source-serif-4-cyrillic.woff2 b/shine-UI/assets/fonts/source-serif-4-cyrillic.woff2 new file mode 100644 index 00000000..d0f3db70 Binary files /dev/null and b/shine-UI/assets/fonts/source-serif-4-cyrillic.woff2 differ diff --git a/shine-UI/assets/fonts/source-serif-4-latin.woff2 b/shine-UI/assets/fonts/source-serif-4-latin.woff2 new file mode 100644 index 00000000..2e295858 Binary files /dev/null and b/shine-UI/assets/fonts/source-serif-4-latin.woff2 differ diff --git a/shine-UI/img/chat-backgrounds/eclipse-dark.webp b/shine-UI/img/chat-backgrounds/eclipse-dark.webp new file mode 100644 index 00000000..6a4aa3c3 Binary files /dev/null and b/shine-UI/img/chat-backgrounds/eclipse-dark.webp differ diff --git a/shine-UI/img/chat-backgrounds/eclipse-light.webp b/shine-UI/img/chat-backgrounds/eclipse-light.webp new file mode 100644 index 00000000..44c65fa5 Binary files /dev/null and b/shine-UI/img/chat-backgrounds/eclipse-light.webp differ diff --git a/shine-UI/img/chat-backgrounds/storm-dark.webp b/shine-UI/img/chat-backgrounds/storm-dark.webp new file mode 100644 index 00000000..0f663d91 Binary files /dev/null and b/shine-UI/img/chat-backgrounds/storm-dark.webp differ diff --git a/shine-UI/img/chat-backgrounds/storm-flash-bottom.webp b/shine-UI/img/chat-backgrounds/storm-flash-bottom.webp new file mode 100644 index 00000000..6c63acc5 Binary files /dev/null and b/shine-UI/img/chat-backgrounds/storm-flash-bottom.webp differ diff --git a/shine-UI/img/chat-backgrounds/storm-flash-top.webp b/shine-UI/img/chat-backgrounds/storm-flash-top.webp new file mode 100644 index 00000000..c237045a Binary files /dev/null and b/shine-UI/img/chat-backgrounds/storm-flash-top.webp differ diff --git a/shine-UI/img/chat-backgrounds/storm-light.webp b/shine-UI/img/chat-backgrounds/storm-light.webp new file mode 100644 index 00000000..199b7063 Binary files /dev/null and b/shine-UI/img/chat-backgrounds/storm-light.webp differ diff --git a/shine-UI/js/components/dm-background-sheet.js b/shine-UI/js/components/dm-background-sheet.js index 568393bd..0cf614e7 100644 --- a/shine-UI/js/components/dm-background-sheet.js +++ b/shine-UI/js/components/dm-background-sheet.js @@ -20,9 +20,10 @@ export function openDmBackgroundSheet(chatId) { button.type = 'button'; button.className = 'ui-button dm-bg-option'; const preview = document.createElement('span'); - preview.className = 'dm-bg-option__preview dm-bg-image'; + preview.className = `dm-bg-option__preview dm-bg-image${findDmChatBackground(id)?.glow ? ' has-dm-glow' : ''}`; preview.setAttribute('aria-hidden', 'true'); preview.innerHTML = `${iconHtml('check')}`; + preview.dataset.dmBg = id; paintDmChatBackground(preview, findDmChatBackground(id)); const name = document.createElement('span'); name.className = 'dm-bg-option__name'; diff --git a/shine-UI/js/components/ui-icon.js b/shine-UI/js/components/ui-icon.js index 9b113a65..a45af3a8 100644 --- a/shine-UI/js/components/ui-icon.js +++ b/shine-UI/js/components/ui-icon.js @@ -33,6 +33,7 @@ const paths = { profile: '', share: '', search: '', + lock: '', link: '', gift: '', plus: '', diff --git a/shine-UI/js/i18n/locales/en.json b/shine-UI/js/i18n/locales/en.json index a03b6ea3..b4746309 100644 --- a/shine-UI/js/i18n/locales/en.json +++ b/shine-UI/js/i18n/locales/en.json @@ -1252,7 +1252,9 @@ "title": "Chat background", "hint": "The background changes only in this chat and only on this device. The other person can't see it.", "none": "No background", - "nebula": "Nebula" + "nebula": "Nebula", + "eclipse": "Eclipse", + "storm": "Storm" }, "dm_mute_menu": { "text_001": "Unmute", diff --git a/shine-UI/js/i18n/locales/ru.json b/shine-UI/js/i18n/locales/ru.json index 47e1e1b6..529901c0 100644 --- a/shine-UI/js/i18n/locales/ru.json +++ b/shine-UI/js/i18n/locales/ru.json @@ -1252,7 +1252,9 @@ "title": "Фон чата", "hint": "Фон меняется только в этом чате и только на этом устройстве. Собеседник его не видит.", "none": "Без фона", - "nebula": "Туманность" + "nebula": "Туманность", + "eclipse": "Затмение", + "storm": "Гроза" }, "dm_mute_menu": { "text_001": "Включить звук", diff --git a/shine-UI/js/pages/chat-view.js b/shine-UI/js/pages/chat-view.js index 712e2e7b..3eea1038 100644 --- a/shine-UI/js/pages/chat-view.js +++ b/shine-UI/js/pages/chat-view.js @@ -1069,8 +1069,11 @@ function createDmEncryptionNotice() { const heading = document.createElement('strong'); heading.className = 'dm-security-notice__title'; - heading.textContent = `🔒 ${t('screens.chat_view.security_notice.title')}`; - notice.append(heading); + heading.textContent = t('screens.chat_view.security_notice.title'); + const lock = document.createElement('span'); + lock.className = 'dm-security-notice__icon'; + lock.innerHTML = iconHtml('lock'); + notice.append(lock, heading); for (const [label, text] of [ [t('screens.chat_view.security_notice.zero_knowledge_label'), t('screens.chat_view.security_notice.zero_knowledge')], @@ -3008,7 +3011,12 @@ export function render({ navigate, route, chrome }) { const background = findDmChatBackground(getDmChatBackground(chatId)); paintDmChatBackground(backgroundLayer, background); backgroundLayer.hidden = !background; - [screen, form].forEach((node) => node.classList.toggle('has-dm-bg', Boolean(background))); + [screen, form].forEach((node) => { + node.classList.toggle('has-dm-bg', Boolean(background)); + node.classList.toggle('has-dm-glow', Boolean(background?.glow)); + }); + // По id стили берут оттенок сообщений и поля ввода (dm-background.css). + [screen, form, backgroundLayer].forEach((node) => { node.dataset.dmBg = background?.id || ''; }); }; syncBackground(); diff --git a/shine-UI/js/services/dm-chat-backgrounds.js b/shine-UI/js/services/dm-chat-backgrounds.js index 30b697c8..b14350be 100644 --- a/shine-UI/js/services/dm-chat-backgrounds.js +++ b/shine-UI/js/services/dm-chat-backgrounds.js @@ -3,6 +3,7 @@ import { t } from '../i18n/index.js'; // Фоны личных чатов. Новый фон — одна запись здесь, подпись в обоих словарях (screens.dm_background.) // и две картинки в img/chat-backgrounds/: для тёмной и светлой темы (вертикальные, до 250 КБ). // id хранится у пользователей (dm-chat-prefs.js): не переименовывать. Выбор чата — только id. +// glow: сообщения и поле ввода светятся оттенком фона; сами цвета — блок [data-dm-bg=''] в styles/features/dm-background.css. const BACKGROUNDS = [ { id: 'nebula', @@ -10,6 +11,20 @@ const BACKGROUNDS = [ dark: 'img/chat-backgrounds/nebula-dark.webp', light: 'img/chat-backgrounds/nebula-light.webp', }, + { + id: 'eclipse', + get label() { return t('screens.dm_background.eclipse'); }, + dark: 'img/chat-backgrounds/eclipse-dark.webp', + light: 'img/chat-backgrounds/eclipse-light.webp', + glow: true, + }, + { + id: 'storm', + get label() { return t('screens.dm_background.storm'); }, + dark: 'img/chat-backgrounds/storm-dark.webp', + light: 'img/chat-backgrounds/storm-light.webp', + glow: true, + }, ]; export function listDmChatBackgrounds() { diff --git a/shine-UI/styles/features/chat.css b/shine-UI/styles/features/chat.css index 7f76aa35..155e4011 100644 --- a/shine-UI/styles/features/chat.css +++ b/shine-UI/styles/features/chat.css @@ -281,7 +281,11 @@ .dm-chat-screen > .dm-chat-wrap { flex: 1 1 auto; - width: 100%; + box-sizing: border-box; + /* Прокрутка обрезает всё за своим краем: поля экрана — внутри неё, чтобы свечение и тень пузырей не срезало. */ + width: calc(100% + 2 * var(--page-gutter)); + margin-inline: calc(-1 * var(--page-gutter)); + padding-inline: var(--page-gutter); min-width: 0; min-height: 0; overflow-y: auto; @@ -338,26 +342,65 @@ gap: 10px; } +/* Шрифт справки о шифровании. Файлы свои: приложение не обращается к сторонним серверам, когда открыт личный чат. */ +@font-face { + font-family: 'Source Serif 4'; + font-weight: 400 600; + font-display: swap; + src: url("../../assets/fonts/source-serif-4-cyrillic.woff2") format('woff2'); + unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +@font-face { + font-family: 'Source Serif 4'; + font-weight: 400 600; + font-display: swap; + src: url("../../assets/fonts/source-serif-4-latin.woff2") format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} + /* Ненавязчивая справка в начале DM-ленты: не является отправленным сообщением. */ .dm-security-notice { + font-family: 'Source Serif 4', Georgia, serif; width: min(100%, 460px); box-sizing: border-box; justify-self: center; margin: 24px auto 16px; padding: 0 18px; color: var(--text-secondary); - font-size: 12px; + font-size: .875rem; line-height: 1.55; text-align: center; + text-wrap: pretty; overflow-wrap: anywhere; } +/* Замок в стеклянном круге, как кнопка голосового; на светящихся фонах — их оттенок (dm-background.css). */ +.dm-security-notice__icon { + --lock-tone: var(--accent); + display: grid; + place-items: center; + width: 44px; + height: 44px; + margin: 0 auto 10px; + border-radius: 50%; + background: + radial-gradient(90% 70% at 32% 8%, color-mix(in srgb, var(--dm-light) 30%, transparent), transparent 72%), + linear-gradient(165deg, color-mix(in srgb, var(--lock-tone) 40%, transparent), color-mix(in srgb, var(--lock-tone) 13%, transparent)); + box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lock-tone) 52%, transparent), 0 0 18px -5px color-mix(in srgb, var(--lock-tone) 66%, transparent); + color: color-mix(in srgb, var(--lock-tone) 34%, var(--text-primary)); +} +.dm-security-notice__icon svg { width: 22px; height: 22px; } + .dm-security-notice__title { display: block; margin-bottom: 12px; - font-size: 13px; + color: var(--text-primary); + font-size: 1.125rem; + line-height: 1.35; font-weight: 600; + text-wrap: balance; } +.dm-security-notice p strong { color: color-mix(in srgb, var(--text-secondary) 25%, var(--text-primary)); font-weight: 600; } .dm-security-notice p { margin: 0; @@ -1283,6 +1326,7 @@ .dm-chat-screen .bubble.out { --dm-fill: var(--bubble-out); border-bottom-right-radius: 6px; } .dm-chat-screen :is(.bubble.in, .bubble.out) { background: + var(--dm-flash, none), radial-gradient(85% 70% at 74% 112%, var(--dm-glow) 0%, transparent 62%), radial-gradient(75% 95% at 4% -18%, var(--dm-sheen) 0%, transparent 64%), radial-gradient(60% 60% at 96% -6%, var(--dm-sheen-soft) 0%, transparent 70%), @@ -1297,6 +1341,10 @@ .dm-chat-screen .bubble-status--read { color: var(--action); } .dm-chat-screen .bubble-status--failed { color: var(--danger); } .dm-chat-screen .bubble-delivery-note { clear: both; } +/* Срок вложения и время — в одной строке; не влезают — время переносится под срок. */ +.dm-chat-screen .dm-attachment-expiry { float: left; line-height: 1rem; } +.dm-chat-screen .dm-attachment-expiry ~ .bubble-meta { margin-top: 6px; } +.dm-chat-screen .dm-attachment-expiry ~ .bubble-reply-preview { clear: both; } .dm-day-separator { display: flex; justify-content: center; margin: 8px 0; } .dm-day-separator span { padding: 3px 10px; border-radius: var(--radius-pill); color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border-subtle); font-size: var(--text-xs); line-height: var(--leading-xs); } diff --git a/shine-UI/styles/features/dm-background.css b/shine-UI/styles/features/dm-background.css index 3025b86e..3bb9f2bc 100644 --- a/shine-UI/styles/features/dm-background.css +++ b/shine-UI/styles/features/dm-background.css @@ -25,7 +25,12 @@ .dm-chat-screen.has-dm-bg .bubble.out { --dm-fill: color-mix(in srgb, var(--bubble-out) 68%, transparent); } .dm-chat-screen.has-dm-bg .dm-day-separator span { background: color-mix(in srgb, var(--surface) 74%, transparent); } -/* Под панелью ввода проезжают сообщения: размытие одно на экран, а не под каждым пузырём. */ +/* Под панелью ввода проезжают сообщения: размытие одно на экран, а не под каждым пузырём. Панель — до самых краёв + * экрана (обычно она уже на 4px с каждой стороны, на картинке это видно полосками); само поле остаётся на месте. */ +.composer-slot .dm-chat-input.has-dm-bg { + margin-inline: calc(-1 * var(--page-gutter)); + padding-inline: 10px; +} .dm-chat-input.has-dm-bg { --dm-fill: color-mix(in srgb, var(--bubble-out) 55%, transparent); background: color-mix(in srgb, var(--surface) 52%, transparent); @@ -34,6 +39,105 @@ } .dm-chat-input.has-dm-bg .dm-input::placeholder { color: var(--text-secondary); } +/* --- Светящиеся сообщения (has-dm-glow) --- + * Фон с `glow` в списке даёт сообщениям и полю ввода свой свет: тёмная сердцевина, свечение от краёв внутрь и искры на + * канте. Меняются только переменные материала «Объём» (chat.css). Цвета — пять --dm-tint-* в блоке фона ниже: они от + * картинки, а не от палитры, потому что фон один и тот же при любом акценте. */ +.dm-chat-screen.has-dm-glow .bubble.out { + --dm-fill: color-mix(in srgb, var(--dm-tint-core) 80%, transparent); + --dm-glow: color-mix(in srgb, var(--dm-tint-light) 32%, transparent); + --dm-sheen: color-mix(in srgb, var(--dm-tint-light) 44%, transparent); + --dm-sheen-soft: color-mix(in srgb, var(--dm-tint-light) 50%, transparent); + --dm-inner: inset 0 0 24px -6px color-mix(in srgb, var(--dm-tint-light) 62%, transparent), inset 0 14px 20px -12px color-mix(in srgb, var(--dm-tint-light) 78%, transparent); + --dm-drop: 0 -3px 16px -7px color-mix(in srgb, var(--dm-tint-light) 80%, transparent), 0 0 12px -4px color-mix(in srgb, var(--dm-tint-light) 44%, transparent), 0 10px 22px -14px rgb(0 0 0 / .75); + --dm-rim: + radial-gradient(46% 46% at 58% 0, var(--dm-tint-spark), transparent), + radial-gradient(34% 30% at 64% 100%, var(--dm-tint-spark), transparent), + radial-gradient(22% 60% at 100% 100%, color-mix(in srgb, var(--dm-tint-light) 55%, var(--dm-tint-spark)), transparent), + linear-gradient(180deg, color-mix(in srgb, var(--dm-tint-light) 72%, var(--dm-tint-spark)), color-mix(in srgb, var(--dm-tint-light) 46%, transparent) 42%, color-mix(in srgb, var(--dm-tint-light) 66%, transparent)); +} +.dm-chat-screen.has-dm-glow .bubble.in { + --dm-fill: color-mix(in srgb, var(--dm-tint-slate) 78%, transparent); + --dm-glow: color-mix(in srgb, var(--dm-tint-mist) 12%, transparent); + --dm-sheen: color-mix(in srgb, var(--dm-tint-mist) 22%, transparent); + --dm-sheen-soft: color-mix(in srgb, var(--dm-tint-mist) 16%, transparent); + --dm-inner: inset 0 0 22px -6px color-mix(in srgb, var(--dm-tint-mist) 46%, transparent); + --dm-drop: 0 10px 22px -14px rgb(0 0 0 / .75); + --dm-rim: + radial-gradient(30% 40% at 24% 0, var(--dm-tint-spark), transparent), + radial-gradient(26% 40% at 34% 100%, color-mix(in srgb, var(--dm-tint-light) 80%, var(--dm-tint-spark)), transparent), + linear-gradient(180deg, color-mix(in srgb, var(--dm-tint-mist) 62%, transparent), color-mix(in srgb, var(--dm-tint-mist) 38%, transparent)); +} +.dm-chat-screen.has-dm-glow .dm-voice-card__play { + --dm-rim: color-mix(in srgb, var(--dm-tint-mist) 42%, transparent); + background: color-mix(in srgb, var(--dm-tint-mist) 17%, transparent); + box-shadow: none; +} +.dm-chat-screen.has-dm-glow .dm-voice-card__wave:not(.dm-voice-card__wave--played) { color: color-mix(in srgb, currentColor 62%, transparent); } +.dm-chat-screen.has-dm-glow .dm-security-notice__icon { --lock-tone: var(--dm-tint-light); } +.dm-chat-screen.has-dm-glow :is(.dm-voice-card__meta, .dm-attachment-expiry, .bubble-meta, .dm-security-notice) { color: color-mix(in srgb, var(--text-secondary) 40%, var(--text-primary)); } +.dm-chat-input.has-dm-bg.has-dm-glow { + --dm-fill: color-mix(in srgb, var(--dm-tint-slate) 66%, transparent); + --dm-inner: inset 0 0 22px -8px color-mix(in srgb, var(--dm-tint-mist) 44%, transparent); + --dm-rim: + radial-gradient(26% 60% at 64% 0, var(--dm-tint-spark), transparent), + radial-gradient(26% 60% at 62% 100%, var(--dm-tint-spark), transparent), + radial-gradient(20% 60% at 6% 0, var(--dm-tint-spark), transparent), + color-mix(in srgb, var(--dm-tint-mist) 62%, transparent); + border-top-color: transparent; + background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--dm-tint-core) 46%, transparent)); +} +:root[data-theme='light'] .dm-chat-screen.has-dm-glow :is(.bubble.in, .bubble.out) { --dm-drop: 0 10px 22px -14px rgb(70 40 150 / .42); } + +/* «Затмение»: световые дуги. Видны целиком на любом экране; вспышки почти белые, поэтому тексту, который лежит прямо + * на фоне, нужна подложка. */ +[data-dm-bg='eclipse'] { --dm-tint-light: #9a60ff; --dm-tint-spark: #ecd6ff; --dm-tint-core: #2e2950; --dm-tint-slate: #2a2c49; --dm-tint-mist: #98a1d6; } +:root[data-theme='light'] [data-dm-bg='eclipse'] { --dm-tint-light: #a685f6; --dm-tint-spark: #d8c5ff; --dm-tint-core: #ebe1ff; --dm-tint-slate: #fbfaff; --dm-tint-mist: #a9a3d8; } +.dm-bg-image[data-dm-bg='eclipse'] { background-size: 100% 100%; } +.dm-chat-screen[data-dm-bg='eclipse'] :is(.dm-security-notice, .bubble--emoji-only .bubble-meta, .chat-unread-separator > span) { background: color-mix(in srgb, var(--dm-tint-core) 82%, transparent); border-radius: 18px; } +.dm-chat-screen[data-dm-bg='eclipse'] .dm-security-notice { padding-block: 18px; } +.dm-chat-screen[data-dm-bg='eclipse'] :is(.bubble--emoji-only .bubble-meta, .chat-unread-separator > span) { padding: 1px 8px; } + +/* «Гроза»: у сообщений отблески молний на кромке, у отправленных голосовых — фиолетовая кнопка и волна. */ +[data-dm-bg='storm'] { --dm-tint-light: #9a55f0; --dm-tint-spark: #efdcff; --dm-tint-core: #2c264a; --dm-tint-slate: #312e50; --dm-tint-mist: #a89cdc; --dm-wave-top: #e6d4ff; --dm-wave-bottom: #a878f6; } +:root[data-theme='light'] [data-dm-bg='storm'] { --dm-tint-light: #a67df3; --dm-tint-spark: #d9c6ff; --dm-tint-core: #ece2ff; --dm-tint-slate: #fbfaff; --dm-tint-mist: #aba2da; --dm-wave-top: #8a5be6; --dm-wave-bottom: #6a3fc8; } +.dm-chat-screen[data-dm-bg='storm'] .bubble.out { + --dm-flash: + url("../../img/chat-backgrounds/storm-flash-top.webp") right -30px top 0 / 136px 48px no-repeat, + url("../../img/chat-backgrounds/storm-flash-bottom.webp") right var(--dm-flash-x, 78px) bottom 0 / 136px 45px no-repeat, + radial-gradient(70% 130% at 106% 30%, color-mix(in srgb, var(--dm-tint-light) 34%, transparent), transparent 72%), + linear-gradient(90deg, color-mix(in srgb, var(--dm-tint-mist) 20%, transparent), transparent 46%); + --dm-sheen: color-mix(in srgb, var(--dm-tint-mist) 30%, transparent); + --dm-glow: color-mix(in srgb, var(--dm-tint-light) 24%, transparent); + --dm-rim: + radial-gradient(40% 40% at 72% 100%, var(--dm-tint-spark), transparent), + linear-gradient(180deg, color-mix(in srgb, var(--dm-tint-light) 34%, var(--dm-tint-spark)), color-mix(in srgb, var(--dm-tint-light) 62%, transparent) 30%, color-mix(in srgb, var(--dm-tint-light) 60%, transparent) 74%, color-mix(in srgb, var(--dm-tint-light) 62%, var(--dm-tint-spark))); + --dm-inner: inset 0 0 22px -7px color-mix(in srgb, var(--dm-tint-light) 58%, transparent), inset 0 10px 18px -12px color-mix(in srgb, var(--dm-tint-light) 60%, transparent); +} +/* Днём тонкая молния на светлом стекле читается пятном: остаётся только свет. */ +:root[data-theme='light'] .dm-chat-screen[data-dm-bg='storm'] .bubble.out { --dm-flash: radial-gradient(70% 130% at 106% 30%, color-mix(in srgb, var(--dm-tint-light) 34%, transparent), transparent 72%); } +/* Отблески не на одном и том же месте у соседних сообщений. */ +.dm-chat-screen[data-dm-bg='storm'] .bubble.out:nth-child(3n) { --dm-flash-x: 112px; } +.dm-chat-screen[data-dm-bg='storm'] .bubble.out:nth-child(3n + 1) { --dm-flash-x: 54px; } +.dm-chat-screen[data-dm-bg='storm'] .bubble.out:has(.dm-attachment-stack) { --dm-flash-x: 46px; } /* между сроком вложения и временем */ +.dm-chat-screen[data-dm-bg='storm'] .bubble.in { + --dm-sheen: color-mix(in srgb, var(--dm-tint-mist) 52%, transparent); + --dm-sheen-soft: color-mix(in srgb, var(--dm-tint-mist) 26%, transparent); + --dm-inner: inset 0 0 24px -7px color-mix(in srgb, var(--dm-tint-mist) 66%, transparent); + --dm-rim: linear-gradient(180deg, color-mix(in srgb, var(--dm-tint-mist) 40%, var(--dm-tint-spark)), color-mix(in srgb, var(--dm-tint-mist) 58%, transparent) 34%, color-mix(in srgb, var(--dm-tint-mist) 56%, transparent) 70%, color-mix(in srgb, var(--dm-tint-mist) 74%, var(--dm-tint-spark))); +} +.dm-chat-screen[data-dm-bg='storm'] .bubble.in:not(:has(.dm-attachment-stack)) { + --dm-flash: + url("../../img/chat-backgrounds/storm-flash-top.webp") right -16px top 0 / 136px 48px no-repeat, + url("../../img/chat-backgrounds/storm-flash-bottom.webp") left -34px bottom 0 / 120px 40px no-repeat; +} +:root[data-theme='light'] .dm-chat-screen[data-dm-bg='storm'] .bubble.in:not(:has(.dm-attachment-stack)) { --dm-flash: none; } +.dm-chat-screen[data-dm-bg='storm'] .bubble.out .dm-voice-card__play { + --dm-rim: linear-gradient(160deg, var(--dm-tint-spark), color-mix(in srgb, var(--dm-tint-light) 60%, transparent) 60%); + background: radial-gradient(90% 70% at 34% 8%, color-mix(in srgb, var(--dm-tint-spark) 38%, transparent), transparent 72%), linear-gradient(165deg, color-mix(in srgb, var(--dm-tint-light) 82%, var(--dm-tint-core)), color-mix(in srgb, var(--dm-tint-light) 42%, var(--dm-tint-core))); +} +.dm-chat-screen[data-dm-bg='storm'] .bubble.out .dm-voice-card__wave:not(.dm-voice-card__wave--played) .dm-voice-wave__bar { background: linear-gradient(180deg, var(--dm-wave-top), var(--dm-wave-bottom)); opacity: .86; } + /* --- Шторка «Фон чата» --- */ .dm-bg-sheet .sheet__card { width: min(100%, 420px); } .dm-bg-sheet__content { display: grid; gap: 14px; } @@ -67,6 +171,8 @@ } .dm-bg-option__bubble { width: 58%; height: 13px; border-radius: 7px 7px 7px 2px; background: color-mix(in srgb, var(--surface) 80%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 16%, transparent); } .dm-bg-option__bubble.is-out { width: 66%; justify-self: end; border-radius: 7px 7px 2px 7px; background: color-mix(in srgb, var(--bubble-out) 80%, transparent); } +.has-dm-glow .dm-bg-option__bubble { background: color-mix(in srgb, var(--dm-tint-slate) 80%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dm-tint-mist) 46%, transparent); } +.has-dm-glow .dm-bg-option__bubble.is-out { background: color-mix(in srgb, var(--dm-tint-core) 80%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dm-tint-light) 70%, transparent), inset 0 0 8px -2px var(--dm-tint-light); } .dm-bg-option__check { position: absolute; top: 7px; right: 7px; display: none; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); } .dm-bg-option__check svg { width: 14px; height: 14px; stroke-width: 2.6; } .dm-bg-option[aria-pressed='true'] { color: var(--text-primary); } diff --git a/shine-UI/styles/features/profile-support.css b/shine-UI/styles/features/profile-support.css index 9f3d4678..f677af91 100644 --- a/shine-UI/styles/features/profile-support.css +++ b/shine-UI/styles/features/profile-support.css @@ -6,16 +6,18 @@ /* Строка и карточка лежат в одной ячейке, друг на друге: высоту блока ведёт только карточка (0fr ↔ 1fr), строка не тянется и задаёт минимум. Двумя рядами одной сетки (1fr 0fr ↔ 0fr 1fr) нельзя: сумма долей — всегда полная высота - карточки, поэтому блок не сжимался, а строка растягивалась на всю его высоту и скачком возвращалась к 64px. */ -.profile-support { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; overflow: hidden; } + карточки, поэтому блок не сжимался, а строка растягивалась на всю его высоту и скачком возвращалась к 64px. + Ряд панели — только то, что карточка добавляет к строке (сдвиг на --ps-line вниз и обратно): высота идёт от карточки + ровно к строке и мягко тормозит. От карточки к нулю она упиралась бы в строку на полном ходу — рывок в конце. */ +.profile-support { --ps-line: 64px; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; overflow: hidden; } .profile-support > * { display: grid; grid-area: 1 / 1; } -.profile-support__panel { grid-template-rows: 0fr; opacity: 0; visibility: hidden; } +.profile-support__panel { grid-template-rows: 0fr; margin-top: var(--ps-line); opacity: 0; visibility: hidden; } .profile-support[data-expanded='true'] .profile-support__panel { grid-template-rows: 1fr; opacity: 1; visibility: visible; } .profile-support[data-expanded='true'] .profile-support__line { opacity: 0; visibility: hidden; } .profile-support[data-expanded='true'] .profile-support__summary > * { opacity: 0; } /* Сжимается сама карточка — скругление и кант остаются целыми. После «выезда» орбита и искры выходят за её край (до 10px), поэтому обрезку снимаем. */ -.profile-support .profile-support-stats { min-height: 0; overflow: hidden; } +.profile-support .profile-support-stats { min-height: 0; margin-top: calc(-1 * var(--ps-line)); overflow: hidden; } .profile-support.is-settled, .profile-support.is-settled .profile-support-stats { overflow: visible; } /* Размытие фона — только у стоящей карточки: в движении за ней ровный фон, а пересчёт размытия на каждом кадре @@ -36,7 +38,7 @@ justify-content: center; gap: var(--space-1) var(--space-2); width: 100%; - min-height: 64px; + min-height: var(--ps-line); padding: 10px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); @@ -223,11 +225,12 @@ /* Сначала гаснет уходящий слой, потом проявляется другой: к моменту появления сумм блок уже сжат до строки, тексты не накладываются. Подложка строки проявляется раньше её сумм — без провала в фон между слоями. Только переходы: повторный тап разворачивает их с текущего места, таймеров нет. Переход берётся у состояния, в которое идём. */ - .profile-support__panel { transition: grid-template-rows 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 120ms ease-out, visibility 0s 240ms; } + /* Сворачивание мягче раскрытия: невидимый хвост длинной истории уходит сразу, а край в видимой части плавно тормозит. */ + .profile-support__panel { transition: grid-template-rows 360ms cubic-bezier(0.32, 0.72, 0, 1), opacity 180ms ease-in-out, visibility 0s 360ms; } .profile-support[data-expanded='true'] .profile-support__panel { transition: grid-template-rows 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 140ms 60ms ease-out, visibility 0s; } - .profile-support__line { transition: opacity 80ms 40ms ease-out, visibility 0s; } + .profile-support__line { transition: opacity 160ms 80ms ease-out, visibility 0s; } .profile-support[data-expanded='true'] .profile-support__line { transition: opacity 80ms 20ms ease-out, visibility 0s 100ms; } - .profile-support__summary > * { transition: opacity 120ms 100ms ease-out; } + .profile-support__summary > * { transition: opacity 180ms 150ms ease-out; } .profile-support[data-expanded='true'] .profile-support__summary > * { transition: opacity 80ms ease-out; } .profile-support__summary { transition: background-color var(--duration-fast) ease, transform 180ms cubic-bezier(0.175, 0.885, 0.32, 1.275); } .profile-support__summary:active:not(:disabled) { transform: scale(0.97); } diff --git a/shine-UI/tests/dm-chat-background.test.mjs b/shine-UI/tests/dm-chat-background.test.mjs index da25d540..9c3a4d13 100644 --- a/shine-UI/tests/dm-chat-background.test.mjs +++ b/shine-UI/tests/dm-chat-background.test.mjs @@ -102,6 +102,29 @@ test('картинки передаются в CSS абсолютными адр } }); +test('оттенок сообщений привязан к фону, который есть в списке', () => { + const css = file('styles/features/dm-background.css'); + const tinted = new Set([...css.matchAll(/\[data-dm-bg='([^']+)'\]/g)].map(([, id]) => id)); + for (const id of tinted) assert.ok(findDmChatBackground(id), `в стилях остался оттенок удалённого фона «${id}»`); + // Светящимся сообщениям нужны все пять цветов в обеих темах: без одного из них пропадёт вся заливка пузыря. + const glowing = listDmChatBackgrounds().filter(({ glow }) => glow); + assert.ok(glowing.length >= 2); + for (const { id } of glowing) { + for (const prefix of ['\n', "\n:root[data-theme='light'] "]) { + const start = css.indexOf(`${prefix}[data-dm-bg='${id}'] {`); + assert.notEqual(start, -1, `${id}: нет блока цветов (${prefix.trim() || 'тёмная тема'})`); + const block = css.slice(start, css.indexOf('}', start)); + for (const name of ['light', 'spark', 'core', 'slate', 'mist']) assert.match(block, new RegExp(`--dm-tint-${name}: #[0-9a-f]{6};`), `${id}: --dm-tint-${name}`); + } + } + // Картинки из стилей (отблески молний) лежат в приложении. + for (const [, path] of css.matchAll(/url\("([^"]+)"\)/g)) assert.ok(existsSync(new URL(path, new URL('styles/features/', root))), path); + // Оттенок нужен и ленте, и полю ввода, и плитке в шторке – все они помечаются id фона. + assert.match(file('js/pages/chat-view.js'), /\[screen, form, backgroundLayer\]\.forEach\(\(node\) => \{ node\.dataset\.dmBg = /); + assert.match(file('js/pages/chat-view.js'), /classList\.toggle\('has-dm-glow', Boolean\(background\?\.glow\)\)/); + assert.match(file('js/components/dm-background-sheet.js'), /preview\.dataset\.dmBg = id/); +}); + test('объём сообщений: у эмодзи без пузыря нет канта, размытия на каждом пузыре нет', () => { const css = file('styles/features/chat.css').replace(/\r\n/g, '\n'); assert.match(css, /\.dm-chat-screen \.bubble:not\(\.bubble--emoji-only\)::before/); diff --git a/shine-UI/tests/dm-security-notice.test.mjs b/shine-UI/tests/dm-security-notice.test.mjs index ecc6e277..25e218a3 100644 --- a/shine-UI/tests/dm-security-notice.test.mjs +++ b/shine-UI/tests/dm-security-notice.test.mjs @@ -44,6 +44,19 @@ test('уведомление формируется только локальн assert.doesNotMatch(functionBody, /authService|addSignedMessageToChat|sendDirectMessage|AddBlock|fetch\(/); }); +test('замок — значок приложения, шрифт справки лежит в приложении, а не грузится со стороны', () => { + const body = chat.slice(chat.indexOf('function createDmEncryptionNotice()'), chat.indexOf('function renderLog(')); + assert.match(body, /iconHtml\('lock'\)/); + assert.doesNotMatch(body, /🔒/u); + const fonts = [...css.matchAll(/@font-face \{[^}]*url\("([^"]+)"\)/g)].map(([, path]) => path); + assert.equal(fonts.length, 2, 'кириллица и латиница'); + for (const path of fonts) { + assert.match(path, /^\.\.\/\.\.\/assets\/fonts\//); + const data = readFileSync(new URL(path, new URL('../styles/features/', import.meta.url))); + assert.equal(data.toString('latin1', 0, 4), 'wOF2', path); + } +}); + test('уведомление имеет собственные серые стили и не оформляется как bubble', () => { assert.match(css, /\.dm-security-notice\s*\{[\s\S]*?color: var\(--text-secondary\)/); assert.doesNotMatch(chat.slice(chat.indexOf('function createDmEncryptionNotice()'), chat.indexOf('function renderLog(')), /className = ['"`]bubble/); diff --git a/shine-UI/tests/support-phase2.test.mjs b/shine-UI/tests/support-phase2.test.mjs index 81d1f0ae..e879798a 100644 --- a/shine-UI/tests/support-phase2.test.mjs +++ b/shine-UI/tests/support-phase2.test.mjs @@ -68,6 +68,10 @@ test('support card collapses as one block: layers share a cell, only the card dr assert.match(rule('.profile-support'), /align-items: start/); assert.match(rule('.profile-support__panel'), /grid-template-rows: 0fr/); assert.match(rule('.profile-support__panel'), /visibility: hidden/); + // Ряд панели — только добавка карточки к строке: иначе сжатие упирается в строку на полном ходу и кончается рывком. + assert.match(rule('.profile-support__panel'), /margin-top: var\(--ps-line\)/); + assert.match(rule('.profile-support .profile-support-stats'), /margin-top: calc\(-1 \* var\(--ps-line\)\)/); + assert.match(rule('.profile-support__summary'), /min-height: var\(--ps-line\)/); assert.match(rule(".profile-support[data-expanded='true'] .profile-support__panel"), /grid-template-rows: 1fr/); assert.match(rule(".profile-support[data-expanded='true'] .profile-support__line"), /visibility: hidden/); // Сияние ждёт конца перехода именно той панели, которая теперь анимируется.