| name | yororen-ui-app-core |
| description | App bootstrap and core architecture for end users building a gpui desktop app with Yororen UI (yororen_ui). Use when generating or refactoring main.rs, window setup, global theme, global i18n, assets (UiAsset/CompositeAssetSource), or when creating a new Yororen UI app crate. Not for developing yororen-ui itself. |
Yororen UI App Core
Build the foundation of a Yororen UI app: application bootstrap, global registrations, window creation, and a maintainable module layout.
Requirements to Enforce
- Use Rust edition 2024 (match Yororen UI and the demo apps).
- Use gpui-ce (gpui community edition) from crates.io with compatible version.
Canonical Bootstrap (copy this shape)
Follow this order:
Application::new().with_assets(UiAsset)
component::init(cx)
cx.set_global(GlobalTheme::new(cx.window_appearance()))
cx.set_global(I18n::with_embedded(Locale::new("en")?)) (or demo-specific loader)
cx.set_global(AppState::default())
cx.open_window(options, |_, cx| cx.new(|cx| Root::new(cx)))
Use the demos as the ground truth for structure:
demo/counter/src/main.rs
demo/todolist/src/main.rs
demo/file_browser/src/main.rs
Dependency Setup
If the user's app does not include Yororen UI yet, add it first.
Recommended (from crates.io):
[dependencies]
yororen_ui = "0.2"
Alternative (from GitHub):
[dependencies]
yororen_ui = { git = "https://github.com/MeowLynxSea/yororen-ui.git", tag = "v0.2.0" }
Notes:
- Prefer crates.io for stable releases.
- Use GitHub for latest development version.
- Avoid local
path = "../yororen-ui" dependencies for end users unless they explicitly want to track local, potentially-unstable changes.
Then run a build once so Cargo fetches the dependency source checkout (needed for reading demos/docs from the dependency).
New project rule
When scaffolding a brand-new app:
- Use crates.io version for production (e.g.,
yororen_ui = "0.2").
- Use the same
gpui-ce version as specified in yororen_ui Cargo.toml.
Using gpui-ce (required)
Yororen UI depends on gpui-ce (gpui community edition) from crates.io.
Make sure your app uses a compatible version:
[dependencies]
gpui = { package = "gpui-ce", version = "0.3" }
This ensures version compatibility with yororen_ui.
Project Structure (recommended)
main.rs: bootstrap only (assets/theme/i18n/state/window)
state.rs: global state (Arc<Mutex<...>>) + Global
*_app.rs: root component implementing Render
components/: reusable UI components (pure UI)
model/ or domain/: app logic + data types (no gpui dependencies)
Rules
- Keep
main.rs minimal; avoid business logic there.
- Store a notify target
EntityId in global state if other components need to trigger a root re-render (see demo/todolist/src/todo_app.rs).
- Keep lock scopes short; never hold a lock while doing expensive computation or building a huge UI subtree.
Docs to Read (Dependency source, read-only)
Do not assume the user has the repo wiki checked out.
Read from the yororen_ui dependency source checkout (via cargo metadata).
Recommended entry points in that checkout:
README.md
demo/counter/src/main.rs
demo/todolist/src/main.rs