#![forbid(unsafe_code)]
pub mod attrs;
pub mod components;
mod escape;
pub mod metadata;
mod node;
mod render;
pub mod style;
mod tags;
pub use attrs::*;
pub use components::{Children, ImageProps, LinkProps, Slots, each, fragment_of, island, raw_html, suspense, when};
pub use escape::{escape_attr, escape_text, is_safe_url};
pub use metadata::Metadata;
pub use node::{Attr, AttrValue, Element, IntoViewResult, Node, Part, Suspense, View};
pub use render::{
DocumentParts, RenderFlags, STREAMING_RUNTIME, render_static, render_to_string, resolve, stream_document,
};
pub use style::{CssClass, Stylesheet};
pub use tags::{TAGS, VOID_TAGS};
#[macro_export]
macro_rules! fragment {
($($child:expr),* $(,)?) => {
$crate::Node::Fragment(vec![$($crate::View::into_node($child)),*])
};
}
#[macro_export]
macro_rules! Link {
($($body:tt)*) => { $crate::__link_munch!([$crate::Element::new("a")] $($body)*) };
}
#[doc(hidden)]
#[macro_export]
macro_rules! __link_munch {
([$($acc:tt)*]) => { $($acc)*.with($crate::attrs::data("nr-link", "")) };
([$($acc:tt)*] $key:ident = $val:expr $(, $($rest:tt)*)?) => {
$crate::__link_munch!([$($acc)*.with($crate::attrs::$key($val))] $($($rest)*)?)
};
([$($acc:tt)*] $child:expr $(, $($rest:tt)*)?) => {
$crate::__link_munch!([$($acc)*.with($child)] $($($rest)*)?)
};
}
#[macro_export]
macro_rules! Image {
($($key:ident = $val:expr),* $(,)?) => {
$crate::ImageProps::default()$(.$key($val))*
};
}