Compare commits

..

No commits in common. "binom" and "main" have entirely different histories.
binom ... main

18 changed files with 210 additions and 459 deletions

327
Cargo.lock generated
View file

@ -30,21 +30,15 @@ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
[[package]] [[package]]
name = "async-lock" name = "async-lock"
version = "3.4.1" version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
dependencies = [ dependencies = [
"event-listener", "event-listener",
"event-listener-strategy", "event-listener-strategy",
"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"
@ -92,12 +86,6 @@ 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"
@ -110,15 +98,6 @@ 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"
@ -131,9 +110,9 @@ dependencies = [
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.19.0" version = "3.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee"
[[package]] [[package]]
name = "bytes" name = "bytes"
@ -149,9 +128,9 @@ checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.31" version = "1.2.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
@ -173,9 +152,9 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]] [[package]]
name = "codee" name = "codee"
version = "0.3.2" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd8bbfdadf2f8999c6e404697bc08016dce4a3d77dec465b36c9a0652fdb3327" checksum = "0f18d705321923b1a9358e3fc3c57c3b50171196827fc7f5f10b053242aca627"
dependencies = [ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
@ -184,9 +163,9 @@ dependencies = [
[[package]] [[package]]
name = "collection_literals" name = "collection_literals"
version = "1.0.2" 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 = "26b3f65b8fb8e88ba339f7d23a390fe1b0896217da05e2a66c584c9b29a91df8" checksum = "186dce98367766de751c42c4f03970fc60fc012296e706ccbb9d5df9b6c1e271"
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
@ -199,9 +178,9 @@ dependencies = [
[[package]] [[package]]
name = "config" name = "config"
version = "0.15.13" version = "0.15.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b1eb4fb07bc7f012422df02766c7bd5971effb894f573865642f06fa3265440" checksum = "595aae20e65c3be792d05818e8c63025294ac3cb7e200f11459063a352a6ef80"
dependencies = [ dependencies = [
"convert_case 0.6.0", "convert_case 0.6.0",
"pathdiff", "pathdiff",
@ -232,9 +211,9 @@ dependencies = [
[[package]] [[package]]
name = "const-str" name = "const-str"
version = "0.6.4" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "451d0640545a0553814b4c646eb549343561618838e9b42495f466131fe3ad49" checksum = "9e991226a70654b49d34de5ed064885f0bef0348a8e70018b8ff1ac80aa984a2"
[[package]] [[package]]
name = "const_format" name = "const_format"
@ -280,15 +259,6 @@ 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"
@ -314,16 +284,6 @@ 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"
@ -355,16 +315,6 @@ 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"
@ -376,23 +326,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "distribution-calc"
version = "0.1.1"
dependencies = [
"console_error_panic_hook",
"console_log",
"fluent-templates",
"leptos",
"leptos-fluent",
"leptos_meta",
"leptos_router",
"log",
"wasm-bindgen",
"wasm-bindgen-test",
"web-sys",
]
[[package]] [[package]]
name = "drain_filter_polyfill" name = "drain_filter_polyfill"
version = "0.1.3" version = "0.1.3"
@ -429,9 +362,9 @@ checksum = "a1731451909bde27714eacba19c2566362a7f35224f52b153d3f42cf60f72472"
[[package]] [[package]]
name = "event-listener" name = "event-listener"
version = "5.4.1" version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae"
dependencies = [ dependencies = [
"concurrent-queue", "concurrent-queue",
"parking", "parking",
@ -631,13 +564,16 @@ dependencies = [
] ]
[[package]] [[package]]
name = "generic-array" name = "getrandom"
version = "0.14.7" 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 = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [ dependencies = [
"typenum", "cfg-if",
"version_check", "js-sys",
"libc",
"wasi 0.11.1+wasi-snapshot-preview1",
"wasm-bindgen",
] ]
[[package]] [[package]]
@ -647,11 +583,9 @@ 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", "wasi 0.14.2+wasi-0.2.4",
"wasm-bindgen",
] ]
[[package]] [[package]]
@ -770,6 +704,23 @@ dependencies = [
"throw_error", "throw_error",
] ]
[[package]]
name = "hypergeometric-calc"
version = "0.1.0"
dependencies = [
"console_error_panic_hook",
"console_log",
"fluent-templates",
"leptos",
"leptos-fluent",
"leptos_meta",
"leptos_router",
"log",
"wasm-bindgen",
"wasm-bindgen-test",
"web-sys",
]
[[package]] [[package]]
name = "icu_collections" name = "icu_collections"
version = "2.0.0" version = "2.0.0"
@ -895,9 +846,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.10.0" version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.15.4", "hashbrown 0.15.4",
@ -955,15 +906,15 @@ dependencies = [
[[package]] [[package]]
name = "leptos" name = "leptos"
version = "0.8.6" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20adc17f0584e5f605a31444179bae17c399a2d160bf19eb3da701a1f6e7cb8e" checksum = "2ceaf7d86820125c57dcd380edac4b972debf480ee4c7eea6dd7cea212615978"
dependencies = [ dependencies = [
"any_spawner", "any_spawner",
"cfg-if", "cfg-if",
"either_of", "either_of",
"futures", "futures",
"getrandom", "getrandom 0.2.16",
"hydration_context", "hydration_context",
"leptos_config", "leptos_config",
"leptos_dom", "leptos_dom",
@ -978,7 +929,6 @@ dependencies = [
"rustc_version", "rustc_version",
"send_wrapper", "send_wrapper",
"serde", "serde",
"serde_json",
"serde_qs", "serde_qs",
"server_fn", "server_fn",
"slotmap", "slotmap",
@ -989,16 +939,14 @@ 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.16" version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd05ecc0ee18e70f2bfed53ef9f7f404ae6b8ecceaa52c8d0a33a6d4bd95d9cc" checksum = "928b183ce3921ff7be494648edb0057a63798e5bbfb7de80f91f463f2135cf79"
dependencies = [ dependencies = [
"fluent-templates", "fluent-templates",
"leptos", "leptos",
@ -1010,9 +958,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos-fluent-macros" name = "leptos-fluent-macros"
version = "0.2.16" version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0ccc82283d56ecc712892b7d447b95621e91c1d0d4521edba59c0425ac7eea" checksum = "4314b7d1e4562f20cb895d5bba904482d8917b74257d845ee8e48efc75552be9"
dependencies = [ dependencies = [
"cfg-expr", "cfg-expr",
"current_platform", "current_platform",
@ -1029,9 +977,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos_config" name = "leptos_config"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fddaae8dbc1680aa59c40c8f8ebb780b9a841e503d3cc5143d346a40c6d8ab" checksum = "cf4100ad54455f82b686c9d0500a45c909eb50ce68ccb2ed51439ff2596f54fd"
dependencies = [ dependencies = [
"config", "config",
"regex", "regex",
@ -1042,9 +990,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos_dom" name = "leptos_dom"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aa676df0da118c690d65669eb322f47f0e47f5505ce5d2119ed5b4432d3c732" checksum = "adaca2ec1d6215a7c43dc6353d487e4e34faf325b8e4df2ca3df488964d403be"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"or_poisoned", "or_poisoned",
@ -1058,9 +1006,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos_hot_reload" name = "leptos_hot_reload"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d61ec3e1ff8aaee8c5151688550c0363f85bc37845450764c31ff7584a33f38" checksum = "597f84532609518092960ac241741963c90c216ee11f752e1b238b846f043640"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"camino", "camino",
@ -1076,9 +1024,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos_macro" name = "leptos_macro"
version = "0.8.6" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a824b74d70dd505e5fe32952150325275050febb0d0bd7ac8b8efc50a69ec95" checksum = "8a2ec91579e9a1344adc1eee637cb774a01354a3d25857cbd028b0289efe131d"
dependencies = [ dependencies = [
"attribute-derive", "attribute-derive",
"cfg-if", "cfg-if",
@ -1100,13 +1048,14 @@ dependencies = [
[[package]] [[package]]
name = "leptos_meta" name = "leptos_meta"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d489e38d3f541e9e43ecc2e3a815527840345a2afca629b3e23fcc1dd254578" checksum = "c03b2d5e0a9e7060bce4862c009ced3c2ad0afe45d005eaa4defa3872d2d2aac"
dependencies = [ dependencies = [
"futures", "futures",
"indexmap", "indexmap",
"leptos", "leptos",
"once_cell",
"or_poisoned", "or_poisoned",
"send_wrapper", "send_wrapper",
"wasm-bindgen", "wasm-bindgen",
@ -1115,9 +1064,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos_router" name = "leptos_router"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3991de30a9cce8082e8c0d729744c8f6ffd66a828629806bf1332cb624123c75" checksum = "5d1b70dbd176bd0129e5db0e2ed48b7ff076c1b17cf52bbd0e85dcc3e6b9cbc0"
dependencies = [ dependencies = [
"any_spawner", "any_spawner",
"either_of", "either_of",
@ -1126,6 +1075,7 @@ 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",
@ -1139,9 +1089,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos_router_macro" name = "leptos_router_macro"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "571042420d79f4f5b6b0d149dc1561b03f47e08c37c8fa0dfc80c73ad67be8af" checksum = "8403f583a69812524b98c97f2ed0258771e205cd0f715b1bc6ba5e4f70dcb94b"
dependencies = [ dependencies = [
"proc-macro-error2", "proc-macro-error2",
"proc-macro2", "proc-macro2",
@ -1151,9 +1101,9 @@ dependencies = [
[[package]] [[package]]
name = "leptos_server" name = "leptos_server"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38acbf32649a4b127c8d4ccaed8fb388e19a746430a0ea8f8160e51e28c36e2d" checksum = "5af59932aa8a640da4d3d20650cf07084433e25db0ee690203d893b81773db29"
dependencies = [ dependencies = [
"any_spawner", "any_spawner",
"base64", "base64",
@ -1261,12 +1211,12 @@ dependencies = [
[[package]] [[package]]
name = "oco_ref" name = "oco_ref"
version = "0.2.1" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed0423ff9973dea4d6bd075934fdda86ebb8c05bdf9d6b0507067d4a1226371d" checksum = "64b94982fe39a861561cf67ff17a7849f2cedadbbad960a797634032b7abb998"
dependencies = [ dependencies = [
"serde", "serde",
"thiserror 2.0.12", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@ -1371,9 +1321,9 @@ dependencies = [
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
version = "0.2.36" version = "0.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2" checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn", "syn",
@ -1490,9 +1440,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]] [[package]]
name = "reactive_graph" name = "reactive_graph"
version = "0.2.5" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c8fb64b85138d34e26f0b1b853f44f592eeb0b9976bfa58897fa8beda65f2ea" checksum = "ac68cd988635779e6f378871257cbccfd51d7eeb7bc0bf6184835842aed51cc1"
dependencies = [ dependencies = [
"any_spawner", "any_spawner",
"async-lock", "async-lock",
@ -1513,9 +1463,9 @@ dependencies = [
[[package]] [[package]]
name = "reactive_stores" name = "reactive_stores"
version = "0.2.5" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79983e88dfd1a2925e29a4853ab9161b234ea78dd0d44ed33a706c9cd5e35762" checksum = "23e02f30b9cc6645e330e926dd778d4bcbd0e5770bdf4ec3d422dc0fe3c52a41"
dependencies = [ dependencies = [
"dashmap", "dashmap",
"guardian", "guardian",
@ -1530,9 +1480,9 @@ dependencies = [
[[package]] [[package]]
name = "reactive_stores_macro" name = "reactive_stores_macro"
version = "0.2.5" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1d6c624f2babd2319a55f39637b62d38dd327f8219c6727479792fac3f670b6" checksum = "2f2bfb3b29c0b93d2d58a157b2a6783957bb592b296ab0b98a18fc3cdc574b07"
dependencies = [ dependencies = [
"convert_case 0.8.0", "convert_case 0.8.0",
"proc-macro-error2", "proc-macro-error2",
@ -1543,9 +1493,9 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.17" version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
@ -1694,9 +1644,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.142" version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
dependencies = [ dependencies = [
"itoa", "itoa",
"memchr", "memchr",
@ -1706,9 +1656,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_qs" name = "serde_qs"
version = "0.15.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3faaf9e727533a19351a43cc5a8de957372163c7d35cc48c90b75cdda13c352" checksum = "8b417bedc008acbdf6d6b4bc482d29859924114bbe2650b7921fb68a261d0aa6"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
"serde", "serde",
@ -1717,18 +1667,18 @@ dependencies = [
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "1.0.0" version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "server_fn" name = "server_fn"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36dab1d4cbc272e15f4475d18e90a59488d1d1efe4e7db3f71b73a43d8c5f02b" checksum = "09b0f92b9d3a62c73f238ac21f7a09f15bad335a9d1651514d9da80d2eaf8d4c"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
@ -1739,6 +1689,7 @@ 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",
@ -1759,9 +1710,9 @@ dependencies = [
[[package]] [[package]]
name = "server_fn_macro" name = "server_fn_macro"
version = "0.8.6" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b381389c2307b4b83ce70516c0408d99727ab9f73645e065bb51e6be09cb2f6b" checksum = "341dd1087afe9f3e546c5979a4f0b6d55ac072e1201313f86e7fe364223835ac"
dependencies = [ dependencies = [
"const_format", "const_format",
"convert_case 0.8.0", "convert_case 0.8.0",
@ -1774,25 +1725,14 @@ dependencies = [
[[package]] [[package]]
name = "server_fn_macro_default" name = "server_fn_macro_default"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63eb08f80db903d3c42f64e60ebb3875e0305be502bdc064ec0a0eab42207f00" checksum = "bc5ab934f581482a66da82f2b57b15390ad67c9ab85bd9a6c54bb65060fb1380"
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"
@ -1837,9 +1777,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.104" version = "2.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1871,9 +1811,9 @@ dependencies = [
[[package]] [[package]]
name = "tachys" name = "tachys"
version = "0.2.6" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8112797d6fa2ce26c1633e518759eb357ff28cd5e06d3bde2cb2ec850c3d87f" checksum = "51a9a5d6436e532fd27b49bcca005a038bf510fc369687de830121a74811ccf4"
dependencies = [ dependencies = [
"any_spawner", "any_spawner",
"async-trait", "async-trait",
@ -1889,6 +1829,7 @@ 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",
@ -1965,32 +1906,35 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.9.5" version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
dependencies = [ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"toml_parser", "toml_edit",
"winnow",
] ]
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.7.0" version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "toml_parser" name = "toml_edit"
version = "1.0.2" version = "0.22.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [ dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow", "winnow",
] ]
@ -2054,12 +1998,6 @@ 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"
@ -2150,7 +2088,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", "getrandom 0.3.3",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
] ]
@ -2171,6 +2109,12 @@ 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"
@ -2288,31 +2232,6 @@ 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"
@ -2407,9 +2326,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.7.12" version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -2499,9 +2418,9 @@ dependencies = [
[[package]] [[package]]
name = "zerovec" name = "zerovec"
version = "0.11.3" version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdbb9122ea75b11bf96e7492afb723e8a7fbe12c67417aa95e7e3d18144d37cd" checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428"
dependencies = [ dependencies = [
"yoke", "yoke",
"zerofrom", "zerofrom",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "distribution-calc" name = "hypergeometric-calc"
version = "0.1.1" version = "0.1.0"
edition = "2024" edition = "2024"
authors = ["Felipe Contreras Salinas <felipe@bstr.cl>"] authors = ["Felipe Contreras Salinas <felipe@bstr.cl>"]
@ -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.6", features = ["csr", "tracing"] } leptos = { version = "0.8.2", features = ["csr", "tracing"] }
leptos-fluent = "0.2.16" leptos-fluent = "0.2.15"
leptos_meta = { version = "0.8.5" } leptos_meta = { version = "0.8.2" }
leptos_router = { version = "0.8.5" } leptos_router = { version = "0.8.2" }
log = "0.4.27" log = "0.4.26"
[dev-dependencies] [dev-dependencies]

View file

@ -219,7 +219,7 @@ If you develop a new program, and you want it to be of the greatest possible use
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
distribution-calc hypergeometric-calc
Copyright (C) 2025 LuckyMeowth Copyright (C) 2025 LuckyMeowth
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

View file

@ -1,5 +1,5 @@
# distribution-calc # hypergeometric-calc
Web calculator for Probability Distributions built using [Leptos]. Web calculator for Hypergeometric Distribution built using [Leptos].
## Dependencies ## Dependencies
You will need to install the Rust toolchain. We recommend to do using [Rustup]. Once You will need to install the Rust toolchain. We recommend to do using [Rustup]. Once

View file

@ -1,13 +1,6 @@
not-found = We couldn't find that page. not-found = We couldn't find that page.
title-home = Calculators title = Hypergeometric Distribution Calculator
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
sample-successes = Successes in Sample sample-successes = Successes in Sample
hyper-description = Hypergeometric distribution measures the probability of getting a given amount of a certain type of elements from a sample on a population. Think on drawing
success-probability = Success probability
trials-number = Number of trials
successes-number = Number of successes
binom-description = .

View file

@ -1,13 +1,6 @@
not-found = No pudimos encontrar esta página. not-found = No pudimos encontrar esta página.
title-home = Calculadoras title = Calculadora Distribución Hipergeométrica
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
sample-successes = Éxitos en la muestra sample-successes = Éxitos en la muestra
hyper-description = Hypergeometric distribution measures the probability of getting a given amount of a certain type of elements from a sample on a population. Think on drawing
success-probability = Probabilidad de éxito
trials-number = Número de intentos
successes-number = Número de éxitos
binom-description = .

View file

@ -24,7 +24,7 @@ body {
header { header {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: end;
} }
header > select { header > select {

View file

@ -55,23 +55,6 @@ pub fn hyper_geometric(
} }
} }
#[derive(Default)]
pub struct BinomialProb {
pub exactly: f64,
pub less_than: f64,
pub less_or_equal: f64,
pub greater_than: f64,
pub greater_or_equal: f64,
}
pub fn binomial(
success_probability: f64,
trials_number: u8,
successes_number: u8,
) -> Option<BinomialProb> {
None
}
/// Computes the probability of drawing exactly `sample_successes` in a sample of `sample_size` /// Computes the probability of drawing exactly `sample_successes` in a sample of `sample_size`
/// from a population of size `population_size` and `successes` total successes in the population. /// from a population of size `population_size` and `successes` total successes in the population.
/// ///

View file

@ -6,10 +6,11 @@ use leptos::prelude::{
use leptos::{IntoView, component, view}; use leptos::{IntoView, component, view};
use leptos_fluent::move_tr; use leptos_fluent::move_tr;
use crate::calc::{binomial, hyper_geometric}; use crate::calc::hyper_geometric;
/// A parameterized incrementing button
#[component] #[component]
pub fn HyperCalculator() -> impl IntoView { pub fn Calculator() -> 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);
@ -109,97 +110,6 @@ pub fn HyperCalculator() -> impl IntoView {
</span> </span>
<span class="right">{move || display_rounded(result().greater_or_equal)}</span> <span class="right">{move || display_rounded(result().greater_or_equal)}</span>
</div> </div>
<div>{move_tr!("hyper-description")}</div>
}
}
#[component]
pub fn BinomCalculator() -> impl IntoView {
let (success_probability, set_success_probability) = signal(0f64);
let (trials_number, set_trials_number) = signal(0u8);
let (successes_number, set_successes_number) = signal(0u8);
let result = move || {
binomial(
success_probability.get(),
trials_number.get(),
successes_number.get(),
)
.unwrap_or_default()
};
view! {
<form>
<p>
<label for="success_probability">{move_tr!("success-probability")}</label>
<input
id="success_probability"
type="number"
min=0
max=1
prop:value=success_probability
on:input:target=move |ev| {
set_success_probability.set(ev.target().value().parse().unwrap_or_default())
}
/>
</p>
<p>
<label for="trials_number">{move_tr!("trials-number")}</label>
<input
id="trials_number"
type="number"
min=0
prop:value=trials_number
on:input:target=move |ev| {
set_trials_number.set(ev.target().value().parse().unwrap_or_default())
}
/>
</p>
<p>
<label for="successes_number">{move_tr!("successes-number")}</label>
<input
id="successes_number"
type="number"
min=0
prop:max=trials_number
prop:value=successes_number
on:input:target=move |ev| {
set_successes_number.set(ev.target().value().parse().unwrap_or_default())
}
/>
</p>
</form>
<div class="results">
<span class="left">
<span>"P(X = "</span>
<span>{successes_number}</span>
<span>"): "</span>
</span>
<span class="right">{move || display_rounded(result().exactly)}</span>
<span class="left">
<span>"P(X < "</span>
<span>{successes_number}</span>
<span>"): "</span>
</span>
<span class="right">{move || display_rounded(result().less_than)}</span>
<span class="left">
<span>"P(X ≤ "</span>
<span>{successes_number}</span>
<span>"): "</span>
</span>
<span class="right">{move || display_rounded(result().less_or_equal)}</span>
<span class="left">
<span>"P(X > "</span>
<span>{successes_number}</span>
<span>"): "</span>
</span>
<span class="right">{move || display_rounded(result().greater_than)}</span>
<span class="left">
<span>"P(X ≥ "</span>
<span>{successes_number}</span>
<span>"): "</span>
</span>
<span class="right">{move || display_rounded(result().greater_or_equal)}</span>
</div>
<div>{move_tr!("binom-description")}</div>
} }
} }

View file

@ -1,18 +0,0 @@
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="/">"🏡"</a>
<LanguageSelector />
</header>
<Outlet />
</I18n>
}
}

View file

@ -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, OnAttribute, PropAttribute, Set, expect_context, AddAnyAttr, Children, Get, GlobalAttributes, IntoAttribute, OnAttribute, PropAttribute, Set,
}; };
use leptos::{IntoView, component, view}; use leptos::{IntoView, component, view};
use leptos_fluent::{Language, leptos_fluent}; use leptos_fluent::{Language, expect_i18n, leptos_fluent};
static_loader! { static_loader! {
pub static TRANSLATIONS = { pub static TRANSLATIONS = {
@ -23,39 +23,36 @@ 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_local_storage: true, initial_language_from_localstorage: true,
initial_language_from_navigator_to_local_storage: true, initial_language_from_navigator_to_localstorage: true,
set_language_to_local_storage: true, set_language_to_localstorage: 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 {
let i18n = expect_context::<leptos_fluent::I18n>(); // Use `expect_i18n()` to get the current i18n context:
let i18n = expect_i18n();
view! { view! {
<span> <label for="language">"A/文:"</label>
<label for="language">"A/文:"</label> <select id="language">
<select id="language"> {move || {
{move || { i18n.languages.iter().map(|lang| render_language(lang)).collect::<Vec<_>>()
i18n.languages.iter().map(|lang| render_language(lang)).collect::<Vec<_>>() }}
}} </select>
</select>
</span>
} }
} }
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_context::<leptos_fluent::I18n>(); let i18n = expect_i18n();
view! { view! {
<option <option
id=lang id=lang
value=lang value=lang
prop:selected=i18n.language.get() == lang prop:selected=lang.is_active()
on:click=move |_| i18n.language.set(lang) on:click=move |_| i18n.language.set(lang)
> >
{lang.name} {lang.name}

View file

@ -1,3 +1,2 @@
pub mod calculator; pub mod calculator;
pub mod common;
pub mod localization; pub mod localization;

View file

@ -1,20 +1,15 @@
use leptos::prelude::{AddAnyAttr, Get, expect_context}; use leptos::prelude::{AddAnyAttr, IntoAttribute};
use leptos::{IntoView, component, view}; use leptos::{IntoView, component, view};
use leptos_meta::{Html, Meta, Title, provide_meta_context}; use leptos_meta::*;
use leptos_router::components::{ParentRoute, Route, Router, Routes}; use leptos_router::{components::*, path};
use leptos_router::path;
// Modules // Modules
mod calc; mod calc;
mod components; mod components;
mod pages; mod pages;
use crate::components::common::Common; // Top-Level pages
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]
@ -23,31 +18,19 @@ pub fn App() -> impl IntoView {
provide_meta_context(); provide_meta_context();
view! { view! {
<I18n> <Html attr:lang="en" attr:dir="ltr" attr:data-theme="light" />
<HtmlAttrs />
// sets the document title // sets the document title
<Title text="🧮" /> <Title text="Hypergeometric Calculator" />
// 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=NotFound> <Routes fallback=|| view! { NotFound }>
<ParentRoute path=path!("/") view=Common> <Route path=path!("/") view=Home />
<Route path=path!("") view=Home /> </Routes>
<Route path=path!("/hyper") view=Hyper /> </Router>
<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" /> }
}

View file

@ -1,4 +1,4 @@
use distribution_calc::App; use hypergeometric_calc::App;
use leptos::{mount::mount_to_body, view}; use leptos::{mount::mount_to_body, view};
fn main() { fn main() {

View file

@ -1,17 +0,0 @@
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>
}
}

View file

@ -1,22 +1,50 @@
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;
///Home Page use crate::components::calculator::Calculator;
use crate::components::localization::{I18n, LanguageSelector};
/// Default Home Page
#[component] #[component]
pub fn Home() -> impl IntoView { pub fn Home() -> impl IntoView {
view! { view! {
<div class="container"> <ErrorBoundary fallback=|errors| {
<h1 class="title">{move_tr!("title-home")}</h1> view! {
<menu> <h1>"Uh oh! Something went wrong!"</h1>
<li>
<a href="/binom">{move_tr!("title-binom")}</a> <p>"Errors: "</p>
</li> // Render a list of errors as strings - good for development purposes
<li> <ul>
<a href="/hyper">{move_tr!("title-hyper")}</a> {move || {
</li> errors
</menu> .get()
</div> .into_iter()
.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>}
}

View file

@ -1,17 +0,0 @@
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>
}
}

View file

@ -1,4 +1,2 @@
pub mod binom;
pub mod home; pub mod home;
pub mod hyper;
pub mod not_found; pub mod not_found;