use super::*; use crate::document; use dioxus_html as dioxus_elements; #[non_exhaustive] #[derive(Clone, Props, PartialEq)] pub struct StyleProps { /// Styles are deduplicated by their href attribute pub href: Option, pub media: Option, pub nonce: Option, pub title: Option, /// The contents of the style tag. If present, the children must be a single text node. pub children: Element, #[props(extends = style, extends = GlobalAttributes)] pub additional_attributes: Vec, } impl StyleProps { /// Get all the attributes for the style tag pub fn attributes(&self) -> Vec<(&'static str, String)> { let mut attributes = Vec::new(); extend_attributes(&mut attributes, &self.additional_attributes); if let Some(href) = &self.href { attributes.push(("href", href.clone())); } if let Some(media) = &self.media { attributes.push(("media", media.clone())); } if let Some(nonce) = &self.nonce { attributes.push(("nonce", nonce.clone())); } if let Some(title) = &self.title { attributes.push(("title", title.clone())); } attributes } pub fn style_contents(&self) -> Result> { extract_single_text_node(&self.children) } } /// Render a [`