This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elements: [ | |
decrement_button: LINK | |
increment_button: LINK | |
] | |
counter: | |
LATEST { | |
0 | |
elements.decrement_button.event.press |> THEN { -1 } | |
elements.increment_button.event.press |> THEN { 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::any::Any; | |
use zoon::{once_cell::sync::Lazy, *, named_color::*}; | |
fn main() { | |
start_app("app", root); | |
} | |
#[derive(Clone, Copy)] | |
struct DecreaseButtonPressed; | |
#[derive(Clone, Copy)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{cell::Cell, iter, rc::Rc}; | |
use zoon::*; | |
#[static_ref] | |
fn load_assets_once() -> &'static Mutable<bool> { | |
Task::start(async { | |
load_script(public_url("sortable/sortable_1.15.0.min.js")).await; | |
load_assets_once().set(true); | |
}); | |
Mutable::default() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspiration: | |
# - https://github.com/LukeMathWalker/cargo-chef | |
# - https://dev.to/rogertorres/first-steps-with-docker-rust-30oi | |
# - https://snyk.io/blog/10-best-practices-to-containerize-nodejs-web-applications-with-docker/ | |
# - https://stackoverflow.com/a/54245466 | |
FROM lukemathwalker/cargo-chef:0.1.51-rust-latest AS chef | |
RUN rustup target add wasm32-unknown-unknown | |
# `libclang` is required because of `argonautica` | |
RUN apt-get update && apt-get install -y \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use zoon::{println, *}; | |
fn root() -> impl Element { | |
let addend_a = Mutable::new(1); | |
let addend_b = Mutable::new(1); | |
let sum = map_ref! { | |
let addend_a = addend_a.signal(), | |
let addend_b = addend_b.signal() => { | |
println!("A: {addend_a}, B: {addend_b}"); | |
addend_a + addend_b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{collections::{HashMap, VecDeque}, rc::Rc}; | |
pub type Value = i32; | |
pub type Result<T> = std::result::Result<T, Error>; | |
// ------ Error ------ | |
#[derive(Debug, PartialEq, Eq)] | |
pub enum Error { | |
DivisionByZero, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use zoon::*; | |
use std::ops::Not; | |
blocks!{ | |
#[el] | |
pub fn root() -> View { | |
view![ | |
font::size(14), | |
font::family!("Helvetica Neue", "Helvetica", "Arial", font::sans_serif()), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use zoon::*; | |
blocks!{ | |
#[s_var] | |
fn counter() -> i32 { | |
0 | |
} | |
#[update] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(dead_code)] | |
use std::collections::BTreeMap; | |
use std::collections::hash_map::DefaultHasher; | |
use std::hash::{Hash, Hasher}; | |
struct Model { | |
todos: BTreeMap<String, Todo>, | |
new_todo_title: String, | |
selected_todo: Option<SelectedTodo>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------Seed code ------ | |
#[derive(Debug)] | |
struct BreakpointInterval<B> { | |
id: B, | |
start: u32, | |
end: Option<u32>, | |
} | |
#[derive(Debug)] |
NewerOlder