Allow Multiple dependencies for states in the RealDom (native core) (#412)

* WIP multable deps

* WIP: refactor and genralize state macro

* add traversable trait

* update tui to use elementid to index dom
This commit is contained in:
Demonthos authored and GitHub committed 2022-07-07 00:50:22 -04:00
1 parent c271fc132e
commit 4a5ae758ee
19 files changed
+990 -1103

No files matched your search

+2 -3
View File
@@ -62,13 +62,12 @@ pub(crate) struct Focus {
pub level: FocusLevel,
}
impl NodeDepState for Focus {
impl NodeDepState<()> for Focus {
type Ctx = ();
type DepState = ();
const NODE_MASK: NodeMask =
NodeMask::new_with_attrs(AttributeMask::Static(FOCUS_ATTRIBUTES)).with_listeners();
fn reduce(&mut self, node: NodeView<'_>, _sibling: &Self::DepState, _: &Self::Ctx) -> bool {
fn reduce(&mut self, node: NodeView<'_>, _sibling: (), _: &Self::Ctx) -> bool {
let new = Focus {
level: if let Some(a) = node.attributes().find(|a| a.name == "tabindex") {
if let Some(index) = a