|
@@ -10,7 +10,7 @@ use std::collections::VecDeque;
|
|
use std::ops::{Deref, DerefMut};
|
|
use std::ops::{Deref, DerefMut};
|
|
use std::sync::{Arc, RwLock};
|
|
use std::sync::{Arc, RwLock};
|
|
|
|
|
|
-use crate::custom_element::{CustomElementManager, CustomElementRegistry};
|
|
|
|
|
|
+use crate::custom_element::{CustomElement, CustomElementManager, CustomElementRegistry};
|
|
use crate::node::{
|
|
use crate::node::{
|
|
ElementNode, FromAnyValue, NodeType, OwnedAttributeDiscription, OwnedAttributeValue, TextNode,
|
|
ElementNode, FromAnyValue, NodeType, OwnedAttributeDiscription, OwnedAttributeValue, TextNode,
|
|
};
|
|
};
|
|
@@ -206,7 +206,7 @@ impl<V: FromAnyValue + Send + Sync> RealDom<V> {
|
|
if is_element {
|
|
if is_element {
|
|
let custom_elements = self.custom_elements.clone();
|
|
let custom_elements = self.custom_elements.clone();
|
|
custom_elements
|
|
custom_elements
|
|
- .write()
|
|
|
|
|
|
+ .read()
|
|
.unwrap()
|
|
.unwrap()
|
|
.add_shadow_dom(NodeMut::new(id, self));
|
|
.add_shadow_dom(NodeMut::new(id, self));
|
|
}
|
|
}
|
|
@@ -426,6 +426,11 @@ impl<V: FromAnyValue + Send + Sync> RealDom<V> {
|
|
pub fn raw_world_mut(&mut self) -> &mut World {
|
|
pub fn raw_world_mut(&mut self) -> &mut World {
|
|
&mut self.world
|
|
&mut self.world
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /// Registers a new custom element.
|
|
|
|
+ pub fn register_custom_element<E: CustomElement<V>>(&mut self) {
|
|
|
|
+ self.custom_elements.write().unwrap().register::<E>()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/// A reference to a tracked component in a node.
|
|
/// A reference to a tracked component in a node.
|