Add space around = for Sycamore props
All checks were successful
/ test (pull_request) Successful in 3m35s

Also, add a trailing comma to a match arm in `outline.rs`.
This commit is contained in:
Aaron Fenyes 2025-08-02 00:15:46 -07:00
parent bfd5d8e35f
commit b02e682e15
6 changed files with 80 additions and 80 deletions

View file

@ -10,9 +10,9 @@ use crate::{
#[component]
pub fn AddRemove() -> View {
view! {
div(id="add-remove") {
div(id = "add-remove") {
button(
on:click=|_| {
on:click = |_| {
let state = use_context::<AppState>();
batch(|| {
// this call is batched to avoid redundant realizations.
@ -33,18 +33,18 @@ pub fn AddRemove() -> View {
}
) { "Add sphere" }
button(
on:click=|_| {
on:click = |_| {
let state = use_context::<AppState>();
state.assembly.insert_element_default::<Point>();
}
) { "Add point" }
button(
class="emoji", /* KLUDGE */ // for convenience, we're using an emoji as a temporary icon for this button
disabled={
class = "emoji", /* KLUDGE */ // for convenience, we're using an emoji as a temporary icon for this button
disabled = {
let state = use_context::<AppState>();
state.selection.with(|sel| sel.len() != 2)
},
on:click=|_| {
on:click = |_| {
let state = use_context::<AppState>();
let subjects: [_; 2] = state.selection.with(
// the button is only enabled when two elements are

View file

@ -27,15 +27,15 @@ fn RealizationStatus() -> View {
let realization_status = state.assembly.realization_status;
view! {
div(
id="realization-status",
class=realization_status.with(
id = "realization-status",
class = realization_status.with(
|status| match status {
Ok(_) => "",
Err(_) => "invalid",
}
)
) {
div(class="status")
div(class = "status")
div {
(realization_status.with(
|status| match status {
@ -103,7 +103,7 @@ fn LossHistory() -> View {
});
view! {
div(id=CONTAINER_ID, class="diagnostics-chart")
div(id = CONTAINER_ID, class = "diagnostics-chart")
}
}
@ -209,7 +209,7 @@ fn SpectrumHistory() -> View {
});
view! {
div(id=CONTAINER_ID, class="diagnostics-chart")
div(id = CONTAINER_ID, class = "diagnostics-chart")
}
}
@ -218,8 +218,8 @@ fn DiagnosticsPanel(name: &'static str, children: Children) -> View {
let diagnostics_state = use_context::<DiagnosticsState>();
view! {
div(
class="diagnostics-panel",
"hidden"=diagnostics_state.active_tab.with(
class = "diagnostics-panel",
"hidden" = diagnostics_state.active_tab.with(
|active_tab| {
if active_tab == name {
None
@ -241,16 +241,16 @@ pub fn Diagnostics() -> View {
provide_context(diagnostics_state);
view! {
div(id="diagnostics") {
div(id="diagnostics-bar") {
div(id = "diagnostics") {
div(id = "diagnostics-bar") {
RealizationStatus {}
select(bind:value=active_tab) {
option(value="loss") { "Loss" }
option(value="spectrum") { "Spectrum" }
select(bind:value = active_tab) {
option(value = "loss") { "Loss" }
option(value = "spectrum") { "Spectrum" }
}
}
DiagnosticsPanel(name="loss") { LossHistory {} }
DiagnosticsPanel(name="spectrum") { SpectrumHistory {} }
DiagnosticsPanel(name = "loss") { LossHistory {} }
DiagnosticsPanel(name = "spectrum") { SpectrumHistory {} }
}
}
}

View file

@ -833,12 +833,12 @@ pub fn Display() -> View {
// switch back to integer-valued parameters when that becomes possible
// again
canvas(
ref=display,
id="display",
width="600",
height="600",
tabindex="0",
on:keydown=move |event: KeyboardEvent| {
ref = display,
id = "display",
width = "600",
height = "600",
tabindex = "0",
on:keydown = move |event: KeyboardEvent| {
if event.key() == "Shift" {
// swap navigation inputs
roll_cw.set(yaw_right.get());
@ -864,7 +864,7 @@ pub fn Display() -> View {
set_manip_signal(&event, 1.0);
}
},
on:keyup=move |event: KeyboardEvent| {
on:keyup = move |event: KeyboardEvent| {
if event.key() == "Shift" {
// swap navigation inputs
yaw_right.set(roll_cw.get());
@ -886,7 +886,7 @@ pub fn Display() -> View {
set_manip_signal(&event, 0.0);
}
},
on:blur=move |_| {
on:blur = move |_| {
pitch_up.set(0.0);
pitch_down.set(0.0);
yaw_right.set(0.0);
@ -894,7 +894,7 @@ pub fn Display() -> View {
roll_ccw.set(0.0);
roll_cw.set(0.0);
},
on:click=move |event: MouseEvent| {
on:click = move |event: MouseEvent| {
// find the nearest element along the pointer direction
let (dir, pixel_size) = event_dir(&event);
console::log_1(&JsValue::from(dir.to_string()));

View file

@ -45,8 +45,8 @@ fn RegulatorInput(regulator: Rc<dyn Regulator>) -> View {
view! {
input(
r#type="text",
class=move || {
r#type = "text",
class = move || {
if valid.get() {
set_point.with(|set_pt| {
if set_pt.is_present() {
@ -59,9 +59,9 @@ fn RegulatorInput(regulator: Rc<dyn Regulator>) -> View {
"regulator-input invalid"
}
},
placeholder=measurement.with(|result| result.to_string()),
bind:value=value,
on:change=move |_| {
placeholder = measurement.with(|result| result.to_string()),
bind:value = value,
on:change = move |_| {
valid.set(
match SpecifiedValue::try_from(value.get_clone_untracked()) {
Ok(set_pt) => {
@ -72,11 +72,11 @@ fn RegulatorInput(regulator: Rc<dyn Regulator>) -> View {
}
)
},
on:keydown={
on:keydown = {
move |event: KeyboardEvent| {
match event.key().as_str() {
"Escape" => reset_value(),
_ => ()
_ => (),
}
}
},
@ -96,11 +96,11 @@ impl OutlineItem for InversiveDistanceRegulator {
self.subjects[0].label()
}.clone();
view! {
li(class="regulator") {
div(class="regulator-label") { (other_subject_label) }
div(class="regulator-type") { "Inversive distance" }
RegulatorInput(regulator=self)
div(class="status")
li(class = "regulator") {
div(class = "regulator-label") { (other_subject_label) }
div(class = "regulator-type") { "Inversive distance" }
RegulatorInput(regulator = self)
div(class = "status")
}
}
}
@ -109,11 +109,11 @@ impl OutlineItem for InversiveDistanceRegulator {
impl OutlineItem for HalfCurvatureRegulator {
fn outline_item(self: Rc<Self>, _element: &Rc<dyn Element>) -> View {
view! {
li(class="regulator") {
div(class="regulator-label") // for spacing
div(class="regulator-type") { "Half-curvature" }
RegulatorInput(regulator=self)
div(class="status")
li(class = "regulator") {
div(class = "regulator-label") // for spacing
div(class = "regulator-type") { "Half-curvature" }
RegulatorInput(regulator = self)
div(class = "status")
}
}
}
@ -152,10 +152,10 @@ fn ElementOutlineItem(element: Rc<dyn Element>) -> View {
let details_node = create_node_ref();
view! {
li {
details(ref=details_node) {
details(ref = details_node) {
summary(
class=class.get(),
on:keydown={
class = class.get(),
on:keydown = {
let element_for_handler = element.clone();
move |event: KeyboardEvent| {
match event.key().as_str() {
@ -181,12 +181,12 @@ fn ElementOutlineItem(element: Rc<dyn Element>) -> View {
}
) {
div(
class="element-switch",
on:click=|event: MouseEvent| event.stop_propagation()
class = "element-switch",
on:click = |event: MouseEvent| event.stop_propagation()
)
div(
class="element",
on:click={
class = "element",
on:click = {
let state_for_handler = state.clone();
let element_for_handler = element.clone();
move |event: MouseEvent| {
@ -196,20 +196,20 @@ fn ElementOutlineItem(element: Rc<dyn Element>) -> View {
}
}
) {
div(class="element-label") { (label) }
div(class="element-representation") { (rep_components) }
div(class = "element-label") { (label) }
div(class = "element-representation") { (rep_components) }
input(
r#type="checkbox",
bind:checked=element.ghost(),
on:click=|event: MouseEvent| event.stop_propagation()
r#type = "checkbox",
bind:checked = element.ghost(),
on:click = |event: MouseEvent| event.stop_propagation()
)
}
}
ul(class="regulators") {
ul(class = "regulators") {
Keyed(
list=regulator_list,
view=move |reg| reg.outline_item(&element),
key=|reg| reg.serial()
list = regulator_list,
view = move |reg| reg.outline_item(&element),
key = |reg| reg.serial()
)
}
}
@ -242,18 +242,18 @@ pub fn Outline() -> View {
view! {
ul(
id="outline",
on:click={
id = "outline",
on:click = {
let state = use_context::<AppState>();
move |_| state.selection.update(|sel| sel.clear())
}
) {
Keyed(
list=element_list,
view=|elt| view! {
ElementOutlineItem(element=elt)
list = element_list,
view = |elt| view! {
ElementOutlineItem(element = elt)
},
key=|elt| elt.serial()
key = |elt| elt.serial()
)
}
}

View file

@ -925,17 +925,17 @@ pub fn TestAssemblyChooser() -> View {
// build the chooser
view! {
select(bind:value=assembly_name) {
option(value="general") { "General" }
option(value="low-curv") { "Low-curvature" }
option(value="pointed") { "Pointed" }
option(value="tridim-icosahedron") { "Tridiminished icosahedron" }
option(value="dodeca-packing") { "Dodecahedral packing" }
option(value="balanced") { "Balanced" }
option(value="off-center") { "Off-center" }
option(value="radius-ratio") { "Radius ratio" }
option(value="irisawa-hexlet") { "Irisawa hexlet" }
option(value="empty") { "Empty" }
select(bind:value = assembly_name) {
option(value = "general") { "General" }
option(value = "low-curv") { "Low-curvature" }
option(value = "pointed") { "Pointed" }
option(value = "tridim-icosahedron") { "Tridiminished icosahedron" }
option(value = "dodeca-packing") { "Dodecahedral packing" }
option(value = "balanced") { "Balanced" }
option(value = "off-center") { "Off-center" }
option(value = "radius-ratio") { "Radius ratio" }
option(value = "irisawa-hexlet") { "Irisawa hexlet" }
option(value = "empty") { "Empty" }
}
}
}

View file

@ -58,7 +58,7 @@ fn main() {
provide_context(AppState::new());
view! {
div(id="sidebar") {
div(id = "sidebar") {
AddRemove {}
Outline {}
Diagnostics {}