52 lines
1.7 KiB
Rust
52 lines
1.7 KiB
Rust
#![cfg_attr(docsrs, feature(doc_cfg))]
|
|
|
|
//! Core headless native renderer for Dioxus.
|
|
//!
|
|
//! ## Feature flags
|
|
//! - `default`: Enables the features listed below.
|
|
//! - `accessibility`: Enables [`accesskit`](https://docs.rs/accesskit/latest/accesskit/) accessibility support.
|
|
//! - `hot-reload`: Enables hot-reloading of Dioxus RSX.
|
|
//! - `menu`: Enables the [`muda`](https://docs.rs/muda/latest/muda/) menubar.
|
|
//! - `tracing`: Enables tracing support.
|
|
|
|
mod dioxus_document;
|
|
mod events;
|
|
mod mutation_writer;
|
|
pub use dioxus_document::DioxusDocument;
|
|
|
|
use blitz_dom::{ns, LocalName, Namespace, QualName};
|
|
type NodeId = usize;
|
|
|
|
pub(crate) fn qual_name(local_name: &str, namespace: Option<&str>) -> QualName {
|
|
QualName {
|
|
prefix: None,
|
|
ns: namespace.map(Namespace::from).unwrap_or(ns!(html)),
|
|
local: LocalName::from(local_name),
|
|
}
|
|
}
|
|
|
|
// Syntax sugar to make tracing calls less noisy in function below
|
|
macro_rules! trace {
|
|
($pattern:literal) => {{
|
|
#[cfg(feature = "tracing")]
|
|
tracing::info!($pattern);
|
|
}};
|
|
($pattern:literal, $item1:expr) => {{
|
|
#[cfg(feature = "tracing")]
|
|
tracing::info!($pattern, $item1);
|
|
}};
|
|
($pattern:literal, $item1:expr, $item2:expr) => {{
|
|
#[cfg(feature = "tracing")]
|
|
tracing::info!($pattern, $item1, $item2);
|
|
}};
|
|
($pattern:literal, $item1:expr, $item2:expr, $item3:expr) => {{
|
|
#[cfg(feature = "tracing")]
|
|
tracing::info!($pattern, $item1, $item2);
|
|
}};
|
|
($pattern:literal, $item1:expr, $item2:expr, $item3:expr, $item4:expr) => {{
|
|
#[cfg(feature = "tracing")]
|
|
tracing::info!($pattern, $item1, $item2, $item3, $item4);
|
|
}};
|
|
}
|
|
pub(crate) use trace;
|