Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/function_router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ rand = { version = "0.8", features = ["small_rng"] }
yew = { path = "../../packages/yew" }
yew-router = { path = "../../packages/yew-router" }
serde = { version = "1.0", features = ["derive"] }
lazy_static = "1.4.0"
gloo-timers = "0.2"
wasm-logger = "0.2"
instant = { version = "0.1", features = ["wasm-bindgen"] }
once_cell = "1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
Expand Down
14 changes: 6 additions & 8 deletions examples/function_router/src/generator.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use lazy_static::lazy_static;
use lipsum::MarkovChain;
use once_cell::sync::Lazy;
use rand::distributions::Bernoulli;
use rand::rngs::StdRng;
use rand::seq::IteratorRandom;
Expand All @@ -9,13 +9,11 @@ const KEYWORDS: &str = include_str!("../data/keywords.txt");
const SYLLABLES: &str = include_str!("../data/syllables.txt");
const YEW_CONTENT: &str = include_str!("../data/yew.txt");

lazy_static! {
static ref YEW_CHAIN: MarkovChain<'static> = {
let mut chain = MarkovChain::new();
chain.learn(YEW_CONTENT);
chain
};
}
static YEW_CHAIN: Lazy<MarkovChain<'static>> = Lazy::new(|| {
let mut chain = MarkovChain::new();
chain.learn(YEW_CONTENT);
chain
});

pub struct Generator {
pub seed: u32,
Expand Down
2 changes: 1 addition & 1 deletion examples/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ wasm-logger = "0.2"
yew = { path = "../../packages/yew", features = ["csr"] }
yew-router = { path = "../../packages/yew-router" }
serde = { version = "1.0", features = ["derive"] }
lazy_static = "1.4.0"
once_cell = "1"
gloo-timers = "0.2"
14 changes: 6 additions & 8 deletions examples/router/src/generator.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use lazy_static::lazy_static;
use lipsum::MarkovChain;
use once_cell::sync::Lazy;
use rand::distributions::Bernoulli;
use rand::rngs::SmallRng;
use rand::seq::IteratorRandom;
Expand All @@ -9,13 +9,11 @@ const KEYWORDS: &str = include_str!("../data/keywords.txt");
const SYLLABLES: &str = include_str!("../data/syllables.txt");
const YEW_CONTENT: &str = include_str!("../data/yew.txt");

lazy_static! {
static ref YEW_CHAIN: MarkovChain<'static> = {
let mut chain = MarkovChain::new();
chain.learn(YEW_CONTENT);
chain
};
}
static YEW_CHAIN: Lazy<MarkovChain<'static>> = Lazy::new(|| {
let mut chain = MarkovChain::new();
chain.learn(YEW_CONTENT);
chain
});

pub struct Generator {
pub seed: u64,
Expand Down
1 change: 0 additions & 1 deletion packages/yew-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ proc-macro = true

[dependencies]
boolinator = "2"
lazy_static = "1"
proc-macro-error = "1"
proc-macro2 = "1"
quote = "1"
Expand Down
294 changes: 143 additions & 151 deletions packages/yew-macro/src/props/element.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashSet;

use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use syn::parse::{Parse, ParseStream};
use syn::{Expr, ExprTuple};

Expand Down Expand Up @@ -64,154 +64,146 @@ impl Parse for ElementProps {
}
}

lazy_static! {
static ref BOOLEAN_SET: HashSet<&'static str> = {
vec![
// Living Standard
// From: https://html.spec.whatwg.org/#attributes-3
// where `Value` = Boolean attribute
// Note: `checked` is uniquely handled in the html! macro.
"allowfullscreen",
"async",
"autofocus",
"autoplay",
"controls",
"default",
"defer",
"disabled",
"formnovalidate",
"hidden",
"ismap",
"itemscope",
"loop",
"multiple",
"muted",
"nomodule",
"novalidate",
"open",
"playsinline",
"readonly",
"required",
"reversed",
"selected",
"truespeed",
]
.into_iter()
.collect()
};
}

lazy_static! {
static ref LISTENER_SET: HashSet<&'static str> = {
vec![
// Living Standard
// From: https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
"onabort",
"onauxclick",
"onblur",
"oncancel",
"oncanplay",
"oncanplaythrough",
"onchange",
"onclick",
"onclose",
"oncontextmenu",
"oncuechange",
"ondblclick",
"ondrag",
"ondragend",
"ondragenter",
"ondragexit",
"ondragleave",
"ondragover",
"ondragstart",
"ondrop",
"ondurationchange",
"onemptied",
"onended",
"onerror",
"onfocus",
// onfocusin + onfocusout not in standard but added due to browser support
// see issue 1896: https://github.com/yewstack/yew/issues/1896
"onfocusin",
"onfocusout",
"onformdata",
"oninput",
"oninvalid",
"onkeydown",
"onkeypress",
"onkeyup",
"onload",
"onloadeddata",
"onloadedmetadata",
"onloadstart",
"onmousedown",
"onmouseenter",
"onmouseleave",
"onmousemove",
"onmouseout",
"onmouseover",
"onmouseup",
"onpause",
"onplay",
"onplaying",
"onprogress",
"onratechange",
"onreset",
"onresize",
"onscroll",
"onsecuritypolicyviolation",
"onseeked",
"onseeking",
"onselect",
"onslotchange",
"onstalled",
"onsubmit",
"onsuspend",
"ontimeupdate",
"ontoggle",
"onvolumechange",
"onwaiting",
"onwheel",
static BOOLEAN_SET: Lazy<HashSet<&'static str>> = Lazy::new(|| {
Comment thread
ranile marked this conversation as resolved.
[
// Living Standard
// From: https://html.spec.whatwg.org/#attributes-3
// where `Value` = Boolean attribute
// Note: `checked` is uniquely handled in the html! macro.
"allowfullscreen",
"async",
"autofocus",
"autoplay",
"controls",
"default",
"defer",
"disabled",
"formnovalidate",
"hidden",
"ismap",
"itemscope",
"loop",
"multiple",
"muted",
"nomodule",
"novalidate",
"open",
"playsinline",
"readonly",
"required",
"reversed",
"selected",
"truespeed",
]
.into()
});

// Standard HTML Document and Element
// From: https://html.spec.whatwg.org/multipage/webappapis.html#documentandelementeventhandlers
"oncopy",
"oncut",
"onpaste",

// Others
// From: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers
"onanimationcancel",
"onanimationend",
"onanimationiteration",
"onanimationstart",
"ongotpointercapture",
"onloadend",
"onlostpointercapture",
"onpointercancel",
"onpointerdown",
"onpointerenter",
"onpointerleave",
"onpointerlockchange",
"onpointerlockerror",
"onpointermove",
"onpointerout",
"onpointerover",
"onpointerup",
"onselectionchange",
"onselectstart",
"onshow",
"ontouchcancel",
"ontouchend",
"ontouchmove",
"ontouchstart",
"ontransitioncancel",
"ontransitionend",
"ontransitionrun",
"ontransitionstart",
]
.into_iter()
.collect()
};
}
static LISTENER_SET: Lazy<HashSet<&'static str>> = Lazy::new(|| {
Comment thread
ranile marked this conversation as resolved.
[
// Living Standard
// From: https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
"onabort",
"onauxclick",
"onblur",
"oncancel",
"oncanplay",
"oncanplaythrough",
"onchange",
"onclick",
"onclose",
"oncontextmenu",
"oncuechange",
"ondblclick",
"ondrag",
"ondragend",
"ondragenter",
"ondragexit",
"ondragleave",
"ondragover",
"ondragstart",
"ondrop",
"ondurationchange",
"onemptied",
"onended",
"onerror",
"onfocus",
// onfocusin + onfocusout not in standard but added due to browser support
// see issue 1896: https://github.com/yewstack/yew/issues/1896
"onfocusin",
"onfocusout",
"onformdata",
"oninput",
"oninvalid",
"onkeydown",
"onkeypress",
"onkeyup",
"onload",
"onloadeddata",
"onloadedmetadata",
"onloadstart",
"onmousedown",
"onmouseenter",
"onmouseleave",
"onmousemove",
"onmouseout",
"onmouseover",
"onmouseup",
"onpause",
"onplay",
"onplaying",
"onprogress",
"onratechange",
"onreset",
"onresize",
"onscroll",
"onsecuritypolicyviolation",
"onseeked",
"onseeking",
"onselect",
"onslotchange",
"onstalled",
"onsubmit",
"onsuspend",
"ontimeupdate",
"ontoggle",
"onvolumechange",
"onwaiting",
"onwheel",
// Standard HTML Document and Element
// From: https://html.spec.whatwg.org/multipage/webappapis.html#documentandelementeventhandlers
"oncopy",
"oncut",
"onpaste",
// Others
// From: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers
"onanimationcancel",
"onanimationend",
"onanimationiteration",
"onanimationstart",
"ongotpointercapture",
"onloadend",
"onlostpointercapture",
"onpointercancel",
"onpointerdown",
"onpointerenter",
"onpointerleave",
"onpointerlockchange",
"onpointerlockerror",
"onpointermove",
"onpointerout",
"onpointerover",
"onpointerup",
"onselectionchange",
"onselectstart",
"onshow",
"ontouchcancel",
"ontouchend",
"ontouchmove",
"ontouchstart",
"ontransitioncancel",
"ontransitionend",
"ontransitionrun",
"ontransitionstart",
]
.into()
});
4 changes: 2 additions & 2 deletions tools/changelog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ git2 = "=0.14.2" # see https://github.com/rust-lang/git2-rs/issues/838 fixed wit
regex = "1"
reqwest = { version = "0.11", features = ["blocking", "json"] }
serde = { version = "1", features = ["derive"] }
structopt = "0.3"
strum = { version = "0.24", features = ["derive"] }
lazy_static = "1.4.0"
clap = { version = "3", features = ["derive"] }
semver = "1.0"
once_cell = "1"
Loading