feat(client): redesign native UI, themes, settings and avatars

Separate conversation drafts and voice view state, add native settings and restricted CSS themes, implement validated avatar cropping, and refresh dependencies with documented desktop compatibility backports.
This commit is contained in:
Loki 2026-10-24 14:23:48 +02:00
parent 44d284a568
commit 8e5ab56611
Signed by: boba
GPG key ID: 253067914055423B
276 changed files with 53546 additions and 3399 deletions

View file

@ -0,0 +1,110 @@
import { Theme, ActionButton } from "../theme.slint";
import { AudioSlider, ThemeInput, ThemeEditor } from "../controls.slint";
component ThemeChoice inherits Rectangle {
in property <string> label;
in property <bool> selected;
in property <color> preview-background;
in property <color> preview-sidebar;
in property <color> preview-ink;
callback clicked();
height: 142px;
border-radius: 9px;
border-width: keyboard.has-focus || root.selected ? 2px : 1px;
border-color: root.selected || keyboard.has-focus ? Theme.accent : Theme.border;
background: pointer.has-hover ? Theme.bg-hover : Theme.bg-surface;
accessible-role: button;
accessible-label: root.label;
VerticalLayout {
padding: 8px; spacing: 10px;
Rectangle {
height: 86px; background: root.preview-background; border-radius: 5px; clip: true;
Rectangle { width: 23%; height: 100%; background: root.preview-sidebar; }
Rectangle { x: parent.width * 0.29; y: 15px; width: 41%; height: 6px; background: root.preview-ink; opacity: 0.8; border-radius: 2px; }
Rectangle { x: parent.width * 0.29; y: 29px; width: 59%; height: 4px; background: root.preview-ink; opacity: 0.28; border-radius: 2px; }
Rectangle { x: parent.width * 0.29; y: 40px; width: 45%; height: 4px; background: root.preview-ink; opacity: 0.28; border-radius: 2px; }
Rectangle { x: parent.width * 0.29; y: 61px; width: 60%; height: 13px; background: root.preview-sidebar; border-radius: 3px; }
}
HorizontalLayout {
Text { text: root.label; color: Theme.text-primary; font-size: Math.max(Theme.font-size - 3px, 11px); font-weight: 500; overflow: elide; horizontal-stretch: 1; }
Text { text: root.selected ? "✓" : ""; color: Theme.accent; width: 16px; font-size: Math.max(Theme.font-size - 2px, 11px); }
}
}
pointer := TouchArea { clicked => { keyboard.focus(); root.clicked(); } }
keyboard := FocusScope { key-pressed(event) => { if event.text == " " || event.text == "\n" { root.clicked(); return accept; } return reject; } }
}
export component AppearanceSettings inherits Rectangle {
in-out property <string> theme-mode;
in-out property <string> theme-css;
in-out property <string> theme-file-path;
in-out property <float> text-size;
in property <string> theme-error;
in property <string> theme-status;
in property <bool> theme-preview;
callback theme-selected(string);
callback text-size-changed(float);
callback preview-theme(string);
callback apply-theme(string);
callback reset-theme();
callback import-theme(string);
callback export-theme(string);
VerticalLayout {
spacing: 0; alignment: start;
Text { text: "Тема приложения"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: "Один выбор для чата, комнат и настроек. Можно изменить в любой момент."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 20px; }
HorizontalLayout {
spacing: 12px;
ThemeChoice { label: "Светлая"; selected: root.theme-mode == "light"; preview-background: #f5f4f2; preview-sidebar: #e6e4e0; preview-ink: #353330; clicked => { root.theme-selected("light"); } }
ThemeChoice { label: "Тёмная"; selected: root.theme-mode == "dark"; preview-background: #272729; preview-sidebar: #202022; preview-ink: #e9e7e4; clicked => { root.theme-selected("dark"); } }
ThemeChoice { label: "Мега-тёмная"; selected: root.theme-mode == "black"; preview-background: #080808; preview-sidebar: #131313; preview-ink: #dedbd5; clicked => { root.theme-selected("black"); } }
ThemeChoice { label: "Своя тема"; selected: root.theme-mode == "custom"; preview-background: Theme.bg-base; preview-sidebar: Theme.bg-surface; preview-ink: Theme.accent; clicked => { root.theme-selected("custom"); } }
}
Rectangle { height: 29px; }
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 24px; }
HorizontalLayout {
Text { text: "Размер текста"; color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; horizontal-stretch: 1; }
Text { text: Math.round(root.text-size) + " px"; color: Theme.text-secondary; font-size: Math.max(Theme.font-size - 2px, 11px); horizontal-alignment: right; }
}
Rectangle { height: 9px; }
AudioSlider { minimum: 12; maximum: 22; value <=> root.text-size; changed(value) => { root.text-size-changed(value); } }
Text { text: "Меняет масштаб текста во всём приложении."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 29px; }
if root.theme-mode == "custom" : VerticalLayout {
spacing: 12px; alignment: start;
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 8px; }
HorizontalLayout {
Text { text: "Редактор темы"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; horizontal-stretch: 1; }
if root.theme-preview : Text { text: "Предпросмотр"; color: Theme.accent; font-size: Math.max(Theme.font-size - 3px, 11px); }
}
Text { text: "CSS-переменные в блоке :root меняют цвета и размер текста. Обычные CSS-селекторы, стили размещения и внешние ресурсы не поддерживаются."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeEditor { text <=> root.theme-css; height: 220px; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Предпросмотр"; clicked => { root.preview-theme(root.theme-css); } }
ActionButton { text: "Применить"; active: true; clicked => { root.apply-theme(root.theme-css); } }
Rectangle { horizontal-stretch: 1; }
ActionButton { text: "Сбросить"; quiet: true; clicked => { root.reset-theme(); } }
}
Text { text: "Основные переменные: --vnox-bg, --vnox-surface, --vnox-text, --vnox-accent, --vnox-font-size. Полный список описан в документации тем."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 4px, 11px); wrap: word-wrap; }
Rectangle { height: 8px; }
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 8px; }
Text { text: "Файл темы"; color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; }
Text { text: "Введи локальный путь к .css, чтобы импортировать тему или сохранить её в файл."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeInput { text <=> root.theme-file-path; placeholder-text: "Например: /home/user/themes/my-vnox.css"; accepted => { root.import-theme(root.theme-file-path); } }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Импортировать"; clicked => { root.import-theme(root.theme-file-path); } }
ActionButton { text: "Экспортировать"; clicked => { root.export-theme(root.theme-file-path); } }
Rectangle { horizontal-stretch: 1; }
}
}
if root.theme-error != "" : Text { text: root.theme-error; color: Theme.danger; font-size: Math.max(Theme.font-size - 2px, 11px); wrap: word-wrap; }
if root.theme-status != "" : Text { text: root.theme-status; color: Theme.success; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 26px; }
}
}