Skip to main content

Crate webui

Crate webui 

Source
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§

BuildOptions
Options for building a WebUI application.
BuildResult
Result of a successful build.
BuildStats
Statistics about a completed build.
WebUIHandler
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.
HandlerError
Error types for the WebUI handler.
Plugin
Framework plugin to load for build-time and render-time processing.
WebUIError
Errors that can occur during WebUI build, render, or inspection operations.

Traits§

HandlerPlugin
A handler plugin that can inject additional content during rendering.
ResponseWriter
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 bitmask as a hex string.
get_needed_components
Walk the protocol fragment graph from entry_id and 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_id and return the component templates needed for the current request_path.
get_route_templates
Get the f-template HTML strings needed for a route that the client doesn’t already have.
get_route_templates_for_request
Get the client template HTML strings needed for the active route chain rooted at entry_id for the current request_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 string into bytes for the inventory bitmask.

Type Aliases§

WebUIProtocol