euv_core/vdom/node/enum.rs
1use crate::*;
2
3/// Represents the type of an HTML tag or a component.
4///
5/// Distinguishes between standard HTML elements and user-defined components.
6#[derive(Clone, PartialEq)]
7pub enum Tag {
8 /// A standard HTML element identified by its tag name.
9 Element(String),
10 /// A custom component type.
11 Component(String),
12}
13
14/// Represents a node in the virtual DOM tree.
15///
16/// The core enum representing elements, text, fragments, and empty nodes.
17#[derive(Clone, Default)]
18pub enum VirtualNode {
19 /// An element node with a tag, attributes, and children.
20 Element {
21 /// The tag type of this element.
22 tag: Tag,
23 /// The attributes attached to this element.
24 attributes: Vec<AttributeEntry>,
25 /// The child nodes.
26 children: Vec<VirtualNode>,
27 /// An optional key for diffing.
28 key: Option<String>,
29 },
30 /// A text node.
31 Text(TextNode),
32 /// A fragment of multiple nodes without a wrapper element.
33 Fragment(Vec<VirtualNode>),
34 /// A dynamic node that re-renders based on signal changes.
35 Dynamic(DynamicNode),
36 /// An empty placeholder node.
37 #[default]
38 Empty,
39}