Skip to content

Commit e777b23

Browse files
committed
update to sauron 0.57.4
1 parent 568e80d commit e777b23

File tree

2 files changed

+67
-71
lines changed

2 files changed

+67
-71
lines changed

frameworks/non-keyed/sauron/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ crate-type = ["cdylib"]
1010
[dependencies]
1111
rand = { version = "0.8.5", features = ["small_rng"] }
1212
getrandom = { version = "0.2.7", features = ["js"] }
13-
wasm-bindgen = "0.2.82"
14-
web-sys = { version = "0.3.59", features = ["Window"] }
15-
sauron = "0.50.3"
13+
sauron = "0.57.4"
1614

1715
[profile.release]
1816
lto = true

frameworks/non-keyed/sauron/src/lib.rs

Lines changed: 66 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use rand::prelude::*;
2-
use sauron::prelude::*;
2+
use sauron::*;
33
use std::cmp::min;
4-
use web_sys::window;
54

65
static ADJECTIVES: &[&str] = &[
76
"pretty",
@@ -158,7 +157,7 @@ impl Application<Msg> for App {
158157

159158
node! {
160159
<div class="container">
161-
{ jumbotron_view() }
160+
{ self.view_jumbotron() }
162161
<table class="table table-hover table-striped test-data">
163162
<tbody id="tbody">
164163
{ for r in rows { r } }
@@ -170,79 +169,78 @@ impl Application<Msg> for App {
170169
}
171170
}
172171

173-
pub struct Jumbotron;
174-
175-
fn jumbotron_view() -> Node<Msg> {
176-
node! {
177-
<div class="jumbotron">
178-
<div class="row">
179-
<div class="col-md-6">
180-
<h1>{ text("Sauron") }</h1>
181-
</div>
182-
<div class="col-md-6">
183-
<div class="row">
184-
<div class="col-sm-6 smallpad">
185-
<button
186-
type="button"
187-
id="run"
188-
class="btn btn-primary btn-block"
189-
on_click={|_| Msg::Run(1_000) }>
190-
{ text("Create 1,000 rows") }
191-
</button>
192-
</div>
193-
<div class="col-sm-6 smallpad">
194-
<button
195-
type="button"
196-
class="btn btn-primary btn-block"
197-
on_click={|_| Msg::Run(10_000)}
198-
id="runlots">
199-
{ text("Create 10,000 rows") }
200-
</button>
201-
</div>
202-
<div class="col-sm-6 smallpad">
203-
<button
204-
type="button"
205-
class="btn btn-primary btn-block"
206-
on_click={ |_| Msg::Add(1_000)} id="add">
207-
{ text("Append 1,000 rows") }
208-
</button>
209-
</div>
210-
<div class="col-sm-6 smallpad">
211-
<button
212-
type="button"
213-
class="btn btn-primary btn-block"
214-
on_click={|_|Msg::Update(10)}
215-
id="update">
216-
{ text("Update every 10th row") }
217-
</button>
218-
</div>
219-
<div class="col-sm-6 smallpad">
220-
<button
221-
type="button"
222-
class="btn btn-primary btn-block"
223-
on_click={|_|Msg::Clear} id="clear">
224-
{ text("Clear") }
225-
</button>
226-
</div>
227-
<div class="col-sm-6 smallpad">
228-
<button
229-
type="button"
230-
class="btn btn-primary btn-block"
231-
on_click={ |_|Msg::Swap }
232-
id="swaprows">
233-
{ text("Swap Rows" ) }
234-
</button>
172+
impl App {
173+
fn view_jumbotron(&self) -> Node<Msg> {
174+
node! {
175+
<div class="jumbotron">
176+
<div class="row">
177+
<div class="col-md-6">
178+
<h1>Sauron</h1>
179+
</div>
180+
<div class="col-md-6">
181+
<div class="row">
182+
<div class="col-sm-6 smallpad">
183+
<button
184+
type="button"
185+
id="run"
186+
class="btn btn-primary btn-block"
187+
on_click={|_| Msg::Run(1_000) }>
188+
Create 1,000 rows
189+
</button>
190+
</div>
191+
<div class="col-sm-6 smallpad">
192+
<button
193+
type="button"
194+
class="btn btn-primary btn-block"
195+
on_click={|_| Msg::Run(10_000)}
196+
id="runlots">
197+
Create 10,000 rows
198+
</button>
199+
</div>
200+
<div class="col-sm-6 smallpad">
201+
<button
202+
type="button"
203+
class="btn btn-primary btn-block"
204+
on_click={ |_| Msg::Add(1_000)} id="add">
205+
Append 1,000 rows
206+
</button>
207+
</div>
208+
<div class="col-sm-6 smallpad">
209+
<button
210+
type="button"
211+
class="btn btn-primary btn-block"
212+
on_click={|_|Msg::Update(10)}
213+
id="update">
214+
Update every 10th row
215+
</button>
216+
</div>
217+
<div class="col-sm-6 smallpad">
218+
<button
219+
type="button"
220+
class="btn btn-primary btn-block"
221+
on_click={|_|Msg::Clear} id="clear">
222+
Clear
223+
</button>
224+
</div>
225+
<div class="col-sm-6 smallpad">
226+
<button
227+
type="button"
228+
class="btn btn-primary btn-block"
229+
on_click={ |_|Msg::Swap }
230+
id="swaprows">
231+
Swap Rows
232+
</button>
233+
</div>
235234
</div>
236235
</div>
237236
</div>
238237
</div>
239-
</div>
238+
}
240239
}
241240
}
242241

243242
#[wasm_bindgen(start)]
244243
pub fn start() {
245-
let document = window().unwrap().document().unwrap();
246-
let mount_el = document.query_selector("#main").unwrap().unwrap();
244+
let mount_el = sauron::document().query_selector("#main").unwrap().unwrap();
247245
Program::append_to_mount(App::new(), &mount_el);
248246
}

0 commit comments

Comments
 (0)