make TUI widgets cross framework

This commit is contained in:
Evan Almloff committed 2023-03-19 13:26:29 -05:00
1 parent 9a16687bdc
commit c4c35cb046
33 files changed
+3025 -1091

No files matched your search

+10 -8
View File
@@ -1,17 +1,19 @@
//! Helpers for watching for changes in the DOM tree.
use crate::{node::FromAnyValue, prelude::*};
use crate::{node::FromAnyValue, node_ref::AttributeMask, prelude::*};
/// A trait for watching for changes in the DOM tree.
pub trait NodeWatcher<V: FromAnyValue + Send + Sync> {
/// Called after a node is added to the tree.
fn on_node_added(&self, _node: NodeMut<V>) {}
fn on_node_added(&mut self, _node: NodeMut<V>) {}
/// Called before a node is removed from the tree.
fn on_node_removed(&self, _node: NodeMut<V>) {}
fn on_node_removed(&mut self, _node: NodeMut<V>) {}
/// Called after a node is moved to a new parent.
fn on_node_moved(&self, _node: NodeMut<V>) {}
// /// Called after the text content of a node is changed.
// fn on_text_changed(&self, _node: NodeMut<V>) {}
// /// Called after an attribute of an element is changed.
// fn on_attribute_changed(&self, _node: NodeMut<V>, attribute: &str) {}
fn on_node_moved(&mut self, _node: NodeMut<V>) {}
}
/// A trait for watching for changes to attributes of an element.
pub trait AttributeWatcher<V: FromAnyValue + Send + Sync> {
/// Called before update_state is called on the RealDom
fn on_attributes_changed(&self, _node: NodeMut<V>, _attributes: &AttributeMask) {}
}