Phase 3.1-3.3: ReactiveTracker with ElementId assignment during parsing, dependency scanning, variable change notification in app.rs

This commit is contained in:
Glint Dev
2026-07-21 20:38:41 +03:00
parent a46c9bc9e7
commit d8d3f57a21
4 changed files with 249 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ use std::collections::HashMap;
use std::fmt;
use super::reactive::{ElementId, ReactiveTracker};
use super::style::{ComputedStyle, StyleSheet};
use compact_str::CompactString;
@@ -164,6 +165,7 @@ pub struct Element<'a> {
pub properties: Vec<(Cow<'a, str>, Cow<'a, str>)>,
pub children: Vec<Element<'a>>,
pub computed_style: ComputedStyle,
pub element_id: ElementId,
}
impl<'a> Element<'a> {
@@ -179,6 +181,17 @@ impl<'a> Element<'a> {
properties: Vec::with_capacity(8),
children: Vec::with_capacity(4),
computed_style: ComputedStyle::default(),
element_id: ElementId(u32::MAX),
}
}
pub fn new_with_id(type_name: &'a str, id: ElementId) -> Self {
Self {
type_name,
properties: Vec::with_capacity(8),
children: Vec::with_capacity(4),
computed_style: ComputedStyle::default(),
element_id: id,
}
}
}
@@ -198,6 +211,7 @@ pub struct Document<'a> {
pub rhei_scripts: Vec<String>,
pub stylesheet: StyleSheet,
pub interner: Interner,
pub tracker: ReactiveTracker,
}
#[derive(Debug)]