freya-html 0.5.0

HTML + CSS rendering for Freya using Blitz
Documentation
//! Render inline or remote HTML and CSS in a Freya component using Blitz.
//!
//! ```rust,no_run
//! # use freya::prelude::*;
//! use freya_html::prelude::*;
//!
//! # fn app() -> impl IntoElement {
//! let handle = use_html(|| HtmlSource::html("<h1>Hello!</h1>"));
//! HtmlViewer::new(handle).expanded()
//! # }
//! ```
//!
//! Configure inline documents with [`HtmlContent`], including a validated
//! base URL through [`HtmlContent::with_base_url`].
//!
//! Use [`HtmlSource::url`] to load a remote page. Add local fonts with
//! [`HtmlViewer::font`]. On web, provide a font for inline documents or load one
//! through CSS `@font-face`.
//!
//! For HTTP requests outside the viewer,
//! enable Freya's `remote-asset` feature and use [`freya_components::http::fetch`]:
//!
//! ```rust,no_run
//! # async fn load() -> Result<(), Box<dyn std::error::Error>> {
//! let url = freya_components::Url::parse("https://example.com")?;
//! let bytes = freya_components::http::fetch(url).await?;
//! # Ok(())
//! # }
//! ```

#[doc(hidden)]
pub mod anyrender;
mod cache;
mod component;
mod content;
mod element;
mod fonts;
mod handle;
mod net;
mod state;

pub use cache::ResourceCache;
pub use component::HtmlViewer;
pub use content::HtmlContent;
pub use handle::{
    ElementHit,
    HtmlHandle,
    HtmlSource,
    use_html,
};

pub mod prelude {
    pub use crate::{
        cache::ResourceCache,
        component::HtmlViewer,
        content::HtmlContent,
        handle::{
            ElementHit,
            HtmlHandle,
            HtmlSource,
            use_html,
        },
    };
}