Личный чат: фоны «Затмение» и «Гроза», новая справка о шифровании, плавное сворачивание «Поддержки»

- Фоны «Затмение» и «Гроза» в двух темах. Сообщения, голосовые и поле ввода подхватывают свет фона:
  общий материал has-dm-glow, у фона только пять цветов на тему.
- Срок вложения и время — в одной строке; свечение пузырей не срезается краем ленты.
- Справка о шифровании: замок-значок вместо эмодзи, шрифт Source Serif 4 из файлов приложения (OFL).
- Карточка «Поддержка» сворачивается мягко и без рывка в конце: анимируется только её добавка к строке.

Версия клиента 1.21.18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pixel
2026-12-03 18:12:58 +03:00
co-authored by Claude Opus 5.5
parent e4c96df66e
commit d09431da65
23 changed files with 262 additions and 22 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@@ -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 = `<span class="dm-bg-option__bubble"></span><span class="dm-bg-option__bubble is-out"></span><span class="dm-bg-option__check">${iconHtml('check')}</span>`;
preview.dataset.dmBg = id;
paintDmChatBackground(preview, findDmChatBackground(id));
const name = document.createElement('span');
name.className = 'dm-bg-option__name';
+1
View File
@@ -33,6 +33,7 @@ const paths = {
profile: '<circle cx="12" cy="7" r="4"/><path d="M4 21v-2a8 8 0 0 1 16 0v2"/>',
share: '<path d="m14.4 3.1 7.2 7.1-7.2 6.6v-4.4C8.5 12.4 5 15.1 2.4 20c.4-7.6 4.4-11.7 12-12.4Z"/>',
search: '<circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/>',
lock: '<path d="M8.2 10.5V7.8a3.8 3.8 0 0 1 7.6 0v2.7"/><rect x="5" y="10.5" width="14" height="10" rx="3"/><path d="M12 14.4v2.2"/>',
link: '<path d="M10 14a4.5 4.5 0 0 0 6.4 0l3.2-3.2a4.5 4.5 0 0 0-6.4-6.4L12 5.6"/><path d="M14 10a4.5 4.5 0 0 0-6.4 0l-3.2 3.2a4.5 4.5 0 0 0 6.4 6.4l1.2-1.2"/>',
gift: '<rect x="3" y="8" width="18" height="5" rx="1"/><path d="M5 13v7a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-7M12 8v13M12 8S10.5 3 8 3.5 7 8 12 8Zm0 0s1.5-5 4-4.5S17 8 12 8Z"/>',
plus: '<path d="M12 5v14M5 12h14"/>',
+3 -1
View File
@@ -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",
+3 -1
View File
@@ -1252,7 +1252,9 @@
"title": "Фон чата",
"hint": "Фон меняется только в этом чате и только на этом устройстве. Собеседник его не видит.",
"none": "Без фона",
"nebula": "Туманность"
"nebula": "Туманность",
"eclipse": "Затмение",
"storm": "Гроза"
},
"dm_mute_menu": {
"text_001": "Включить звук",
+11 -3
View File
@@ -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();
@@ -3,6 +3,7 @@ import { t } from '../i18n/index.js';
// Фоны личных чатов. Новый фон — одна запись здесь, подпись в обоих словарях (screens.dm_background.<id>)
// и две картинки в img/chat-backgrounds/: для тёмной и светлой темы (вертикальные, до 250 КБ).
// id хранится у пользователей (dm-chat-prefs.js): не переименовывать. Выбор чата — только id.
// glow: сообщения и поле ввода светятся оттенком фона; сами цвета — блок [data-dm-bg='<id>'] в 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() {
+51 -3
View File
@@ -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); }
+107 -1
View File
@@ -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); }
+11 -8
View File
@@ -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); }
@@ -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/);
@@ -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/);
+4
View File
@@ -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/);
// Сияние ждёт конца перехода именно той панели, которая теперь анимируется.