Repository navigation
blocks-desktop: styled look from the web tokens, app faces, native composer (#303) - #307
Merged
Merged
Conversation
…and a native composer (#303)
This was referenced Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #303
For humans
The desktop app now looks finished by default: the page has a margin, text uses the same sizes as the web app, and blocks are spaced evenly. An app can pick its own font (one or several in order), and the message box is now a real text field with a send button instead of a placeholder.
For apps
blocks_desktop::Lookhas a new fieldfaces: Vec<egui::FontData>. The first face draws all proportional text, each later face fills in glyphs the earlier ones lack, and egui's default comes last. Code and commands stay monospace. With..Look::default(), nothing changes for an app.Stage::shownow draws inside a page margin (--s4× stylespace). It sets type sizes from the web tokens (--fsbody,--fs-metasmall,--fs× 1.7 title) and item spacing from them (--s2×space). These styles apply only inside the stage, so the app's ownUiis unchanged.composeris drawn natively: a text field and a send button (the block'slabel, else "send"), with Cmd/Ctrl+Enter also sending. It sends{...values, text}toaction, or toacts.queuewhileworkingis set. Chips, queued rows and attachments are not drawn yet.What changed
look.rs: the token mirror ofweb/src/css/base/root.css, anddress(faces, sizes, spacing). No new colours or tokens.stage.rs: draws the screen in a margin frame and dresses that frame'sUi.draw/composer.rs: the native composer.docs/architecture/gpui/look/egui-look-{390,1440}-{light,dark}.pngreplace the old unstyled ones, drawn byblocks-deskfromlook/look.json. That file is the spike'ssample::look()screen, produced by the crate's ownsamples().docs/desktop.md(sizes, fonts,composerno longer a gap) andmeasured.md(what the PNGs are now).Decisions:
--fontstays a last-resort fallback, separate fromfaces: it fills missing glyphs and does not replace the face.Tests
crates/blocks-desk/tests/look.rs:an_app_face_draws_every_kinds_text_and_without_one_the_bundled_face_doesdraws everyfixtures/blocksscreen with an app face (egui's Hack) and without one, then reads each drawn glyph's face metrics. With the face set, no glyph comes from the bundled proportional face. Without it, more than 100 do. It fails when face installation is disabled (checked by hand).sizes_and_the_margin_are_the_web_renderers_tokensparsesroot.cssand checks the drawn body and footnote sizes and the page margin against it.crates/blocks-desk/tests/desk.rs:a_composer_sends_what_was_typed_with_its_values_and_queues_while_a_turn_worksrunstypethentapthrough the harness.Evidence at b6a8608, macOS arm64:
cargo test --locked -p blocks-desktop -p blocks-deskblocks-desk --checkon everyfixtures/blocksandfixtures/stress/*-*file at 390x844 and 1440x900 (the CI loop)cargo fmt --all --checkjust clippyjust archjust capByte-identical PNGs on Linux and Windows are covered by the
desktopCI matrix. I ran only macOS here.Not done, and out of scope: egui's widget fills (text fields, buttons) are not themed from the scheme, so the composer field and button keep egui's default dark fill on a light page, the same as forms and secrets today.
src/ net +68 (no budget stated in the issue): the token mirror and dress (+41), the composer (+24), the margin frame (+3).
Perf (fix round, head b6a8608)
The
desktop (windows-latest)perf step first failed at 4.0029 ms against the 4 ms patch budget. This was runner noise, not a regression, so the code is unchanged and only the failed job was rerun (green: slowest patch 3.47 ms at 1440, 2.73 ms at 390).cargo test --release -p blocks-desk --test perf -- --ignored --nocapture