feat: add binomial distribution calc #1
13 changed files with 390 additions and 157 deletions
249
Cargo.lock
generated
249
Cargo.lock
generated
|
|
@ -39,6 +39,12 @@ dependencies = [
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-once-cell"
|
||||||
|
version = "0.5.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-trait"
|
name = "async-trait"
|
||||||
version = "0.1.88"
|
version = "0.1.88"
|
||||||
|
|
@ -86,6 +92,12 @@ version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base16"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d27c3610c36aee21ce8ac510e6224498de4228ad772a171ed65643a24693a5a8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.22.1"
|
version = "0.22.1"
|
||||||
|
|
@ -98,6 +110,15 @@ version = "2.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bstr"
|
name = "bstr"
|
||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
|
|
@ -178,9 +199,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "config"
|
name = "config"
|
||||||
version = "0.15.11"
|
version = "0.15.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "595aae20e65c3be792d05818e8c63025294ac3cb7e200f11459063a352a6ef80"
|
checksum = "5b1eb4fb07bc7f012422df02766c7bd5971effb894f573865642f06fa3265440"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case 0.6.0",
|
"convert_case 0.6.0",
|
||||||
"pathdiff",
|
"pathdiff",
|
||||||
|
|
@ -211,9 +232,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "const-str"
|
name = "const-str"
|
||||||
version = "0.6.2"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e991226a70654b49d34de5ed064885f0bef0348a8e70018b8ff1ac80aa984a2"
|
checksum = "451d0640545a0553814b4c646eb549343561618838e9b42495f466131fe3ad49"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "const_format"
|
name = "const_format"
|
||||||
|
|
@ -259,6 +280,15 @@ dependencies = [
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-deque"
|
name = "crossbeam-deque"
|
||||||
version = "0.8.6"
|
version = "0.8.6"
|
||||||
|
|
@ -284,6 +314,16 @@ version = "0.8.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "current_platform"
|
name = "current_platform"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
@ -315,6 +355,16 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer",
|
||||||
|
"crypto-common",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "displaydoc"
|
name = "displaydoc"
|
||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
|
|
@ -564,16 +614,13 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "generic-array"
|
||||||
version = "0.2.16"
|
version = "0.14.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"typenum",
|
||||||
"js-sys",
|
"version_check",
|
||||||
"libc",
|
|
||||||
"wasi 0.11.1+wasi-snapshot-preview1",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -583,9 +630,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"r-efi",
|
"r-efi",
|
||||||
"wasi 0.14.2+wasi-0.2.4",
|
"wasi",
|
||||||
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -906,15 +955,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos"
|
name = "leptos"
|
||||||
version = "0.8.2"
|
version = "0.8.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ceaf7d86820125c57dcd380edac4b972debf480ee4c7eea6dd7cea212615978"
|
checksum = "20adc17f0584e5f605a31444179bae17c399a2d160bf19eb3da701a1f6e7cb8e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"any_spawner",
|
"any_spawner",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"either_of",
|
"either_of",
|
||||||
"futures",
|
"futures",
|
||||||
"getrandom 0.2.16",
|
"getrandom",
|
||||||
"hydration_context",
|
"hydration_context",
|
||||||
"leptos_config",
|
"leptos_config",
|
||||||
"leptos_dom",
|
"leptos_dom",
|
||||||
|
|
@ -929,6 +978,7 @@ dependencies = [
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"send_wrapper",
|
"send_wrapper",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"serde_qs",
|
"serde_qs",
|
||||||
"server_fn",
|
"server_fn",
|
||||||
"slotmap",
|
"slotmap",
|
||||||
|
|
@ -939,14 +989,16 @@ dependencies = [
|
||||||
"typed-builder",
|
"typed-builder",
|
||||||
"typed-builder-macro",
|
"typed-builder-macro",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"wasm_split_helpers",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos-fluent"
|
name = "leptos-fluent"
|
||||||
version = "0.2.15"
|
version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "928b183ce3921ff7be494648edb0057a63798e5bbfb7de80f91f463f2135cf79"
|
checksum = "cd05ecc0ee18e70f2bfed53ef9f7f404ae6b8ecceaa52c8d0a33a6d4bd95d9cc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fluent-templates",
|
"fluent-templates",
|
||||||
"leptos",
|
"leptos",
|
||||||
|
|
@ -958,9 +1010,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos-fluent-macros"
|
name = "leptos-fluent-macros"
|
||||||
version = "0.2.15"
|
version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4314b7d1e4562f20cb895d5bba904482d8917b74257d845ee8e48efc75552be9"
|
checksum = "ad0ccc82283d56ecc712892b7d447b95621e91c1d0d4521edba59c0425ac7eea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-expr",
|
"cfg-expr",
|
||||||
"current_platform",
|
"current_platform",
|
||||||
|
|
@ -977,9 +1029,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_config"
|
name = "leptos_config"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf4100ad54455f82b686c9d0500a45c909eb50ce68ccb2ed51439ff2596f54fd"
|
checksum = "b0fddaae8dbc1680aa59c40c8f8ebb780b9a841e503d3cc5143d346a40c6d8ab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"config",
|
"config",
|
||||||
"regex",
|
"regex",
|
||||||
|
|
@ -990,9 +1042,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_dom"
|
name = "leptos_dom"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "adaca2ec1d6215a7c43dc6353d487e4e34faf325b8e4df2ca3df488964d403be"
|
checksum = "1aa676df0da118c690d65669eb322f47f0e47f5505ce5d2119ed5b4432d3c732"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"or_poisoned",
|
"or_poisoned",
|
||||||
|
|
@ -1006,9 +1058,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_hot_reload"
|
name = "leptos_hot_reload"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "597f84532609518092960ac241741963c90c216ee11f752e1b238b846f043640"
|
checksum = "0d61ec3e1ff8aaee8c5151688550c0363f85bc37845450764c31ff7584a33f38"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"camino",
|
"camino",
|
||||||
|
|
@ -1024,9 +1076,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_macro"
|
name = "leptos_macro"
|
||||||
version = "0.8.2"
|
version = "0.8.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a2ec91579e9a1344adc1eee637cb774a01354a3d25857cbd028b0289efe131d"
|
checksum = "5a824b74d70dd505e5fe32952150325275050febb0d0bd7ac8b8efc50a69ec95"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"attribute-derive",
|
"attribute-derive",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
|
@ -1048,14 +1100,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_meta"
|
name = "leptos_meta"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c03b2d5e0a9e7060bce4862c009ced3c2ad0afe45d005eaa4defa3872d2d2aac"
|
checksum = "2d489e38d3f541e9e43ecc2e3a815527840345a2afca629b3e23fcc1dd254578"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"leptos",
|
"leptos",
|
||||||
"once_cell",
|
|
||||||
"or_poisoned",
|
"or_poisoned",
|
||||||
"send_wrapper",
|
"send_wrapper",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
|
@ -1064,9 +1115,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_router"
|
name = "leptos_router"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d1b70dbd176bd0129e5db0e2ed48b7ff076c1b17cf52bbd0e85dcc3e6b9cbc0"
|
checksum = "3991de30a9cce8082e8c0d729744c8f6ffd66a828629806bf1332cb624123c75"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"any_spawner",
|
"any_spawner",
|
||||||
"either_of",
|
"either_of",
|
||||||
|
|
@ -1075,7 +1126,6 @@ dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"leptos",
|
"leptos",
|
||||||
"leptos_router_macro",
|
"leptos_router_macro",
|
||||||
"once_cell",
|
|
||||||
"or_poisoned",
|
"or_poisoned",
|
||||||
"reactive_graph",
|
"reactive_graph",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
|
|
@ -1089,9 +1139,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_router_macro"
|
name = "leptos_router_macro"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8403f583a69812524b98c97f2ed0258771e205cd0f715b1bc6ba5e4f70dcb94b"
|
checksum = "571042420d79f4f5b6b0d149dc1561b03f47e08c37c8fa0dfc80c73ad67be8af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
|
@ -1101,9 +1151,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_server"
|
name = "leptos_server"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5af59932aa8a640da4d3d20650cf07084433e25db0ee690203d893b81773db29"
|
checksum = "38acbf32649a4b127c8d4ccaed8fb388e19a746430a0ea8f8160e51e28c36e2d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"any_spawner",
|
"any_spawner",
|
||||||
"base64",
|
"base64",
|
||||||
|
|
@ -1211,12 +1261,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "oco_ref"
|
name = "oco_ref"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "64b94982fe39a861561cf67ff17a7849f2cedadbbad960a797634032b7abb998"
|
checksum = "ed0423ff9973dea4d6bd075934fdda86ebb8c05bdf9d6b0507067d4a1226371d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 1.0.69",
|
"thiserror 2.0.12",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1321,9 +1371,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettyplease"
|
name = "prettyplease"
|
||||||
version = "0.2.34"
|
version = "0.2.36"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55"
|
checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"syn",
|
"syn",
|
||||||
|
|
@ -1440,9 +1490,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reactive_graph"
|
name = "reactive_graph"
|
||||||
version = "0.2.2"
|
version = "0.2.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac68cd988635779e6f378871257cbccfd51d7eeb7bc0bf6184835842aed51cc1"
|
checksum = "3c8fb64b85138d34e26f0b1b853f44f592eeb0b9976bfa58897fa8beda65f2ea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"any_spawner",
|
"any_spawner",
|
||||||
"async-lock",
|
"async-lock",
|
||||||
|
|
@ -1463,9 +1513,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reactive_stores"
|
name = "reactive_stores"
|
||||||
version = "0.2.2"
|
version = "0.2.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23e02f30b9cc6645e330e926dd778d4bcbd0e5770bdf4ec3d422dc0fe3c52a41"
|
checksum = "79983e88dfd1a2925e29a4853ab9161b234ea78dd0d44ed33a706c9cd5e35762"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"guardian",
|
"guardian",
|
||||||
|
|
@ -1480,9 +1530,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reactive_stores_macro"
|
name = "reactive_stores_macro"
|
||||||
version = "0.2.2"
|
version = "0.2.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2f2bfb3b29c0b93d2d58a157b2a6783957bb592b296ab0b98a18fc3cdc574b07"
|
checksum = "c1d6c624f2babd2319a55f39637b62d38dd327f8219c6727479792fac3f670b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case 0.8.0",
|
"convert_case 0.8.0",
|
||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
|
|
@ -1656,9 +1706,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_qs"
|
name = "serde_qs"
|
||||||
version = "0.14.0"
|
version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b417bedc008acbdf6d6b4bc482d29859924114bbe2650b7921fb68a261d0aa6"
|
checksum = "f3faaf9e727533a19351a43cc5a8de957372163c7d35cc48c90b75cdda13c352"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
@ -1667,18 +1717,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "0.6.9"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn"
|
name = "server_fn"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09b0f92b9d3a62c73f238ac21f7a09f15bad335a9d1651514d9da80d2eaf8d4c"
|
checksum = "36dab1d4cbc272e15f4475d18e90a59488d1d1efe4e7db3f71b73a43d8c5f02b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -1689,7 +1739,6 @@ dependencies = [
|
||||||
"gloo-net",
|
"gloo-net",
|
||||||
"http",
|
"http",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"once_cell",
|
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
|
|
@ -1710,9 +1759,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn_macro"
|
name = "server_fn_macro"
|
||||||
version = "0.8.2"
|
version = "0.8.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "341dd1087afe9f3e546c5979a4f0b6d55ac072e1201313f86e7fe364223835ac"
|
checksum = "b381389c2307b4b83ce70516c0408d99727ab9f73645e065bb51e6be09cb2f6b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"const_format",
|
"const_format",
|
||||||
"convert_case 0.8.0",
|
"convert_case 0.8.0",
|
||||||
|
|
@ -1725,14 +1774,25 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn_macro_default"
|
name = "server_fn_macro_default"
|
||||||
version = "0.8.2"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc5ab934f581482a66da82f2b57b15390ad67c9ab85bd9a6c54bb65060fb1380"
|
checksum = "63eb08f80db903d3c42f64e60ebb3875e0305be502bdc064ec0a0eab42207f00"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"server_fn_macro",
|
"server_fn_macro",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha2"
|
||||||
|
version = "0.10.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cpufeatures",
|
||||||
|
"digest",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shlex"
|
name = "shlex"
|
||||||
version = "1.3.0"
|
version = "1.3.0"
|
||||||
|
|
@ -1777,9 +1837,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.103"
|
version = "2.0.104"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8"
|
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -1811,9 +1871,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tachys"
|
name = "tachys"
|
||||||
version = "0.2.3"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "51a9a5d6436e532fd27b49bcca005a038bf510fc369687de830121a74811ccf4"
|
checksum = "a8112797d6fa2ce26c1633e518759eb357ff28cd5e06d3bde2cb2ec850c3d87f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"any_spawner",
|
"any_spawner",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|
@ -1829,7 +1889,6 @@ dependencies = [
|
||||||
"linear-map",
|
"linear-map",
|
||||||
"next_tuple",
|
"next_tuple",
|
||||||
"oco_ref",
|
"oco_ref",
|
||||||
"once_cell",
|
|
||||||
"or_poisoned",
|
"or_poisoned",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"paste",
|
"paste",
|
||||||
|
|
@ -1906,35 +1965,32 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.8.23"
|
version = "0.9.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
checksum = "41ae868b5a0f67631c14589f7e250c1ea2c574ee5ba21c6c8dd4b1485705a5a1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"toml_edit",
|
"toml_parser",
|
||||||
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.11"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_parser"
|
||||||
version = "0.22.27"
|
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 = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
checksum = "97200572db069e74c512a14117b296ba0a80a30123fbbb5aa1f4a348f639ca30"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime",
|
|
||||||
"winnow",
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -1998,6 +2054,12 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.18.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unic-langid"
|
name = "unic-langid"
|
||||||
version = "0.9.6"
|
version = "0.9.6"
|
||||||
|
|
@ -2088,7 +2150,7 @@ version = "1.17.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
|
checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.3.3",
|
"getrandom",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
@ -2109,12 +2171,6 @@ dependencies = [
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasi"
|
|
||||||
version = "0.11.1+wasi-snapshot-preview1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.14.2+wasi-0.2.4"
|
version = "0.14.2+wasi-0.2.4"
|
||||||
|
|
@ -2232,6 +2288,31 @@ dependencies = [
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm_split_helpers"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c50e0e45d0d871605a21fc4ee93a5380b7bdc41b5eda22e42f0777a4ce79b65c"
|
||||||
|
dependencies = [
|
||||||
|
"async-once-cell",
|
||||||
|
"or_poisoned",
|
||||||
|
"wasm_split_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm_split_macros"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9f8a7f0bf54b0129a337aadfe8b716d843689f69c75b2a6413a0cff2e0d00982"
|
||||||
|
dependencies = [
|
||||||
|
"base16",
|
||||||
|
"digest",
|
||||||
|
"quote",
|
||||||
|
"sha2",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.77"
|
version = "0.3.77"
|
||||||
|
|
|
||||||
10
Cargo.toml
10
Cargo.toml
|
|
@ -10,11 +10,11 @@ authors = ["Felipe Contreras Salinas <felipe@bstr.cl>"]
|
||||||
console_error_panic_hook = "0.1.7"
|
console_error_panic_hook = "0.1.7"
|
||||||
console_log = "1.0.0"
|
console_log = "1.0.0"
|
||||||
fluent-templates = "0.13.0"
|
fluent-templates = "0.13.0"
|
||||||
leptos = { version = "0.8.2", features = ["csr", "tracing"] }
|
leptos = { version = "0.8.6", features = ["csr", "tracing"] }
|
||||||
leptos-fluent = "0.2.15"
|
leptos-fluent = "0.2.16"
|
||||||
leptos_meta = { version = "0.8.2" }
|
leptos_meta = { version = "0.8.5" }
|
||||||
leptos_router = { version = "0.8.2" }
|
leptos_router = { version = "0.8.5" }
|
||||||
log = "0.4.26"
|
log = "0.4.27"
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
not-found = We couldn't find that page.
|
not-found = We couldn't find that page.
|
||||||
title = Hypergeometric Distribution Calculator
|
title-home = Calculators
|
||||||
|
title-binom = Binomial Distribution Calculator
|
||||||
|
title-hyper = Hypergeometric Distribution Calculator
|
||||||
population = Population Size
|
population = Population Size
|
||||||
successes = Successes in Population
|
successes = Successes in Population
|
||||||
sample = Sample Size
|
sample = Sample Size
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
not-found = No pudimos encontrar esta página.
|
not-found = No pudimos encontrar esta página.
|
||||||
title = Calculadora Distribución Hipergeométrica
|
title-home = Calculadoras
|
||||||
|
title-binom = Calculadora Distribución Binomial
|
||||||
|
title-hyper = Calculadora Distribución Hipergeométrica
|
||||||
population = Tamaño población
|
population = Tamaño población
|
||||||
successes = Éxitos en la población
|
successes = Éxitos en la población
|
||||||
sample = Tamaño de la muestra
|
sample = Tamaño de la muestra
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,112 @@ use leptos_fluent::move_tr;
|
||||||
|
|
||||||
use crate::calc::hyper_geometric;
|
use crate::calc::hyper_geometric;
|
||||||
|
|
||||||
/// A parameterized incrementing button
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Calculator() -> impl IntoView {
|
pub fn HyperCalculator() -> impl IntoView {
|
||||||
|
let (population, set_population) = signal(0u8);
|
||||||
|
let (successes, set_successes) = signal(0u8);
|
||||||
|
let (sample, set_sample) = signal(0u8);
|
||||||
|
let (sample_successes, set_sample_successes) = signal(0u8);
|
||||||
|
let result = move || {
|
||||||
|
hyper_geometric(
|
||||||
|
population.get(),
|
||||||
|
successes.get(),
|
||||||
|
sample.get(),
|
||||||
|
sample_successes.get(),
|
||||||
|
)
|
||||||
|
.unwrap_or_default()
|
||||||
|
};
|
||||||
|
view! {
|
||||||
|
<form>
|
||||||
|
<p>
|
||||||
|
<label for="population">{move_tr!("population")}</label>
|
||||||
|
<input
|
||||||
|
id="population"
|
||||||
|
type="number"
|
||||||
|
min=0
|
||||||
|
prop:value=population
|
||||||
|
on:input:target=move |ev| {
|
||||||
|
set_population.set(ev.target().value().parse().unwrap_or_default())
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="successes">{move_tr!("successes")}</label>
|
||||||
|
<input
|
||||||
|
id="successes"
|
||||||
|
type="number"
|
||||||
|
min=0
|
||||||
|
prop:max=population
|
||||||
|
prop:value=successes
|
||||||
|
on:input:target=move |ev| {
|
||||||
|
set_successes.set(ev.target().value().parse().unwrap_or_default())
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="sample">{move_tr!("sample")}</label>
|
||||||
|
<input
|
||||||
|
id="sample"
|
||||||
|
type="number"
|
||||||
|
min=0
|
||||||
|
prop:max=population
|
||||||
|
prop:value=sample
|
||||||
|
on:input:target=move |ev| {
|
||||||
|
set_sample.set(ev.target().value().parse().unwrap_or_default())
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="sample_successes">{move_tr!("sample-successes")}</label>
|
||||||
|
<input
|
||||||
|
id="sample_successes"
|
||||||
|
type="number"
|
||||||
|
min=0
|
||||||
|
prop:max=sample
|
||||||
|
prop:value=sample_successes
|
||||||
|
on:input:target=move |ev| {
|
||||||
|
set_sample_successes.set(ev.target().value().parse().unwrap_or_default())
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
<div class="results">
|
||||||
|
<span class="left">
|
||||||
|
<span>"P(X = "</span>
|
||||||
|
<span>{sample_successes}</span>
|
||||||
|
<span>"): "</span>
|
||||||
|
</span>
|
||||||
|
<span class="right">{move || display_rounded(result().exactly)}</span>
|
||||||
|
<span class="left">
|
||||||
|
<span>"P(X < "</span>
|
||||||
|
<span>{sample_successes}</span>
|
||||||
|
<span>"): "</span>
|
||||||
|
</span>
|
||||||
|
<span class="right">{move || display_rounded(result().less_than)}</span>
|
||||||
|
<span class="left">
|
||||||
|
<span>"P(X ≤ "</span>
|
||||||
|
<span>{sample_successes}</span>
|
||||||
|
<span>"): "</span>
|
||||||
|
</span>
|
||||||
|
<span class="right">{move || display_rounded(result().less_or_equal)}</span>
|
||||||
|
<span class="left">
|
||||||
|
<span>"P(X > "</span>
|
||||||
|
<span>{sample_successes}</span>
|
||||||
|
<span>"): "</span>
|
||||||
|
</span>
|
||||||
|
<span class="right">{move || display_rounded(result().greater_than)}</span>
|
||||||
|
<span class="left">
|
||||||
|
<span>"P(X ≥ "</span>
|
||||||
|
<span>{sample_successes}</span>
|
||||||
|
<span>"): "</span>
|
||||||
|
</span>
|
||||||
|
<span class="right">{move || display_rounded(result().greater_or_equal)}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn BinomCalculator() -> impl IntoView {
|
||||||
let (population, set_population) = signal(0u8);
|
let (population, set_population) = signal(0u8);
|
||||||
let (successes, set_successes) = signal(0u8);
|
let (successes, set_successes) = signal(0u8);
|
||||||
let (sample, set_sample) = signal(0u8);
|
let (sample, set_sample) = signal(0u8);
|
||||||
|
|
|
||||||
18
src/components/common.rs
Normal file
18
src/components/common.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
use leptos::html::ElementChild;
|
||||||
|
use leptos::{IntoView, component, view};
|
||||||
|
use leptos_router::nested_router::Outlet;
|
||||||
|
|
||||||
|
use crate::components::localization::{I18n, LanguageSelector};
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Common() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<I18n>
|
||||||
|
<header>
|
||||||
|
<a href="/">Home</a>
|
||||||
|
<LanguageSelector />
|
||||||
|
</header>
|
||||||
|
<Outlet />
|
||||||
|
</I18n>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
use fluent_templates::static_loader;
|
use fluent_templates::static_loader;
|
||||||
use leptos::html::ElementChild;
|
use leptos::html::ElementChild;
|
||||||
use leptos::prelude::{
|
use leptos::prelude::{
|
||||||
AddAnyAttr, Children, Get, GlobalAttributes, IntoAttribute, OnAttribute, PropAttribute, Set,
|
AddAnyAttr, Children, Get, GlobalAttributes, OnAttribute, PropAttribute, Set, expect_context,
|
||||||
};
|
};
|
||||||
use leptos::{IntoView, component, view};
|
use leptos::{IntoView, component, view};
|
||||||
use leptos_fluent::{Language, expect_i18n, leptos_fluent};
|
use leptos_fluent::{Language, leptos_fluent};
|
||||||
|
|
||||||
static_loader! {
|
static_loader! {
|
||||||
pub static TRANSLATIONS = {
|
pub static TRANSLATIONS = {
|
||||||
|
|
@ -23,16 +23,17 @@ pub fn I18n(children: Children) -> impl IntoView {
|
||||||
translations: [TRANSLATIONS],
|
translations: [TRANSLATIONS],
|
||||||
locales: "./locales",
|
locales: "./locales",
|
||||||
check_translations: "./src/**/*.rs",
|
check_translations: "./src/**/*.rs",
|
||||||
initial_language_from_localstorage: true,
|
initial_language_from_local_storage: true,
|
||||||
initial_language_from_navigator_to_localstorage: true,
|
initial_language_from_navigator_to_local_storage: true,
|
||||||
set_language_to_localstorage: true,
|
set_language_to_local_storage: true,
|
||||||
sync_html_tag_lang: true,
|
sync_html_tag_lang: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Selector for languages
|
||||||
#[component]
|
#[component]
|
||||||
pub fn LanguageSelector() -> impl IntoView {
|
pub fn LanguageSelector() -> impl IntoView {
|
||||||
// Use `expect_i18n()` to get the current i18n context:
|
let i18n = expect_context::<leptos_fluent::I18n>();
|
||||||
let i18n = expect_i18n();
|
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<label for="language">"A/文:"</label>
|
<label for="language">"A/文:"</label>
|
||||||
|
|
@ -47,12 +48,12 @@ pub fn LanguageSelector() -> impl IntoView {
|
||||||
fn render_language(lang: &'static Language) -> impl IntoView {
|
fn render_language(lang: &'static Language) -> impl IntoView {
|
||||||
// Passed as atrribute, `Language` is converted to their code,
|
// Passed as atrribute, `Language` is converted to their code,
|
||||||
// so `<input id=lang` becomes `<input id=lang.id.to_string()`
|
// so `<input id=lang` becomes `<input id=lang.id.to_string()`
|
||||||
let i18n = expect_i18n();
|
let i18n = expect_context::<leptos_fluent::I18n>();
|
||||||
view! {
|
view! {
|
||||||
<option
|
<option
|
||||||
id=lang
|
id=lang
|
||||||
value=lang
|
value=lang
|
||||||
prop:selected=lang.is_active()
|
prop:selected=i18n.language.get() == lang
|
||||||
on:click=move |_| i18n.language.set(lang)
|
on:click=move |_| i18n.language.set(lang)
|
||||||
>
|
>
|
||||||
{lang.name}
|
{lang.name}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
pub mod calculator;
|
pub mod calculator;
|
||||||
|
pub mod common;
|
||||||
pub mod localization;
|
pub mod localization;
|
||||||
|
|
|
||||||
47
src/lib.rs
47
src/lib.rs
|
|
@ -1,15 +1,20 @@
|
||||||
use leptos::prelude::{AddAnyAttr, IntoAttribute};
|
use leptos::prelude::{AddAnyAttr, Get, expect_context};
|
||||||
use leptos::{IntoView, component, view};
|
use leptos::{IntoView, component, view};
|
||||||
use leptos_meta::*;
|
use leptos_meta::{Html, Meta, Title, provide_meta_context};
|
||||||
use leptos_router::{components::*, path};
|
use leptos_router::components::{ParentRoute, Route, Router, Routes};
|
||||||
|
use leptos_router::path;
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
mod calc;
|
mod calc;
|
||||||
mod components;
|
mod components;
|
||||||
mod pages;
|
mod pages;
|
||||||
|
|
||||||
// Top-Level pages
|
use crate::components::common::Common;
|
||||||
|
use crate::components::localization::I18n;
|
||||||
|
use crate::pages::binom::Binom;
|
||||||
use crate::pages::home::Home;
|
use crate::pages::home::Home;
|
||||||
|
use crate::pages::hyper::Hyper;
|
||||||
|
use crate::pages::not_found::NotFound;
|
||||||
|
|
||||||
/// An app router which renders the homepage and handles 404's
|
/// An app router which renders the homepage and handles 404's
|
||||||
#[component]
|
#[component]
|
||||||
|
|
@ -18,19 +23,31 @@ pub fn App() -> impl IntoView {
|
||||||
provide_meta_context();
|
provide_meta_context();
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<Html attr:lang="en" attr:dir="ltr" attr:data-theme="light" />
|
<I18n>
|
||||||
|
<HtmlAttrs />
|
||||||
|
|
||||||
// sets the document title
|
// sets the document title
|
||||||
<Title text="Hypergeometric Calculator" />
|
<Title text="🧮" />
|
||||||
|
|
||||||
// injects metadata in the <head> of the page
|
// injects metadata in the <head> of the page
|
||||||
<Meta charset="UTF-8" />
|
<Meta charset="UTF-8" />
|
||||||
<Meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<Meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<Router>
|
<Router>
|
||||||
<Routes fallback=|| view! { NotFound }>
|
<Routes fallback=NotFound>
|
||||||
<Route path=path!("/") view=Home />
|
<ParentRoute path=path!("/") view=Common>
|
||||||
</Routes>
|
<Route path=path!("") view=Home />
|
||||||
</Router>
|
<Route path=path!("/hyper") view=Hyper />
|
||||||
|
<Route path=path!("/binom") view=Binom />
|
||||||
|
</ParentRoute>
|
||||||
|
</Routes>
|
||||||
|
</Router>
|
||||||
|
</I18n>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn HtmlAttrs() -> impl IntoView {
|
||||||
|
let i18n = expect_context::<leptos_fluent::I18n>();
|
||||||
|
view! { <Html attr:lang=move || i18n.language.get() attr:dir="ltr" attr:data-theme="light" /> }
|
||||||
|
}
|
||||||
|
|
|
||||||
17
src/pages/binom.rs
Normal file
17
src/pages/binom.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
use leptos::attr::global::ClassAttribute;
|
||||||
|
use leptos::html::ElementChild;
|
||||||
|
use leptos::{IntoView, component, view};
|
||||||
|
use leptos_fluent::move_tr;
|
||||||
|
|
||||||
|
use crate::components::calculator::BinomCalculator;
|
||||||
|
|
||||||
|
///Binom Page
|
||||||
|
#[component]
|
||||||
|
pub fn Binom() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="title">{move_tr!("title-binom")}</h1>
|
||||||
|
<BinomCalculator />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,50 +1,22 @@
|
||||||
use leptos::attr::global::ClassAttribute;
|
use leptos::attr::global::ClassAttribute;
|
||||||
use leptos::error::ErrorBoundary;
|
|
||||||
use leptos::html::ElementChild;
|
use leptos::html::ElementChild;
|
||||||
use leptos::prelude::{CollectView, Get};
|
|
||||||
use leptos::{IntoView, component, view};
|
use leptos::{IntoView, component, view};
|
||||||
use leptos_fluent::move_tr;
|
use leptos_fluent::move_tr;
|
||||||
|
|
||||||
use crate::components::calculator::Calculator;
|
///Home Page
|
||||||
use crate::components::localization::{I18n, LanguageSelector};
|
|
||||||
|
|
||||||
/// Default Home Page
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Home() -> impl IntoView {
|
pub fn Home() -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<ErrorBoundary fallback=|errors| {
|
<div class="container">
|
||||||
view! {
|
<h1 class="title">{move_tr!("title-home")}</h1>
|
||||||
<h1>"Uh oh! Something went wrong!"</h1>
|
<menu>
|
||||||
|
<li>
|
||||||
<p>"Errors: "</p>
|
<a href="/binom">{move_tr!("title-binom")}</a>
|
||||||
// Render a list of errors as strings - good for development purposes
|
</li>
|
||||||
<ul>
|
<li>
|
||||||
{move || {
|
<a href="/hyper">{move_tr!("title-hyper")}</a>
|
||||||
errors
|
</li>
|
||||||
.get()
|
</menu>
|
||||||
.into_iter()
|
</div>
|
||||||
.map(|(_, e)| view! { <li>{e.to_string()}</li> })
|
|
||||||
.collect_view()
|
|
||||||
}}
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
}
|
|
||||||
}>
|
|
||||||
<I18n>
|
|
||||||
<header>
|
|
||||||
<LanguageSelector />
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
|
||||||
<Title />
|
|
||||||
<Calculator />
|
|
||||||
</div>
|
|
||||||
</I18n>
|
|
||||||
</ErrorBoundary>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Title
|
|
||||||
#[component]
|
|
||||||
pub fn Title() -> impl IntoView {
|
|
||||||
view! {<h1 class="title">{move_tr!("title")}</h1>}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
17
src/pages/hyper.rs
Normal file
17
src/pages/hyper.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
use leptos::attr::global::ClassAttribute;
|
||||||
|
use leptos::html::ElementChild;
|
||||||
|
use leptos::{IntoView, component, view};
|
||||||
|
use leptos_fluent::move_tr;
|
||||||
|
|
||||||
|
use crate::components::calculator::HyperCalculator;
|
||||||
|
|
||||||
|
///Hyper Page
|
||||||
|
#[component]
|
||||||
|
pub fn Hyper() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="title">{move_tr!("title-hyper")}</h1>
|
||||||
|
<HyperCalculator />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
|
pub mod binom;
|
||||||
pub mod home;
|
pub mod home;
|
||||||
|
pub mod hyper;
|
||||||
pub mod not_found;
|
pub mod not_found;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue