/// A namespace-qualified XML name (e.g. `svg:rect` has namespace `"svg"` and local name `"rect"`).
/// Compile function type: takes component definition + target language + data model, returns source code.
"Dom::create_node(NodeType::{}).with_children(vec![Dom::create_text(AzString::from_const_str(\"{}\"))].into())",
fn push_scalar_field(children: &mut Vec<Dom>, field_name: &str, value: &dyn core::fmt::Display) {
"{}children.push(Dom::create_text(AzString::from(format!(\"{{}}: {{}}\", \"{}\", {}).as_str())));",
/// * `default_text` - Default text content for the preview, or `None` if the element has no text.
description: AzString::from_const_str("Conditional rendering: shows 'then' if condition is true, else shows 'else' (if provided)."),
data_field("condition", ComponentFieldType::Bool, Some(ComponentDefaultValue::Bool(false)), "The boolean condition to evaluate"),
"if (data.condition) {\n // then branch\n AzDom_createDiv();\n} else {\n // else branch\n AzDom_createDiv();\n}"
"if (data.condition) {\n // then branch\n Dom::div();\n} else {\n // else branch\n Dom::div();\n}"
"let mut children = Vec::new();\nfor i in 0..data.count {\n children.push(Dom::div());\n}\nDom::div().with_children(children)"
"AzDom container = AzDom_createDiv();\nfor (uint32_t i = 0; i < data.count; i++) {\n AzDom_addChild(&container, AzDom_createDiv());\n}"
"auto container = Dom::div();\nfor (uint32_t i = 0; i < data.count; i++) {\n container.add_child(Dom::div());\n}"
"let items: Vec<serde_json::Value> = serde_json::from_str(&data.data_json).unwrap_or_default();\nlet children: Vec<Dom> = items.iter().map(|item| {\n Dom::div() // map template\n}).collect();\nDom::div().with_children(children)"
"// Parse data.data_json and map each item\nAzDom container = AzDom_createDiv();\n// TODO: iterate parsed JSON array"
"// Parse data.data_json and map each item\nauto container = Dom::div();\n// TODO: iterate parsed JSON array"
"import json\nitems = json.loads(data.data_json)\ncontainer = Dom.div()\nfor item in items:\n container.add_child(Dom.div())"
/// Attributes of an XML node (note: not yet filtered and / or broken into function arguments!)
pub fn get_html_node<'a>(root_nodes: &'a [XmlNodeChild]) -> Result<&'a XmlNode, DomXmlParseError> {
pub fn get_body_node<'a>(root_nodes: &'a [XmlNodeChild]) -> Result<&'a XmlNode, DomXmlParseError> {
fn find_node_by_type<'a>(root_nodes: &'a [XmlNodeChild], node_type: &str) -> Option<&'a XmlNode> {
pub fn get_item<'a>(hierarchy: &[usize], root_node: &'a mut XmlNode) -> Option<&'a mut XmlNode> {
// render_dom_from_body_node() removed — use render_dom_from_body_node_fast() or str_to_dom()
/// Combines the split string back into its original form while replacing the variables with their
/// Given a string and a key => value mapping, replaces parts of the string with the value, i.e.: