The single 1700-line app.slint becomes a design system and screens that later waves can compose: - theme.slint: colour, radius, spacing and type tokens (dark and light, a runtime font scale); icons.slint: Lucide icons as tintable images. - components/: Button, IconButton, TextField, SearchBox, Select, Toggle, Slider, SegmentedTabs, Avatar, badges, Card, Meter, NavItem, ListItem, PopupMenu, Tooltip, Modal, Toast, ResizeHandle, Spinner, RichText and the EmojiPicker. - shells/: the desktop frame (server rail, top bar, sidebar with the user card) and the phone frame with a bottom navigation, switched at a breakpoint from the settings. - screens/: today's screens re-skinned (channels, chat, streams panel and viewer, settings page, home, dialogs, phone pages); all callbacks and properties keep their behaviour. Navigation state is the Nav global. On the Rust side app.rs keeps setup and event glue; servers.rs, chat.rs, settings_page.rs and appearance.rs hold the logic, vm/ the pure view models, bind/ the callbacks, dev.rs the development switches. Models are created once and updated row by row (vm::list::sync); each chat tab owns its lines model, so a message appends one row. Emoji come from the bundled Twemoji archive through a size-bounded image cache, split into runs that wrap with the text. New settings ui.theme, ui.font_scale, ui.narrow_breakpoint and ui.image_cache_mb apply live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
import { Theme } from "../theme.slint";
|
|
|
|
// A tinted icon from `Icons`.
|
|
export component Icon inherits Image {
|
|
in property <length> size: Theme.icon-md;
|
|
in property <brush> tint: Theme.icon;
|
|
width: size;
|
|
height: size;
|
|
colorize: tint;
|
|
image-fit: contain;
|
|
accessible-role: AccessibleRole.none;
|
|
}
|
|
|
|
// A spinning indicator of work in progress: dots on a circle, one lit
|
|
// after the other.
|
|
export component Spinner inherits Rectangle {
|
|
in property <length> size: 20px;
|
|
in property <color> tint: Theme.accent-text;
|
|
in property <bool> running: true;
|
|
property <int> step;
|
|
width: size;
|
|
height: size;
|
|
accessible-role: AccessibleRole.progress-indicator;
|
|
accessible-label: @tr("Loading");
|
|
Timer {
|
|
interval: 90ms;
|
|
running: root.running;
|
|
triggered => { root.step = mod(root.step + 1, 8); }
|
|
}
|
|
for i in 8: Rectangle {
|
|
property <angle> a: i * 45deg;
|
|
property <length> dot: root.size / 5;
|
|
x: root.size / 2 + (root.size / 2 - dot / 2) * cos(a) - dot / 2;
|
|
y: root.size / 2 + (root.size / 2 - dot / 2) * sin(a) - dot / 2;
|
|
width: dot;
|
|
height: dot;
|
|
border-radius: dot / 2;
|
|
background: root.tint;
|
|
opacity: mod(i - root.step + 8, 8) == 0 ? 1.0 : 0.15 + (8 - mod(root.step - i + 8, 8)) * 0.08;
|
|
}
|
|
}
|