This commit is contained in:
parent
9fd1025d4a
commit
e430258cd9
1478
Cargo.lock
generated
1478
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
21
Cargo.toml
21
Cargo.toml
@ -6,14 +6,33 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
axum = { version = "0.6.18", features = ["tracing", "http2"] }
|
||||
kttd-ui = {path = "crates/kttd-ui"}
|
||||
|
||||
axum = { version = "0.6.18", features = ["tracing", "http2", "ws"] }
|
||||
axum-sessions = "0.5.0"
|
||||
chrono = { version = "0.4.24", features = ["serde"] }
|
||||
ctxerr = "0.2.5"
|
||||
diesel = { version = "2.0.4", features = ["chrono"] }
|
||||
diesel-async = { version = "0.2.2", features = ["postgres", "tokio-postgres", "deadpool"] }
|
||||
dioxus-ssr = "0.3.0"
|
||||
dotenv = "0.15.0"
|
||||
log = "0.4.17"
|
||||
rand = "0.8.5"
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
serde_json = "1.0.96"
|
||||
sha256 = "1.1.3"
|
||||
tokio = { version = "1.28.0", features = ["parking_lot", "macros", "rt", "rt-multi-thread"] }
|
||||
tower-http = { version = "0.4.0", features = ["fs"] }
|
||||
dioxus-liveview = { version = "0.3.0", features = ["axum"] }
|
||||
pretty_env_logger = "0.4.0"
|
||||
cookie = "0.17.0"
|
||||
dashmap = "5.4.0"
|
||||
reqwest = "0.11.18"
|
||||
dioxus = "0.3.2"
|
||||
dioxus-hot-reload = "0.1.1"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/kttd-ui",
|
||||
]
|
||||
|
||||
|
268
ui/Cargo.lock → crates/kttd-ui/Cargo.lock
generated
268
ui/Cargo.lock → crates/kttd-ui/Cargo.lock
generated
@ -40,12 +40,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.71"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "1.8.0"
|
||||
@ -168,16 +162,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
||||
dependencies = [
|
||||
"termcolor",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "2.2.0"
|
||||
@ -187,16 +171,6 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console_error_panic_hook"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.4"
|
||||
@ -222,50 +196,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxx"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cxxbridge-flags",
|
||||
"cxxbridge-macro",
|
||||
"link-cplusplus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxx-build"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"codespan-reporting",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"scratch",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-flags"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb"
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-macro"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.1"
|
||||
@ -390,21 +320,6 @@ dependencies = [
|
||||
"serde",
|
||||
"serde-value",
|
||||
"serde_repr",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dioxus-interpreter-js"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "360fdd7b22ac8859492efb2fbfd0e380d2208a442896ea54891424a67f984918"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"sledgehammer_bindgen",
|
||||
"sledgehammer_utils",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -435,33 +350,6 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dioxus-web"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a90cda9fc7992af131b4ce468ea4740669fb18983c209f9b95572e5fea82a57e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"console_error_panic_hook",
|
||||
"dioxus-core",
|
||||
"dioxus-html",
|
||||
"dioxus-interpreter-js",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"gloo-timers",
|
||||
"js-sys",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"serde-wasm-bindgen",
|
||||
"serde_json",
|
||||
"smallstr",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumset"
|
||||
version = "1.1.2"
|
||||
@ -608,17 +496,6 @@ dependencies = [
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.28"
|
||||
@ -632,11 +509,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-macro",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -673,18 +548,6 @@ dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-timers"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
@ -710,12 +573,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cxx",
|
||||
"cxx-build",
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -862,6 +724,13 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kttd-ui"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"dioxus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
@ -874,15 +743,6 @@ version = "0.2.144"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
|
||||
|
||||
[[package]]
|
||||
name = "link-cplusplus"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.9"
|
||||
@ -908,15 +768,6 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86"
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
@ -1108,12 +959,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "scratch"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.17"
|
||||
@ -1139,17 +984,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-wasm-bindgen"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.163"
|
||||
@ -1192,43 +1026,12 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sledgehammer_bindgen"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b56abc5091d1a0671f24490664b5dfb1f6f73e0c7ac4d0ac01856809a45aa916"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sledgehammer_utils"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "095fd5332b21763203248070746b86b98c6167fc620af73d4cb2bc2d7d9cd815"
|
||||
dependencies = [
|
||||
"lru",
|
||||
"once_cell",
|
||||
"rustc-hash",
|
||||
"ux",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallbox"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4679d6eef28b85020158619fc09769de89e90886c5de7157587d87cb72648faa"
|
||||
|
||||
[[package]]
|
||||
name = "smallstr"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e922794d168678729ffc7e07182721a14219c65814e66e91b839a272fe5ae4f"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.10.0"
|
||||
@ -1266,15 +1069,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.40"
|
||||
@ -1328,14 +1122,6 @@ version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||
|
||||
[[package]]
|
||||
name = "ui"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"dioxus",
|
||||
"dioxus-web",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.8"
|
||||
@ -1348,18 +1134,6 @@ version = "1.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "ux"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cb3ff47e36907a6267572c1e398ff32ef78ac5131de8aa272e53846592c207e"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
@ -1419,18 +1193,6 @@ dependencies = [
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "083abe15c5d88556b77bdf7aef403625be9e327ad37c62c4e4129af740168163"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.85"
|
||||
@ -1460,16 +1222,6 @@ version = "0.2.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16b5f940c7edfdc6d12126d98c9ef4d1b3d470011c47c76a6581df47ad9ba721"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
19
crates/kttd-ui/Cargo.toml
Normal file
19
crates/kttd-ui/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "kttd-ui"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
chrono = { version = "0.4.24", features = ["serde"] }
|
||||
dioxus = "0.3.2"
|
||||
dioxus-router = { version = "0.3.0" }
|
||||
dioxus-web = { version = "0.3.1", features = ["hydrate"] }
|
||||
reqwest = "0.11.18"
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
serde_json = "1.0.96"
|
||||
|
||||
|
||||
[features]
|
||||
web = ["dioxus-router/web"]
|
19
crates/kttd-ui/Dioxus.toml
Normal file
19
crates/kttd-ui/Dioxus.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[application]
|
||||
|
||||
name = "kttd-ui"
|
||||
default_platform = "web"
|
||||
out_dir = "dist"
|
||||
asset_dir = "public"
|
||||
|
||||
[web.app]
|
||||
title = "KTTD | ⛺"
|
||||
|
||||
[web.watcher]
|
||||
reload_html = true
|
||||
watch_path = ["src", "public"]
|
||||
[web.resource]
|
||||
style = []
|
||||
script = []
|
||||
|
||||
[web.resource.dev]
|
||||
script = []
|
@ -1,4 +1,4 @@
|
||||
import { create, update_memory, save_template, initilize } from './snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js';
|
||||
import { create, update_memory, save_template, set_node, initilize } from './snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js';
|
||||
import * as __wbg_star0 from './snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js';
|
||||
|
||||
let wasm;
|
||||
@ -249,7 +249,7 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
||||
try {
|
||||
_assertNum(arg0);
|
||||
_assertNum(arg1);
|
||||
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc15abd557875a8b1(arg0, arg1, addBorrowedObject(arg2));
|
||||
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h40f88f5f450dffa8(arg0, arg1, addBorrowedObject(arg2));
|
||||
} finally {
|
||||
heap[stack_pointer++] = undefined;
|
||||
}
|
||||
@ -258,13 +258,13 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
||||
function __wbg_adapter_25(arg0, arg1, arg2) {
|
||||
_assertNum(arg0);
|
||||
_assertNum(arg1);
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdb69843e664466e9(arg0, arg1, addHeapObject(arg2));
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h418ddc6ee349cc7a(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
function __wbg_adapter_28(arg0, arg1, arg2) {
|
||||
_assertNum(arg0);
|
||||
_assertNum(arg1);
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h252fa91beba72db3(arg0, arg1, addHeapObject(arg2));
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2004f860f8b5c2ed(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
function getCachedStringFromWasm0(ptr, len) {
|
||||
@ -378,6 +378,9 @@ imports.wbg.__wbg_savetemplate_66c28e397e4ac81d = function() { return logError(f
|
||||
wasm.__wbindgen_free(arg0, arg1 * 4);
|
||||
save_template(v0, arg2 >>> 0);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setnode_c73c4693eea19c18 = function() { return logError(function (arg0, arg1) {
|
||||
set_node(arg0 >>> 0, takeObject(arg1));
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_initilize_b869c4536d6c8ce7 = function() { return logError(function (arg0, arg1) {
|
||||
initilize(takeObject(arg0), getObject(arg1));
|
||||
}, arguments) };
|
||||
@ -421,146 +424,6 @@ imports.wbg.__wbg_getElementById_0d9e5885e90e4f2a = function() { return logError
|
||||
const ret = getObject(arg0).getElementById(v0);
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlInputElement_8074f39ec717e1ff = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLInputElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_checked_cbb1050502aaac3e = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).checked;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_type_3c4f36d465bbb555 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).type;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_value_7a0dd72b70bbc491 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlSelectElement_d743e0d5015b521c = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLSelectElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_value_aa66035368a3e9bb = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_data_ef47af9c565d228b = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).data;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_altKey_cf299e5232cc1044 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).altKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_metaKey_1f5f8711ee54d89e = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).metaKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_ctrlKey_0f7db24e63e9f57f = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).ctrlKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_shiftKey_a7e77bb634b4facc = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).shiftKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_type_cf31349a6b3c0175 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).type;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_target_303861d1c3271001 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).target;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_preventDefault_23c6bf1d0b02c67a = function() { return logError(function (arg0) {
|
||||
getObject(arg0).preventDefault();
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_altKey_d5019155384cdb12 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).altKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_ctrlKey_4530e4ce8b727d5b = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).ctrlKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_shiftKey_85b0f1542b5da6bd = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).shiftKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_metaKey_d33b1a7b4af847f4 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).metaKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_location_56371582e3d5d6d3 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).location;
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_repeat_c6caf85955a13f57 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).repeat;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_key_e340e265ee020ac5 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).key;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_code_03601b564d0df7dc = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).code;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pageX_243dc80144978538 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).pageX;
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pageY_c93c4fa4b876ae25 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).pageY;
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_length_f5b1ceb7591dd7a1 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).length;
|
||||
_assertNum(ret);
|
||||
@ -570,102 +433,6 @@ imports.wbg.__wbg_item_e1f4d2a1e1fdfb92 = function() { return logError(function
|
||||
const ret = getObject(arg0).item(arg1 >>> 0);
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_Node_a14f4f9b51b4be4b = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Node;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_parentElement_a37a694bf4be8540 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).parentElement;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_textContent_20f9c491b823cb08 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).textContent;
|
||||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_appendChild_173b88a25c048f2b = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg0).appendChild(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setProperty_66e3a889ea358430 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
var v1 = getCachedStringFromWasm0(arg3, arg4);
|
||||
getObject(arg0).setProperty(v0, v1);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_protocol_3b68fdb5cac51103 = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).protocol;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_host_dd408bb5e83bdc24 = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).host;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_CompositionEvent_49037bc235854cd0 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof CompositionEvent;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_data_9753553cb1c55be3 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).data;
|
||||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlFormElement_4aa426f0cc6322e6 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLFormElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_elements_c01926aeddc205cd = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).elements;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_propertyName_c14e9def22a5ca76 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).propertyName;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_elapsedTime_f024b1eec7d3f79b = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).elapsedTime;
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pseudoElement_bf06f74d55e889bf = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).pseudoElement;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setonmessage_493b82147081ec7e = function() { return logError(function (arg0, arg1) {
|
||||
getObject(arg0).onmessage = getObject(arg1);
|
||||
}, arguments) };
|
||||
@ -691,10 +458,10 @@ imports.wbg.__wbg_deltaMode_90fac2815fd3b6a6 = function() { return logError(func
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_Element_4a31fb648ff28399 = function() { return logError(function (arg0) {
|
||||
imports.wbg.__wbg_instanceof_CompositionEvent_49037bc235854cd0 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Element;
|
||||
result = getObject(arg0) instanceof CompositionEvent;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
@ -702,61 +469,10 @@ imports.wbg.__wbg_instanceof_Element_4a31fb648ff28399 = function() { return logE
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_getAttribute_db1c723c9e92f817 = function() { return logError(function (arg0, arg1, arg2, arg3) {
|
||||
var v0 = getCachedStringFromWasm0(arg2, arg3);
|
||||
const ret = getObject(arg1).getAttribute(v0);
|
||||
var ptr2 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len2 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len2;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr2;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setAttribute_e8e8474a029723cb = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
var v1 = getCachedStringFromWasm0(arg3, arg4);
|
||||
getObject(arg0).setAttribute(v0, v1);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setAttributeNS_c063456a4edf4a5f = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
var v1 = getCachedStringFromWasm0(arg3, arg4);
|
||||
var v2 = getCachedStringFromWasm0(arg5, arg6);
|
||||
getObject(arg0).setAttributeNS(v0, v1, v2);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_toggleAttribute_8367609837b2e3e3 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
const ret = getObject(arg0).toggleAttribute(v0);
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlElement_edb6b41b4b7de6a7 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_style_490ba346de45c9a1 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).style;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlTextAreaElement_19f6a6bbcfdee19a = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLTextAreaElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_value_3fd0a672660967e3 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
imports.wbg.__wbg_data_9753553cb1c55be3 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).data;
|
||||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
@ -820,24 +536,6 @@ imports.wbg.__wbg_buttons_489c8b943073f8da = function() { return logError(functi
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_animationName_5462d453f81ef571 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).animationName;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_elapsedTime_5d1d20bf21694b89 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).elapsedTime;
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pseudoElement_0ea69b9c3e1e076d = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).pseudoElement;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pointerId_110fbf1bac892eed = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).pointerId;
|
||||
_assertNum(ret);
|
||||
@ -888,6 +586,346 @@ imports.wbg.__wbg_isPrimary_dcb8a5e2f73a7ca9 = function() { return logError(func
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_propertyName_c14e9def22a5ca76 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).propertyName;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_elapsedTime_f024b1eec7d3f79b = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).elapsedTime;
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pseudoElement_bf06f74d55e889bf = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).pseudoElement;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlFormElement_4aa426f0cc6322e6 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLFormElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_elements_c01926aeddc205cd = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).elements;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlTextAreaElement_19f6a6bbcfdee19a = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLTextAreaElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_value_3fd0a672660967e3 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_animationName_5462d453f81ef571 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).animationName;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_elapsedTime_5d1d20bf21694b89 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).elapsedTime;
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pseudoElement_0ea69b9c3e1e076d = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).pseudoElement;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlInputElement_8074f39ec717e1ff = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLInputElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_checked_cbb1050502aaac3e = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).checked;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_type_3c4f36d465bbb555 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).type;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_value_7a0dd72b70bbc491 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_altKey_cf299e5232cc1044 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).altKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_metaKey_1f5f8711ee54d89e = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).metaKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_ctrlKey_0f7db24e63e9f57f = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).ctrlKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_shiftKey_a7e77bb634b4facc = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).shiftKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_Element_4a31fb648ff28399 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Element;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_getAttribute_db1c723c9e92f817 = function() { return logError(function (arg0, arg1, arg2, arg3) {
|
||||
var v0 = getCachedStringFromWasm0(arg2, arg3);
|
||||
const ret = getObject(arg1).getAttribute(v0);
|
||||
var ptr2 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len2 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len2;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr2;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setAttribute_e8e8474a029723cb = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
var v1 = getCachedStringFromWasm0(arg3, arg4);
|
||||
getObject(arg0).setAttribute(v0, v1);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setAttributeNS_c063456a4edf4a5f = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
var v1 = getCachedStringFromWasm0(arg3, arg4);
|
||||
var v2 = getCachedStringFromWasm0(arg5, arg6);
|
||||
getObject(arg0).setAttributeNS(v0, v1, v2);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_toggleAttribute_8367609837b2e3e3 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
const ret = getObject(arg0).toggleAttribute(v0);
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlElement_edb6b41b4b7de6a7 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_style_490ba346de45c9a1 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).style;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
||||
const ret = getStringFromWasm0(arg0, arg1);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
||||
const obj = getObject(arg1);
|
||||
const ret = typeof(obj) === 'string' ? obj : undefined;
|
||||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
};
|
||||
imports.wbg.__wbg_type_cf31349a6b3c0175 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).type;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_target_303861d1c3271001 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).target;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_preventDefault_23c6bf1d0b02c67a = function() { return logError(function (arg0) {
|
||||
getObject(arg0).preventDefault();
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_HtmlSelectElement_d743e0d5015b521c = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof HTMLSelectElement;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_value_aa66035368a3e9bb = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_data_ef47af9c565d228b = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).data;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_altKey_d5019155384cdb12 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).altKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_ctrlKey_4530e4ce8b727d5b = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).ctrlKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_shiftKey_85b0f1542b5da6bd = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).shiftKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_metaKey_d33b1a7b4af847f4 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).metaKey;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_location_56371582e3d5d6d3 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).location;
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_repeat_c6caf85955a13f57 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).repeat;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_key_e340e265ee020ac5 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).key;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_code_03601b564d0df7dc = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).code;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_Node_a14f4f9b51b4be4b = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Node;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_parentElement_a37a694bf4be8540 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).parentElement;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_firstChild_0fd9de1eda04eb34 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).firstChild;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_nextSibling_560b2649c19c5c20 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).nextSibling;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_textContent_20f9c491b823cb08 = function() { return logError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).textContent;
|
||||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_settextContent_ea2ce5e8fc889af7 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
getObject(arg0).textContent = v0;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_appendChild_173b88a25c048f2b = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg0).appendChild(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pageX_243dc80144978538 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).pageX;
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_pageY_c93c4fa4b876ae25 = function() { return logError(function (arg0) {
|
||||
const ret = getObject(arg0).pageY;
|
||||
_assertNum(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_instanceof_Comment_0d57730f846eb4b8 = function() { return logError(function (arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Comment;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_setProperty_66e3a889ea358430 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
||||
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
||||
var v1 = getCachedStringFromWasm0(arg3, arg4);
|
||||
getObject(arg0).setProperty(v0, v1);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_protocol_3b68fdb5cac51103 = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).protocol;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_host_dd408bb5e83bdc24 = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg1).host;
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_newnoargs_e643855c6572a4a8 = function() { return logError(function (arg0, arg1) {
|
||||
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
||||
const ret = new Function(v0);
|
||||
@ -926,18 +964,6 @@ imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
||||
_assertBoolean(ret);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
||||
const ret = getStringFromWasm0(arg0, arg1);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
||||
const obj = getObject(arg1);
|
||||
const ret = typeof(obj) === 'string' ? obj : undefined;
|
||||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
};
|
||||
imports.wbg.__wbindgen_is_string = function(arg0) {
|
||||
const ret = typeof(getObject(arg0)) === 'string';
|
||||
_assertBoolean(ret);
|
||||
@ -960,16 +986,16 @@ imports.wbg.__wbindgen_memory = function() {
|
||||
const ret = wasm.memory;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper1698 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 45, __wbg_adapter_22);
|
||||
imports.wbg.__wbindgen_closure_wrapper3145 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 261, __wbg_adapter_22);
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbindgen_closure_wrapper1700 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 43, __wbg_adapter_25);
|
||||
imports.wbg.__wbindgen_closure_wrapper3147 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 259, __wbg_adapter_25);
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbindgen_closure_wrapper2501 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 199, __wbg_adapter_28);
|
||||
imports.wbg.__wbindgen_closure_wrapper4510 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 301, __wbg_adapter_28);
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports['./snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js'] = __wbg_star0;
|
BIN
crates/kttd-ui/dist/assets/dioxus/kttd-ui_bg.wasm
vendored
Normal file
BIN
crates/kttd-ui/dist/assets/dioxus/kttd-ui_bg.wasm
vendored
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
let m,p,ls,lss,sp,d,t,c,s,sl,op,i,e,z,index,bubbles,n,len,field,root,text,ns,value,ptr,many,event_name,tmpl_id,id;const ns_cache = [];const evt = [];const attr = [];
|
||||
let m,p,ls,lss,sp,d,t,c,s,sl,op,i,e,z,bubbles,id,value,ptr,tmpl_id,event_name,root,field,len,many,text,index,ns,n;const evt = [];const ns_cache = [];const attr = [];
|
||||
class ListenerMap {
|
||||
constructor(root) {
|
||||
// bubbling events can listen at the root element
|
22
crates/kttd-ui/dist/index.html
vendored
Normal file
22
crates/kttd-ui/dist/index.html
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>KTTD | ⛺</title>
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
<script type="module">
|
||||
import init from "/./assets/dioxus/kttd-ui.js";
|
||||
init("/./assets/dioxus/kttd-ui_bg.wasm").then(wasm => {
|
||||
if (wasm.__wbindgen_start == undefined) {
|
||||
wasm.main();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
391
crates/kttd-ui/src/components/nav.rs
Normal file
391
crates/kttd-ui/src/components/nav.rs
Normal file
@ -0,0 +1,391 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
pub fn nav(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
section { class: "relative",
|
||||
nav { class: "flex justify-between border-b",
|
||||
div { class: "px-12 py-8 flex w-full items-center",
|
||||
a { class: "hidden xl:block mr-16",
|
||||
href: "#",
|
||||
icons::icon_0 {}
|
||||
}
|
||||
ul { class: "hidden xl:flex font-semibold font-heading",
|
||||
li { class: "mr-12",
|
||||
a { class: "hover:text-gray-600",
|
||||
href: "#",
|
||||
"Category"
|
||||
}
|
||||
}
|
||||
li { class: "mr-12",
|
||||
a { class: "hover:text-gray-600",
|
||||
href: "#",
|
||||
"Collection"
|
||||
}
|
||||
}
|
||||
li { class: "mr-12",
|
||||
a { class: "hover:text-gray-600",
|
||||
href: "#",
|
||||
"Story"
|
||||
}
|
||||
}
|
||||
li {
|
||||
a { class: "hover:text-gray-600",
|
||||
href: "#",
|
||||
"Brand"
|
||||
}
|
||||
}
|
||||
}
|
||||
a { class: "flex-shrink-0 xl:mx-auto text-3xl font-bold font-heading",
|
||||
href: "#",
|
||||
img { class: "h-9",
|
||||
width: "auto",
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/logos/yofte-logo.svg",
|
||||
}
|
||||
}
|
||||
div { class: "hidden xl:inline-block mr-14",
|
||||
input { class: "py-5 px-8 w-full placeholder-gray-400 text-xs uppercase font-semibold font-heading bg-gray-50 border border-gray-200 focus:ring-blue-300 focus:border-blue-300 rounded-md",
|
||||
placeholder: "Search",
|
||||
r#type: "text",
|
||||
}
|
||||
}
|
||||
div { class: "hidden xl:flex items-center",
|
||||
a { class: "mr-10 hover:text-gray-600",
|
||||
href: "#",
|
||||
icons::icon_1 {}
|
||||
}
|
||||
a { class: "flex items-center hover:text-gray-600",
|
||||
href: "#",
|
||||
icons::icon_2 {}
|
||||
span { class: "inline-block w-6 h-6 text-center bg-gray-50 rounded-full font-semibold font-heading",
|
||||
"3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
a { class: "hidden xl:flex items-center px-12 border-l font-semibold font-heading hover:text-gray-600",
|
||||
href: "#",
|
||||
icons::icon_3 {}
|
||||
span {
|
||||
"Sign In"
|
||||
}
|
||||
}
|
||||
a { class: "xl:hidden flex mr-6 items-center text-gray-600",
|
||||
href: "#",
|
||||
icons::icon_4 {}
|
||||
span { class: "inline-block w-6 h-6 text-center bg-gray-50 rounded-full font-semibold font-heading",
|
||||
"3"
|
||||
}
|
||||
}
|
||||
a { class: "navbar-burger self-center mr-12 xl:hidden",
|
||||
href: "#",
|
||||
icons::icon_5 {}
|
||||
}
|
||||
}
|
||||
div { class: "hidden navbar-menu fixed top-0 left-0 bottom-0 w-5/6 max-w-sm z-50",
|
||||
div { class: "navbar-backdrop fixed inset-0 bg-gray-800 opacity-25",
|
||||
}
|
||||
nav { class: "relative flex flex-col py-6 px-6 w-full h-full bg-white border-r overflow-y-auto",
|
||||
div { class: "flex items-center mb-8",
|
||||
a { class: "mr-auto text-3xl font-bold font-heading",
|
||||
href: "#",
|
||||
img { class: "h-9",
|
||||
src: "https://shuffle.dev/yofte-assets/logos/yofte-logo.svg",
|
||||
width: "auto",
|
||||
alt: "",
|
||||
}
|
||||
}
|
||||
button { class: "navbar-close",
|
||||
icons::icon_6 {}
|
||||
}
|
||||
}
|
||||
div { class: "flex mb-8 justify-between",
|
||||
a { class: "inline-flex items-center font-semibold font-heading",
|
||||
href: "#",
|
||||
icons::icon_7 {}
|
||||
span {
|
||||
"Sign In"
|
||||
}
|
||||
}
|
||||
div { class: "flex items-center",
|
||||
a { class: "mr-10",
|
||||
href: "#",
|
||||
icons::icon_8 {}
|
||||
}
|
||||
a { class: "flex items-center",
|
||||
href: "#",
|
||||
icons::icon_9 {}
|
||||
span { class: "inline-block w-6 h-6 text-center bg-gray-100 rounded-full font-semibold font-heading",
|
||||
"3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input { class: "block mb-10 py-5 px-8 bg-gray-100 rounded-md border-transparent focus:ring-blue-300 focus:border-blue-300 focus:outline-none",
|
||||
r#type: "search",
|
||||
placeholder: "Search",
|
||||
}
|
||||
ul { class: "text-3xl font-bold font-heading",
|
||||
li { class: "mb-8",
|
||||
a {
|
||||
href: "#",
|
||||
"Category"
|
||||
}
|
||||
}
|
||||
li { class: "mb-8",
|
||||
a {
|
||||
href: "#",
|
||||
"Collection"
|
||||
}
|
||||
}
|
||||
li { class: "mb-8",
|
||||
a {
|
||||
href: "#",
|
||||
"Story"
|
||||
}
|
||||
}
|
||||
li {
|
||||
a {
|
||||
href: "#",
|
||||
"Brand"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
mod icons {
|
||||
use super::*;
|
||||
|
||||
pub(super) fn icon_0(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "mr-3",
|
||||
fill: "none",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
view_box: "0 0 23 23",
|
||||
width: "23",
|
||||
height: "23",
|
||||
path {
|
||||
stroke_linejoin: "round",
|
||||
d: "M18.1159 8.72461H2.50427C1.99709 8.72461 1.58594 9.12704 1.58594 9.62346V21.3085C1.58594 21.8049 1.99709 22.2074 2.50427 22.2074H18.1159C18.6231 22.2074 19.0342 21.8049 19.0342 21.3085V9.62346C19.0342 9.12704 18.6231 8.72461 18.1159 8.72461Z",
|
||||
stroke: "currentColor",
|
||||
stroke_linecap: "round",
|
||||
stroke_width: "1.5",
|
||||
}
|
||||
path {
|
||||
stroke: "currentColor",
|
||||
stroke_linecap: "round",
|
||||
d: "M6.34473 6.34469V4.95676C6.34473 3.85246 6.76252 2.79338 7.5062 2.01252C8.24988 1.23165 9.25852 0.792969 10.3102 0.792969C11.362 0.792969 12.3706 1.23165 13.1143 2.01252C13.858 2.79338 14.2758 3.85246 14.2758 4.95676V6.34469",
|
||||
stroke_width: "1.5",
|
||||
stroke_linejoin: "round",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_1(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
height: "20",
|
||||
view_box: "0 0 23 20",
|
||||
width: "23",
|
||||
fill: "none",
|
||||
path {
|
||||
d: "M11.4998 19.2061L2.70115 9.92527C1.92859 9.14433 1.41864 8.1374 1.24355 7.04712C1.06847 5.95684 1.23713 4.8385 1.72563 3.85053V3.85053C2.09464 3.10462 2.63366 2.45803 3.29828 1.96406C3.9629 1.47008 4.73408 1.14284 5.5483 1.00931C6.36252 0.875782 7.19647 0.939779 7.98144 1.19603C8.7664 1.45228 9.47991 1.89345 10.0632 2.48319L11.4998 3.93577L12.9364 2.48319C13.5197 1.89345 14.2332 1.45228 15.0182 1.19603C15.8031 0.939779 16.6371 0.875782 17.4513 1.00931C18.2655 1.14284 19.0367 1.47008 19.7013 1.96406C20.3659 2.45803 20.905 3.10462 21.274 3.85053V3.85053C21.7625 4.8385 21.9311 5.95684 21.756 7.04712C21.581 8.1374 21.071 9.14433 20.2984 9.92527L11.4998 19.2061Z",
|
||||
stroke: "currentColor",
|
||||
stroke_width: "1.5",
|
||||
stroke_linejoin: "round",
|
||||
stroke_linecap: "round",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_2(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "mr-3",
|
||||
fill: "none",
|
||||
height: "31",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: "32",
|
||||
view_box: "0 0 32 31",
|
||||
path {
|
||||
stroke_linejoin: "round",
|
||||
stroke_width: "1.5",
|
||||
d: "M16.0006 16.3154C19.1303 16.3154 21.6673 13.799 21.6673 10.6948C21.6673 7.59064 19.1303 5.07422 16.0006 5.07422C12.871 5.07422 10.334 7.59064 10.334 10.6948C10.334 13.799 12.871 16.3154 16.0006 16.3154Z",
|
||||
stroke_linecap: "round",
|
||||
stroke: "currentColor",
|
||||
}
|
||||
path {
|
||||
stroke_width: "1.5",
|
||||
d: "M24.4225 23.8963C23.6678 22.3507 22.4756 21.0445 20.9845 20.1298C19.4934 19.2151 17.7647 18.7295 15.9998 18.7295C14.2349 18.7295 12.5063 19.2151 11.0152 20.1298C9.52406 21.0445 8.33179 22.3507 7.57715 23.8963",
|
||||
stroke: "currentColor",
|
||||
stroke_linecap: "round",
|
||||
stroke_linejoin: "round",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_3(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "h-2 w-2 text-gray-500 cursor-pointer",
|
||||
height: "10",
|
||||
width: "10",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
fill: "none",
|
||||
view_box: "0 0 10 10",
|
||||
path {
|
||||
stroke_width: "1.5",
|
||||
stroke_linejoin: "round",
|
||||
d: "M9.00002 1L1 9.00002M1.00003 1L9.00005 9.00002",
|
||||
stroke: "black",
|
||||
stroke_linecap: "round",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_4(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
view_box: "0 0 20 12",
|
||||
fill: "none",
|
||||
width: "20",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
height: "12",
|
||||
path {
|
||||
d: "M1 2H19C19.2652 2 19.5196 1.89464 19.7071 1.70711C19.8946 1.51957 20 1.26522 20 1C20 0.734784 19.8946 0.48043 19.7071 0.292893C19.5196 0.105357 19.2652 0 19 0H1C0.734784 0 0.48043 0.105357 0.292893 0.292893C0.105357 0.48043 0 0.734784 0 1C0 1.26522 0.105357 1.51957 0.292893 1.70711C0.48043 1.89464 0.734784 2 1 2ZM19 10H1C0.734784 10 0.48043 10.1054 0.292893 10.2929C0.105357 10.4804 0 10.7348 0 11C0 11.2652 0.105357 11.5196 0.292893 11.7071C0.48043 11.8946 0.734784 12 1 12H19C19.2652 12 19.5196 11.8946 19.7071 11.7071C19.8946 11.5196 20 11.2652 20 11C20 10.7348 19.8946 10.4804 19.7071 10.2929C19.5196 10.1054 19.2652 10 19 10ZM19 5H1C0.734784 5 0.48043 5.10536 0.292893 5.29289C0.105357 5.48043 0 5.73478 0 6C0 6.26522 0.105357 6.51957 0.292893 6.70711C0.48043 6.89464 0.734784 7 1 7H19C19.2652 7 19.5196 6.89464 19.7071 6.70711C19.8946 6.51957 20 6.26522 20 6C20 5.73478 19.8946 5.48043 19.7071 5.29289C19.5196 5.10536 19.2652 5 19 5Z",
|
||||
fill: "#8594A5",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_5(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "mr-2",
|
||||
fill: "none",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: "23",
|
||||
height: "23",
|
||||
view_box: "0 0 23 23",
|
||||
path {
|
||||
stroke_width: "1.5",
|
||||
stroke_linecap: "round",
|
||||
stroke_linejoin: "round",
|
||||
d: "M18.1159 8.72461H2.50427C1.99709 8.72461 1.58594 9.12704 1.58594 9.62346V21.3085C1.58594 21.8049 1.99709 22.2074 2.50427 22.2074H18.1159C18.6231 22.2074 19.0342 21.8049 19.0342 21.3085V9.62346C19.0342 9.12704 18.6231 8.72461 18.1159 8.72461Z",
|
||||
stroke: "currentColor",
|
||||
}
|
||||
path {
|
||||
d: "M6.34473 6.34469V4.95676C6.34473 3.85246 6.76252 2.79338 7.5062 2.01252C8.24988 1.23165 9.25852 0.792969 10.3102 0.792969C11.362 0.792969 12.3706 1.23165 13.1143 2.01252C13.858 2.79338 14.2758 3.85246 14.2758 4.95676V6.34469",
|
||||
stroke_linejoin: "round",
|
||||
stroke_width: "1.5",
|
||||
stroke_linecap: "round",
|
||||
stroke: "currentColor",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_6(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "mr-3",
|
||||
height: "31",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
view_box: "0 0 32 31",
|
||||
width: "32",
|
||||
fill: "none",
|
||||
path {
|
||||
stroke: "currentColor",
|
||||
stroke_width: "1.5",
|
||||
d: "M16.0006 16.3154C19.1303 16.3154 21.6673 13.799 21.6673 10.6948C21.6673 7.59064 19.1303 5.07422 16.0006 5.07422C12.871 5.07422 10.334 7.59064 10.334 10.6948C10.334 13.799 12.871 16.3154 16.0006 16.3154Z",
|
||||
stroke_linecap: "round",
|
||||
stroke_linejoin: "round",
|
||||
}
|
||||
path {
|
||||
stroke_linecap: "round",
|
||||
stroke_width: "1.5",
|
||||
stroke: "currentColor",
|
||||
stroke_linejoin: "round",
|
||||
d: "M24.4225 23.8963C23.6678 22.3507 22.4756 21.0445 20.9845 20.1298C19.4934 19.2151 17.7647 18.7295 15.9998 18.7295C14.2349 18.7295 12.5063 19.2151 11.0152 20.1298C9.52406 21.0445 8.33179 22.3507 7.57715 23.8963",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_7(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "mr-3",
|
||||
view_box: "0 0 23 23",
|
||||
fill: "none",
|
||||
height: "23",
|
||||
width: "23",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
path {
|
||||
stroke_linecap: "round",
|
||||
stroke: "currentColor",
|
||||
stroke_width: "1.5",
|
||||
stroke_linejoin: "round",
|
||||
d: "M18.1159 8.72461H2.50427C1.99709 8.72461 1.58594 9.12704 1.58594 9.62346V21.3085C1.58594 21.8049 1.99709 22.2074 2.50427 22.2074H18.1159C18.6231 22.2074 19.0342 21.8049 19.0342 21.3085V9.62346C19.0342 9.12704 18.6231 8.72461 18.1159 8.72461Z",
|
||||
}
|
||||
path {
|
||||
d: "M6.34473 6.34469V4.95676C6.34473 3.85246 6.76252 2.79338 7.5062 2.01252C8.24988 1.23165 9.25852 0.792969 10.3102 0.792969C11.362 0.792969 12.3706 1.23165 13.1143 2.01252C13.858 2.79338 14.2758 3.85246 14.2758 4.95676V6.34469",
|
||||
stroke_width: "1.5",
|
||||
stroke_linecap: "round",
|
||||
stroke: "currentColor",
|
||||
stroke_linejoin: "round",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_8(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
height: "20",
|
||||
width: "23",
|
||||
fill: "none",
|
||||
view_box: "0 0 23 20",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
path {
|
||||
d: "M11.4998 19.2061L2.70115 9.92527C1.92859 9.14433 1.41864 8.1374 1.24355 7.04712C1.06847 5.95684 1.23713 4.8385 1.72563 3.85053V3.85053C2.09464 3.10462 2.63366 2.45803 3.29828 1.96406C3.9629 1.47008 4.73408 1.14284 5.5483 1.00931C6.36252 0.875782 7.19647 0.939779 7.98144 1.19603C8.7664 1.45228 9.47991 1.89345 10.0632 2.48319L11.4998 3.93577L12.9364 2.48319C13.5197 1.89345 14.2332 1.45228 15.0182 1.19603C15.8031 0.939779 16.6371 0.875782 17.4513 1.00931C18.2655 1.14284 19.0367 1.47008 19.7013 1.96406C20.3659 2.45803 20.905 3.10462 21.274 3.85053V3.85053C21.7625 4.8385 21.9311 5.95684 21.756 7.04712C21.581 8.1374 21.071 9.14433 20.2984 9.92527L11.4998 19.2061Z",
|
||||
stroke_linejoin: "round",
|
||||
stroke: "currentColor",
|
||||
stroke_width: "1.5",
|
||||
stroke_linecap: "round",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_9(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
view_box: "0 0 18 18",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: "18",
|
||||
height: "18",
|
||||
fill: "none",
|
||||
path {
|
||||
fill: "black",
|
||||
d: "M18 15.4688H0V17.7207H18V15.4688Z",
|
||||
}
|
||||
path {
|
||||
fill: "black",
|
||||
d: "M11.0226 7.87402H0V10.126H11.0226V7.87402Z",
|
||||
}
|
||||
path {
|
||||
fill: "black",
|
||||
d: "M18 0.279297H0V2.53127H18V0.279297Z",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
}
|
||||
|
366
crates/kttd-ui/src/components/product_page.rs
Normal file
366
crates/kttd-ui/src/components/product_page.rs
Normal file
@ -0,0 +1,366 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
pub fn product_page(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
section { class: "py-20",
|
||||
div { class: "container mx-auto px-4",
|
||||
div { class: "flex flex-wrap -mx-4 mb-24",
|
||||
div { class: "w-full md:w-1/2 px-4 mb-8 md:mb-0",
|
||||
div { class: "relative mb-10",
|
||||
style: "height: 564px;",
|
||||
a { class: "absolute top-1/2 left-0 ml-8 transform translate-1/2",
|
||||
href: "#",
|
||||
icons::icon_0 {}
|
||||
}
|
||||
img { class: "object-cover w-full h-full",
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/images/product-bottle.png",
|
||||
}
|
||||
a { class: "absolute top-1/2 right-0 mr-8 transform translate-1/2",
|
||||
href: "#",
|
||||
icons::icon_1 {}
|
||||
}
|
||||
}
|
||||
div { class: "flex flex-wrap -mx-2",
|
||||
div { class: "w-1/2 sm:w-1/4 p-2",
|
||||
a { class: "block border border-blue-300",
|
||||
href: "#",
|
||||
img { class: "w-full h-32 object-cover",
|
||||
src: "https://shuffle.dev/yofte-assets/images/product-bottle.png",
|
||||
alt: "",
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "w-1/2 sm:w-1/4 p-2",
|
||||
a { class: "block border border-transparent hover:border-gray-400",
|
||||
href: "#",
|
||||
img { class: "w-full h-32 object-cover",
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/images/product-bottle2.png",
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "w-1/2 sm:w-1/4 p-2",
|
||||
a { class: "block border border-transparent hover:border-gray-400",
|
||||
href: "#",
|
||||
img { class: "w-full h-32 object-cover",
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/images/product-bottle3.png",
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "w-1/2 sm:w-1/4 p-2",
|
||||
a { class: "block border border-transparent hover:border-gray-400",
|
||||
href: "#",
|
||||
img { class: "w-full h-32 object-cover",
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/images/product-bottle4.png",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "w-full md:w-1/2 px-4",
|
||||
div { class: "lg:pl-20",
|
||||
div { class: "mb-10 pb-10 border-b",
|
||||
span { class: "text-gray-500",
|
||||
"Brille"
|
||||
}
|
||||
h2 { class: "mt-2 mb-6 max-w-xl text-5xl md:text-6xl font-bold font-heading",
|
||||
"BRILE water filter carafe"
|
||||
}
|
||||
div { class: "mb-8",
|
||||
button {
|
||||
img {
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/elements/star-gold.svg",
|
||||
}
|
||||
}
|
||||
button {
|
||||
img {
|
||||
src: "https://shuffle.dev/yofte-assets/elements/star-gold.svg",
|
||||
alt: "",
|
||||
}
|
||||
}
|
||||
button {
|
||||
img {
|
||||
src: "https://shuffle.dev/yofte-assets/elements/star-gold.svg",
|
||||
alt: "",
|
||||
}
|
||||
}
|
||||
button {
|
||||
img {
|
||||
src: "https://shuffle.dev/yofte-assets/elements/star-gold.svg",
|
||||
alt: "",
|
||||
}
|
||||
}
|
||||
button {
|
||||
img {
|
||||
src: "https://shuffle.dev/yofte-assets/elements/star-gray.svg",
|
||||
alt: "",
|
||||
}
|
||||
}
|
||||
}
|
||||
p { class: "inline-block mb-8 text-2xl font-bold font-heading text-blue-300",
|
||||
span {
|
||||
"$29.99"
|
||||
}
|
||||
span { class: "font-normal text-base text-gray-400 line-through",
|
||||
"$33.69"
|
||||
}
|
||||
}
|
||||
p { class: "max-w-md text-gray-500",
|
||||
"Maecenas commodo libero ut molestie dictum. Morbi placerat eros id porttitor sagittis."
|
||||
}
|
||||
}
|
||||
div { class: "flex mb-12",
|
||||
div { class: "mr-6",
|
||||
span { class: "block mb-4 font-bold font-heading text-gray-400 uppercase",
|
||||
"QTY"
|
||||
}
|
||||
div { class: "inline-flex items-center px-4 font-semibold font-heading text-gray-500 border border-gray-200 focus:ring-blue-300 focus:border-blue-300 rounded-md",
|
||||
button { class: "py-2 hover:text-gray-700",
|
||||
icons::icon_2 {}
|
||||
}
|
||||
input { class: "w-12 m-0 px-2 py-4 text-center md:text-right border-0 focus:ring-transparent focus:outline-none rounded-md",
|
||||
placeholder: "1",
|
||||
r#type: "number",
|
||||
}
|
||||
button { class: "py-2 hover:text-gray-700",
|
||||
icons::icon_3 {}
|
||||
}
|
||||
}
|
||||
}
|
||||
div {
|
||||
span { class: "block mb-4 font-bold font-heading text-gray-400 uppercase",
|
||||
"Size"
|
||||
}
|
||||
select { class: "pl-6 pr-10 py-4 font-semibold font-heading text-gray-500 border border-gray-200 focus:ring-blue-300 focus:border-blue-300 rounded-md",
|
||||
id: "",
|
||||
name: "",
|
||||
option {
|
||||
value: "1",
|
||||
"Medium"
|
||||
}
|
||||
option {
|
||||
value: "2",
|
||||
"Small"
|
||||
}
|
||||
option {
|
||||
value: "3",
|
||||
"Large"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "flex flex-wrap -mx-4 mb-14 items-center",
|
||||
div { class: "w-full xl:w-2/3 px-4 mb-4 xl:mb-0",
|
||||
a { class: "block bg-orange-300 hover:bg-orange-400 text-center text-white font-bold font-heading py-5 px-8 rounded-md uppercase transition duration-200",
|
||||
href: "#",
|
||||
"Add to cart"
|
||||
}
|
||||
}
|
||||
div { class: "w-full xl:w-1/3 px-4",
|
||||
a { class: "ml-auto sm:ml-0 flex-shrink-0 inline-flex mr-4 items-center justify-center w-16 h-16 rounded-md border hover:border-gray-500",
|
||||
href: "#",
|
||||
icons::icon_4 {}
|
||||
}
|
||||
a { class: "flex-shrink-0 inline-flex items-center justify-center w-16 h-16 rounded-md border hover:border-gray-500",
|
||||
href: "#",
|
||||
icons::icon_5 {}
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "flex items-center",
|
||||
span { class: "mr-8 text-gray-500 font-bold font-heading uppercase",
|
||||
"SHARE IT"
|
||||
}
|
||||
a { class: "mr-1 w-8 h-8",
|
||||
href: "#",
|
||||
img {
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/buttons/facebook-circle.svg",
|
||||
}
|
||||
}
|
||||
a { class: "mr-1 w-8 h-8",
|
||||
href: "#",
|
||||
img {
|
||||
alt: "",
|
||||
src: "https://shuffle.dev/yofte-assets/buttons/instagram-circle.svg",
|
||||
}
|
||||
}
|
||||
a { class: "w-8 h-8",
|
||||
href: "#",
|
||||
img {
|
||||
src: "https://shuffle.dev/yofte-assets/buttons/twitter-circle.svg",
|
||||
alt: "",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
div {
|
||||
ul { class: "flex flex-wrap mb-16 border-b-2",
|
||||
li { class: "w-1/2 md:w-auto",
|
||||
a { class: "inline-block py-6 px-10 bg-white text-gray-500 font-bold font-heading shadow-2xl",
|
||||
href: "#",
|
||||
"Description"
|
||||
}
|
||||
}
|
||||
li { class: "w-1/2 md:w-auto",
|
||||
a { class: "inline-block py-6 px-10 text-gray-500 font-bold font-heading",
|
||||
href: "#",
|
||||
"Customer reviews"
|
||||
}
|
||||
}
|
||||
li { class: "w-1/2 md:w-auto",
|
||||
a { class: "inline-block py-6 px-10 text-gray-500 font-bold font-heading",
|
||||
href: "#",
|
||||
"Shipping & returns"
|
||||
}
|
||||
}
|
||||
li { class: "w-1/2 md:w-auto",
|
||||
a { class: "inline-block py-6 px-10 text-gray-500 font-bold font-heading",
|
||||
href: "#",
|
||||
"Brand"
|
||||
}
|
||||
}
|
||||
}
|
||||
h3 { class: "mb-8 text-3xl font-bold font-heading text-blue-300",
|
||||
"Summer collection and laoreet get"
|
||||
}
|
||||
p { class: "max-w-2xl text-gray-500",
|
||||
"I had interdum at ante porta, eleifend feugiat nunc. In semper euismod mi a accums lorem sad. Morbi at auctor nibh. Aliquam tincidunt placerat mollis. Lorem euismod dignissim, felis tortor ollis eros, non ultricies turpis."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
mod icons {
|
||||
use super::*;
|
||||
|
||||
pub(super) fn icon_0(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "w-6 h-6",
|
||||
view_box: "0 0 24 23",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
height: "23",
|
||||
fill: "none",
|
||||
width: "24",
|
||||
path {
|
||||
stroke: "black",
|
||||
fill: "black",
|
||||
d: "M2.01328 18.9877C2.05682 16.7902 2.71436 12.9275 6.3326 9.87096L6.33277 9.87116L6.33979 9.86454L6.3398 9.86452C6.34682 9.85809 8.64847 7.74859 13.4997 7.74859C13.6702 7.74859 13.8443 7.75111 14.0206 7.757L14.0213 7.75702L14.453 7.76978L14.6331 7.77511V7.59486V3.49068L21.5728 10.5736L14.6331 17.6562V13.6558V13.5186L14.4998 13.4859L14.1812 13.4077C14.1807 13.4075 14.1801 13.4074 14.1792 13.4072M2.01328 18.9877L14.1792 13.4072M2.01328 18.9877C7.16281 11.8391 14.012 13.3662 14.1792 13.4072M2.01328 18.9877L14.1792 13.4072M23.125 10.6961L23.245 10.5736L23.125 10.4512L13.7449 0.877527L13.4449 0.571334V1V6.5473C8.22585 6.54663 5.70981 8.81683 5.54923 8.96832C-0.317573 13.927 0.931279 20.8573 0.946581 20.938L0.946636 20.9383L1.15618 22.0329L1.24364 22.4898L1.47901 22.0885L2.041 21.1305L2.04103 21.1305C4.18034 17.4815 6.71668 15.7763 8.8873 15.0074C10.9246 14.2858 12.6517 14.385 13.4449 14.4935V20.1473V20.576L13.7449 20.2698L23.125 10.6961Z",
|
||||
stroke_width: "0.35",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_1(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg { class: "w-6 h-6",
|
||||
height: "27",
|
||||
view_box: "0 0 27 27",
|
||||
fill: "none",
|
||||
width: "27",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
path {
|
||||
d: "M13.4993 26.2061L4.70067 16.9253C3.9281 16.1443 3.41815 15.1374 3.24307 14.0471C3.06798 12.9568 3.23664 11.8385 3.72514 10.8505V10.8505C4.09415 10.1046 4.63318 9.45803 5.29779 8.96406C5.96241 8.47008 6.73359 8.14284 7.54782 8.00931C8.36204 7.87578 9.19599 7.93978 9.98095 8.19603C10.7659 8.45228 11.4794 8.89345 12.0627 9.48319L13.4993 10.9358L14.9359 9.48319C15.5192 8.89345 16.2327 8.45228 17.0177 8.19603C17.8026 7.93978 18.6366 7.87578 19.4508 8.00931C20.265 8.14284 21.0362 8.47008 21.7008 8.96406C22.3654 9.45803 22.9045 10.1046 23.2735 10.8505V10.8505C23.762 11.8385 23.9306 12.9568 23.7556 14.0471C23.5805 15.1374 23.0705 16.1443 22.298 16.9253L13.4993 26.2061Z",
|
||||
stroke: "black",
|
||||
stroke_width: "1.5",
|
||||
stroke_linecap: "round",
|
||||
stroke_linejoin: "round",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_2(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
view_box: "0 0 12 12",
|
||||
height: "12",
|
||||
width: "12",
|
||||
fill: "none",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
g {
|
||||
opacity: "0.35",
|
||||
rect {
|
||||
height: "12",
|
||||
x: "5",
|
||||
fill: "currentColor",
|
||||
width: "2",
|
||||
}
|
||||
rect {
|
||||
fill: "currentColor",
|
||||
width: "2",
|
||||
height: "12",
|
||||
x: "12",
|
||||
y: "5",
|
||||
transform: "rotate(90 12 5)",
|
||||
}
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_3(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
width: "12",
|
||||
fill: "none",
|
||||
view_box: "0 0 12 2",
|
||||
height: "2",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
g {
|
||||
opacity: "0.35",
|
||||
rect {
|
||||
transform: "rotate(90 12 0)",
|
||||
height: "12",
|
||||
fill: "currentColor",
|
||||
x: "12",
|
||||
width: "2",
|
||||
}
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_4(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
fill: "none",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
height: "18",
|
||||
width: "10",
|
||||
view_box: "0 0 10 18",
|
||||
path {
|
||||
fill: "#1F40FF",
|
||||
d: "M0.19922 1.1817C-0.0687795 0.909696 -0.0687794 0.472695 0.19922 0.202695C0.46722 -0.0673054 0.90022 -0.0683048 1.16822 0.202695L8.99822 8.11069C9.26622 8.3807 9.26622 8.81769 8.99822 9.08969L1.16822 16.9977C0.900219 17.2677 0.467218 17.2677 0.199219 16.9977C-0.0687809 16.7267 -0.0687808 16.2887 0.199219 16.0187L7.34022 8.5997L0.19922 1.1817Z",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) fn icon_5(cx: Scope) -> Element {
|
||||
cx.render(rsx!(
|
||||
svg {
|
||||
width: "10",
|
||||
view_box: "0 0 10 18",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
height: "18",
|
||||
fill: "none",
|
||||
path {
|
||||
fill: "#1F40FF",
|
||||
d: "M9 16.0185C9.268 16.2905 9.268 16.7275 9 16.9975C8.732 17.2675 8.299 17.2685 8.031 16.9975L0.201 9.0895C-0.067 8.8195 -0.067 8.3825 0.201 8.1105L8.031 0.2025C8.299 -0.0675 8.732 -0.0675 9 0.2025C9.268 0.4735 9.268 0.9115 9 1.1815L1.859 8.6005L9 16.0185Z",
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
}
|
||||
|
169
crates/kttd-ui/src/lib.rs
Normal file
169
crates/kttd-ui/src/lib.rs
Normal file
@ -0,0 +1,169 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_router::{Router, Route, Link};
|
||||
|
||||
mod components {
|
||||
pub mod nav;
|
||||
pub mod product_page;
|
||||
}
|
||||
|
||||
pub fn MainMenu(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
ul {
|
||||
li {
|
||||
div {class: "user-view",
|
||||
div {class: "background",
|
||||
img {src: "/static/images/office.jpg"}
|
||||
}
|
||||
a {href: "#user", img { class: "circle", src: "/static/images/yuna.jpg"}}
|
||||
a {href: "#name", span { class: "white-text name", "Андрей Ткаченко"}}
|
||||
a {href: "#email", span { class: "white-text email", "andrey@aidev.ru"}}
|
||||
}
|
||||
}
|
||||
li { a { href: "#!", i {class: "material-icons", "cloud" }, "First Link With Icon" }}
|
||||
li { a { href: "#!", "Second Link"}}
|
||||
li { div { class: "divider"}}
|
||||
li { a { class: "subheader", "Subheader"}}
|
||||
li { a { class: "waves-effect", href: "#!", "Third Link With Waves"}}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
pub fn Search(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
div { class:"searchbar has-sidebar",
|
||||
span {class: "prefix", i { class: "material-icons", "search"}}
|
||||
input { class: "search-docs", id: "searchbar", "type": "search", required: true, autofocus: true, placeholder: "Search...", autocomplete: "off" }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn Login(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
"Login page"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
pub struct User {
|
||||
id: i32,
|
||||
image_id: Option<i32>,
|
||||
first_name: String,
|
||||
last_name: String,
|
||||
email: String,
|
||||
crated_at: chrono::NaiveDateTime,
|
||||
updated_at: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
pub fn Main(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
div {id: "slide-out", class: "sidenav sidenav-fixed",
|
||||
MainMenu {}
|
||||
}
|
||||
|
||||
div { class: "fixed-action-btn",
|
||||
a { class: "btn-floating btn-large",
|
||||
i {class: "large material-icons", "add" }
|
||||
}
|
||||
|
||||
ul {
|
||||
li{ a { class: "btn-floating", i { class: "material-icons", "insert_chart" }}}
|
||||
li{ a { class: "btn-floating yellow darken-1", i {class: "material-icons", "format_quote"}}}
|
||||
li{ a { class: "btn-floating green", i { class: "material-icons", "publish"}}}
|
||||
li{ a { class: "btn-floating blue", i { class: "material-icons", "attach_file"}}}
|
||||
}
|
||||
}
|
||||
|
||||
header {
|
||||
div {
|
||||
nav {
|
||||
div {class: "nav-wrapper",
|
||||
a {href: "#",
|
||||
"data-target": "slide-out",
|
||||
class: "sidenav-trigger",
|
||||
|
||||
i { class: "material-icons", "menu" }
|
||||
}
|
||||
|
||||
ul { id: "nav-mobile", class:"right hide-on-med-and-down",
|
||||
li{ a { id: "theme-switch", href: "#", class: "", title: "Switch to dark mode", i {class: "material-icons", "dark_mode"}}}
|
||||
li{ a { href: "badges.html", "Components:"}}
|
||||
li{ a { href: "collapsible.html", "JavaScript"}}
|
||||
}
|
||||
|
||||
div { class: "row",
|
||||
div { class: "col s6",
|
||||
a { href: "#!", class: "breadcrumb", "First" }
|
||||
a { href: "#!", class: "breadcrumb", "Second" }
|
||||
a { href: "#!", class: "breadcrumb", "Third" }
|
||||
}
|
||||
|
||||
div { class: "col s6",
|
||||
ul {class: "hide-on-small-only",
|
||||
li {
|
||||
Search {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nav { class: "top-nav",
|
||||
// div {
|
||||
// div { class: "nav-wrapper",
|
||||
// div { class: "row",
|
||||
// div { class: "col s12 m10 offset-m1",
|
||||
// h1 { class: "header", "Sidenav"}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
main {
|
||||
div {
|
||||
"Maineq",
|
||||
Link { to: "/login", "Login" }
|
||||
}
|
||||
}
|
||||
|
||||
footer {
|
||||
class: "page-footer",
|
||||
"Footer1"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn app(cx: Scope) -> Element {
|
||||
// let future = use_future(cx, (), |_| async move {
|
||||
// // reqwest::get("/api/v1/user/")
|
||||
// // .await
|
||||
// // .unwrap()
|
||||
// // .json::<ApiResponse>()
|
||||
// // .await
|
||||
// });
|
||||
|
||||
cx.render(rsx! {
|
||||
Router {
|
||||
Route { to: "/", Main {} }
|
||||
Route { to: "/login", Login {} }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_vdom() -> VirtualDom {
|
||||
let mut dom = VirtualDom::new(app);
|
||||
let _ = dom.rebuild();
|
||||
|
||||
println!("{}", dom.base_scope().name() );
|
||||
|
||||
// dioxus_router::get_router_from_vdom(&dom, ScopeId)
|
||||
|
||||
dom
|
||||
}
|
3
crates/kttd-ui/src/main.rs
Normal file
3
crates/kttd-ui/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
dioxus_web::launch_cfg(kttd_ui::app, dioxus_web::Config::new().hydrate(true))
|
||||
}
|
11
hurl/user-create.hurl
Normal file
11
hurl/user-create.hurl
Normal file
@ -0,0 +1,11 @@
|
||||
POST http://127.0.0.1:3000/user
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"first_name": "Andrey",
|
||||
"last_name": "Tkachenko",
|
||||
"email": "andrey@aidev.ru",
|
||||
"password": "demo123"
|
||||
}
|
||||
|
||||
HTTP 201
|
4
hurl/user-get.hurl
Normal file
4
hurl/user-get.hurl
Normal file
@ -0,0 +1,4 @@
|
||||
GET http://127.0.0.1:3000/user/1
|
||||
Content-Type: application/json
|
||||
|
||||
HTTP 200
|
3
hurl/user-list.hurl
Normal file
3
hurl/user-list.hurl
Normal file
@ -0,0 +1,3 @@
|
||||
GET http://127.0.0.1:3000/user/list
|
||||
|
||||
HTTP 200
|
96
public/index.html
Normal file
96
public/index.html
Normal file
@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@materializecss/materialize@2.0.0-alpha/dist/css/materialize.min.css" />
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/@materializecss/materialize@2.0.0-alpha/dist/js/materialize.min.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<script>
|
||||
const theme = localStorage.getItem('theme');
|
||||
if (theme) document.documentElement.setAttribute('theme', theme);
|
||||
|
||||
$(document).ready(function () {
|
||||
M.AutoInit();
|
||||
|
||||
const currentTheme = localStorage.getItem('theme');
|
||||
const switchElem = document.querySelector('#theme-switch');
|
||||
|
||||
const setTheme = (isDark) => {
|
||||
if (isDark) {
|
||||
switchElem.classList.add('is-dark');
|
||||
switchElem.querySelector('i').innerText = 'light_mode';
|
||||
switchElem.title = 'Switch to light mode';
|
||||
}
|
||||
else {
|
||||
switchElem.classList.remove('is-dark');
|
||||
switchElem.querySelector('i').innerText = 'dark_mode';
|
||||
switchElem.title = 'Switch to dark mode';
|
||||
}
|
||||
}
|
||||
|
||||
if (switchElem) {
|
||||
// Load
|
||||
if (currentTheme) setTheme(true);
|
||||
// Change
|
||||
switchElem.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
if (!switchElem.classList.contains('is-dark')) {
|
||||
// Dark Theme
|
||||
document.documentElement.setAttribute('theme', 'dark');
|
||||
localStorage.setItem('theme', 'dark');
|
||||
setTheme(true);
|
||||
}
|
||||
else {
|
||||
// Light Theme
|
||||
document.documentElement.removeAttribute('theme');
|
||||
localStorage.removeItem('theme');
|
||||
setTheme(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
nav.top-nav {
|
||||
height: 110px;
|
||||
box-shadow: none;
|
||||
border-bottom: 1px solid var(--separator-color);
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
header,
|
||||
main,
|
||||
footer {
|
||||
padding-left: 300px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 992px) {
|
||||
|
||||
header,
|
||||
main,
|
||||
footer {
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
|
||||
<script type="module">
|
||||
import init from "/./static/dioxus/kttd-ui.js";
|
||||
init("/./static/dioxus/kttd-ui_bg.wasm").then(wasm => {
|
||||
if (wasm.__wbindgen_start == undefined) {
|
||||
wasm.main();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
1
public/static/dioxus
Symbolic link
1
public/static/dioxus
Symbolic link
@ -0,0 +1 @@
|
||||
../../crates/kttd-ui/dist/assets/dioxus
|
BIN
public/static/images/office.jpg
Normal file
BIN
public/static/images/office.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
96
src/api/auth.rs
Normal file
96
src/api/auth.rs
Normal file
@ -0,0 +1,96 @@
|
||||
use axum::{
|
||||
async_trait,
|
||||
extract::{FromRequestParts, State},
|
||||
headers::Cookie,
|
||||
http::{request::Parts, HeaderValue, StatusCode},
|
||||
Json, RequestPartsExt, TypedHeader,
|
||||
};
|
||||
use axum_sessions::async_session::Session;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::db::{models::user::User, repos};
|
||||
|
||||
use super::{error::Error, ApiState};
|
||||
|
||||
const KTTD_SESSION_COOKIE_NAME: &str = "SESS";
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct LoginRequest {
|
||||
username: String,
|
||||
password: String,
|
||||
}
|
||||
|
||||
// #[derive(Debug)]
|
||||
// pub struct SessionUser(pub Option<User>, Option<HeaderValue>);
|
||||
|
||||
// #[async_trait]
|
||||
// impl FromRequestParts<ApiState> for SessionUser {
|
||||
// type Rejection = (StatusCode, &'static str);
|
||||
|
||||
// async fn from_request_parts(
|
||||
// parts: &mut Parts,
|
||||
// state: &ApiState,
|
||||
// ) -> Result<Self, Self::Rejection> {
|
||||
// println!("1111");
|
||||
// let cookie: Option<TypedHeader<Cookie>> = parts.extract().await.unwrap();
|
||||
// let session_cookie = cookie
|
||||
// .as_ref()
|
||||
// .and_then(|cookie| cookie.get(KTTD_SESSION_COOKIE_NAME));
|
||||
|
||||
// // return the new created session cookie for client
|
||||
// if session_cookie.is_none() {
|
||||
// let mut session = Session::new();
|
||||
// session.insert("user_id", 1).unwrap();
|
||||
// let cookie = state.store.store_session(session).await.unwrap().unwrap();
|
||||
|
||||
// return Ok(Self(
|
||||
// None,
|
||||
// Some(
|
||||
// HeaderValue::from_str(
|
||||
// format!("{}={}", KTTD_SESSION_COOKIE_NAME, cookie).as_str(),
|
||||
// )
|
||||
// .unwrap(),
|
||||
// ),
|
||||
// ));
|
||||
// }
|
||||
|
||||
// let user_id = if let Some(session) = state
|
||||
// .store
|
||||
// .load_session(session_cookie.unwrap().to_owned())
|
||||
// .await
|
||||
// .unwrap()
|
||||
// {
|
||||
// if let Some(user_id) = session.get::<i32>("user_id") {
|
||||
// user_id
|
||||
// } else {
|
||||
// return Err((
|
||||
// StatusCode::INTERNAL_SERVER_ERROR,
|
||||
// "No `user_id` found in session",
|
||||
// ));
|
||||
// }
|
||||
// } else {
|
||||
// return Err((StatusCode::BAD_REQUEST, "No session found for cookie"));
|
||||
// };
|
||||
|
||||
// Ok(Self(None, None))
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn login(
|
||||
// State(s): State<ApiState>,
|
||||
// user: SessionUser,
|
||||
// Json(payload): Json<LoginRequest>,
|
||||
// ) -> Result<Json<User>, Error> {
|
||||
// println!("{:?}, {:?}", payload, user);
|
||||
// let user = repos::user::fetch_user(&s.pool, 1).await?;
|
||||
|
||||
// Ok(Json(user))
|
||||
// }
|
||||
|
||||
// pub async fn logout(State(s): State<ApiState>, user: SessionUser) -> Result<Json<()>, Error> {
|
||||
// if let Some(user) = &user.0 {
|
||||
// println!("1111");
|
||||
// }
|
||||
|
||||
// Ok(Json(()))
|
||||
// }
|
213
src/api/mod.rs
213
src/api/mod.rs
@ -1,45 +1,214 @@
|
||||
pub mod auth;
|
||||
mod error;
|
||||
mod user;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::{
|
||||
routing::{get, post},
|
||||
Router,
|
||||
extract::{FromRef, FromRequestParts, State},
|
||||
http::{self, header, request::Parts, HeaderValue, StatusCode},
|
||||
response::{Html, IntoResponse, Response},
|
||||
routing::{get, get_service, post},
|
||||
Json, Router,
|
||||
};
|
||||
|
||||
use axum_sessions::{async_session::MemoryStore, SessionLayer};
|
||||
use rand::Rng;
|
||||
use axum_sessions::async_session::base64;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use dashmap::DashMap;
|
||||
use rand::distributions::{Alphanumeric, DistString};
|
||||
use tower_http::services::ServeDir;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ApiState {
|
||||
use crate::db::{models::user::User, repos, DbPool};
|
||||
|
||||
use self::error::Error;
|
||||
|
||||
const SERVER_ADDR: &str = "0.0.0.0:3000";
|
||||
const KTTD_SESSION_TAG: &str = "SESS";
|
||||
|
||||
struct Auth(pub Option<Session>);
|
||||
|
||||
#[axum::async_trait]
|
||||
impl<OuterState> FromRequestParts<OuterState> for Auth
|
||||
where
|
||||
Self: FromRef<OuterState>,
|
||||
OuterState: Send + Sync,
|
||||
{
|
||||
type Rejection = Error;
|
||||
|
||||
async fn from_request_parts(
|
||||
_parts: &mut Parts,
|
||||
state: &OuterState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
Ok(Self::from_ref(state))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Session {
|
||||
user: User,
|
||||
last_access: chrono::NaiveDateTime,
|
||||
created_at: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
pub struct ApiStateInner {
|
||||
pub pool: DbPool,
|
||||
pub session: DashMap<String, Session>,
|
||||
}
|
||||
|
||||
pub type ApiState = Arc<ApiStateInner>;
|
||||
|
||||
pub(crate) async fn auth<B>(
|
||||
req: http::Request<B>,
|
||||
next: axum::middleware::Next<B>,
|
||||
state: ApiState,
|
||||
) -> axum::response::Response {
|
||||
let sess_cookie = req
|
||||
.headers()
|
||||
.get_all("Cookie")
|
||||
.iter()
|
||||
.filter_map(|cookie| {
|
||||
cookie
|
||||
.to_str()
|
||||
.ok()
|
||||
.and_then(|cookie| cookie.parse::<cookie::Cookie>().ok())
|
||||
})
|
||||
.find(|cookie| cookie.name() == KTTD_SESSION_TAG);
|
||||
|
||||
log::info!("Session: {:?}", sess_cookie);
|
||||
|
||||
let session = sess_cookie.and_then(|cookie| state.session.get(cookie.value()));
|
||||
if let Some(sess) = session {
|
||||
log::info!("Found session {}", sess.created_at);
|
||||
next.run(req).await
|
||||
} else {
|
||||
(
|
||||
StatusCode::UNAUTHORIZED,
|
||||
Json(serde_json::json!({
|
||||
"error": "401 Unauthorized",
|
||||
})),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn start_server(pool: DbPool) {
|
||||
let mut secret = [0u8; 64];
|
||||
rand::thread_rng().fill(&mut secret);
|
||||
let state = Arc::new(ApiStateInner {
|
||||
pool,
|
||||
session: DashMap::new(),
|
||||
});
|
||||
let state_clone = state.clone();
|
||||
|
||||
let session_store = MemoryStore::new();
|
||||
let session_layer = SessionLayer::new(session_store, &secret);
|
||||
|
||||
let state = ApiState { pool };
|
||||
|
||||
let app = Router::new()
|
||||
.route("/", get(root))
|
||||
let v1 = Router::new()
|
||||
.route("/auth/logout", post(logout))
|
||||
.route("/user", post(user::create_user))
|
||||
.route("/user/list", get(user::list_users))
|
||||
.route("/user/:id", get(user::get_user))
|
||||
.with_state(state)
|
||||
.layer(session_layer);
|
||||
.layer(axum::middleware::from_fn(move |req, next| {
|
||||
auth(req, next, state_clone.clone())
|
||||
}));
|
||||
|
||||
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
|
||||
let api = Router::new()
|
||||
.route("/login", post(login)) // login
|
||||
.nest("/v1", v1)
|
||||
.fallback(bad_request);
|
||||
|
||||
let static_ = Router::new()
|
||||
.nest_service("/", get_service(ServeDir::new("./public/static")))
|
||||
.fallback(not_found);
|
||||
|
||||
let app = Router::new()
|
||||
.route(
|
||||
"/_dioxus/hot_reload",
|
||||
get(move |ws: axum::extract::WebSocketUpgrade| async move {
|
||||
ws.on_upgrade(move |_socket| async move {
|
||||
println!("hot reloading connected");
|
||||
})
|
||||
}),
|
||||
)
|
||||
.route("/favicon.ico", get(favicon))
|
||||
.nest("/api", api)
|
||||
.nest("/static", static_)
|
||||
.fallback(root)
|
||||
.with_state(state);
|
||||
|
||||
println!("Listening on http://{SERVER_ADDR}");
|
||||
axum::Server::bind(&SERVER_ADDR.parse().unwrap())
|
||||
.serve(app.into_make_service())
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// basic handler that responds with a static string
|
||||
async fn root() -> &'static str {
|
||||
"Hello, World!"
|
||||
pub(crate) async fn logout(State(state): State<ApiState>) -> impl IntoResponse {
|
||||
// state.session.remove();
|
||||
|
||||
(
|
||||
StatusCode::SEE_OTHER,
|
||||
[
|
||||
(header::LOCATION, HeaderValue::from_static("/")),
|
||||
(
|
||||
header::SET_COOKIE,
|
||||
HeaderValue::from_static("SESS=_; Max-Age=0"),
|
||||
),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
pub(crate) struct LoginRequest {
|
||||
username: String,
|
||||
password: String,
|
||||
}
|
||||
|
||||
pub(crate) async fn login(
|
||||
State(state): State<ApiState>,
|
||||
Json(login): Json<LoginRequest>,
|
||||
) -> Result<impl IntoResponse, Error> {
|
||||
let password_salt = sha256::digest(login.password);
|
||||
let user = repos::user::fetch_login_user(&state.pool, &login.username, &password_salt).await?;
|
||||
let token = Alphanumeric.sample_string(&mut rand::thread_rng(), 16);
|
||||
let sess = format!("SESS={}; Max-Age=999999", token);
|
||||
|
||||
state.session.insert(
|
||||
token,
|
||||
Session {
|
||||
user,
|
||||
last_access: chrono::Local::now().naive_local(),
|
||||
created_at: chrono::Local::now().naive_local(),
|
||||
},
|
||||
);
|
||||
|
||||
Ok((
|
||||
StatusCode::SEE_OTHER,
|
||||
[
|
||||
(header::LOCATION, HeaderValue::from_static("/")),
|
||||
(header::SET_COOKIE, HeaderValue::from_str(&sess).unwrap()),
|
||||
],
|
||||
))
|
||||
}
|
||||
|
||||
async fn bad_request() -> impl IntoResponse {
|
||||
(StatusCode::BAD_REQUEST, Html("400 Bad Request"))
|
||||
}
|
||||
|
||||
async fn not_found() -> impl IntoResponse {
|
||||
(StatusCode::NOT_FOUND, Html("404 Not Found"))
|
||||
}
|
||||
|
||||
async fn favicon() -> impl IntoResponse {
|
||||
let one_pixel_favicon = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mPk+89QDwADvgGOSHzRgAAAAABJRU5ErkJggg==";
|
||||
let pixel_favicon = base64::decode(one_pixel_favicon).unwrap();
|
||||
(
|
||||
[(header::CONTENT_TYPE, HeaderValue::from_static("image/png"))],
|
||||
pixel_favicon,
|
||||
)
|
||||
}
|
||||
|
||||
async fn root() -> Html<String> {
|
||||
let vdom = kttd_ui::get_vdom();
|
||||
|
||||
let mut index = std::fs::read_to_string("./public/index.html").unwrap();
|
||||
let body_pos = index.find("<div id=\"main\">").unwrap();
|
||||
|
||||
index.insert_str(body_pos + 15, &dioxus_ssr::pre_render(&vdom));
|
||||
|
||||
Html(index)
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
use axum::{
|
||||
extract::{Path, State},
|
||||
http::StatusCode,
|
||||
response::IntoResponse,
|
||||
Json,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::db::{
|
||||
models::user::{NewUser, User},
|
||||
repos,
|
||||
};
|
||||
use crate::db::{models::user::NewUser, repos};
|
||||
|
||||
use super::{error::Error, ApiState};
|
||||
|
||||
@ -23,7 +21,7 @@ pub struct ApiUser {
|
||||
pub async fn create_user(
|
||||
State(s): State<ApiState>,
|
||||
Json(payload): Json<ApiUser>,
|
||||
) -> Result<(StatusCode, Json<User>), Error> {
|
||||
) -> Result<impl IntoResponse, Error> {
|
||||
let user = repos::user::create_user(
|
||||
&s.pool,
|
||||
NewUser {
|
||||
@ -38,13 +36,13 @@ pub async fn create_user(
|
||||
Ok((StatusCode::CREATED, Json(user)))
|
||||
}
|
||||
|
||||
pub async fn list_users(State(s): State<ApiState>) -> Result<Json<Vec<User>>, Error> {
|
||||
pub async fn list_users(State(s): State<ApiState>) -> Result<impl IntoResponse, Error> {
|
||||
Ok(Json(repos::user::list_users(&s.pool).await?))
|
||||
}
|
||||
|
||||
pub async fn get_user(
|
||||
State(s): State<ApiState>,
|
||||
Path(user_id): Path<i32>,
|
||||
) -> Result<Json<User>, Error> {
|
||||
) -> Result<impl IntoResponse, Error> {
|
||||
Ok(Json(repos::user::fetch_user(&s.pool, user_id).await?))
|
||||
}
|
||||
|
@ -33,3 +33,21 @@ pub async fn fetch_user(pool: &DbPool, user_id: i32) -> Result<User, Error> {
|
||||
.first(&mut conn)
|
||||
.await?)
|
||||
}
|
||||
|
||||
pub async fn fetch_login_user(
|
||||
pool: &DbPool,
|
||||
username: &str,
|
||||
password_salt: &str,
|
||||
) -> Result<User, Error> {
|
||||
let mut conn = pool.get().await?;
|
||||
|
||||
Ok(users::table
|
||||
.filter(
|
||||
users::email
|
||||
.eq(username)
|
||||
.and(users::password.eq(password_salt)),
|
||||
)
|
||||
.select(User::as_select())
|
||||
.first(&mut conn)
|
||||
.await?)
|
||||
}
|
||||
|
@ -2,10 +2,15 @@ mod api;
|
||||
mod db;
|
||||
mod error;
|
||||
|
||||
use dioxus::prelude::hot_reload_init;
|
||||
pub use error::{Error, ErrorKind};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Error> {
|
||||
hot_reload_init!();
|
||||
pretty_env_logger::init();
|
||||
dotenv::dotenv().ok();
|
||||
|
||||
let durl = std::env::var("DATABASE_URL")
|
||||
.unwrap_or_else(|_| "postgres://postgres@127.0.0.1:5432/kttd".to_string());
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
[package]
|
||||
name = "ui"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dioxus = "0.3.2"
|
||||
dioxus-web = "0.3.1"
|
BIN
ui/dist/assets/dioxus/dioxus_bg.wasm
vendored
BIN
ui/dist/assets/dioxus/dioxus_bg.wasm
vendored
Binary file not shown.
46
ui/dist/index.html
vendored
46
ui/dist/index.html
vendored
@ -1,46 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>dioxus | ⛺</title>
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
<script type="module">
|
||||
import init from "/./assets/dioxus/dioxus.js";
|
||||
init("/./assets/dioxus/dioxus_bg.wasm").then(wasm => {
|
||||
if (wasm.__wbindgen_start == undefined) {
|
||||
wasm.main();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html><script>// Dioxus-CLI
|
||||
// https://github.com/DioxusLabs/cli
|
||||
|
||||
(function () {
|
||||
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
var url = protocol + '//' + window.location.host + '/_dioxus/ws';
|
||||
var poll_interval = 8080;
|
||||
var reload_upon_connect = () => {
|
||||
window.setTimeout(
|
||||
() => {
|
||||
var ws = new WebSocket(url);
|
||||
ws.onopen = () => window.location.reload();
|
||||
ws.onclose = reload_upon_connect;
|
||||
},
|
||||
poll_interval);
|
||||
};
|
||||
|
||||
var ws = new WebSocket(url);
|
||||
ws.onmessage = (ev) => {
|
||||
if (ev.data == "reload") {
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
ws.onclose = reload_upon_connect;
|
||||
})()</script>
|
@ -1,19 +0,0 @@
|
||||
#![allow(non_snake_case)]
|
||||
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
// launch the web app
|
||||
dioxus_web::launch(App);
|
||||
}
|
||||
|
||||
// create a component that renders a div with the text "Hello, world!"
|
||||
fn App(cx: Scope) -> Element {
|
||||
let mut count = use_state(cx, || 0);
|
||||
|
||||
cx.render(rsx! {
|
||||
h1 { "High-Five counter: {count}" }
|
||||
button { onclick: move |_| count += 1, "Up high!" }
|
||||
button { onclick: move |_| count -= 1, "Down low!" }
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user