Move the BBCode reader and the Twemoji archive into voelin-ui-vm

Both are pure (no Slint): vm/bbcode.rs and emoji.rs with their tests and
the packed archive (assets/twemoji.bin, with its license note; the
packing script writes it there). voelin-ui keeps the paths
crate::vm::bbcode and crate::emoji as re-exports until the callers move.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-20 09:15:44 +03:00
1 parent 4dc8272c64
commit 8e6838a00f
12 files changed
+29 -21

No files matched your search

Generated
+2 -1
View File
@@ -9735,7 +9735,6 @@ dependencies = [
"chrono",
"dirs",
"image",
"miniz_oxide 0.8.9",
"png",
"serde",
"serde_json",
@@ -9761,7 +9760,9 @@ name = "voelin-ui-vm"
version = "0.0.1-alpha"
dependencies = [
"image",
"miniz_oxide 0.8.9",
"png",
"unicode-segmentation",
"voelin-core",
]
+4
View File
@@ -18,6 +18,10 @@ path = "src/lib.rs"
# Picture sizes (the header of a file); PNG and JPEG are listed as the
# front end's toolkit used to bring them.
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "gif", "webp", "bmp", "ico"] }
# The Twemoji archive's blocks (raw deflate).
miniz_oxide = "0.8"
# Grapheme clusters for emoji in chat text.
unicode-segmentation = "1.13"
voelin-core = { path = "../voelin-core", default-features = false }
[dev-dependencies]
+11
View File
@@ -0,0 +1,11 @@
# Bundled assets
- `twemoji.bin`: the Twemoji 15.0 SVGs (3720 emoji, from the `@twemoji/svg`
15.0.0 package) packed by `scripts/pack-twemoji.py` into blocks of raw
deflate with an index; `src/emoji.rs` reads it. Twemoji graphics by Twitter,
Inc and other contributors, licensed under CC-BY 4.0
(https://creativecommons.org/licenses/by/4.0/). The files are unchanged
apart from surrounding whitespace.
It is credited in `THIRD_PARTY_NOTICES.md` and the About page, with the fonts
and icons of the Slint front end (`crates/voelin-ui/assets/README.md`).
File renamed without changes.
File renamed without changes.
@@ -119,12 +119,6 @@ impl Archive {
.map(|i| &self.entries[i])
}
/// Number of emoji in the archive.
#[cfg(test)]
pub fn len(&self) -> usize {
self.entries.len()
}
pub fn contains(&self, key: &str) -> bool {
self.find(key).is_some()
}
@@ -350,7 +344,7 @@ mod tests {
#[test]
fn archive_opens() {
let a = archive();
assert!(a.len() > 3000);
assert!(a.entries.len() > 3000);
assert!(a.contains("1f600"));
assert!(!a.contains("zzz"));
assert_eq!(a.name("1f600"), Some("grinning face"));
+2
View File
@@ -3,8 +3,10 @@
//! Neither Slint nor GPUI is a dependency; each front end converts these
//! types (docs/ui.md, "Two crates").
pub mod bbcode;
pub mod bridge;
pub mod color;
pub mod emoji;
pub mod image;
pub mod list;
pub mod studio_bridge;
-2
View File
@@ -24,8 +24,6 @@ dirs = "6"
# avatars, icons and banners on TeamSpeak servers are GIF and WebP too (the
# decoders are in the tree already, for SVG pictures).
image = { version = "0.25", default-features = false, features = ["gif", "webp", "bmp", "ico"] }
# Twemoji archive blocks (raw deflate); already used by png.
miniz_oxide = "0.8"
png = "0.18"
serde = { version = "1", features = ["derive"] }
# Settings and gateway values as JSON (the advanced and integrations pages).
+2 -6
View File
@@ -1,11 +1,7 @@
# Bundled assets
- `twemoji.bin`: the Twemoji 15.0 SVGs (3720 emoji, from the `@twemoji/svg`
15.0.0 package) packed by `scripts/pack-twemoji.py` into blocks of raw
deflate with an index; `src/emoji.rs` reads it. Twemoji graphics by Twitter,
Inc and other contributors, licensed under CC-BY 4.0
(https://creativecommons.org/licenses/by/4.0/). The files are unchanged
apart from surrounding whitespace.
The Twemoji archive is with the code that reads it, in
`crates/voelin-ui-vm/assets/` (its license note is there).
The fonts (Inter, SIL OFL 1.1) and icons (Lucide, ISC) that the Slint files
import are under `ui/assets/`, each with its license. All three are credited
+3 -1
View File
@@ -6,7 +6,6 @@ mod bind;
mod camera;
mod chat;
mod dev;
mod emoji;
mod events;
mod home;
mod hotkey;
@@ -28,5 +27,8 @@ mod studio;
mod video;
mod vm;
// The Twemoji archive and text splitting live with the view models.
use voelin_ui_vm::emoji;
pub use app::{HostedEngine, RunOptions, run};
pub use inbox::{Request, request};
+1 -1
View File
@@ -4,7 +4,7 @@
//! [`list::sync`], so a small change redraws only what changed.
pub mod avatar;
pub mod bbcode;
pub use voelin_ui_vm::bbcode;
pub mod chat;
pub mod home;
pub mod list;
+3 -3
View File
@@ -2,7 +2,7 @@
"""Pack the Twemoji SVGs into one compressed archive for the UI.
Colour emoji cannot go through the software renderer's text path, so the UI
shows them as images: `crates/voelin-ui/src/emoji.rs` reads this archive
shows them as images: `crates/voelin-ui-vm/src/emoji.rs` reads this archive
(embedded in the binary) and decodes single emoji on demand.
Usage:
@@ -11,7 +11,7 @@ Usage:
The package is @twemoji/svg (15.0.0: `npm pack @twemoji/svg`, unpacked); the
directory holds the SVGs named by code points (`1f600.svg`,
`1f468-200d-1f4bb.svg`). `out` defaults to
crates/voelin-ui/assets/twemoji.bin. Only the Python standard library is
crates/voelin-ui-vm/assets/twemoji.bin. Only the Python standard library is
needed; names come from its `unicodedata` plus a table for the emoji newer
than it (Unicode 15), so any Python 3.11+ gives the same file.
@@ -247,7 +247,7 @@ def main():
sys.exit(2)
src = sys.argv[1]
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
out = sys.argv[2] if len(sys.argv) > 2 else os.path.join(root, "crates/voelin-ui/assets/twemoji.bin")
out = sys.argv[2] if len(sys.argv) > 2 else os.path.join(root, "crates/voelin-ui-vm/assets/twemoji.bin")
items = []
for file in os.listdir(src):
if not file.endswith(".svg"):