Merge main (ad20979) into phase4/session-seam

Main brings the merge of phase5/ui-vm: the toolkit-free crates/voelin-ui-vm
crate and the logic/bind split of crates/voelin-ui. Conflicts, and what each
resolution keeps:

- crates/voelin-ui/src/settings_pages.rs: main deleted it (it is
  settings_pages/{mod,bind}.rs and voelin-ui-vm's settings_pages/logic.rs
  now), this branch had changed its voelin_core::identity paths. Deleted; the
  paths are voelin_core::ts::identity:: in bind.rs and in logic.rs.
- crates/voelin-ui/src/identities.rs: the module comment names
  voelin_core::ts::identity::import_new (this branch) and settings_pages/
  (main).
- docs/architecture.md: the voelin-core row of this branch with the
  voelin-ui-vm and voelin-ui rows of main.

Not conflicts, but needed to compile: voelin-ui-vm named the in-tree
voelin-model by path, which this branch moved to the protocol repository
(workspace dependency), and imported voelin_core::identity::Found, which is
voelin_core::ts::identity::Found. Cargo.lock merged without a conflict and
resolves with --locked; THIRD_PARTY_NOTICES.md is up to date
(scripts/notices.sh --check).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-24 10:32:05 +03:00
commit e13d401b9c
73 files changed
+11836 -5281

No files matched your search

+116 -25
View File
@@ -4,14 +4,31 @@
(`crates/voelin-android` runs the same window). It uses Slint's software
renderer, the Inter font, Lucide icons and Twemoji; the look follows the
design mockups (deep navy panels, a blue accent, a server rail, a top bar, a
sidebar with the user card, an optional right panel).
sidebar with the user card, an optional right panel). What its screens show
is made by `crates/voelin-ui-vm`, which knows no UI toolkit ([Two
crates](#two-crates)).
![Server page](screenshots/desktop-server.png)
## Structure
```
crates/voelin-ui/
crates/voelin-ui-vm/ view models and state, no UI toolkit
assets/twemoji.bin the Twemoji SVGs packed by scripts/pack-twemoji.py
src/
image.rs color.rs ImageRef (a picture by where it comes from), Rgb
list.rs list::diff(old, new) → Changes (update, remove, insert by index)
bridge.rs the bridge structs as plain values (Arc<str>, ImageRef, Rgb, Vec)
studio_bridge.rs the same for the Stream Studio
state.rs AppState, SessionView, Tab, Msg: what the client knows apart from
the window, generic over the list type of a chat tab's lines
servers.rs tree.rs chat.rs social.rs home.rs streams.rs avatar.rs studio/mod.rs
pure view models (engine state → bridge structs), unit-tested
settings.rs the UI's settings keys, the audio form
settings_pages/logic.rs, studio/logic.rs
the decisions of the settings pages and of the Stream Studio
bbcode.rs emoji.rs chat formatting; the Twemoji archive, text → runs of text and emoji
crates/voelin-ui/ the Slint front end
ui/
app.slint MainWindow: picks the shell, puts the page's screens in it, dialogs
theme.slint Theme global: design tokens (colours, radii, spacing, type)
@@ -35,28 +52,98 @@ crates/voelin-ui/
studio-parts (the studio's pieces), studio (its page, its
phone layout)
assets/ fonts/ (Inter, OFL), icons/ (Lucide, ISC), logo.svg
assets/twemoji.bin the Twemoji SVGs packed by scripts/pack-twemoji.py
src/
app.rs setup, App state, event dispatch
app.rs setup, the Slint models (`Models`), event dispatch; `App` holds
a `voelin_ui_vm::state::AppState` and the window
servers.rs chat.rs members.rs streams.rs settings_page.rs appearance.rs
home.rs social.rs messages.rs events.rs settings_pages.rs previews.rs
studio.rs popout.rs the logic of each area (social.rs: contacts, the bell and the
search; previews.rs: pictures in chat; studio.rs: the Stream
Studio's controller; popout.rs: the stream's own window)
vm/ pure view models (engine state → Slint structs), unit-tested
bind/ callbacks of each area, wired once
home.rs social.rs messages.rs events.rs previews.rs popout.rs
the Slint side of each area (social.rs: contacts, the bell and the
search; previews.rs: pictures in chat; popout.rs: the stream's own
window)
settings_pages/ mod.rs (Pages), bind.rs: the settings pages on the Bridge
studio/ mod.rs (StudioState), bind.rs: the Stream Studio's windows and engine
bind/ callbacks of each area, wired once; convert.rs, convert/items.rs
(plain values → Slint values), rows.rs (a Slint model kept in step
with a plain list)
images.rs the image cache (LRU, bounded by `ui.image_cache_mb`)
emoji.rs the Twemoji archive, text → runs of text and emoji
dev.rs development switches (screenshots, sample data)
```
Models are created once (`app::Models`) and updated row by row with
`vm::list::sync`, which keeps the rows shared at both ends and changes,
`bind::rows::Rows::sync`, which finds what changed with
`voelin_ui_vm::list::diff`, keeps the rows shared at both ends and changes,
inserts or removes the rest: a client that starts talking changes one row of
the tree. Every chat tab owns a `VecModel` of its lines; the chat view shows
the selected tab's model, so a new message is one `push` and switching tabs
swaps the model. Lists that can grow (channels, messages, notices, the emoji
grid) use `ListView`, which builds only the visible rows.
the tree. Every chat tab owns a `Rows` of its lines (`app::ChatRows`); the
chat view shows the selected tab's model, so a new message is one `push` and
switching tabs swaps the model. Lists that can grow (channels, messages,
notices, the emoji grid) use `ListView`, which builds only the visible rows.
## Two crates
`voelin-ui-vm` turns engine state into rows and decides what the controls
change; it has no `slint` and no `gpui` in its dependency tree, and the
Slint crate imports it as `vm` (`use voelin_ui_vm as vm`), so `vm::chat` in
this file is `voelin_ui_vm::chat`. The boundary:
- **Values.** A picture is an `ImageRef` (`Arc<ImageSource>`: a file of the
engine's cache with its stamp, decoded RGBA pixels, SVG or memory bytes,
or none; `size()` reads a file's header). A colour is an `Rgb(u32)`, a
shared string an `Arc<str>`, a list a `Vec`. The bridge structs (51 in
`bridge.rs`, 10 in `studio_bridge.rs`) are plain `Clone + PartialEq + Debug`
structs with the field names of the Slint structs in `bridge.slint` and
`studio-bridge.slint`; `MytsBadge` and `MytsForm`, which have no data source
in this build, stay Slint-only.
- **Lists.** `list::diff(old, new)` gives `Changes`: updates, removals and
insertions by index, in the order to apply them. `bind/rows.rs` applies
them to a `VecModel` and converts only the changed rows; a GPUI view
re-renders from the list and needs no `Changes`.
- **Conversion.** The Slint crate owns the temporary `From` impls from the
plain structs to the Slint ones (`bind/convert/items.rs`), the colour,
picture and model helpers (`bind/convert.rs`) and the decoded-picture cache
(`images.rs`).
- **State.** `AppState<L>` (the servers, their sessions, the settings the
screens show, the dialogs' targets), `SessionView<L>` and `Tab<L>` live in
`voelin_ui_vm::state`, generic over the list type `L` of a chat tab's
lines: the Slint app plugs in `Rows<ChatLine>` (`app::ChatRows`), a front
end that re-renders can use a `Vec`. `App.state` is the one `AppState`.
- **Logic and bind.** An area that interleaves decisions with Bridge writes
is split into `<area>/logic.rs` in `voelin-ui-vm` (functions over the
settings service, the `AppState` and plain rows; they return rows,
commands or messages for the status line, and write no Bridge) and
`<area>/bind.rs` in `voelin-ui` (the Bridge and model writes, windows,
timers, threads, engine commands). Done: `settings_pages` and `studio`.
The pure code is tested in `voelin-ui-vm` (`cargo test -p voelin-ui-vm`,
no display); the Slint crate's tests are what needs the window types.
### Controllers still to split
Counted as `.set_` calls per file (`grep -c '\.set_'`, the status line's
`set_status` included) before this round's splits; Bridge writes alone are
about four fifths of each. Each one is a slice of the same shape as
`settings_pages` and `studio`: move the decisions into
`voelin-ui-vm/src/<area>/logic.rs`, keep the writes in
`voelin-ui/src/<area>/bind.rs`.
| File | `.set_` calls | What it mixes |
|---|---|---|
| `streams.rs` | 45 | the streams panel, viewer and share dialog: what the voice card, the viewer header and the share form say, with the watch and share bookkeeping |
| `chat.rs` | 38 | the chat view: lines, the unread divider, pins, topics and downloads, with the engine's history batches |
| `app.rs` | 38 | event dispatch and the status line, the toolbar and tree refreshes |
| `servers.rs` | 37 | the rail, the server dialog and the channel tree's refresh |
| `settings_page.rs` | 26 | the audio settings page and the devices |
| `social.rs` | 23 | home's contacts, the bell and the search |
| `dev.rs` | 23 | development switches and the sample data (the switches stay with the window; the sample rows can move) |
| `images.rs` | 13 | the decoded-picture cache |
| `messages.rs` | 12 | direct messages |
| `appearance.rs` | 11 | theme, font scale and breakpoints |
| `popout.rs` | 8 | the viewer's own window |
| `members.rs`, `links.rs`, `inbox.rs`, `home.rs`, `events.rs` | 6, 5, 5, 5, 4 | small; split with their neighbours |
Before this round: `studio.rs` had 62 and `settings_pages.rs` 52 (the two
with the most). Their `bind.rs` files still show 58 and 51 `.set_` calls: the
Bridge and model writes stay where the toolkit is, and what each write says
now comes from `logic.rs`, which has tests of its own.
## Theme tokens
@@ -275,7 +362,7 @@ The studio (mockups 09, 10 and the phone's 04) is a page of the main window
window, "Stream Studio" for the studio; while a share runs the button opens
its dialog), a window of its own (the button in its
header; closing that window brings it back) and a phone page. Its controller
is `src/studio.rs` on the engine's studio ([studio.md](studio.md)): the
is `src/studio/` on the engine's studio ([studio.md](studio.md)), its decisions in `voelin-ui-vm`'s `studio/logic.rs`: the
studio runs while it is shown, live or recording, and a `Streamer` started
for it encodes the composite from the start, so Record Clip and recordings
work before going live.
@@ -400,7 +487,7 @@ without joining; there is no Observe button. Without a gateway, observing
starts once one is found.
Settings → Profiles (`ProfilesSection` in `screens/settings-pages.slint`;
`settings_pages.rs`, and `identities.rs` for the default and the import
`settings_pages/`, and `identities.rs` for the default and the import
switch) lists the stored identities with where they came from, marks the
store's default and has "Use as default" for the others, plus the switch
for importing the official clients' identities on start
@@ -420,10 +507,14 @@ for importing the official clients' identities on start
`ui/app.slint` put its sidebar and main parts into `DesktopShell` under
`if Nav.page == Page.<name>:` (and a case in `MobileShell`). Dialogs go at
the end of `MainWindow` with an `*-open` flag in `Nav`.
4. Rust: a pure view model in `src/vm/<name>.rs` (with tests) that turns
engine state into the structs; a model in `app::Models` set on the Bridge
once and updated with `vm::list::sync`; callbacks in `src/bind/<name>.rs`
(call it from `bind::wire`); the logic as `impl App` in `src/<name>.rs`.
4. Rust: a pure view model in `voelin-ui-vm/src/<name>.rs` (with tests) that
turns engine state into the plain bridge structs (`bridge.rs`, with a
`From` impl for the Slint struct in `bind/convert/items.rs`); a model in
`app::Models` set on the Bridge once and updated with `Rows::sync`;
callbacks in `voelin-ui/src/bind/<name>.rs` (call it from `bind::wire`);
the Slint side as `impl App` in `voelin-ui/src/<name>.rs`, with the
decisions in the view-model crate (`<name>/logic.rs`, [Two
crates](#two-crates)).
5. A development switch to open it (`dev.rs`, `VOELIN_OPEN=<name>`), a
screenshot (below) and a line in this file.
@@ -453,8 +544,8 @@ In a config file write them as dotted keys at the top level
The software renderer has no colour glyphs, so emoji are images. The 3720
Twemoji SVGs are packed by `scripts/pack-twemoji.py` into
`assets/twemoji.bin` (64 KiB blocks of raw deflate, an index sorted by key,
picker names and categories; 1.9 MB) and embedded in the binary. `emoji.rs`
`crates/voelin-ui-vm/assets/twemoji.bin` (64 KiB blocks of raw deflate, an index sorted by key,
picker names and categories; 1.9 MB) and embedded in the binary. `voelin-ui-vm`'s `emoji.rs`
splits chat text into grapheme clusters, maps emoji to Twemoji keys (code
points in hex; U+FE0F dropped outside ZWJ sequences, as Twemoji names its
files; text-default symbols such as © or digits only with U+FE0F) and makes
@@ -471,7 +562,7 @@ code-point ranges) and searches Unicode names. There are no shortcodes yet.
## Formatting
TeamSpeak clients format chat with BBCode. `vm/bbcode.rs` reads a message
TeamSpeak clients format chat with BBCode. `voelin-ui-vm/src/bbcode.rs` reads a message
into a `Doc`: blocks (lines, quote lines, code, list items, rules) of spans
with a style (bold, italic, underline, strike, code, colour, link) or a
picture. The Doc does not depend on BBCode, so Markdown (TeamSpeak 6) can be