Skip to content

Commit

Permalink
fix effect path; upgrade deps; tag 0.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Dec 27, 2022
1 parent 34c0286 commit 633aa8a
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 56 deletions.
67 changes: 37 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions demo_respo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ readme = "README.md"

[dependencies]
respo = { path = "../respo/" }
js-sys = "0.3.57"
wasm-bindgen = "0.2.80"
js-sys = "0.3.60"
wasm-bindgen = "0.2.83"
console_error_panic_hook = "0.1.7"
serde = { version = "1.0.137", features = [ "derive" ] }
serde_json = "1.0.81"
uuid = { version = "1.1.1", features = [ "v4", "js" ] }
serde = { version = "1.0.152", features = [ "derive" ] }
serde_json = "1.0.91"
uuid = { version = "1.2.2", features = [ "v4", "js" ] }

[dependencies.web-sys]
version = "0.3.57"
version = "0.3.60"
features = [
"console",
'Document',
Expand Down
14 changes: 7 additions & 7 deletions respo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "respo"
version = "0.0.16"
version = "0.0.17"
edition = "2021"
description = "a tiny virtual DOM library migrated from ClojureScript"
license = "Apache-2.0"
Expand All @@ -12,19 +12,19 @@ readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
js-sys = "0.3.57"
wasm-bindgen = "0.2.80"
js-sys = "0.3.60"
wasm-bindgen = "0.2.83"
lazy_static = "1.4.0"
serde = { version = "1.0.137", features = [ "derive" ] }
serde_json = "1.0.81"
cirru_parser = "0.1.22"
serde = { version = "1.0.152", features = [ "derive" ] }
serde_json = "1.0.91"
cirru_parser = "0.1.24"
rust-hsluv = "0.1.4"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies.web-sys]
version = "0.3.57"
version = "0.3.60"
features = [
"console",
'Document',
Expand Down
11 changes: 2 additions & 9 deletions respo/src/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ use std::fmt::Debug;
use std::rc::Rc;
use wasm_bindgen::prelude::Closure;
use wasm_bindgen::{JsCast, JsValue};
use web_sys::console::log_1;
use web_sys::{Element, HtmlElement, KeyboardEvent, KeyboardEventInit, Node};

use crate::{input, log, respo, static_styles, CssDisplay, DispatchFn, RespoEffectType, RespoEvent, RespoNode};
use crate::{input, respo, static_styles, CssDisplay, DispatchFn, RespoEffectType, RespoEvent, RespoNode};
use crate::{CssColor, CssOverflow, CssPosition, CssSize, RespoEffectArg, RespoStyle};

pub(crate) const BUTTON_NAME: &str = "dialog-button";
Expand Down Expand Up @@ -212,12 +211,7 @@ pub(crate) fn effect_keydown(_args: Vec<RespoEffectArg>, effect_type: RespoEffec
.key_code(event.key_code());
let new_event = KeyboardEvent::new_with_keyboard_event_init_dict(&event.type_(), &init_dict).unwrap();

// log_1(&new_event);
// log_1(&el_1);

// TODO need to find target more accurately
// el_1.dispatch_event(&new_event).unwrap();
el_1.last_child().unwrap().dispatch_event(&new_event).unwrap();
el_1.dispatch_event(&new_event).unwrap();
}) as Box<dyn FnMut(_)>);
window
.add_event_listener_with_callback("keydown", listener.as_ref().unchecked_ref())
Expand Down Expand Up @@ -251,7 +245,6 @@ where
input()
.style(RespoStyle::default().display(CssDisplay::None).to_owned())
.on_keydown(move |e, dispatch| -> Result<(), String> {
log!("keydown");
if let RespoEvent::Keyboard { key, .. } = e {
if key == "Escape" {
on_close(dispatch)?;
Expand Down
12 changes: 8 additions & 4 deletions respo/src/respo/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,12 @@ where
Ok(())
}
RespoNode::Element { children, .. } => {
for (k, child) in children {
for (idx, (k, child)) in children.iter().enumerate() {
let mut next_coord = coord.to_owned();
next_coord.push(RespoCoord::Key(k.to_owned()));
collect_effects_outside_in_as(child, &next_coord, dom_path, effect_type, changes)?;
let mut next_dom_path = dom_path.to_owned();
next_dom_path.push(idx as u32);
collect_effects_outside_in_as(child, &next_coord, &next_dom_path, effect_type, changes)?;
}
Ok(())
}
Expand Down Expand Up @@ -430,10 +432,12 @@ where
Ok(())
}
RespoNode::Element { children, .. } => {
for (k, child) in children {
for (idx, (k, child)) in children.iter().enumerate() {
let mut next_coord = coord.to_owned();
next_coord.push(RespoCoord::Key(k.to_owned()));
collect_effects_inside_out_as(child, &next_coord, dom_path, effect_type, changes)?;
let mut next_dom_path = dom_path.to_owned();
next_dom_path.push(idx as u32);
collect_effects_inside_out_as(child, &next_coord, &next_dom_path, effect_type, changes)?;
}
Ok(())
}
Expand Down

0 comments on commit 633aa8a

Please sign in to comment.