euv-core 0.3.12

A declarative, cross-platform UI framework for Rust with virtual DOM, reactive signals, and HTML macros for WebAssembly.
Documentation
use crate::*;

/// Represents the type of an HTML tag or a component.
///
/// Distinguishes between standard HTML elements and user-defined components.
#[derive(Clone, Debug, PartialEq)]
pub enum Tag {
    /// A standard HTML element identified by its tag name.
    Element(String),
    /// A custom component type.
    Component(String),
}

/// Represents a node in the virtual DOM tree.
///
/// The core enum representing elements, text, fragments, and empty nodes.
#[derive(Clone, Debug, Default)]
pub enum VirtualNode {
    /// An element node with a tag, attributes, and children.
    Element {
        /// The tag type of this element.
        tag: Tag,
        /// The attributes attached to this element.
        attributes: Vec<AttributeEntry>,
        /// The child nodes.
        children: Vec<VirtualNode>,
        /// An optional key for diffing.
        key: Option<String>,
    },
    /// A text node.
    Text(TextNode),
    /// A fragment of multiple nodes without a wrapper element.
    Fragment(Vec<VirtualNode>),
    /// A dynamic node that re-renders based on signal changes.
    Dynamic(DynamicNode),
    /// An empty placeholder node.
    #[default]
    Empty,
}