feat: get desktop working with just creation
This commit is contained in:
1 parent
8caabb97d8
commit
e8ae830cf2
16 files changed
+1301
-329
No files matched your search
@@ -1,4 +1,4 @@
|
||||
use crate::arena::ElementId;
|
||||
use crate::{arena::ElementId, ScopeId};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Mutations<'a> {
|
||||
@@ -35,9 +35,61 @@ impl std::ops::DerefMut for Mutations<'_> {
|
||||
each subtree has its own numbering scheme
|
||||
*/
|
||||
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(
|
||||
feature = "serialize",
|
||||
derive(serde::Serialize, serde::Deserialize),
|
||||
serde(tag = "type")
|
||||
)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum Mutation<'a> {
|
||||
AppendChildren {
|
||||
m: usize,
|
||||
},
|
||||
|
||||
AssignId {
|
||||
path: &'static [u8],
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
CreateElement {
|
||||
name: &'a str,
|
||||
namespace: Option<&'a str>,
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
CreatePlaceholder {
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
CreateTextNode {
|
||||
value: &'a str,
|
||||
},
|
||||
HydrateText {
|
||||
path: &'static [u8],
|
||||
value: &'a str,
|
||||
id: ElementId,
|
||||
},
|
||||
LoadTemplate {
|
||||
name: &'static str,
|
||||
index: usize,
|
||||
},
|
||||
|
||||
// Take the current element and replace it with the element with the given id.
|
||||
ReplaceWith {
|
||||
id: ElementId,
|
||||
m: usize,
|
||||
},
|
||||
|
||||
ReplacePlaceholder {
|
||||
m: usize,
|
||||
path: &'static [u8],
|
||||
},
|
||||
|
||||
SaveTemplate {
|
||||
name: &'static str,
|
||||
m: usize,
|
||||
},
|
||||
|
||||
SetAttribute {
|
||||
name: &'a str,
|
||||
value: &'a str,
|
||||
@@ -50,20 +102,8 @@ pub enum Mutation<'a> {
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
LoadTemplate {
|
||||
name: &'static str,
|
||||
index: usize,
|
||||
},
|
||||
|
||||
SaveTemplate {
|
||||
name: &'static str,
|
||||
m: usize,
|
||||
},
|
||||
|
||||
HydrateText {
|
||||
path: &'static [u8],
|
||||
SetInnerText {
|
||||
value: &'a str,
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
SetText {
|
||||
@@ -71,41 +111,24 @@ pub enum Mutation<'a> {
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
ReplacePlaceholder {
|
||||
m: usize,
|
||||
path: &'static [u8],
|
||||
},
|
||||
/// Create a new Event Listener.
|
||||
NewEventListener {
|
||||
/// The name of the event to listen for.
|
||||
event_name: &'a str,
|
||||
|
||||
AssignId {
|
||||
path: &'static [u8],
|
||||
/// The ID of the node to attach the listener to.
|
||||
scope: ScopeId,
|
||||
|
||||
/// The ID of the node to attach the listener to.
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
// Take the current element and replace it with the element with the given id.
|
||||
Replace {
|
||||
/// Remove an existing Event Listener.
|
||||
RemoveEventListener {
|
||||
/// The ID of the node to remove.
|
||||
id: ElementId,
|
||||
m: usize,
|
||||
},
|
||||
|
||||
CreateElement {
|
||||
name: &'a str,
|
||||
namespace: Option<&'a str>,
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
SetInnerText {
|
||||
value: &'a str,
|
||||
},
|
||||
|
||||
CreateText {
|
||||
value: &'a str,
|
||||
},
|
||||
|
||||
CreatePlaceholder {
|
||||
id: ElementId,
|
||||
},
|
||||
|
||||
AppendChildren {
|
||||
m: usize,
|
||||
/// The name of the event to remove.
|
||||
event: &'a str,
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user