Added dioxus-router to cargo dependencies. Added some basic page routing to void-fe, changed the root page to be a list of links to each poem.

This commit is contained in:
Ada Werefox 2023-04-08 20:47:51 -05:00
parent bcf1b36a6b
commit 31b0391ede
10 changed files with 612 additions and 284 deletions

159
Cargo.lock generated
View File

@ -111,6 +111,17 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -226,6 +237,17 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "colored"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd"
dependencies = [
"atty",
"lazy_static",
"winapi",
]
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
version = "2.1.0" version = "2.1.0"
@ -542,6 +564,27 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "dioxus-router"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f06b41f4af0b206ff39308488214a0d2dc67ad9bbbc60e7a322fe871b000bf5"
dependencies = [
"dioxus",
"futures-channel",
"futures-util",
"gloo-events",
"js-sys",
"log",
"serde",
"serde_urlencoded",
"simple_logger",
"thiserror",
"url",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "dioxus-rsx" name = "dioxus-rsx"
version = "0.0.2" version = "0.0.2"
@ -757,6 +800,15 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "form_urlencoded"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
dependencies = [
"percent-encoding",
]
[[package]] [[package]]
name = "fsevent-sys" name = "fsevent-sys"
version = "4.1.0" version = "4.1.0"
@ -911,6 +963,16 @@ dependencies = [
"regex", "regex",
] ]
[[package]]
name = "gloo-events"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "gloo-timers" name = "gloo-timers"
version = "0.2.6" version = "0.2.6"
@ -965,6 +1027,15 @@ dependencies = [
"ahash", "ahash",
] ]
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.2.6" version = "0.2.6"
@ -1068,6 +1139,16 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]] [[package]]
name = "ignore" name = "ignore"
version = "0.4.20" version = "0.4.20"
@ -1440,6 +1521,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "num_threads"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.17.1" version = "1.17.1"
@ -1981,6 +2071,18 @@ dependencies = [
"syn 2.0.13", "syn 2.0.13",
] ]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
"itoa",
"ryu",
"serde",
]
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.10.6" version = "0.10.6"
@ -2010,6 +2112,19 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "simple_logger"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78beb34673091ccf96a8816fce8bfd30d1292c7621ca2bcb5f2ba0fae4f558d"
dependencies = [
"atty",
"colored",
"log",
"time 0.3.20",
"windows-sys 0.42.0",
]
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.8" version = "0.4.8"
@ -2197,6 +2312,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890"
dependencies = [ dependencies = [
"itoa", "itoa",
"libc",
"num_threads",
"serde", "serde",
"time-core", "time-core",
"time-macros", "time-macros",
@ -2217,6 +2334,21 @@ dependencies = [
"time-core", "time-core",
] ]
[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "to_method" name = "to_method"
version = "1.1.0" version = "1.1.0"
@ -2391,6 +2523,12 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "unicode-bidi"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]] [[package]]
name = "unicode-id" name = "unicode-id"
version = "0.3.3" version = "0.3.3"
@ -2403,6 +2541,15 @@ version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "unicode-normalization"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
"tinyvec",
]
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.10.1" version = "1.10.1"
@ -2421,6 +2568,17 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "url"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
]
[[package]] [[package]]
name = "ux" name = "ux"
version = "0.1.5" version = "0.1.5"
@ -2456,6 +2614,7 @@ dependencies = [
"console_error_panic_hook", "console_error_panic_hook",
"dioxus", "dioxus",
"dioxus-autofmt", "dioxus-autofmt",
"dioxus-router",
"dioxus-web", "dioxus-web",
"log", "log",
"markdown", "markdown",

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@ pub mod web_app_backend {
#[get("/")] #[get("/")]
async fn index() -> Template { async fn index() -> Template {
let mut vdom = VirtualDom::new(void_app::App); let mut vdom = VirtualDom::new(void_app::HomePage);
let _ = vdom.rebuild(); let _ = vdom.rebuild();
let output = dioxus_ssr::render(&vdom); let output = dioxus_ssr::render(&vdom);
Template::render( Template::render(

View File

@ -16,6 +16,10 @@ wasm-logger = "0.2.0"
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
log = "0.4.17" log = "0.4.17"
[dependencies.dioxus-router]
version = "0.3.0"
features = ["query", "web"]
[dependencies.rust-embed] [dependencies.rust-embed]
version = "6.6.1" version = "6.6.1"
features = ["debug-embed"] features = ["debug-embed"]

View File

@ -1,4 +1,4 @@
let m,p,ls,lss,sp,d,t,c,s,sl,op,i,e,z,text,ptr,n,field,value,root,len,tmpl_id,index,many,id,event_name,bubbles,ns;const evt = [];const attr = [];const ns_cache = []; let m,p,ls,lss,sp,d,t,c,s,sl,op,i,e,z,text,n,tmpl_id,index,id,root,value,field,ns,bubbles,event_name,ptr,len,many;const ns_cache = [];const evt = [];const attr = [];
class ListenerMap { class ListenerMap {
constructor(root) { constructor(root) {
// bubbling events can listen at the root element // bubbling events can listen at the root element

View File

@ -236,6 +236,11 @@ function logError(f, args) {
function _assertNum(n) { function _assertNum(n) {
if (typeof(n) !== 'number') throw new Error('expected a number argument'); if (typeof(n) !== 'number') throw new Error('expected a number argument');
} }
function __wbg_adapter_22(arg0, arg1, arg2) {
_assertNum(arg0);
_assertNum(arg1);
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc1880658589bff58(arg0, arg1, addHeapObject(arg2));
}
let stack_pointer = 128; let stack_pointer = 128;
@ -244,28 +249,32 @@ function addBorrowedObject(obj) {
heap[--stack_pointer] = obj; heap[--stack_pointer] = obj;
return stack_pointer; return stack_pointer;
} }
function __wbg_adapter_22(arg0, arg1, arg2) { function __wbg_adapter_25(arg0, arg1, arg2) {
try { try {
_assertNum(arg0); _assertNum(arg0);
_assertNum(arg1); _assertNum(arg1);
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h48233aaf91e57484(arg0, arg1, addBorrowedObject(arg2)); wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h03d5b8da0fff4084(arg0, arg1, addBorrowedObject(arg2));
} finally { } finally {
heap[stack_pointer++] = undefined; heap[stack_pointer++] = undefined;
} }
} }
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__he360c1b3b32f360f(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_28(arg0, arg1, arg2) { function __wbg_adapter_28(arg0, arg1, arg2) {
_assertNum(arg0); _assertNum(arg0);
_assertNum(arg1); _assertNum(arg1);
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf1e9673798e59b8a(arg0, arg1, addHeapObject(arg2)); wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf1e9673798e59b8a(arg0, arg1, addHeapObject(arg2));
} }
function __wbg_adapter_31(arg0, arg1, arg2) {
try {
_assertNum(arg0);
_assertNum(arg1);
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h169afd08b98b789d(arg0, arg1, addBorrowedObject(arg2));
} finally {
heap[stack_pointer++] = undefined;
}
}
let cachedUint32Memory0 = null; let cachedUint32Memory0 = null;
function getUint32Memory0() { function getUint32Memory0() {
@ -285,14 +294,6 @@ function getArrayJsValueFromWasm0(ptr, len) {
return result; return result;
} }
function getCachedStringFromWasm0(ptr, len) {
if (ptr === 0) {
return getObject(len);
} else {
return getStringFromWasm0(ptr, len);
}
}
function handleError(f, args) { function handleError(f, args) {
try { try {
return f.apply(this, args); return f.apply(this, args);
@ -301,6 +302,14 @@ function handleError(f, args) {
} }
} }
function getCachedStringFromWasm0(ptr, len) {
if (ptr === 0) {
return getObject(len);
} else {
return getStringFromWasm0(ptr, len);
}
}
async function load(module, imports) { async function load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) { if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') { if (typeof WebAssembly.instantiateStreaming === 'function') {
@ -386,6 +395,20 @@ function getImports() {
const ret = getObject(arg0).location; const ret = getObject(arg0).location;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_history_6ee959556f01f7ea = function() { return handleError(function (arg0) {
const ret = getObject(arg0).history;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_scrollTo_881c41fdbf5d1cdd = function() { return logError(function (arg0, arg1, arg2) {
getObject(arg0).scrollTo(arg1, arg2);
}, arguments) };
imports.wbg.__wbg_title_4ec47c50bbc90221 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).title;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_createElement_e2a0e21263eb5416 = function() { return handleError(function (arg0, arg1, arg2) { imports.wbg.__wbg_createElement_e2a0e21263eb5416 = function() { return handleError(function (arg0, arg1, arg2) {
var v0 = getCachedStringFromWasm0(arg1, arg2); var v0 = getCachedStringFromWasm0(arg1, arg2);
const ret = getObject(arg0).createElement(v0); const ret = getObject(arg0).createElement(v0);
@ -407,6 +430,125 @@ function getImports() {
const ret = getObject(arg0).getElementById(v0); const ret = getObject(arg0).getElementById(v0);
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_instanceof_HtmlTextAreaElement_4bc39f9d861a6832 = 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_00fb0fdc46959169 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).value;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_animationName_8b08b6b55e2871c3 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).animationName;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_elapsedTime_b9b2848f0ce69c4d = function() { return logError(function (arg0) {
const ret = getObject(arg0).elapsedTime;
return ret;
}, arguments) };
imports.wbg.__wbg_pseudoElement_489395cbb841b9a8 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).pseudoElement;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlFormElement_04e7484e36bd99d6 = 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_ce4445b6cda59af6 = function() { return logError(function (arg0) {
const ret = getObject(arg0).elements;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_pointerId_d2caae4465ba386f = function() { return logError(function (arg0) {
const ret = getObject(arg0).pointerId;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_width_a1d5efe9db3fb17a = function() { return logError(function (arg0) {
const ret = getObject(arg0).width;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_height_7a964b61a7a42a7d = function() { return logError(function (arg0) {
const ret = getObject(arg0).height;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_pressure_352c13794490720b = function() { return logError(function (arg0) {
const ret = getObject(arg0).pressure;
return ret;
}, arguments) };
imports.wbg.__wbg_tangentialPressure_1dfc978ca995fe64 = function() { return logError(function (arg0) {
const ret = getObject(arg0).tangentialPressure;
return ret;
}, arguments) };
imports.wbg.__wbg_tiltX_5e065070f9907bab = function() { return logError(function (arg0) {
const ret = getObject(arg0).tiltX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_tiltY_88a95794fa24061b = function() { return logError(function (arg0) {
const ret = getObject(arg0).tiltY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_twist_1ac0d3bf085b9fa5 = function() { return logError(function (arg0) {
const ret = getObject(arg0).twist;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_pointerType_df759fa0bd6634ed = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).pointerType;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_isPrimary_31079f1bab7f6665 = function() { return logError(function (arg0) {
const ret = getObject(arg0).isPrimary;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_propertyName_e41c6239ffb77f2a = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).propertyName;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_elapsedTime_6bbd8686761d767f = function() { return logError(function (arg0) {
const ret = getObject(arg0).elapsedTime;
return ret;
}, arguments) };
imports.wbg.__wbg_pseudoElement_589db5e026c64890 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).pseudoElement;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlInputElement_5c9d54338207f061 = function() { return logError(function (arg0) { imports.wbg.__wbg_instanceof_HtmlInputElement_5c9d54338207f061 = function() { return logError(function (arg0) {
let result; let result;
try { try {
@ -451,6 +593,14 @@ function getImports() {
imports.wbg.__wbg_preventDefault_16b2170b12f56317 = function() { return logError(function (arg0) { imports.wbg.__wbg_preventDefault_16b2170b12f56317 = function() { return logError(function (arg0) {
getObject(arg0).preventDefault(); getObject(arg0).preventDefault();
}, arguments) }; }, arguments) };
imports.wbg.__wbg_addEventListener_cf5b03cd29763277 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
var v0 = getCachedStringFromWasm0(arg1, arg2);
getObject(arg0).addEventListener(v0, getObject(arg3), getObject(arg4));
}, arguments) };
imports.wbg.__wbg_removeEventListener_b25f5db74f767386 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
var v0 = getCachedStringFromWasm0(arg1, arg2);
getObject(arg0).removeEventListener(v0, getObject(arg3), arg4 !== 0);
}, arguments) };
imports.wbg.__wbg_data_af909e5dfe73e68c = function() { return logError(function (arg0) { imports.wbg.__wbg_data_af909e5dfe73e68c = function() { return logError(function (arg0) {
const ret = getObject(arg0).data; const ret = getObject(arg0).data;
return addHeapObject(ret); return addHeapObject(ret);
@ -537,6 +687,37 @@ function getImports() {
getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0; getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_pushState_429f091d389407b4 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
var v0 = getCachedStringFromWasm0(arg2, arg3);
var v1 = getCachedStringFromWasm0(arg4, arg5);
getObject(arg0).pushState(getObject(arg1), v0, v1);
}, arguments) };
imports.wbg.__wbg_replaceState_099eb1e3de220ab7 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
var v0 = getCachedStringFromWasm0(arg2, arg3);
var v1 = getCachedStringFromWasm0(arg4, arg5);
getObject(arg0).replaceState(getObject(arg1), v0, v1);
}, arguments) };
imports.wbg.__wbg_href_bb86bb94d1c6861b = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).href;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_protocol_3767aa51aa3121ca = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).protocol;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_host_ab37f7d1be2315a7 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).host;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_instanceof_Node_abf5312af68f179e = function() { return logError(function (arg0) { imports.wbg.__wbg_instanceof_Node_abf5312af68f179e = function() { return logError(function (arg0) {
let result; let result;
try { try {
@ -573,112 +754,6 @@ function getImports() {
_assertNum(ret); _assertNum(ret);
return ret; return ret;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_protocol_3767aa51aa3121ca = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).protocol;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_host_ab37f7d1be2315a7 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).host;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_instanceof_CompositionEvent_57e2f1c0e7330ddc = 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_70b505c651722930 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).data;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_setProperty_21e2e7868b86a93e = 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_length_5ce97df09b61b986 = function() { return logError(function (arg0) {
const ret = getObject(arg0).length;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_item_2ab86c1e3cb70ed3 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg0).item(arg1 >>> 0);
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_screenX_efa7b61dc7fa2efd = function() { return logError(function (arg0) {
const ret = getObject(arg0).screenX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_screenY_c5e6449919709a69 = function() { return logError(function (arg0) {
const ret = getObject(arg0).screenY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_clientX_35f23f953e04ec0e = function() { return logError(function (arg0) {
const ret = getObject(arg0).clientX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_clientY_8104e462abc0b3ec = function() { return logError(function (arg0) {
const ret = getObject(arg0).clientY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_offsetX_413d9f02022e72ad = function() { return logError(function (arg0) {
const ret = getObject(arg0).offsetX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_offsetY_488f80a0a9666028 = function() { return logError(function (arg0) {
const ret = getObject(arg0).offsetY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_ctrlKey_e1b8f1de1eb24d5d = function() { return logError(function (arg0) {
const ret = getObject(arg0).ctrlKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_shiftKey_fdd99b6df96e25c5 = function() { return logError(function (arg0) {
const ret = getObject(arg0).shiftKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_altKey_d531a4d3704557cb = function() { return logError(function (arg0) {
const ret = getObject(arg0).altKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_metaKey_934772989e28020c = function() { return logError(function (arg0) {
const ret = getObject(arg0).metaKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_button_a1c470d5e4c997f2 = function() { return logError(function (arg0) {
const ret = getObject(arg0).button;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_buttons_42a7b7de33d8e572 = function() { return logError(function (arg0) {
const ret = getObject(arg0).buttons;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_instanceof_Element_cb847a3fc7b1b1a4 = function() { return logError(function (arg0) { imports.wbg.__wbg_instanceof_Element_cb847a3fc7b1b1a4 = function() { return logError(function (arg0) {
let result; let result;
try { try {
@ -748,28 +823,10 @@ function getImports() {
imports.wbg.__wbg_warn_48cbddced45e5414 = function() { return logError(function (arg0, arg1, arg2, arg3) { imports.wbg.__wbg_warn_48cbddced45e5414 = function() { return logError(function (arg0, arg1, arg2, arg3) {
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
}, arguments) }; }, arguments) };
imports.wbg.__wbg_animationName_8b08b6b55e2871c3 = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_instanceof_CompositionEvent_57e2f1c0e7330ddc = function() { return logError(function (arg0) {
const ret = getObject(arg1).animationName;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_elapsedTime_b9b2848f0ce69c4d = function() { return logError(function (arg0) {
const ret = getObject(arg0).elapsedTime;
return ret;
}, arguments) };
imports.wbg.__wbg_pseudoElement_489395cbb841b9a8 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).pseudoElement;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlTextAreaElement_4bc39f9d861a6832 = function() { return logError(function (arg0) {
let result; let result;
try { try {
result = getObject(arg0) instanceof HTMLTextAreaElement; result = getObject(arg0) instanceof CompositionEvent;
} catch { } catch {
result = false; result = false;
} }
@ -777,30 +834,26 @@ function getImports() {
_assertBoolean(ret); _assertBoolean(ret);
return ret; return ret;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_value_00fb0fdc46959169 = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_data_70b505c651722930 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).value; const ret = getObject(arg1).data;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN; var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0; getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_propertyName_e41c6239ffb77f2a = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_setProperty_21e2e7868b86a93e = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
const ret = getObject(arg1).propertyName; var v0 = getCachedStringFromWasm0(arg1, arg2);
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); var v1 = getCachedStringFromWasm0(arg3, arg4);
const len0 = WASM_VECTOR_LEN; getObject(arg0).setProperty(v0, v1);
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_elapsedTime_6bbd8686761d767f = function() { return logError(function (arg0) { imports.wbg.__wbg_length_5ce97df09b61b986 = function() { return logError(function (arg0) {
const ret = getObject(arg0).elapsedTime; const ret = getObject(arg0).length;
_assertNum(ret);
return ret; return ret;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_pseudoElement_589db5e026c64890 = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_item_2ab86c1e3cb70ed3 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).pseudoElement; const ret = getObject(arg0).item(arg1 >>> 0);
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); return isLikeNone(ret) ? 0 : addHeapObject(ret);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_setonmessage_5ea7e452fd7a5544 = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_setonmessage_5ea7e452fd7a5544 = function() { return logError(function (arg0, arg1) {
getObject(arg0).onmessage = getObject(arg1); getObject(arg0).onmessage = getObject(arg1);
@ -810,6 +863,66 @@ function getImports() {
const ret = new WebSocket(v0); const ret = new WebSocket(v0);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_screenX_efa7b61dc7fa2efd = function() { return logError(function (arg0) {
const ret = getObject(arg0).screenX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_screenY_c5e6449919709a69 = function() { return logError(function (arg0) {
const ret = getObject(arg0).screenY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_clientX_35f23f953e04ec0e = function() { return logError(function (arg0) {
const ret = getObject(arg0).clientX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_clientY_8104e462abc0b3ec = function() { return logError(function (arg0) {
const ret = getObject(arg0).clientY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_offsetX_413d9f02022e72ad = function() { return logError(function (arg0) {
const ret = getObject(arg0).offsetX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_offsetY_488f80a0a9666028 = function() { return logError(function (arg0) {
const ret = getObject(arg0).offsetY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_ctrlKey_e1b8f1de1eb24d5d = function() { return logError(function (arg0) {
const ret = getObject(arg0).ctrlKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_shiftKey_fdd99b6df96e25c5 = function() { return logError(function (arg0) {
const ret = getObject(arg0).shiftKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_altKey_d531a4d3704557cb = function() { return logError(function (arg0) {
const ret = getObject(arg0).altKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_metaKey_934772989e28020c = function() { return logError(function (arg0) {
const ret = getObject(arg0).metaKey;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_button_a1c470d5e4c997f2 = function() { return logError(function (arg0) {
const ret = getObject(arg0).button;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_buttons_42a7b7de33d8e572 = function() { return logError(function (arg0) {
const ret = getObject(arg0).buttons;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_deltaX_b7d127c94d6265c0 = function() { return logError(function (arg0) { imports.wbg.__wbg_deltaX_b7d127c94d6265c0 = function() { return logError(function (arg0) {
const ret = getObject(arg0).deltaX; const ret = getObject(arg0).deltaX;
return ret; return ret;
@ -827,71 +940,6 @@ function getImports() {
_assertNum(ret); _assertNum(ret);
return ret; return ret;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_instanceof_HtmlFormElement_04e7484e36bd99d6 = 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_ce4445b6cda59af6 = function() { return logError(function (arg0) {
const ret = getObject(arg0).elements;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_pointerId_d2caae4465ba386f = function() { return logError(function (arg0) {
const ret = getObject(arg0).pointerId;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_width_a1d5efe9db3fb17a = function() { return logError(function (arg0) {
const ret = getObject(arg0).width;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_height_7a964b61a7a42a7d = function() { return logError(function (arg0) {
const ret = getObject(arg0).height;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_pressure_352c13794490720b = function() { return logError(function (arg0) {
const ret = getObject(arg0).pressure;
return ret;
}, arguments) };
imports.wbg.__wbg_tangentialPressure_1dfc978ca995fe64 = function() { return logError(function (arg0) {
const ret = getObject(arg0).tangentialPressure;
return ret;
}, arguments) };
imports.wbg.__wbg_tiltX_5e065070f9907bab = function() { return logError(function (arg0) {
const ret = getObject(arg0).tiltX;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_tiltY_88a95794fa24061b = function() { return logError(function (arg0) {
const ret = getObject(arg0).tiltY;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_twist_1ac0d3bf085b9fa5 = function() { return logError(function (arg0) {
const ret = getObject(arg0).twist;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_pointerType_df759fa0bd6634ed = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).pointerType;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_isPrimary_31079f1bab7f6665 = function() { return logError(function (arg0) {
const ret = getObject(arg0).isPrimary;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function() { return logError(function (arg0, arg1) {
var v0 = getCachedStringFromWasm0(arg0, arg1); var v0 = getCachedStringFromWasm0(arg0, arg1);
const ret = new Function(v0); const ret = new Function(v0);
@ -901,6 +949,10 @@ function getImports() {
const ret = getObject(arg0).call(getObject(arg1)); const ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_new_f9876326328f45ed = function() { return logError(function () {
const ret = new Object();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_resolve_fd40f858d9db1a04 = function() { return logError(function (arg0) { imports.wbg.__wbg_resolve_fd40f858d9db1a04 = function() { return logError(function (arg0) {
const ret = Promise.resolve(getObject(arg0)); const ret = Promise.resolve(getObject(arg0));
return addHeapObject(ret); return addHeapObject(ret);
@ -925,6 +977,11 @@ function getImports() {
const ret = global.global; const ret = global.global;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_set_6aa458a4ebdb65cb = function() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbindgen_is_undefined = function(arg0) { imports.wbg.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined; const ret = getObject(arg0) === undefined;
_assertBoolean(ret); _assertBoolean(ret);
@ -976,18 +1033,22 @@ imports.wbg.__wbindgen_memory = function() {
const ret = wasm.memory; const ret = wasm.memory;
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper896 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper906 = function() { return logError(function (arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 118, __wbg_adapter_22); const ret = makeMutClosure(arg0, arg1, 116, __wbg_adapter_22);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbindgen_closure_wrapper898 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper908 = function() { return logError(function (arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 116, __wbg_adapter_25); const ret = makeMutClosure(arg0, arg1, 118, __wbg_adapter_25);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbindgen_closure_wrapper2223 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper2232 = function() { return logError(function (arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_28); const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_28);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbindgen_closure_wrapper4203 = function() { return logError(function (arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 339, __wbg_adapter_31);
return addHeapObject(ret);
}, arguments) };
imports['./snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js'] = __wbg_star0; imports['./snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js'] = __wbg_star0;
return imports; return imports;

File diff suppressed because one or more lines are too long

View File

@ -10,97 +10,190 @@ pub mod void_app {
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types // import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
pub use dioxus::prelude::*; pub use dioxus::prelude::*;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use markdown::{self, Options};
// #[derive(PartialEq, Props)] #[cfg(any(target_family = "wasm"))]
// pub struct Poems { use dioxus_router::{Router, Route, Link};
// pub poems: Vec<String>,
// } #[derive(PartialEq, Props)]
pub struct PoemRequest {
slug: String,
}
#[derive(PartialEq, Props)] #[derive(PartialEq, Props)]
struct PoemData { struct PoemData {
title: String, title: Option<String>,
content: String, content: Option<String>,
creation_date: String, creation_date: Option<String>,
} slug: Option<String>,
#[derive(PartialEq, Props)]
struct PoemTitle {
title: String,
}
#[derive(PartialEq, Props)]
struct PoemContent {
content: String,
creation_date: String,
} }
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "data/poems"] #[folder = "data/poems"]
pub struct Poems; pub struct Poems;
#[cfg(target_family = "wasm")]
pub fn DioxusApp(cx: Scope) -> Element {
cx.render(rsx! {
Router {
Route { to: "/", HomePage {} }
Route { to: "/poem/:slug/", PoemPage {} }
}
})
}
/// Renders the app and returns the rendered Element. /// Renders the app and returns the rendered Element.
pub fn App(cx: Scope) -> Element { pub fn HomePage(cx: Scope) -> Element {
cx.render(rsx!( cx.render(rsx!{
div { class: "min-h-screen font-nerd bg-alice-werefox-grey-light dark:bg-alice-werefox-grey", div { class: "min-h-screen font-nerd bg-alice-werefox-grey-light dark:bg-alice-werefox-grey",
div { class: "container space-y-4 mx-auto p-4", div { class: "container space-y-4 mx-auto p-4",
div { class: "p-4 space-y-2 ring-4 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark ring-alice-werefox-red-dark dark:ring-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light",
p { class: "text-lg text-center",
"A Letter to the Void"
}
}
Poems::iter().map(|p| { Poems::iter().map(|p| {
let creation_date = String::from(String::from("<br>Written on: ") + p.split("_").next().unwrap()); let filename = p.to_string();
let poem_content = Poems::get(&p).expect("Found poem {&p:?}"); let poem_content = Poems::get(&filename).expect("Found poem {filename:?}");
let mut poem_to_str = std::str::from_utf8(poem_content.data.as_ref()).expect("Title is valid UT8.").lines(); let mut poem_to_str = std::str::from_utf8(poem_content.data.as_ref()).expect("Title is valid UT8.").lines();
let poem_title = poem_to_str.next().unwrap(); let title_markdown = poem_to_str.next().expect("No title specified.");
let poem_content = poem_to_str.into_iter().collect::<Vec<&str>>().join("\n"); let title = markdown::to_html_with_options(title_markdown, &Options::gfm()).unwrap();
let poem_title_to_html_string = markdown::to_html(poem_title); let slug = String::from(filename.trim_end_matches(".md"));
let poem_content_to_html_string = markdown::to_html(poem_content.as_str()); cx.render(rsx!(
rsx!{ MakePoem{ title: poem_title_to_html_string, content: poem_content_to_html_string, creation_date: creation_date } } ul { class: "space-y-4",
PoemButton { title: title, slug: slug }
}
))
}) })
} }
} }
)) })
} }
#[cfg(any(target_family = "unix", target_family = "windows"))] #[cfg(any(target_family = "unix", target_family = "windows"))]
fn RenderPoemTitle(cx: Scope<PoemTitle>) -> Element { pub fn PoemPage(cx: Scope<PoemRequest>) -> Element {
cx.render(rsx!( let slug = cx.props.slug.clone();
cx.render(rsx!{
div { class: "min-h-screen font-nerd bg-alice-werefox-grey-light dark:bg-alice-werefox-grey",
div { class: "container space-y-4 mx-auto p-4", GetPoem { slug: slug } }
}
})
}
#[cfg(target_family = "wasm")]
fn PoemPage(cx: Scope) -> Element {
log::trace!("Test");
let slug = String::from(dioxus_router::use_route(cx).segment("slug").expect("No slug specified."));
log::trace!("{slug}");
cx.render(rsx!{
div { class: "min-h-screen font-nerd bg-alice-werefox-grey-light dark:bg-alice-werefox-grey",
div { class: "container space-y-4 mx-auto p-4", GetPoem { slug: slug } }
}
})
}
#[cfg(any(target_family = "unix", target_family = "windows"))]
fn PoemButton(cx: Scope<PoemData>) -> Element {
let title = cx.props.title.clone().expect("No title specified.");
let slug = cx.props.slug.clone().expect("No slug specified.");
let slug_ref = slug.as_str();
cx.render(rsx!{
div {
a { href: "/poem/{slug_ref}",
li { class: "p-4 ml-6 mr-6 space-y-2 ring-2 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark ring-alice-werefox-red-dark dark:ring-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light hover:text-alice-werefox-blue-dark dark:hover:text-alice-werefox-blue-light hover:ring-alice-werefox-blue dark:hover:ring-alice-werefox-blue hover:animate-yip transition",
div { class: "text-lg text-center", "{title}" }
}
}
}
})
}
#[cfg(target_family = "wasm")]
fn PoemButton(cx: Scope<PoemData>) -> Element {
let title = cx.props.title.clone().expect("No title specified.");
let slug = cx.props.slug.clone().expect("No slug specified.");
let slug_ref = slug.as_str();
cx.render(rsx!{
div {
Link { to: "/poem/{slug_ref}",
li { class: "p-4 ml-6 mr-6 space-y-2 ring-2 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark ring-alice-werefox-red-dark dark:ring-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light hover:text-alice-werefox-blue-dark dark:hover:text-alice-werefox-blue-light hover:ring-alice-werefox-blue dark:hover:ring-alice-werefox-blue hover:animate-yip transition",
div { class: "text-lg text-center", dangerous_inner_html: "{title}" }
}
}
}
})
}
fn GetPoem(cx: Scope<PoemData>) -> Element {
let filename = String::from(String::from(cx.props.slug.clone().expect("No slug specified.")) + ".md");
let creation_date = String::from(String::from("<br>Written on: ") + filename.split("_").next().unwrap());
let poem_content = Poems::get(&filename).expect("Found poem {filename:?}");
let mut poem_to_str = std::str::from_utf8(poem_content.data.as_ref()).expect("Title is valid UT8.").lines();
let poem_title = poem_to_str.next().unwrap();
let poem_content = poem_to_str.into_iter().collect::<Vec<&str>>().join("\n");
let poem_title_to_html_string = markdown::to_html_with_options(poem_title, &Options::gfm()).unwrap();
let poem_content_to_html_string = markdown::to_html_with_options(poem_content.as_str(), &Options::gfm()).unwrap();
cx.render(rsx!{
MakePoem{ title: poem_title_to_html_string, content: poem_content_to_html_string, creation_date: creation_date } }
)
}
#[cfg(any(target_family = "unix", target_family = "windows"))]
fn RenderPoemTitle(cx: Scope<PoemData>) -> Element {
let title = cx.props.title.clone().expect("No title specified.");
cx.render(rsx!{
span { class: "mx-auto max-w-fit flex justify-center bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", span { class: "mx-auto max-w-fit flex justify-center bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4",
"{cx.props.title}" "{title}"
} }
)) })
} }
#[cfg(target_family = "wasm")] #[cfg(target_family = "wasm")]
fn RenderPoemTitle(cx: Scope<PoemTitle>) -> Element { fn RenderPoemTitle(cx: Scope<PoemData>) -> Element {
cx.render(rsx!( let title = cx.props.title.clone().expect("This poem has an empty title.");
cx.render(rsx!{
p { class: "mx-auto max-w-fit flex justify-center bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", p { class: "mx-auto max-w-fit flex justify-center bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4",
dangerous_inner_html: "{cx.props.title}", dangerous_inner_html: "{title}",
} }
)) })
} }
#[cfg(any(target_family = "unix", target_family = "windows"))] #[cfg(any(target_family = "unix", target_family = "windows"))]
fn RenderPoemElement(cx: Scope<PoemContent>) -> Element { fn RenderPoemElement(cx: Scope<PoemData>) -> Element {
cx.render(rsx!( let content = cx.props.content.clone().expect("No content specified.");
div { class: "font-nerd flex flex-col space-y-4 mx-4 py-4", "{cx.props.content}{cx.props.creation_date}" } let creation_date = cx.props.creation_date.clone().expect("No creation date specified.");
)) cx.render(rsx!{
div { class: "font-nerd flex flex-col space-y-4 mx-4 py-4", "{content}{creation_date}" }
})
} }
#[cfg(target_family = "wasm")] #[cfg(target_family = "wasm")]
fn RenderPoemElement(cx: Scope<PoemContent>) -> Element { fn RenderPoemElement(cx: Scope<PoemData>) -> Element {
cx.render(rsx!(div { let content = cx.props.content.clone().expect("No content specified.");
let creation_date = cx.props.creation_date.clone().expect("No creation date specified.");
cx.render(rsx!{
div {
class: "font-nerd flex flex-col space-y-4 mx-4 py-4", class: "font-nerd flex flex-col space-y-4 mx-4 py-4",
dangerous_inner_html: "{cx.props.content}{cx.props.creation_date}" dangerous_inner_html: "{content}{creation_date}"
})) }
})
} }
fn MakePoem(cx: Scope<PoemData>) -> Element { fn MakePoem(cx: Scope<PoemData>) -> Element {
cx.render(rsx!( let title = cx.props.title.clone().expect("No title specified.");
let creation_date = cx.props.creation_date.clone().expect("No creation date specified.");
let content = cx.props.content.clone().expect("No content specified.");
cx.render(rsx!{
div { class: "flex-col space-y-4", div { class: "flex-col space-y-4",
RenderPoemTitle { title: cx.props.title.clone() } RenderPoemTitle { title: title.clone() }
details { class: "mx-auto max-w-fit space-y-4 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", details { class: "mx-auto max-w-fit space-y-4 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4",
summary { class: "flex justify-center border-4 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", summary { class: "flex justify-center border-4 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4",
"Open" "Open"
} }
RenderPoemElement { content: cx.props.content.clone(), creation_date: cx.props.creation_date.clone() } RenderPoemElement { content: content.clone(), creation_date: creation_date.clone() }
} }
} }
)) })
} }
} }

View File

@ -1,12 +1,23 @@
#[cfg(target_family = "wasm")]
use console_error_panic_hook; use console_error_panic_hook;
#[cfg(target_family = "wasm")]
use void_fe::void_app; use void_fe::void_app;
#[cfg(target_family = "wasm")]
use wasm_logger; use wasm_logger;
#[cfg(any(target_family = "unix", target_family = "windows"))]
fn main() {
print!("You can't run this without targeting web assembly. Try running `dioxus serve`.")
}
#[cfg(target_family = "wasm")]
fn main() { fn main() {
// init debug tool for WebAssembly // init debug tool for WebAssembly
wasm_logger::init(wasm_logger::Config::default()); wasm_logger::init(wasm_logger::Config::default());
console_error_panic_hook::set_once(); console_error_panic_hook::set_once();
dioxus_web::launch(void_app::App); dioxus_web::launch(void_app::DioxusApp);
} }