Merge branch 'master' into jk/breaking-merged
This commit is contained in:
211 files changed
+21135
-3770
No files matched your search
@@ -17,13 +17,12 @@ rustc-hash = "1.1.0"
|
||||
lru = "0.10.0"
|
||||
tracing = { workspace = true }
|
||||
http = "0.2.9"
|
||||
tokio = { version = "1.28", features = ["full"], optional = true }
|
||||
tokio = { version = "1.28", features = ["fs", "io-util"], optional = true }
|
||||
async-trait = "0.1.58"
|
||||
serde_json = { version = "1.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
dioxus = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
fern = { version = "0.6.0", features = ["colored"] }
|
||||
anyhow = "1.0"
|
||||
|
||||
@@ -92,27 +92,29 @@ impl Renderer {
|
||||
match segment {
|
||||
Segment::Attr(idx) => {
|
||||
let attr = &template.dynamic_attrs[*idx];
|
||||
if attr.name == "dangerous_inner_html" {
|
||||
inner_html = Some(attr);
|
||||
} else if attr.namespace == Some("style") {
|
||||
accumulated_dynamic_styles.push(attr);
|
||||
} else if BOOL_ATTRS.contains(&attr.name) {
|
||||
if truthy(&attr.value) {
|
||||
write!(buf, " {}=", attr.name)?;
|
||||
write_value(buf, &attr.value)?;
|
||||
attr.attribute_type().try_for_each(|attr| {
|
||||
if attr.name == "dangerous_inner_html" {
|
||||
inner_html = Some(attr);
|
||||
} else if attr.namespace == Some("style") {
|
||||
accumulated_dynamic_styles.push(attr);
|
||||
} else if BOOL_ATTRS.contains(&attr.name) {
|
||||
if truthy(&attr.value) {
|
||||
write_attribute(buf, attr)?;
|
||||
}
|
||||
} else {
|
||||
write_attribute(buf, attr)?;
|
||||
}
|
||||
} else {
|
||||
write_attribute(buf, attr)?;
|
||||
}
|
||||
|
||||
if self.pre_render {
|
||||
if let AttributeValue::Listener(_) = &attr.value {
|
||||
// The onmounted event doesn't need a DOM listener
|
||||
if attr.name != "onmounted" {
|
||||
accumulated_listeners.push(attr.name);
|
||||
if self.pre_render {
|
||||
if let AttributeValue::Listener(_) = &attr.value {
|
||||
// The onmounted event doesn't need a DOM listener
|
||||
if attr.name != "onmounted" {
|
||||
accumulated_listeners.push(attr.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
}
|
||||
Segment::Node(idx) => match &template.dynamic_nodes[*idx] {
|
||||
DynamicNode::Component(node) => {
|
||||
@@ -240,7 +242,9 @@ fn to_string_works() {
|
||||
div {}
|
||||
div { "nest 2" }
|
||||
"{dyn2}"
|
||||
(0..5).map(|i| render! { div { "finalize {i}" } })
|
||||
for i in (0..5) {
|
||||
div { "finalize {i}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,16 +405,6 @@ pub(crate) fn write_attribute(buf: &mut impl Write, attr: &Attribute) -> std::fm
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn write_value(buf: &mut impl Write, value: &AttributeValue) -> std::fmt::Result {
|
||||
match value {
|
||||
AttributeValue::Text(value) => write!(buf, "\"{}\"", value),
|
||||
AttributeValue::Bool(value) => write!(buf, "{}", value),
|
||||
AttributeValue::Int(value) => write!(buf, "{}", value),
|
||||
AttributeValue::Float(value) => write!(buf, "{}", value),
|
||||
_ => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn write_value_unquoted(
|
||||
buf: &mut impl Write,
|
||||
value: &AttributeValue,
|
||||
|
||||
@@ -70,7 +70,7 @@ fn text_nodes() {
|
||||
fn app(_: ()) -> Element {
|
||||
let dynamic_text = "hello";
|
||||
render! {
|
||||
div { dynamic_text }
|
||||
div { {dynamic_text} }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ fn components_hydrate() {
|
||||
fn Child2(_: ()) -> Element {
|
||||
let dyn_text = "hello";
|
||||
render! {
|
||||
div { dyn_text }
|
||||
div { {dyn_text} }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,11 +159,7 @@ fn components_hydrate() {
|
||||
fn Child4(_: ()) -> Element {
|
||||
render! {
|
||||
for _ in 0..2 {
|
||||
render! {
|
||||
render! {
|
||||
"{1}"
|
||||
}
|
||||
}
|
||||
{render! { "{1}" }}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ fn lists() {
|
||||
ul {
|
||||
(0..5).map(|i| render! {
|
||||
li { "item {i}" }
|
||||
})
|
||||
}
|
||||
}
|
||||
}),
|
||||
"<ul><li>item 0</li><li>item 1</li><li>item 2</li><li>item 3</li><li>item 4</li></ul>"
|
||||
@@ -58,7 +58,7 @@ fn components() {
|
||||
div {
|
||||
(0..5).map(|name| render! {
|
||||
MyComponent { name: name }
|
||||
})
|
||||
}
|
||||
}
|
||||
}),
|
||||
"<div><div>component 0</div><div>component 1</div><div>component 2</div><div>component 3</div><div>component 4</div></div>"
|
||||
|
||||
Reference in new issue
Block a user