cotis-web
Browser/WASM render backend for the Cotis UI framework. cotis-web implements CotisRendererAsync for HTML/CSS output. Layout output from cotis-layout is converted to render commands by cotis-pipes, then mapped to DOM elements via CSS absolute positioning and a companion JavaScript module (renderer.js).
Status: Early
0.1.0-alpharelease. APIs are still evolving.
Workspace crates
| Crate | Role |
|---|---|
cotis-web |
WASM renderer backend — HTMLRenderer, DOM draw pipeline, browser interactivity |
cotis-web-builder |
wasm-pack build routine and cotis-cli plugin |
web-example |
Full example WASM application (not published) |
Prerequisites
-
Rust stable toolchain (see
rust-toolchain.toml) -
wasm32-unknown-unknowntarget: -
wasm-packon PATH (for building WASM output)
Installation
Add the renderer crate to your Cargo.toml:
= "0.1.0-alpha"
A full browser application also needs layout, pipes, and a WASM app crate. See Quick start.
Quick start
Build and serve the bundled example from the repository:
Then serve the output directory (contains index.html, pkg/, and web-renderer/renderer.js) with any static file server.
With cotis-cli
Install the build routine as a plugin:
Run from your WASM app crate directory (where Cargo.toml defines the cdylib).
Typical app wiring
use ;
use CotisLayoutManager;
use CotisLayoutToRenderListPipeForGenerics;
use Dimensions;
use HTMLRenderer;
let renderer = new;
let manager = new;
let mut app = new;
// AsyncRenderApp::compute_frame_async(&mut app, |layout| { ... }).await;
See web-example/src/lib.rs for a complete UI tree with custom HTML, images, and form state.
Features
cotis-web
app_launch— WASM export helpers viacotislaunch hooks (enable oncotisas well)complex_color— layered and gradient color support (forwards tocotis-defaults)complex_colored_text— extendscomplex_colorto text color fields
Ecosystem
Cotis is split across several repositories. This repo provides the browser renderer and build tooling.
| Repository | Role |
|---|---|
cotis |
Core traits and CotisApp orchestration |
| cotis-web (this repo) | Browser/WASM renderer and build routine |
cotis-layout |
Flexbox-style layout engine |
cotis-pipes |
Layout output to render commands |
cotis-cli |
Plugin host for installable build and run routines |
cotis-wgpu |
Desktop renderer (wgpu + winit + glyphon) |
cotis-raylib |
Desktop renderer (raylib) |
Documentation
- API reference:
cargo doc --open -p cotis-web --target wasm32-unknown-unknown - Published docs: cotis-web, cotis-web-builder
- Contributing: CONTRIBUTING.md
- Security: SECURITY.md
- License: MIT