Sycamore demo

This commit is contained in:
Elnu 2023-08-17 18:40:52 -07:00
parent a4f513703f
commit d29f3aabca
9 changed files with 492 additions and 9 deletions

3
dyesub-tool/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
layout.json
output.svg
dist

View file

@ -12,3 +12,5 @@ regex = "1.9.3"
serde_json = "1.0.105"
strum = "0.25.0"
strum_macros = "0.25.2"
sycamore = "0.9.0-beta.1"
web-sys = "0.3.64"

14
dyesub-tool/index.html Normal file
View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dyesub-tool</title>
<link data-trunk rel="css" href="missing.min.css"> <!-- 1.0.9 -->
</head>
<body>
<main>
</main>
</body>
</html>

126
dyesub-tool/missing.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,10 +1,25 @@
pub mod svg;
mod render;
use render::{render_file, Result};
use sycamore::prelude::*;
fn main() -> Result<()> {
render_file("layout.json", "output.svg")?;
Ok(())
#[component]
fn Slider<G: Html>(cx: Scope) -> View<G> {
let value = create_signal(cx, 0.0);
view! { cx,
(value.get())
input(type="range", bind:valueAsNumber=value)
}
}
fn main() {
sycamore::render_to(|cx| view! { cx,
Slider
Slider
Slider
}, {
let window = web_sys::window().unwrap();
let document = window.document().unwrap();
&document.query_selector("main").unwrap().unwrap()
});
}