dioxus_native_dom/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3//! Core headless native renderer for Dioxus.
4//!
5//! ## Feature flags
6//!  - `default`: Enables the features listed below.
7//!  - `accessibility`: Enables [`accesskit`](https://docs.rs/accesskit/latest/accesskit/) accessibility support.
8//!  - `hot-reload`: Enables hot-reloading of Dioxus RSX.
9//!  - `menu`: Enables the [`muda`](https://docs.rs/muda/latest/muda/) menubar.
10//!  - `tracing`: Enables tracing support.
11
12mod dioxus_document;
13mod events;
14mod mutation_writer;
15pub use blitz_dom::DocumentConfig;
16pub use dioxus_document::DioxusDocument;
17
18use blitz_dom::{ns, LocalName, Namespace, QualName};
19type NodeId = usize;
20
21pub(crate) fn qual_name(local_name: &str, namespace: Option<&str>) -> QualName {
22    QualName {
23        prefix: None,
24        ns: namespace.map(Namespace::from).unwrap_or(ns!(html)),
25        local: LocalName::from(local_name),
26    }
27}
28
29// Syntax sugar to make tracing calls less noisy in function below
30macro_rules! trace {
31    ($pattern:literal) => {{
32        #[cfg(feature = "tracing")]
33        tracing::debug!($pattern);
34    }};
35    ($pattern:literal, $item1:expr) => {{
36        #[cfg(feature = "tracing")]
37        tracing::debug!($pattern, $item1);
38    }};
39    ($pattern:literal, $item1:expr, $item2:expr) => {{
40        #[cfg(feature = "tracing")]
41        tracing::debug!($pattern, $item1, $item2);
42    }};
43    ($pattern:literal, $item1:expr, $item2:expr, $item3:expr) => {{
44        #[cfg(feature = "tracing")]
45        tracing::debug!($pattern, $item1, $item2);
46    }};
47    ($pattern:literal, $item1:expr, $item2:expr, $item3:expr, $item4:expr) => {{
48        #[cfg(feature = "tracing")]
49        tracing::debug!($pattern, $item1, $item2, $item3, $item4);
50    }};
51}
52pub(crate) use trace;