use super::*;
use std::fmt::{self, Debug, Formatter};
fn fmt_lit_str(lit: &syn::LitStr, formatter: &mut Formatter<'_>) -> fmt::Result {
write!(formatter, "Text({:?})", lit.value())
}
impl Debug for HtmlNode {
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
match self {
Self::Element(element) => formatter.debug_tuple("Element").field(element).finish(),
Self::Text(lit) => fmt_lit_str(lit, formatter),
Self::Expr(expr) => formatter.debug_tuple("Expr").field(expr).finish(),
Self::Dynamic(expr) => formatter.debug_tuple("Dynamic").field(expr).finish(),
Self::If(html_if) => formatter.debug_tuple("If").field(html_if).finish(),
Self::Match(html_match) => formatter.debug_tuple("Match").field(html_match).finish(),
Self::For(html_for) => formatter.debug_tuple("For").field(html_for).finish(),
Self::DynamicTag(dynamic_tag) => formatter
.debug_tuple("DynamicTag")
.field(dynamic_tag)
.finish(),
}
}
}
#[derive(Clone)]
pub(crate) enum HtmlNode {
Element(HtmlElement),
Text(syn::LitStr),
Expr(Expr),
Dynamic(Expr),
If(HtmlIf),
Match(HtmlMatch),
For(HtmlFor),
DynamicTag(HtmlDynamicTag),
}
#[derive(Clone, Debug)]
pub(crate) enum HtmlAttrValue {
Expr(Expr),
If(HtmlAttrIf),
Match(HtmlAttrMatch),
Style(Vec<(String, HtmlStylePropValue)>),
Classes(Vec<HtmlAttrValue>),
Styles(Vec<HtmlAttrValue>),
}
#[derive(Clone, Debug)]
pub(crate) enum HtmlStylePropValue {
Literal(String),
Expr(Expr),
If(HtmlAttrIf),
Match(HtmlAttrMatch),
}
#[derive(Clone, Copy, Debug, Default, DisplayDebug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub(crate) enum AttrIfMode {
Reactive,
#[default]
Raw,
}