1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use serde::{Serialize, Deserialize};

use crate::Id;

/// A UI component tree composed of primitive components.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum Primitive {
    Empty,
    Text { content: String },
    TextField { content: String },
    Button { label: Box<Id<Primitive>> },
    VStack { wrapped: Box<Id<Primitive>> },
    HStack { wrapped: Box<Id<Primitive>> },
    ZStack { wrapped: Box<Id<Primitive>> },
    Tuple2 { child1: Box<Id<Primitive>>, child2: Box<Id<Primitive>> },
    Tuple3 { child1: Box<Id<Primitive>>, child2: Box<Id<Primitive>>, child3: Box<Id<Primitive>> },
    Tuple4 { child1: Box<Id<Primitive>>, child2: Box<Id<Primitive>>, child3: Box<Id<Primitive>>, child4: Box<Id<Primitive>> },
    Tuple5 { child1: Box<Id<Primitive>>, child2: Box<Id<Primitive>>, child3: Box<Id<Primitive>>, child4: Box<Id<Primitive>>, child5: Box<Id<Primitive>> },
}