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};
use std::path::PathBuf;
let result = build(BuildOptions {
app_dir: PathBuf::from("./src"),
..BuildOptions::default()
}).unwrap();
println!("Built {} fragments in {:?}", result.stats.fragment_count, result.stats.duration);Modules§
- component_
asset_ output - Transactional publication of generated component ESM inputs.
- server
- High-level server helper for custom Rust servers using
webui-router. - streaming
- Streaming
ResponseWriterhelpers for actix-web (or any) HTTP host.
Structs§
- Asset
File Name Template - Validated filename template for emitted build assets.
- Asset
File Name Template Error - Error returned when an asset filename template is invalid.
- Boundary
Descriptor - Runtime occurrence returned when traversal suspends.
- Boundary
Instance Id - Response-local runtime boundary occurrence identity.
- Build
Options - Options for building a WebUI application.
- Build
Result - Result of a successful build.
- Build
Stats - Statistics about a completed build.
- Component
Asset File - A generated component or root ESM input.
- Component
Asset Graph - Rendered component asset graph.
- Component
Template Artifact - Client template payload generated by a parser plugin for one component.
- CssFallback
Chain - A CSS
var()fallback chain that needs theme or local CSS coverage. - CssToken
Analysis - CSS token analysis produced from the parsed template/component graph.
- Diagnostic
- A build-time template-authoring diagnostic.
- Parser
Options - Build/output options that affect parser-generated component templates.
- Prepared
Projection Manifests - Projection metadata validated once for reuse across many protocol builds.
- Protocol
- A decoded protocol with reusable deterministic indices.
- Render
Options - Options controlling how the handler renders a protocol.
- Session
Options - Owned per-response configuration.
- Span
Instance Id - Response-local generated component span identity.
- Stream
Status - Borrowed-writer result of one semantic streaming step.
- Stream
Step - Bytes and continuation state returned by one owned semantic step.
- Streaming
Response - A progressive response that writes directly through a
FlushWriter. - Streaming
Session - A progressive response owned independently of any Rust borrow.
- Token
File - Loaded token themes — maps theme name → (token name → CSS value).
- WebUI
Handler - The main WebUI handler that processes protocols and renders them.
Enums§
- Boundary
Key - Valid evaluated key for a repeated boundary declaration.
- Boundary
Mode - Whether a committed occurrence may receive later state updates.
- CssStrategy
- Strategy for how component CSS is delivered in rendered output.
- DomStrategy
- Default DOM strategy for components without an authored declarative Shadow root.
- Handler
Error - Error types for the WebUI handler.
- Legal
Comments - Strategy for preserving legal comments in generated output.
- Parser
Error - Error type for WebUI parser.
- Plugin
- Framework plugin to load for build-time and render-time processing.
- Projection
Manifest Source - One projection manifest supplied to a build.
- Severity
- Severity of a
Diagnostic. - State
Surface - State surface a component consumes through one hydration channel.
- Streaming
State - Borrowed or owned JSON state supplied to a streaming step.
- WebUI
Error - Errors that can occur during WebUI build, render, or inspection operations.
Constants§
- DEFAULT_
ASSET_ FILE_ NAME_ TEMPLATE - Default build-asset filename template.
- DEFAULT_
CSS_ FILE_ NAME_ TEMPLATE - Default Link-mode CSS filename template.
Traits§
- Flush
Writer - A response writer that can hand buffered bytes to its transport immediately.
- 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. - inspect
- Inspect a compiled WebUI protocol file and return its JSON representation.
- inspect_
bytes - Inspect raw protocol bytes and return their JSON representation.
- load_
token_ file - Load a multi-theme token file.
- parse_
inventory - Parse a hex-encoded inventory string into bytes.
- prepare_
projection_ manifests - Validate and merge projection sources once for repeated builds.
- render_
component_ assets - Render a static component asset graph.
- resolve_
theme_ path - Resolve a
--themevalue to a file path on disk.