Expand description
Programmatic API for the WebUI build-time rendering framework.
This crate provides the core build, render, and inspection APIs
that power the webui CLI, Node.js bindings, and WASM module.
§Example
use webui::{build, BuildOptions, CssStrategy, DomStrategy};
use std::path::PathBuf;
let result = build(BuildOptions {
app_dir: PathBuf::from("./src"),
entry: "index.html".to_string(),
css: CssStrategy::Link,
dom: DomStrategy::Shadow,
plugin: None,
components: Vec::new(),
}).unwrap();
println!("Built {} fragments in {:?}", result.stats.fragment_count, result.stats.duration);Modules§
- server
- High-level server helper for custom Rust servers using
webui-router.
Structs§
- Build
Options - Options for building a WebUI application.
- Build
Result - Result of a successful build.
- Build
Stats - Statistics about a completed build.
- WebUI
Handler - The main WebUI handler that processes protocols and renders them.
Enums§
- CssStrategy
- Strategy for how component CSS is delivered in rendered output.
- DomStrategy
- Strategy for how component DOM is structured.
- Handler
Error - Error types for the WebUI handler.
- Plugin
- Framework plugin to load for build-time and render-time processing.
- WebUI
Error - Errors that can occur during WebUI build, render, or inspection operations.
Traits§
- Handler
Plugin - A handler plugin that can inject additional content during rendering.
- Response
Writer - Interface for writing rendered output
Functions§
- build
- Build a WebUI application from an app directory.
- build_
to_ disk - Build a WebUI application and write output files to disk.
- encode_
inventory - Encode an inventory bitfield as a hex string.
- get_
needed_ components - Walk the protocol fragment graph from
entry_idand return the names of all components the route needs that are NOT in the client’s inventory. - get_
needed_ components_ for_ request - Walk the protocol from the persistent
entry_idand return the component templates needed for the currentrequest_path. - inspect
- Inspect a compiled WebUI protocol file and return its JSON representation.
- inspect_
bytes - Inspect raw protocol bytes and return their JSON representation.
- parse_
inventory - Parse a hex-encoded inventory string into bytes.