Skip to content

Commit

Permalink
**breaking** remove custom_element feature and WebComponent as its fu…
Browse files Browse the repository at this point in the history
…nctionality is superseeded by StatefulComponent
  • Loading branch information
ivanceras committed Apr 17, 2024
1 parent 49ceea6 commit d1954f8
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 670 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sauron-macro = { version = "0.61", path = "crates/macro", optional = true }
sauron-html-parser = { version = "0.61", path = "crates/html-parser", optional = true }

[features]
default = ["with-dom", "with-node-macro", "custom_element", "with-interning", "with-jss"]
default = ["with-dom", "with-node-macro", "with-interning", "with-jss"]
with-dom = ["sauron-core/with-dom"]
with-lookup = ["sauron-core/with-lookup"]
with-ric = ["sauron-core/with-ric"]
Expand All @@ -37,7 +37,6 @@ with-trace = ["sauron-core/with-trace"]

# lets you use node! macro to write html like code in the view
with-node-macro = ["sauron-macro"]
custom_element = ["sauron-macro","sauron-core/custom_element"]
html-parser = ["sauron-html-parser"]
use-template = ["sauron-core/use-template"]
use-skipdiff = ["sauron-core/use-skipdiff"]
Expand Down
20 changes: 20 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## Unreleased
- remove support for `custom_element` as its functionality is superseeded with `stateful_component`

## 0.61.5
- rename `safe_html` to `raw_html`
- decode html entities before parsing and converting into node
- optimize dispatching of mount event only to element that has attached event listener to on_mount
- make `stateful_component` patches work on its own dom tree

## 0.61.4
- make `use-template` and `use-skipdiff` fail safe if the template and skipdiff is not used in the view
- feat: feature gate `with-trace` for determining how much time is spent in section of making stateful component

## 0.61.3
- more clippy lint fixes
- improvements on the examples

## 0.61.2
- use `with-lookup` feature by default

## 0.61.0
- add template system, skip_diff
- web_sys::Node is now wrapped with DomNode, the event listeners
Expand Down
1 change: 0 additions & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ log-patches = [] # use in combination to with-debug to log the debug patches
with-ric = [] # use of request_idle_callback in javascript
with-raf = [] # use of request_animation_frame in javascript
with-interning = [] # use caching of strings when crossing rust to js, for faster transfer
custom_element = [] # use of register_custom_element, adding this will add the js snippets
ensure-check = [] #do checking if pending msgs, patches, cmds, has been processed accordingly to ensure proper order and synchronized dom state
ensure-attr-set = [] #ensure attributes is reflected into the element by explicitly calling the element corresponding methods aside fro just setting its attribute by name
test-fixtures = [] #include the test-fixtures for updating the program with the supplied vdom
Expand Down
2 changes: 0 additions & 2 deletions crates/core/src/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ use cfg_if::cfg_if;

cfg_if! {if #[cfg(feature = "with-dom")] {
pub use application::{Application, Measurements, SkipDiff, skip_if, skip_diff, SkipPath};
#[cfg(feature = "custom_element")]
pub use component::{register_web_component, WebComponent, WebComponentWrapper};
pub use component::{stateful_component, StatefulComponent, StatefulModel, StatelessModel};
pub use component::component;
pub use dom_patch::{DomPatch, PatchVariant};
Expand Down
5 changes: 0 additions & 5 deletions crates/core/src/dom/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ use std::any::TypeId;
#[cfg(feature = "with-dom")]
pub use stateful_component::{stateful_component, StatefulComponent, StatefulModel};

#[cfg(feature = "custom_element")]
pub use web_component::{register_web_component, WebComponent, WebComponentWrapper};

#[cfg(feature = "with-dom")]
mod stateful_component;
#[cfg(feature = "use-template")]
pub(crate) mod template;
#[cfg(feature = "custom_element")]
mod web_component;

/// A component has a view and can update itself.
///
Expand Down
7 changes: 5 additions & 2 deletions crates/core/src/dom/component/stateful_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,17 @@ where
#[cfg(feature = "with-dom")]
impl From<wasm_bindgen::JsValue> for DomAttrValue {
fn from(val: wasm_bindgen::JsValue) -> Self {
if let Some(v) = val.as_bool() {
if val.is_null(){
DomAttrValue::Empty
}
else if let Some(v) = val.as_bool() {
DomAttrValue::Simple(v.into())
} else if let Some(v) = val.as_f64() {
DomAttrValue::Simple(v.into())
} else if let Some(v) = val.as_string() {
DomAttrValue::Simple(v.into())
} else {
todo!("handle other conversion, other than bool, f64, strings, nulls ")
todo!("for: {:?}", val)
}
}
}
195 changes: 0 additions & 195 deletions crates/core/src/dom/component/web_component.rs

This file was deleted.

4 changes: 0 additions & 4 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ pub mod prelude {
MountTarget, Cmd, TimeoutCallbackHandle, DomAttrValue,
stateful_component, Time,
};
#[cfg(feature = "custom_element")]
pub use crate::dom::WebComponent;
#[cfg(feature = "custom_element")]
pub use crate::dom::WebComponentWrapper;
}}
}

Expand Down
Loading

0 comments on commit d1954f8

Please sign in to comment.