diff --git a/.forge/jobs.toml b/.forge/jobs.toml index 31a7c1a..7a4141e 100644 --- a/.forge/jobs.toml +++ b/.forge/jobs.toml @@ -9,3 +9,10 @@ branches = ["main"] timeout = 3600 image = "eclipse-temurin:17-jdk-noble" run = "bash ci/forge-apk.sh" + +[[job]] +name = "wasm-apk" +branches = ["main"] +timeout = 3600 +image = "eclipse-temurin:17-jdk-noble" +run = "bash ci/forge-wasm-apk.sh" diff --git a/.gitignore b/.gitignore index 080bab5..c8a7768 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ android/app/build/ android/local.properties build/ build-*/ +android-wasm/target/ +android-wasm/assets/*.wasm diff --git a/android-wasm/Cargo.lock b/android-wasm/Cargo.lock new file mode 100644 index 0000000..861b666 --- /dev/null +++ b/android-wasm/Cargo.lock @@ -0,0 +1,2137 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59317f77929f0e679d39364702289274de2f0f0b22cbf50b2b8cff2169a0b27a" +dependencies = [ + "gimli", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags", + "cc", + "jni 0.22.4", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_log-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84521a3cf562bc62942e294181d9eef17eb38ceb8c68677bc49f144e4c3d4f8d" + +[[package]] +name = "android_logger" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b07e8e73d720a1f2e4b6014766e6039fd2e96a4fa44e2a78d0e1fa2ff49826" +dependencies = [ + "android_log-sys", + "env_filter", + "log", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" +dependencies = [ + "allocator-api2", +] + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core", +] + +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "cpp_demangle" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0667304c32ea56cb4cd6d2d7c0cfe9a2f8041229db8c033af7f8d69492429def" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-assembler-x64" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80552083a2db143c5d951debe9f59a7d9f22084c70abe450fed5220060fa26c3" +dependencies = [ + "cranelift-assembler-x64-meta", +] + +[[package]] +name = "cranelift-assembler-x64-meta" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cf84b7e5f0aa42cb0d55cabf01c520fdb70a50d8b572a841ee875083589d643" +dependencies = [ + "cranelift-srcgen", +] + +[[package]] +name = "cranelift-bforest" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d47ec2358cdbace0520ac212c003656b529f0c60e43fbbe9a331632cd9e8fc" +dependencies = [ + "cranelift-entity", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-bitset" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebb94b54db96b26e387bc8c698823d83d9254d551a6ed846a60cebf62ed7135" +dependencies = [ + "serde", + "serde_derive", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-codegen" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be81b89cb7b186a26cf2014c312aeb17737da988b4444d16a0cb3424d637d44e" +dependencies = [ + "bumpalo", + "cranelift-assembler-x64", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.17.1", + "libm", + "log", + "postcard", + "pulley-interpreter", + "regalloc2", + "rustc-hash", + "serde", + "serde_derive", + "sha2", + "smallvec", + "target-lexicon", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb1b64a509c3814932fb9845ce8da835cd10d62c6c56dacfdcd9af389d3bf313" +dependencies = [ + "cranelift-assembler-x64-meta", + "cranelift-codegen-shared", + "cranelift-srcgen", + "heck", + "pulley-interpreter", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e667a0e9ed3bbbed0e7e52cd2dea85a645745b39f547097e2fca0bf317cac9df" + +[[package]] +name = "cranelift-control" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5fa7d5123705226a368b6b1c7b10f23036c35e8041ffdd5f6505790f5c31404" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1bffb83ac1d7052691d1710ca8eb334d4fcaad363e589f2b89d38d97bda5776" +dependencies = [ + "cranelift-bitset", + "serde", + "serde_derive", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-frontend" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc727c856bf57eae76c72ac4f9b1eaf49947a2b02f699798262fc8399557b7a" +dependencies = [ + "cranelift-codegen", + "hashbrown 0.17.1", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92e743f35915d55cd3d3178aab483661f78c2f9274aa704f29be69e3789c5bd" + +[[package]] +name = "cranelift-native" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "127c50e5e2b2b97116d4e2c079db6ce29b07303cd1ab48a8bb4c2abbf16a7a68" +dependencies = [ + "cranelift-codegen", + "libc", + "mach2", + "target-lexicon", +] + +[[package]] +name = "cranelift-srcgen" +version = "0.137.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f34b169b8cbbaed2b4995205f1d02d7eac4b2771df5479255fe5483e1334a39" + +[[package]] +name = "crc32fast" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[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]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "env_filter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "rand_core", +] + +[[package]] +name = "gimli" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" +dependencies = [ + "fnv", + "hashbrown 0.16.1", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash", + "serde", + "serde_core", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom", + "libc", +] + +[[package]] +name = "leb128" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83bff1d572d6b9aeef67ddfc8448e4a3737909cb28e81f97c791b9018703e52" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "mach2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memfd" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57804b2c9b69967f1536a56f86297e367a33b19e98852ed624b84551cdbc0d90" +dependencies = [ + "rustix", +] + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "object" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c" +dependencies = [ + "crc32fast", + "hashbrown 0.17.1", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "pulley-interpreter" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c66a82a3d48db9b7c2ba1307e06fcb81a35ba82952f58bc1bfb218321f7c0b" +dependencies = [ + "cranelift-bitset", + "log", + "pulley-macros", + "wasmtime-internal-core", +] + +[[package]] +name = "pulley-macros" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138a9a5997d9cba5e54c7c3b836d7164f2bfe0852c7e98d5835e1708d6efdf36" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "regalloc2" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "757712e8e61590d6d4f5d563483755538b5aa13467837a3b41cd9832509a7f85" +dependencies = [ + "allocator-api2", + "bumpalo", + "hashbrown 0.17.1", + "log", + "rustc-hash", + "serde", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "rustc-demangle" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustix-linux-procfs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" +dependencies = [ + "once_cell", + "rustix", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "target-lexicon" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da" + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "toml_datetime" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.19+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd43688c4858d7264ae1cf9a9f874a67c3feb74a883b1cd7bebd6a4ea8307218" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ultra-launcher-wasm" +version = "0.1.0" +dependencies = [ + "android-activity", + "android_logger", + "base64", + "jni 0.21.1", + "log", + "ndk", + "sha2", + "wasmtime", + "wasmtime-wasi", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "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]] +name = "wasm-encoder" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2608e8bb6d67fd68f5a8d0eb1363d6e7bcbc1f8ded5a0bd3a1e382462b876b22" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b88de21560ecd49deb8d8f1616b9b695f66fc312c5eca503f43accdc5795339e" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f20f20e44f7e8aeb6744823ea9d869ede51e51be4fdaedede2852282e54d2d8" +dependencies = [ + "bitflags", + "hashbrown 0.17.1", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "wasmprinter" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86a21c9e3325655ba02de3e645bc8357a8b3651a2e3ada25b6dbc37560deb9b7" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser", +] + +[[package]] +name = "wasmtime" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdfacce893df54d319b29720e79edb001cd1b48faaf78fdb3b9c608eaeeea29f" +dependencies = [ + "addr2line", + "async-trait", + "bitflags", + "bumpalo", + "bytes", + "cc", + "encoding_rs", + "futures", + "libc", + "log", + "mach2", + "memfd", + "object", + "once_cell", + "postcard", + "pulley-interpreter", + "rustix", + "semver", + "serde", + "serde_derive", + "smallvec", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-internal-component-macro", + "wasmtime-internal-component-util", + "wasmtime-internal-core", + "wasmtime-internal-cranelift", + "wasmtime-internal-fiber", + "wasmtime-internal-jit-debug", + "wasmtime-internal-jit-icache-coherence", + "wasmtime-internal-unwinder", + "wasmtime-internal-versioned-export-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "wasmtime-environ" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f79df81f2a5d7a1cb8b9eb35b4a2d7a8cb8e948bd3e5a1f79036c0094879275a" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-entity", + "gimli", + "hashbrown 0.17.1", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "semver", + "serde", + "serde_derive", + "smallvec", + "target-lexicon", + "wasm-encoder", + "wasmparser", + "wasmprinter", + "wasmtime-internal-component-util", + "wasmtime-internal-core", +] + +[[package]] +name = "wasmtime-internal-component-macro" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61479c89e12c716cc7a962e68574c01f3cf8bfd27fbeb6fc477b27b5096b8350" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasmtime-internal-component-util", + "wasmtime-internal-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-internal-component-util" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33c2836b127721e0abdc3490545cdc6d5269d1050a19a4057909901c16e1b781" + +[[package]] +name = "wasmtime-internal-core" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765a08b721bf2b2e5cbd3e9365a71b497d57fc5e8b2cf73ddf12d85d502d7fa" +dependencies = [ + "hashbrown 0.17.1", + "libm", + "serde", +] + +[[package]] +name = "wasmtime-internal-cranelift" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e8f190dd62c021d278ab0bd4afab06426844831d6a35dc369835754ad997d4" +dependencies = [ + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "gimli", + "itertools", + "log", + "object", + "pulley-interpreter", + "smallvec", + "target-lexicon", + "thiserror 2.0.21", + "wasmparser", + "wasmtime-environ", + "wasmtime-internal-core", + "wasmtime-internal-unwinder", + "wasmtime-internal-versioned-export-macros", +] + +[[package]] +name = "wasmtime-internal-fiber" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6326d47c759c0478489a034f1282a6f516ce97594f9af785539697d03add17ec" +dependencies = [ + "cc", + "libc", + "rustix", + "wasmtime-environ", + "wasmtime-internal-versioned-export-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "wasmtime-internal-jit-debug" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b78d046468d9aaf81e97954165369693084f43e313daad47f959b1169d596d3" +dependencies = [ + "cc", + "wasmtime-internal-versioned-export-macros", +] + +[[package]] +name = "wasmtime-internal-jit-icache-coherence" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e5f3cb3fdc12489163dc60741696dddb32c9ed0662ff59c8dfb177ffd7a07" +dependencies = [ + "libc", + "wasmtime-internal-core", + "windows-sys 0.61.2", +] + +[[package]] +name = "wasmtime-internal-unwinder" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbf9357720c1477c43f88dace11923737e8aa87abe5f46f90e23c93a2a0fb3fe" +dependencies = [ + "cranelift-codegen", + "log", + "object", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-internal-versioned-export-macros" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce7c663ad018cc86ce824e21b35b8bed9877ee9ca6af8ef8672e28852450392e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "wasmtime-internal-wit-bindgen" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df6397ebf5957c9d9c6001b7d9cd1586113f3556e7d1f9e0457c7166cf0a1da" +dependencies = [ + "anyhow", + "bitflags", + "heck", + "indexmap", + "wit-component", + "wit-parser", +] + +[[package]] +name = "wasmtime-wasi" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc6ef7dfa261eda94e66b547cb93cced2d25eb7ea19f6621a5dfc42cb39fcae" +dependencies = [ + "async-trait", + "bitflags", + "bytes", + "futures", + "rand", + "rustix", + "rustix-linux-procfs", + "thiserror 2.0.21", + "tokio", + "tracing", + "url", + "wasmtime", + "wasmtime-wasi-io", + "wiggle", + "windows-sys 0.61.2", +] + +[[package]] +name = "wasmtime-wasi-io" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9828eddc4b35d0d91a2f7ea3ff7c72b67808ece7bb2663eed0b17e480285897e" +dependencies = [ + "async-trait", + "bytes", + "futures", + "tracing", + "wasmtime", +] + +[[package]] +name = "wast" +version = "35.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +dependencies = [ + "leb128", +] + +[[package]] +name = "wiggle" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c29596a5aa1a8356a7b45d099f0317dddac51e9a7424ead062cd84d13c64064" +dependencies = [ + "bitflags", + "thiserror 2.0.21", + "tracing", + "wasmtime", + "wasmtime-environ", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5dfb60b3495abb891675ab46933e5168140d87eb3a21a412360daa47c52896" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasmtime-environ", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "50.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a99a153f98fec1f3c6d33d7f22ed294686ad817be10b7890c669a5d63c9b40e4" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "wiggle-generate", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "winnow" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-component" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2818766842bd2321074c348fb5c15d8fdb105a9eb78374e6d77c7d4127e1f2f9" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "962e43c4db2da607b50839a531e5b63473268b40efdf8028d5c54b572ca4f6f6" +dependencies = [ + "anyhow", + "hashbrown 0.17.1", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-ident", + "wasmparser", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror 1.0.69", + "wast", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/android-wasm/Cargo.toml b/android-wasm/Cargo.toml new file mode 100644 index 0000000..2ed1f58 --- /dev/null +++ b/android-wasm/Cargo.toml @@ -0,0 +1,64 @@ +[package] +name = "ultra-launcher-wasm" +version = "0.1.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] +path = "src/lib.rs" + +[dependencies] +android-activity = { version = "0.6", features = ["native-activity"] } +android_logger = "0.14" +base64 = "0.22" +jni = "0.21" +log = "0.4" +ndk = "0.9" +sha2 = "0.10" +wasmtime = { version = "50", default-features = false, features = ["component-model", "cranelift", "runtime", "std"] } +wasmtime-wasi = "50" + +[profile.release] +opt-level = 3 +debug = false +lto = "thin" +codegen-units = 16 +strip = true + +[package.metadata.android] +package = "dev.ultra.launcher.wasm" +apk_name = "ultra-launcher-wasm" +build_targets = ["aarch64-linux-android"] +resources = "res" +assets = "assets" + +[package.metadata.android.sdk] +min_sdk_version = 30 +target_sdk_version = 35 + +[package.metadata.android.application] +label = "ultra Wasm" +icon = "@mipmap/ic_launcher" +theme = "@style/HomeWasm" +extract_native_libs = true +has_code = true + +[package.metadata.android.application.activity] +name = "dev.ultra.launcher.wasm.LauncherActivity" +config_changes = "orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" +launch_mode = "singleTask" +state_not_needed = true +clear_task_on_launch = true +exclude_from_recents = true +orientation = "unspecified" + +[[package.metadata.android.application.activity.intent_filter]] +actions = ["android.intent.action.MAIN"] +categories = ["android.intent.category.HOME", "android.intent.category.DEFAULT", "android.intent.category.LAUNCHER"] + +[[package.metadata.android.uses_permission]] +name = "android.permission.REQUEST_DELETE_PACKAGES" + +[[package.metadata.android.uses_permission]] +name = "android.permission.QUERY_ALL_PACKAGES" diff --git a/android-wasm/build.sh b/android-wasm/build.sh new file mode 100644 index 0000000..a0b549b --- /dev/null +++ b/android-wasm/build.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")" + +if [ -z "${ANDROID_HOME:-}" ] || [ ! -d "$ANDROID_HOME/ndk" ]; then + export ANDROID_HOME="/home/nandi/Android/Sdk" +fi +export ANDROID_SDK_ROOT="$ANDROID_HOME" +if [ -z "${ANDROID_NDK_ROOT:-}" ]; then + ANDROID_NDK_ROOT=$(ls -1d "$ANDROID_HOME/ndk/"* | tail -n 1) + export ANDROID_NDK_ROOT +fi +BUILD_TOOLS=$(ls -1d "$ANDROID_HOME/build-tools/"* | tail -n 1) +PLATFORM=$(ls -1d "$ANDROID_HOME/platforms/"* | tail -n 1) + +KEYSTORE="${CARGO_APK_RELEASE_KEYSTORE:-$PWD/../android/app/debug.keystore}" +export CARGO_APK_RELEASE_KEYSTORE="$KEYSTORE" +export CARGO_APK_RELEASE_KEYSTORE_PASSWORD="${CARGO_APK_RELEASE_KEYSTORE_PASSWORD:-android}" + +cargo apk build --release +apk="target/release/apk/ultra-launcher-wasm.apk" + +work="target/java-build" +rm -rf "$work" +mkdir -p "$work/classes" "$work/dex" +javac --release 11 -classpath "$PLATFORM/android.jar" \ + -d "$work/classes" java/dev/ultra/launcher/wasm/LauncherActivity.java +"$BUILD_TOOLS/d8" --min-api 30 --output "$work/dex" \ + $(find "$work/classes" -name '*.class') + +python3 - "$apk" "$work/dex/classes.dex" "$work/unaligned.apk" <<'PY' +import sys, zipfile +src, dex, dst = sys.argv[1], sys.argv[2], sys.argv[3] +with zipfile.ZipFile(src, "r") as zin, zipfile.ZipFile(dst, "w") as zout: + for info in zin.infolist(): + if info.filename.startswith("META-INF/") or info.filename == "classes.dex": + continue + zout.writestr(info, zin.read(info.filename)) + zout.write(dex, "classes.dex", compress_type=zipfile.ZIP_DEFLATED) +PY + +"$BUILD_TOOLS/zipalign" -f -p 4 "$work/unaligned.apk" "$work/aligned.apk" +"$BUILD_TOOLS/apksigner" sign \ + --ks "$KEYSTORE" --ks-pass pass:android --key-pass pass:android --ks-key-alias androiddebugkey \ + --out "$apk" "$work/aligned.apk" + +echo "Built $PWD/$apk ($(stat -c%s "$apk") bytes)" diff --git a/android-wasm/java/dev/ultra/launcher/wasm/LauncherActivity.java b/android-wasm/java/dev/ultra/launcher/wasm/LauncherActivity.java new file mode 100644 index 0000000..446777c --- /dev/null +++ b/android-wasm/java/dev/ultra/launcher/wasm/LauncherActivity.java @@ -0,0 +1,314 @@ +package dev.ultra.launcher.wasm; + +import android.app.NativeActivity; +import android.content.ActivityNotFoundException; +import android.content.ComponentName; +import android.content.Intent; +import android.content.pm.ApplicationInfo; +import android.content.pm.LauncherActivityInfo; +import android.content.pm.LauncherApps; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Insets; +import android.graphics.PixelFormat; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.os.Process; +import android.os.UserHandle; +import android.provider.Settings; +import android.util.Log; +import android.view.HapticFeedbackConstants; +import android.view.KeyEvent; +import android.view.Window; +import android.view.WindowInsets; +import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; +import android.widget.Toast; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.File; +import java.io.FileOutputStream; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.security.MessageDigest; +import java.text.Collator; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +public class LauncherActivity extends NativeActivity { + private static final String TAG = "ultra-wasm"; + + static { + System.loadLibrary("ultra_launcher_wasm"); + } + + private static native void nativeOnEvent(String event); + private static native void nativeOnInsets(int top, int bottom); + + private final Handler main = new Handler(Looper.getMainLooper()); + private LauncherApps launcher; + private final UserHandle user = Process.myUserHandle(); + private final Map activities = new ConcurrentHashMap<>(); + private final Object iconLock = new Object(); + + private final LauncherApps.Callback packages = new LauncherApps.Callback() { + @Override public void onPackageRemoved(String pkg, UserHandle u) { appsChanged(pkg); } + @Override public void onPackageAdded(String pkg, UserHandle u) { appsChanged(pkg); } + @Override public void onPackageChanged(String pkg, UserHandle u) { appsChanged(pkg); } + @Override public void onPackagesAvailable(String[] pkgs, UserHandle u, boolean replacing) { + appsChanged(String.join(",", pkgs)); + } + @Override public void onPackagesUnavailable(String[] pkgs, UserHandle u, boolean replacing) { + appsChanged(String.join(",", pkgs)); + } + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + getWindow().setFormat(PixelFormat.TRANSLUCENT); + super.onCreate(savedInstanceState); + launcher = getSystemService(LauncherApps.class); + launcher.registerCallback(packages, main); + seeThrough(); + getWindow().getDecorView().setOnApplyWindowInsetsListener((v, insets) -> { + onInsets(insets); + return v.onApplyWindowInsets(insets); + }); + getWindow().getDecorView().requestApplyInsets(); + } + + private void seeThrough() { + Window w = getWindow(); + w.setFormat(PixelFormat.TRANSLUCENT); + w.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + w.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER); + w.setStatusBarColor(Color.TRANSPARENT); + w.setNavigationBarColor(Color.TRANSPARENT); + if (Build.VERSION.SDK_INT >= 30) { + w.setDecorFitsSystemWindows(false); + } + } + + private void onInsets(WindowInsets insets) { + int top, bottom; + if (Build.VERSION.SDK_INT >= 30) { + Insets bars = insets.getInsets(WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout()); + Insets ime = insets.getInsets(WindowInsets.Type.ime()); + top = bars.top; + bottom = Math.max(bars.bottom, ime.bottom); + } else { + top = insets.getSystemWindowInsetTop(); + bottom = insets.getSystemWindowInsetBottom(); + } + nativeOnInsets(top, bottom); + nativeOnEvent("insets"); + } + + @Override + protected void onDestroy() { + if (launcher != null) launcher.unregisterCallback(packages); + super.onDestroy(); + } + + @Override + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + nativeOnEvent("home"); + } + + @Override + public boolean dispatchKeyEvent(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.KEYCODE_BACK) { + if (e.getAction() == KeyEvent.ACTION_UP && !e.isCanceled()) { + nativeOnEvent("back"); + } + return true; + } + return super.dispatchKeyEvent(e); + } + + private void appsChanged(String pkgs) { + if (pkgs != null && !pkgs.isEmpty()) { + for (String pkg : pkgs.split(",")) { + if (pkg.isEmpty()) continue; + String prefix = pkg + "/"; + activities.keySet().removeIf(k -> k.startsWith(prefix)); + } + } + nativeOnEvent("apps-changed:" + (pkgs == null ? "" : pkgs)); + } + + // ---- Called from Rust via JNI ---- + + public String apps() { + try { + List list = new ArrayList<>(launcher.getActivityList(null, user)); + Map labels = new HashMap<>(); + for (LauncherActivityInfo i : list) labels.put(i, String.valueOf(i.getLabel())); + Collator by = Collator.getInstance(); + list.sort((x, y) -> by.compare(labels.get(x), labels.get(y))); + JSONArray out = new JSONArray(); + Set seen = new HashSet<>(); + for (LauncherActivityInfo i : list) { + ComponentName cn = i.getComponentName(); + if (cn.getPackageName().equals(getPackageName())) continue; + String c = cn.flattenToShortString(); + seen.add(c); + activities.put(c, i); + JSONObject o = new JSONObject().put("label", labels.get(i)).put("component", c); + if ((i.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) != 0) o.put("system", true); + out.put(o); + } + activities.keySet().retainAll(seen); + return new JSONObject().put("apps", out).toString(); + } catch (JSONException | RuntimeException e) { + Log.w(TAG, "listing apps", e); + return "{\"apps\":[]}"; + } + } + + public byte[] icon(String key, int size) { + if (key == null || key.length() < 3) return null; + size = Math.max(16, Math.min(size, 512)); + File f = iconFile(key, size); + if (f != null && f.length() == (long) size * size * 4) { + try { + return Files.readAllBytes(f.toPath()); + } catch (java.io.IOException e) { + f.delete(); + } + } + byte[] px; + synchronized (iconLock) { + try { + Drawable d = appIcon(key.substring(2)); + px = d == null ? null : toPixels(d, size); + } catch (RuntimeException | OutOfMemoryError e) { + Log.w(TAG, "icon for " + key, e); + return null; + } + } + if (px != null && f != null) { + File tmp = new File(f.getPath() + ".tmp"); + try (FileOutputStream out = new FileOutputStream(tmp)) { + out.write(px); + } catch (java.io.IOException e) { + tmp.delete(); + tmp = null; + } + if (tmp != null && !tmp.renameTo(f)) tmp.delete(); + } + return px; + } + + private File iconFile(String key, int size) { + try { + String pkg = key.substring(2).split("/", 2)[0]; + long stamp = getPackageManager().getPackageInfo(pkg, 0).lastUpdateTime; + String id = "v2|" + key + "|" + size + "|" + stamp + "|" + getResources().getDisplayMetrics().densityDpi; + byte[] h = MessageDigest.getInstance("SHA-1").digest(id.getBytes(java.nio.charset.StandardCharsets.UTF_8)); + StringBuilder name = new StringBuilder(); + for (byte b : h) name.append(String.format("%02x", b)); + File dir = new File(getCacheDir(), "icons"); + if (!dir.isDirectory() && !dir.mkdirs()) return null; + return new File(dir, name.toString()); + } catch (Exception e) { + return null; + } + } + + private Drawable appIcon(String c) { + ComponentName cn = ComponentName.unflattenFromString(c); + if (cn == null) return null; + LauncherActivityInfo info = activities.get(c); + if (info == null) { + info = launcher.resolveActivity( + new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(cn), user); + } + if (info == null) return null; + Drawable d = info.getIcon(getResources().getDisplayMetrics().densityDpi); + return d != null ? d : getPackageManager().getDefaultActivityIcon(); + } + + private static byte[] toPixels(Drawable d, int size) { + d = d.mutate(); + Bitmap bmp = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); + d.setBounds(0, 0, size, size); + d.draw(new Canvas(bmp)); + ByteBuffer buf = ByteBuffer.allocate(size * size * 4); + bmp.copyPixelsToBuffer(buf); + bmp.recycle(); + return buf.array(); + } + + public void launch(String component) { + main.post(() -> { + ComponentName cn = ComponentName.unflattenFromString(component); + try { + launcher.startMainActivity(cn, user, null, null); + } catch (ActivityNotFoundException | SecurityException | NullPointerException e) { + Toast.makeText(this, "Can't open " + component, Toast.LENGTH_SHORT).show(); + } + }); + } + + public void appInfo(String component) { + main.post(() -> { + ComponentName cn = ComponentName.unflattenFromString(component); + if (cn != null) launcher.startAppDetailsActivity(cn, user, null, null); + }); + } + + public void uninstall(String component) { + main.post(() -> { + ComponentName cn = ComponentName.unflattenFromString(component); + if (cn != null) { + try { + startActivity(new Intent(Intent.ACTION_DELETE, + Uri.fromParts("package", cn.getPackageName(), null)) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); + } catch (ActivityNotFoundException e) { + Toast.makeText(this, "Not available", Toast.LENGTH_SHORT).show(); + } + } + }); + } + + public void openSettings() { + main.post(() -> startActivity(new Intent(Settings.ACTION_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))); + } + + public void pickWallpaper() { + main.post(() -> startActivity(Intent.createChooser( + new Intent(Intent.ACTION_SET_WALLPAPER), "Wallpaper").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))); + } + + public void haptic() { + main.post(() -> getWindow().getDecorView().performHapticFeedback( + HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING)); + } + + public void setTextInput(boolean active) { + main.post(() -> { + InputMethodManager imm = getSystemService(InputMethodManager.class); + if (imm == null) return; + if (active) imm.showSoftInput(getWindow().getDecorView(), 0); + else imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0); + }); + } +} diff --git a/android-wasm/res/mipmap-xxxhdpi/ic_launcher.png b/android-wasm/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..481900b Binary files /dev/null and b/android-wasm/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android-wasm/res/values/styles.xml b/android-wasm/res/values/styles.xml new file mode 100644 index 0000000..ea7147e --- /dev/null +++ b/android-wasm/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + diff --git a/android-wasm/src/lib.rs b/android-wasm/src/lib.rs new file mode 100644 index 0000000..a9f35c2 --- /dev/null +++ b/android-wasm/src/lib.rs @@ -0,0 +1,646 @@ +use android_activity::input::{InputEvent, KeyAction, Keycode, MotionAction}; +use android_activity::{AndroidApp, AndroidAppWaker, InputStatus, MainEvent, PollEvent}; +use base64::Engine as _; +use jni::objects::{GlobalRef, JByteArray, JObject, JString, JValue}; +use jni::sys::jint; +use jni::{JNIEnv, JavaVM}; +use ndk::hardware_buffer_format::HardwareBufferFormat; +use ndk::native_window::NativeWindow; +use sha2::{Digest, Sha256}; +use std::collections::VecDeque; +use std::ffi::CString; +use std::path::PathBuf; +use std::sync::atomic::{AtomicU32, Ordering}; +use std::sync::Mutex; +use std::time::{Duration, Instant}; +use wasmtime::component::{Component, HasSelf, Linker, ResourceTable}; +use wasmtime::{Config, Engine, Store}; +use wasmtime_wasi::{FsPerms, WasiCtx, WasiCtxBuilder, WasiCtxView, WasiView}; + +wasmtime::component::bindgen!({ + path: "../wasi/wit", + world: "gui", +}); + +use latha::gui::types as wt; + +const B64: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; +const MIN_FRAME: Duration = Duration::from_millis(16); + +static EVENTS: Mutex> = Mutex::new(VecDeque::new()); +static WAKER: Mutex> = Mutex::new(None); +static INSET_TOP: AtomicU32 = AtomicU32::new(0); +static INSET_BOTTOM: AtomicU32 = AtomicU32::new(0); + +#[no_mangle] +pub extern "system" fn Java_dev_ultra_launcher_wasm_LauncherActivity_nativeOnEvent( + mut env: JNIEnv, + _class: JObject, + event: JString, +) { + if let Ok(s) = env.get_string(&event) { + if let Ok(mut q) = EVENTS.lock() { + q.push_back(s.to_string_lossy().into_owned()); + } + if let Ok(w) = WAKER.lock() { + if let Some(waker) = w.as_ref() { + waker.wake(); + } + } + } +} + +#[no_mangle] +pub extern "system" fn Java_dev_ultra_launcher_wasm_LauncherActivity_nativeOnInsets( + _env: JNIEnv, + _class: JObject, + top: jint, + bottom: jint, +) { + INSET_TOP.store(top.max(0) as u32, Ordering::Relaxed); + INSET_BOTTOM.store(bottom.max(0) as u32, Ordering::Relaxed); +} + +struct HostState { + wasi: WasiCtx, + table: ResourceTable, + vm: JavaVM, + activity: GlobalRef, + frame_wanted: bool, + tick_at: Option, + quit: Option, + clipboard: String, + primary: String, + dark: bool, +} + +impl WasiView for HostState { + fn ctx(&mut self) -> WasiCtxView<'_> { + WasiCtxView { + ctx: &mut self.wasi, + table: &mut self.table, + } + } +} + +impl HostState { + fn call_void(&self, method: &str, sig: &str, args: &[JValue]) { + if let Ok(mut env) = self.vm.attach_current_thread() { + if let Err(e) = env.call_method(&self.activity, method, sig, args) { + log::warn!("JNI {method} failed: {e}"); + } + } + } + + fn call_void_str(&self, method: &str, arg: &str) { + if let Ok(mut env) = self.vm.attach_current_thread() { + if let Ok(js) = env.new_string(arg) { + if let Err(e) = env.call_method( + &self.activity, + method, + "(Ljava/lang/String;)V", + &[JValue::Object(&js)], + ) { + log::warn!("JNI {method}({arg}) failed: {e}"); + } + } + } + } +} + +impl latha::gui::host::Host for HostState { + fn request_frame(&mut self) { + self.frame_wanted = true; + } + fn request_tick(&mut self, delay_ms: u32) { + self.tick_at = Some(Instant::now() + Duration::from_millis(delay_ms as u64)); + } + fn set_title(&mut self, title: String) { + log::info!("title: {title}"); + } + fn set_cursor(&mut self, _shape: latha::gui::host::Cursor) {} + fn set_min_size(&mut self, _min: latha::gui::host::Size) {} + fn clipboard_text(&mut self) -> String { + self.clipboard.clone() + } + fn set_clipboard_text(&mut self, text: String) { + self.clipboard = text; + } + fn primary_text(&mut self) -> String { + self.primary.clone() + } + fn set_primary_text(&mut self, text: String) { + self.primary = text; + } + fn prefers_dark(&mut self) -> bool { + self.dark + } + fn accent_color(&mut self) -> Option { + None + } + fn bell(&mut self) {} + fn set_text_input(&mut self, active: bool) { + self.call_void("setTextInput", "(Z)V", &[JValue::Bool(active as u8)]); + } + fn open_url(&mut self, _url: String) -> bool { + false + } + fn quit(&mut self, code: i32) { + self.quit = Some(code); + } +} + +impl ultra::launcher::android::Host for HostState { + fn apps(&mut self) -> String { + let Ok(mut env) = self.vm.attach_current_thread() else { + return "{\"apps\":[]}".to_owned(); + }; + let Ok(res) = env.call_method(&self.activity, "apps", "()Ljava/lang/String;", &[]) else { + return "{\"apps\":[]}".to_owned(); + }; + let Ok(obj) = res.l() else { + return "{\"apps\":[]}".to_owned(); + }; + let js: JString = obj.into(); + env.get_string(&js) + .map(|s| s.to_string_lossy().into_owned()) + .unwrap_or_else(|_| "{\"apps\":[]}".to_owned()) + } + + fn icon(&mut self, key: String, size: u32) -> Option { + let mut env = self.vm.attach_current_thread().ok()?; + let js = env.new_string(&key).ok()?; + let res = env + .call_method( + &self.activity, + "icon", + "(Ljava/lang/String;I)[B", + &[JValue::Object(&js), JValue::Int(size as jint)], + ) + .ok()?; + let obj = res.l().ok()?; + if obj.is_null() { + return None; + } + let arr: JByteArray = obj.into(); + let bytes = env.convert_byte_array(arr).ok()?; + Some(B64.encode(&bytes)) + } + + fn launch(&mut self, component: String) { + self.call_void_str("launch", &component); + } + fn app_info(&mut self, component: String) { + self.call_void_str("appInfo", &component); + } + fn uninstall(&mut self, component: String) { + self.call_void_str("uninstall", &component); + } + fn open_settings(&mut self) { + self.call_void("openSettings", "()V", &[]); + } + fn pick_wallpaper(&mut self) { + self.call_void("pickWallpaper", "()V", &[]); + } + fn haptic(&mut self) { + self.call_void("haptic", "()V", &[]); + } + fn insets(&mut self) -> (u32, u32) { + ( + INSET_TOP.load(Ordering::Relaxed), + INSET_BOTTOM.load(Ordering::Relaxed), + ) + } + fn poll_events(&mut self) -> Vec { + let mut out = Vec::new(); + if let Ok(mut q) = EVENTS.lock() { + while let Some(ev) = q.pop_front() { + out.push(ev); + } + } + out + } +} + +struct FrameBuf { + width: u32, + height: u32, + pixels: Vec, // RGBA8888 premultiplied +} + +impl FrameBuf { + fn new() -> Self { + Self { + width: 0, + height: 0, + pixels: Vec::new(), + } + } + + fn resize(&mut self, w: u32, h: u32) { + if self.width != w || self.height != h { + self.width = w; + self.height = h; + self.pixels.resize((w as usize) * (h as usize) * 4, 0); + } + } + + fn apply_damage(&mut self, store: &mut Store, app: &Gui, dmg: &wt::Damage) { + let fw = self.width as i32; + let fh = self.height as i32; + for m in &dmg.moves { + let x0 = m.area.x.max(0); + let y0 = m.area.y.max(0); + let x1 = (m.area.x + m.area.width as i32).min(fw); + let y1 = (m.area.y + m.area.height as i32).min(fh); + if x1 <= x0 || y1 <= y0 { + continue; + } + let w = (x1 - x0) as usize; + let h = (y1 - y0) as usize; + let stride = (self.width as usize) * 4; + let mut tmp = vec![0u8; w * h * 4]; + for row in 0..h { + let src_off = ((y0 as usize + row) * stride) + (x0 as usize) * 4; + tmp[row * w * 4..(row + 1) * w * 4] + .copy_from_slice(&self.pixels[src_off..src_off + w * 4]); + } + for row in 0..h { + let dy = y0 + row as i32 + m.dy; + if dy < 0 || dy >= fh { + continue; + } + for col in 0..w { + let dx = x0 + col as i32 + m.dx; + if dx < 0 || dx >= fw { + continue; + } + let dst_off = ((dy as usize) * stride) + (dx as usize) * 4; + let src_off = (row * w + col) * 4; + self.pixels[dst_off..dst_off + 4] + .copy_from_slice(&tmp[src_off..src_off + 4]); + } + } + } + + for r in &dmg.rects { + if r.width == 0 || r.height == 0 { + continue; + } + let Ok(b64) = app.latha_gui_app().call_frame_pixels(&mut *store, *r) else { + continue; + }; + let Ok(bgra) = B64.decode(b64.as_bytes()) else { + continue; + }; + let rw = r.width as usize; + let rh = r.height as usize; + if bgra.len() < rw * rh * 4 { + continue; + } + let stride = (self.width as usize) * 4; + for row in 0..rh { + let py = r.y + row as i32; + if py < 0 || py >= fh { + continue; + } + for col in 0..rw { + let px = r.x + col as i32; + if px < 0 || px >= fw { + continue; + } + let src = (row * rw + col) * 4; + let dst = (py as usize) * stride + (px as usize) * 4; + // BGRA -> RGBA (premultiplied) + self.pixels[dst] = bgra[src + 2]; + self.pixels[dst + 1] = bgra[src + 1]; + self.pixels[dst + 2] = bgra[src]; + self.pixels[dst + 3] = bgra[src + 3]; + } + } + } + } + + fn present(&self, win: &NativeWindow) { + if self.width == 0 || self.height == 0 { + return; + } + let _ = win.set_buffers_geometry( + self.width as i32, + self.height as i32, + Some(HardwareBufferFormat::R8G8B8A8_UNORM), + ); + if let Ok(mut buf) = win.lock(None) { + let dst_stride = buf.stride() * 4; + let src_stride = (self.width as usize) * 4; + let ptr = buf.bits() as *mut u8; + for row in 0..(self.height as usize) { + unsafe { + std::ptr::copy_nonoverlapping( + self.pixels.as_ptr().add(row * src_stride), + ptr.add(row * dst_stride), + src_stride, + ); + } + } + } + } +} + +fn keycode_text(code: Keycode, shift: bool) -> String { + let ch = match code { + Keycode::A => Some(if shift { 'A' } else { 'a' }), + Keycode::B => Some(if shift { 'B' } else { 'b' }), + Keycode::C => Some(if shift { 'C' } else { 'c' }), + Keycode::D => Some(if shift { 'D' } else { 'd' }), + Keycode::E => Some(if shift { 'E' } else { 'e' }), + Keycode::F => Some(if shift { 'F' } else { 'f' }), + Keycode::G => Some(if shift { 'G' } else { 'g' }), + Keycode::H => Some(if shift { 'H' } else { 'h' }), + Keycode::I => Some(if shift { 'I' } else { 'i' }), + Keycode::J => Some(if shift { 'J' } else { 'j' }), + Keycode::K => Some(if shift { 'K' } else { 'k' }), + Keycode::L => Some(if shift { 'L' } else { 'l' }), + Keycode::M => Some(if shift { 'M' } else { 'm' }), + Keycode::N => Some(if shift { 'N' } else { 'n' }), + Keycode::O => Some(if shift { 'O' } else { 'o' }), + Keycode::P => Some(if shift { 'P' } else { 'p' }), + Keycode::Q => Some(if shift { 'Q' } else { 'q' }), + Keycode::R => Some(if shift { 'R' } else { 'r' }), + Keycode::S => Some(if shift { 'S' } else { 's' }), + Keycode::T => Some(if shift { 'T' } else { 't' }), + Keycode::U => Some(if shift { 'U' } else { 'u' }), + Keycode::V => Some(if shift { 'V' } else { 'v' }), + Keycode::W => Some(if shift { 'W' } else { 'w' }), + Keycode::X => Some(if shift { 'X' } else { 'x' }), + Keycode::Y => Some(if shift { 'Y' } else { 'y' }), + Keycode::Z => Some(if shift { 'Z' } else { 'z' }), + Keycode::Keycode0 => Some('0'), + Keycode::Keycode1 => Some('1'), + Keycode::Keycode2 => Some('2'), + Keycode::Keycode3 => Some('3'), + Keycode::Keycode4 => Some('4'), + Keycode::Keycode5 => Some('5'), + Keycode::Keycode6 => Some('6'), + Keycode::Keycode7 => Some('7'), + Keycode::Keycode8 => Some('8'), + Keycode::Keycode9 => Some('9'), + Keycode::Space => Some(' '), + Keycode::Period => Some('.'), + Keycode::Minus => Some(if shift { '_' } else { '-' }), + _ => None, + }; + ch.map(|c| c.to_string()).unwrap_or_default() +} + +fn load_wasm_bytes(app: &AndroidApp) -> Result, String> { + if let Some(ext) = app.external_data_path() { + let override_path = ext.join("launcher.wasm"); + if let Ok(bytes) = std::fs::read(&override_path) { + log::info!("Loaded override wasm from {}", override_path.display()); + return Ok(bytes); + } + } + let mgr = app.asset_manager(); + let cname = CString::new("launcher.wasm").unwrap(); + let mut asset = mgr + .open(&cname) + .ok_or_else(|| "assets/launcher.wasm not found".to_owned())?; + asset + .buffer() + .map(|b| b.to_vec()) + .map_err(|e| format!("reading assets/launcher.wasm: {e}")) +} + +fn load_component(engine: &Engine, app: &AndroidApp) -> Result { + let bytes = load_wasm_bytes(app)?; + let hash = format!("{:x}", Sha256::digest(&bytes)); + let cache_dir = app + .internal_data_path() + .unwrap_or_else(|| PathBuf::from("/data/local/tmp")); + let cache_file = cache_dir.join(format!("launcher-{}.cwasm", &hash[..16])); + if let Ok(cwasm) = std::fs::read(&cache_file) { + if let Ok(comp) = unsafe { Component::deserialize(engine, &cwasm) } { + log::info!("Loaded cached AOT component {}", cache_file.display()); + return Ok(comp); + } + } + let comp = Component::from_binary(engine, &bytes).map_err(|e| format!("compile wasm: {e}"))?; + if let Ok(serialized) = comp.serialize() { + let _ = std::fs::write(&cache_file, serialized); + } + Ok(comp) +} + +#[no_mangle] +fn android_main(app: AndroidApp) { + android_logger::init_once( + android_logger::Config::default() + .with_max_level(log::LevelFilter::Info) + .with_tag("ultra-wasm"), + ); + + if let Ok(mut w) = WAKER.lock() { + *w = Some(app.create_waker()); + } + + let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr() as *mut _) }.expect("JavaVM"); + let activity = { + let env = vm.attach_current_thread().expect("JNI attach"); + let obj = unsafe { JObject::from_raw(app.activity_as_ptr() as *mut _) }; + env.new_global_ref(obj).expect("global ref") + }; + + let data_dir = app + .internal_data_path() + .unwrap_or_else(|| PathBuf::from("/data/local/tmp")); + let _ = std::fs::create_dir_all(&data_dir); + + let mut cfg = Config::new(); + cfg.wasm_component_model(true); + let engine = Engine::new(&cfg).expect("wasmtime engine"); + let component = match load_component(&engine, &app) { + Ok(c) => c, + Err(e) => { + log::error!("Failed to load launcher.wasm: {e}"); + return; + } + }; + + let mut linker: Linker = Linker::new(&engine); + wasmtime_wasi::p2::add_to_linker_sync(&mut linker).expect("wasi p2 linker"); + latha::gui::host::add_to_linker::<_, HasSelf<_>>(&mut linker, |s| s).expect("gui host linker"); + ultra::launcher::android::add_to_linker::<_, HasSelf<_>>(&mut linker, |s| s) + .expect("android host linker"); + + let mut wasi_builder = WasiCtxBuilder::new(); + wasi_builder.inherit_stdio(); + wasi_builder.env("QT_QPA_PLATFORM", "qt2wasmgui"); + let _ = wasi_builder.preopened_dir(&data_dir, "/data", FsPerms::ReadWrite); + + let state = HostState { + wasi: wasi_builder.build(), + table: ResourceTable::new(), + vm, + activity, + frame_wanted: true, + tick_at: None, + quit: None, + clipboard: String::new(), + primary: String::new(), + dark: true, + }; + + let mut store = Store::new(&engine, state); + let gui = Gui::instantiate(&mut store, &component, &linker).expect("instantiate launcher"); + if let Err(e) = gui + .latha_gui_app() + .call_start(&mut store, &["ultra-home".to_owned()]) + { + log::error!("app.start failed: {e}"); + return; + } + + let mut fb = FrameBuf::new(); + let mut last_paint = Instant::now() - MIN_FRAME; + let mut running = true; + + while running && store.data().quit.is_none() { + let wait = store + .data() + .tick_at + .map(|t| t.saturating_duration_since(Instant::now())) + .unwrap_or(Duration::from_millis(50)); + + app.poll_events(Some(wait.min(Duration::from_millis(50))), |ev| match ev { + PollEvent::Main(MainEvent::Destroy) => running = false, + PollEvent::Main(MainEvent::InitWindow { .. }) + | PollEvent::Main(MainEvent::WindowResized { .. }) => { + if let Some(win) = app.native_window() { + let w = win.width().max(1) as u32; + let h = win.height().max(1) as u32; + let scale = (app.config().density().unwrap_or(420) as f64) / 160.0; + fb.resize(w, h); + let _ = gui.latha_gui_app().call_resize(&mut store, w, h, scale); + store.data_mut().frame_wanted = true; + } + } + PollEvent::Main(MainEvent::GainedFocus) => { + let _ = gui.latha_gui_app().call_focus(&mut store, true); + } + PollEvent::Main(MainEvent::LostFocus) => { + let _ = gui.latha_gui_app().call_focus(&mut store, false); + } + PollEvent::Main(MainEvent::InputAvailable) => { + if let Ok(mut iter) = app.input_events_iter() { + loop { + let read = iter.next(|event| { + match event { + InputEvent::MotionEvent(me) => { + let p = me.pointer_at_index(0); + let x = p.x() as f64; + let y = p.y() as f64; + let kind = match me.action() { + MotionAction::Down => Some(( + wt::PointerKind::Press, + wt::Button::Left, + wt::Buttons::LEFT, + )), + MotionAction::Up => Some(( + wt::PointerKind::Release, + wt::Button::Left, + wt::Buttons::empty(), + )), + MotionAction::Move => Some(( + wt::PointerKind::Move, + wt::Button::None, + wt::Buttons::LEFT, + )), + MotionAction::Cancel => Some(( + wt::PointerKind::Leave, + wt::Button::None, + wt::Buttons::empty(), + )), + _ => None, + }; + if let Some((kind, button, buttons)) = kind { + let pe = wt::PointerEvent { + kind, + button, + buttons, + modifiers: wt::Modifiers::empty(), + x, + y, + clicks: 1, + }; + let _ = gui.latha_gui_app().call_pointer(&mut store, pe); + store.data_mut().frame_wanted = true; + } + InputStatus::Handled + } + InputEvent::KeyEvent(ke) => { + let pressed = ke.action() == KeyAction::Down; + let keysym = match ke.key_code() { + Keycode::Del => 0xff08, + Keycode::Enter => 0xff0d, + Keycode::Escape => 0xff1b, + _ => 0, + }; + let text = if pressed { + keycode_text(ke.key_code(), ke.meta_state().shift_on()) + } else { + String::new() + }; + if keysym != 0 || !text.is_empty() { + let ev = wt::KeyEvent { + pressed, + repeat: ke.repeat_count() > 0, + keysym, + scancode: ke.scan_code() as u32, + modifiers: wt::Modifiers::empty(), + text, + }; + let _ = gui.latha_gui_app().call_key(&mut store, &ev); + store.data_mut().frame_wanted = true; + } + InputStatus::Unhandled + } + _ => InputStatus::Unhandled, + } + }); + if !read { + break; + } + } + } + } + _ => {} + }); + + let has_events = EVENTS.lock().map(|q| !q.is_empty()).unwrap_or(false); + let due = store + .data() + .tick_at + .map(|t| Instant::now() >= t) + .unwrap_or(false); + if due || has_events { + store.data_mut().tick_at = None; + if let Ok(next) = gui.latha_gui_app().call_tick(&mut store) { + if let Some(ms) = next { + store.data_mut().tick_at = Some(Instant::now() + Duration::from_millis(ms as u64)); + } + } + } + + if store.data().frame_wanted && last_paint.elapsed() >= MIN_FRAME { + store.data_mut().frame_wanted = false; + last_paint = Instant::now(); + if let Some(win) = app.native_window() { + if let Ok(dmg) = gui.latha_gui_app().call_paint(&mut store) { + fb.apply_damage(&mut store, &gui, &dmg); + fb.present(&win); + } + } + } + } +} diff --git a/ci/forge-wasm-apk.sh b/ci/forge-wasm-apk.sh new file mode 100644 index 0000000..90d5a04 --- /dev/null +++ b/ci/forge-wasm-apk.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Builds the WASI launcher component (wasi/) and the wasmtime runtime APK (android-wasm/). +set -euo pipefail +cd /src + +export PIXI_HOME=/opt/pixi +curl -fsSL https://pixi.sh/install.sh | bash +export PATH="$PIXI_HOME/bin:$PATH" + +pixi run --manifest-path wasi/pixi.toml build +mkdir -p android-wasm/assets +cp wasi/build/launcher.wasm android-wasm/assets/launcher.wasm + +curl -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --target aarch64-linux-android +export PATH="$HOME/.cargo/bin:$PATH" +cargo install cargo-apk --version 0.10.0 --locked + +bash android-wasm/build.sh +cp android-wasm/target/release/apk/ultra-launcher-wasm.apk ultra-launcher-wasm.apk diff --git a/wasi/CMakeLists.txt b/wasi/CMakeLists.txt new file mode 100644 index 0000000..cd76291 --- /dev/null +++ b/wasi/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.21) +project(launcher_wasi C CXX) + +include(${QT2WASM_ROOT}/cmake/Qt2Wasm.cmake) + +set(FONTS_QRC_CPP "${CMAKE_CURRENT_BINARY_DIR}/qrc_fonts.cpp") +add_custom_command( + OUTPUT "${FONTS_QRC_CPP}" + COMMAND "${QT2WASM_QT_PREFIX}/../host/libexec/rcc" + --name fonts + -o "${FONTS_QRC_CPP}" + "${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc" + "${CMAKE_CURRENT_SOURCE_DIR}/fonts/DejaVuSans.ttf" + "${CMAKE_CURRENT_SOURCE_DIR}/fonts/DejaVuSans-Bold.ttf" + COMMENT "Compiling fonts.qrc" +) + +qt2wasm_add_component(launcher GUI + SOURCES + src/main.cpp + src/launcher_window.cpp + src/layout.cpp + "${FONTS_QRC_CPP}" + INCLUDE_DIRS + src +) diff --git a/wasi/build.sh b/wasi/build.sh new file mode 100644 index 0000000..6ba3a86 --- /dev/null +++ b/wasi/build.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")" + +QT2WASM_ROOT="${QT2WASM_ROOT:-$(python3 -c 'import qt2wasm, pathlib; print(pathlib.Path(qt2wasm.__file__).parent / "_data")')}" +QT2WASM_COMPAT_DIR="${QT2WASM_COMPAT_DIR:-$CONDA_PREFIX/opt/qt6-wasi/compat}" +MOC="${QT2WASM_MOC:-$QT_WASI_HOST_PATH/libexec/moc}" + +BUILD_DIR="build" +GEN_DIR="$PWD/$BUILD_DIR/gen" +mkdir -p "$GEN_DIR/bindings" "$GEN_DIR/runtime" + +# 1. Generate C guest bindings for `world gui` (latha:gui/gui + ultra:launcher/android). +wit-bindgen c --world gui --out-dir "$GEN_DIR/bindings" wit + +# 2. Run moc on qt2wasm runtime headers and our window class. +"$MOC" "$QT2WASM_ROOT/runtime/wasieventdispatcher.h" -o "$GEN_DIR/runtime/moc_wasieventdispatcher.cpp" +"$MOC" "$QT2WASM_ROOT/gui/qt2wasmgui.h" -o "$GEN_DIR/runtime/moc_qt2wasmgui.cpp" +"$MOC" "src/launcher_window.h" -o "$GEN_DIR/moc_launcher_window.cpp" + +# 3. Configure and link the core WASI reactor module. +cmake -S . -B "$BUILD_DIR" -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE="$QT2WASM_QT_TOOLCHAIN" \ + -DQT2WASM_ROOT="$QT2WASM_ROOT" \ + -DQT2WASM_QT_PREFIX="$QT2WASM_QT_PREFIX" \ + -DQT2WASM_GEN_DIR="$GEN_DIR" \ + -DQT2WASM_COMPAT_DIR="$QT2WASM_COMPAT_DIR" \ + -DQT2WASM_GUI_WORLD=gui \ + -DQT2WASM_QPA_PLATFORM=qt2wasmgui + +cmake --build "$BUILD_DIR" + +# 4. Wrap as a WASI Preview 2 component. +wasm-tools component new "$BUILD_DIR/launcher.core.wasm" \ + --adapt "wasi_snapshot_preview1=$QT2WASM_ADAPTER" \ + -o "$BUILD_DIR/launcher.wasm" + +echo "Built $PWD/$BUILD_DIR/launcher.wasm ($(stat -c%s "$BUILD_DIR/launcher.wasm") bytes)" diff --git a/wasi/fonts.qrc b/wasi/fonts.qrc new file mode 100644 index 0000000..d259df7 --- /dev/null +++ b/wasi/fonts.qrc @@ -0,0 +1,6 @@ + + + fonts/DejaVuSans.ttf + fonts/DejaVuSans-Bold.ttf + + diff --git a/wasi/fonts/DejaVuSans-Bold.ttf b/wasi/fonts/DejaVuSans-Bold.ttf new file mode 100644 index 0000000..7d6b762 Binary files /dev/null and b/wasi/fonts/DejaVuSans-Bold.ttf differ diff --git a/wasi/fonts/DejaVuSans.ttf b/wasi/fonts/DejaVuSans.ttf new file mode 100644 index 0000000..0692d93 Binary files /dev/null and b/wasi/fonts/DejaVuSans.ttf differ diff --git a/wasi/pixi.lock b/wasi/pixi.lock new file mode 100644 index 0000000..964945f --- /dev/null +++ b/wasi/pixi.lock @@ -0,0 +1,1000 @@ +version: 7 +platforms: +- name: linux-64 + virtual-packages: + - __unix=0=0 + - __linux=4.18 + - __glibc=2.28 + - __archspec=0=x86_64 +environments: + default: + channels: + - url: https://prefix.dev/nandi-testing/ + - url: https://conda.anaconda.org/conda-forge/ + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/binaryen-121-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/brotli-1.2.1-h505cf86_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/brotli-bin-1.2.1-h9908984_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cmake-4.5.0-hff7ac6b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fonttools-4.68.0-py315h4d0d421_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/markupsafe-3.0.4-py315h4aa9e2b_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ninja-1.13.2-h171cf75_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py315h178884a_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rhash-1.4.6-hb03c661_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-hebe6cf0_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zensical-0.1.1-py311h7b25dd4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/_python_abi3_support-1.0-hd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.5.1-pyh5ded981_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cpython-3.15.2-py315hd8ed1ab_100.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.6-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-3.11.3-pyh5ded981_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/munkres-1.1.4-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pathspec-1.1.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.21.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pymdown-extensions-13.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-gil-3.15.2-h4df99d1_100.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zensical-ui-0.0.42-pyh5ded981_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://prefix.dev/nandi-testing/linux-64/bzip2-1.0.8-hda65f42_10.conda + - conda: https://prefix.dev/nandi-testing/linux-64/c-ares-1.34.9-hebe6cf0_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/icu-78.3-py310h44b86e0_2.conda + - conda: https://prefix.dev/nandi-testing/linux-64/jco-1.41.0-hb0f4dca_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/keyutils-1.6.3-h7cc23a3_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/krb5-1.22.2-hbc21106_2.conda + - conda: https://prefix.dev/nandi-testing/linux-64/ld_impl_linux-64-2.46.1-default_hbd61a6d_103.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libabseil-20260526.0-cxx17_h0dc7533_2.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libbrotlicommon-1.2.1-h39a168f_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libbrotlidec-1.2.1-ha411449_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libbrotlienc-1.2.1-h018ffa1_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libcurl-8.23.0-ha042cf0_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libedit-3.1.20260512-pl5321h373387f_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libev-4.33-h280c20c_3.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libexpat-2.9.0-hd2095e1_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libffi-3.7.0-h81df57d_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libgcc-16.2.0-ha9f2e26_7.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libgomp-16.2.0-he0feb66_7.conda + - conda: https://prefix.dev/nandi-testing/linux-64/liblzma-5.8.3-hb03c661_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libmpdec-4.0.0-hb03c661_2.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libnghttp2-1.71.0-hc5e5977_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libpsl-0.23.1-hd9e3e90_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libsqlite-3.54.1-h13e7031_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libssh2-1.11.1-h6154650_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libstdcxx-16.2.0-h934c35e_7.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libuuid-2.42.4-hcfc3c73_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libuv-1.52.1-h280c20c_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/libzlib-1.3.2-h25fd6f3_3.conda + - conda: https://prefix.dev/nandi-testing/linux-64/ncurses-6.6-hdb14827_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/nodejs-26.10.0-ha5cdc1e_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/openssl-3.6.5-h781a0a9_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/python-3.15.2-h6e52b48_100_cp315.conda + - conda: https://prefix.dev/nandi-testing/linux-64/qt6-wasi-6.8.3-hb0f4dca_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/tk-8.6.13-noxft_h1df4ec4_4.conda + - conda: https://prefix.dev/nandi-testing/linux-64/wasi-sdk-27.0-hb0f4dca_1.conda + - conda: https://prefix.dev/nandi-testing/linux-64/wasm-tools-1.239.0-hb0f4dca_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/wit-bindgen-0.46.0-hb0f4dca_0.conda + - conda: https://prefix.dev/nandi-testing/linux-64/zstd-1.5.7-hb78ec9c_7.conda + - conda: https://prefix.dev/nandi-testing/noarch/ca-certificates-2026.10.23-hbd8a1cb_0.conda + - conda: https://prefix.dev/nandi-testing/noarch/importlib-metadata-9.0.1-pyhcf101f3_0.conda + - conda: https://prefix.dev/nandi-testing/noarch/python_abi-3.15-9_cp315.conda + - conda: https://prefix.dev/nandi-testing/noarch/qt2wasm-0.10.6-pyh4616a5c_0.conda + - conda: https://prefix.dev/nandi-testing/noarch/tomli-2.5.0-pyh5ded981_0.conda + - conda: https://prefix.dev/nandi-testing/noarch/tzdata-2026e-h5d301ff_0.conda + - conda: https://prefix.dev/nandi-testing/noarch/wasi-preview1-adapter-36.0.0-h4616a5c_0.conda + - conda: https://prefix.dev/nandi-testing/noarch/zipp-4.1.2-pyh5ded981_0.conda +packages: +- conda: https://conda.anaconda.org/conda-forge/linux-64/binaryen-121-h5888daf_0.conda + sha256: 01233c9dc409bd6285c03598409d6f9b86aaad88005088b2d72de54ed06d44f1 + md5: c331a601e8643b96889adbd82961c290 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libstdcxx >=13 + license: Apache-2.0 + license_family: APACHE + run_exports: {} + size: 6054210 + timestamp: 1734410441026 +- conda: https://conda.anaconda.org/conda-forge/linux-64/brotli-1.2.1-h505cf86_0.conda + sha256: 3efb8e6ac07f12773f02e876567700f554965e33a8e30ee05ddd891c303f7aa3 + md5: 65f1fc5f6a3a984a8a25641d0e60fc25 + depends: + - __glibc >=2.17,<3.0.a0 + - brotli-bin 1.2.1 h9908984_0 + - libbrotlidec 1.2.1 ha411449_0 + - libbrotlienc 1.2.1 h018ffa1_0 + - libgcc >=15 + license: MIT + license_family: MIT + run_exports: + weak: + - libbrotlicommon >=1.2.1,<1.3.0a0 + - libbrotlienc >=1.2.1,<1.3.0a0 + - libbrotlidec >=1.2.1,<1.3.0a0 + size: 20477 + timestamp: 1792653712185 +- conda: https://conda.anaconda.org/conda-forge/linux-64/brotli-bin-1.2.1-h9908984_0.conda + sha256: c64939f0ade0fea29525d2f549a700841a331c0886b3694083d08eb4769936ce + md5: 903eceb31743f0ce070abb9b9f879714 + depends: + - __glibc >=2.17,<3.0.a0 + - libbrotlidec 1.2.1 ha411449_0 + - libbrotlienc 1.2.1 h018ffa1_0 + - libgcc >=15 + license: MIT + license_family: MIT + run_exports: {} + size: 21494 + timestamp: 1792653706181 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cmake-4.5.0-hff7ac6b_0.conda + sha256: 515262118596cd67037b345048d2c7d5a400ef218894f749973960b39e5c2a76 + md5: b57a771ac5a81aa791dbeab4263e92fa + depends: + - libstdcxx >=15 + - libgcc >=15 + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - rhash >=1.4.6,<2.0a0 + - libexpat >=2.9.0,<3.0a0 + - liblzma >=5.8.3,<6.0a0 + - ncurses >=6.6,<7.0a0 + - zstd >=1.5.7,<1.6.0a0 + - libcurl >=8.23.0,<9.0a0 + - libuv >=1.52.1,<2.0a0 + - libzlib >=1.3.2,<2.0a0 + license: BSD-3-Clause + license_family: BSD + run_exports: {} + size: 27320556 + timestamp: 1794549486278 +- conda: https://conda.anaconda.org/conda-forge/linux-64/fonttools-4.68.0-py315h4d0d421_0.conda + sha256: f1ca91b02a5153c27e400a6537d6413850da54d4ba0913e3f7f1a0cf42f1e38f + md5: 68744252efceeeb7f55638d9d549b0f4 + depends: + - __glibc >=2.17,<3.0.a0 + - brotli + - libgcc >=15 + - munkres + - python >=3.15,<3.16.0a0 + - python_abi 3.15.* *_cp315 + license: MIT + license_family: MIT + run_exports: {} + size: 3349521 + timestamp: 1793164830929 +- conda: https://conda.anaconda.org/conda-forge/linux-64/markupsafe-3.0.4-py315h4aa9e2b_4.conda + sha256: 5295ef9c4510cc8365c39db60f78b636ab46b925b944f552b1259848cc16927d + md5: 718ebfa70a24dd938f999bae19220b7b + depends: + - python + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + - python_abi 3.15.* *_cp315 + constrains: + - jinja2 >=3.0.0 + license: BSD-3-Clause + license_family: BSD + run_exports: {} + size: 29174 + timestamp: 1793707103879 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ninja-1.13.2-h171cf75_1.conda + sha256: 2b5f2e865122f9fc0637f520a7cb22e16b9727b2db6761ee16cb5e6404412c81 + md5: 2db7a395d7dc2b6ed5effaf68fb99443 + depends: + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + license: Apache-2.0 + license_family: APACHE + run_exports: {} + size: 186767 + timestamp: 1786713048064 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py315h178884a_3.conda + sha256: 740a7f3a4ce68b31984909cb2412be177e4f8581f0eb28d8cbb19e5ad78f1b3f + md5: 8a07113e62a8e7977bb0ff67506442a7 + depends: + - python + - yaml + - libgcc >=15 + - __glibc >=2.17,<3.0.a0 + - yaml >=0.2.5,<0.3.0a0 + - python_abi 3.15.* *_cp315 + license: MIT + license_family: MIT + run_exports: {} + size: 226096 + timestamp: 1793655133957 +- conda: https://conda.anaconda.org/conda-forge/linux-64/rhash-1.4.6-hb03c661_2.conda + sha256: 186a5b225077ad5f4656966da947d43307101950751ef4a239b455588756b4e1 + md5: 007602d697e07c11ff9864964eba5ee3 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + run_exports: + weak: + - rhash >=1.4.6,<2.0a0 + size: 194994 + timestamp: 1786731436520 +- conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-hebe6cf0_3.conda + sha256: d164dfa75ecd538f6fd68765defcc06aa875bc697b9b215362d79a2a73125dd0 + md5: e741576fb8f89821ac7c1c537322a33d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + license: MIT + license_family: MIT + run_exports: + weak: + - yaml >=0.2.5,<0.3.0a0 + size: 84936 + timestamp: 1787228426393 +- conda: https://conda.anaconda.org/conda-forge/linux-64/zensical-0.1.1-py311h7b25dd4_0.conda + noarch: python + sha256: ebc742d9fb379736ce379d6e1d2750450548ccae25c518b5317e11a9f03168bd + md5: 5e4b7d9df92a14258ffed0c31be2abe9 + depends: + - python + - click >=8.1.8 + - markdown >=3.7 + - pygments >=2.20 + - pymdown-extensions >=11.0 + - pyyaml >=6.0.2 + - tomli >=2.4.0 + - jinja2 >=3.1 + - pathspec >=1.0.4 + - zensical-ui ==0.0.42 + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + - _python_abi3_support 1.* + - cpython >=3.11 + constrains: + - __glibc >=2.17 + license: MIT + license_family: MIT + run_exports: {} + size: 7813059 + timestamp: 1794378251094 +- conda: https://conda.anaconda.org/conda-forge/noarch/_python_abi3_support-1.0-hd8ed1ab_3.conda + sha256: 2a7204314663eeda5dec482a956f0e2eaf289bd5b9953eaaaad0e81aa64638f2 + md5: 3845f3d75991bae0fb90884662f4327c + depends: + - cpython + - python-gil + license: MIT + license_family: MIT + run_exports: {} + size: 8144 + timestamp: 1784221492234 +- conda: https://conda.anaconda.org/conda-forge/noarch/click-8.5.1-pyh5ded981_0.conda + sha256: f26981878e8ccdc82fc9025d25997aff119080486e5d089948cb718d428d8cb0 + md5: d996564510ceb5744c225b93891316dc + depends: + - python >=3.11 + - python + license: BSD-3-Clause + license_family: BSD + run_exports: {} + size: 112921 + timestamp: 1794046236533 +- conda: https://conda.anaconda.org/conda-forge/noarch/cpython-3.15.2-py315hd8ed1ab_100.conda + noarch: generic + sha256: 5433d0f101e153f35b99809cf81bd04ebf8d6a97c07af9ea2f5c998d624d6fe7 + md5: 6c0b7c2ddf16d1a1dabfa0847641b518 + depends: + - python >=3.15,<3.16.0a0 + - python_abi * *_cp315 + license: Python-2.0 + run_exports: {} + size: 52891 + timestamp: 1793014812118 +- conda: https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.6-pyhcf101f3_1.conda + sha256: fc9ca7348a4f25fed2079f2153ecdcf5f9cf2a0bc36c4172420ca09e1849df7b + md5: 04558c96691bed63104678757beb4f8d + depends: + - markupsafe >=2.0 + - python >=3.10 + - python + license: BSD-3-Clause + license_family: BSD + run_exports: {} + size: 120685 + timestamp: 1764517220861 +- conda: https://conda.anaconda.org/conda-forge/noarch/markdown-3.11.3-pyh5ded981_0.conda + sha256: 00d8eab9985c4c23b4a6f3c4e6c89e220b18a54e80b07fcc73fba3fac007f067 + md5: 3b24b328ea4593136b77ec4b7b2bec74 + depends: + - importlib-metadata >=4.4 + - python >=3.11 + - python + license: BSD-3-Clause + license_family: BSD + run_exports: {} + size: 91718 + timestamp: 1793922176577 +- conda: https://conda.anaconda.org/conda-forge/noarch/munkres-1.1.4-pyhd8ed1ab_1.conda + sha256: d09c47c2cf456de5c09fa66d2c3c5035aa1fa228a1983a433c47b876aa16ce90 + md5: 37293a85a0f4f77bbd9cf7aaefc62609 + depends: + - python >=3.9 + license: Apache-2.0 + license_family: Apache + run_exports: {} + size: 15851 + timestamp: 1749895533014 +- conda: https://conda.anaconda.org/conda-forge/noarch/pathspec-1.1.1-pyhd8ed1ab_0.conda + sha256: 6eaee417d33f298db79bc7185ab1208604c0e6cf51dade34cd513c6f9db9c6f3 + md5: 11adc78451c998c0fd162584abfa3559 + depends: + - python >=3.10 + license: MPL-2.0 + license_family: MOZILLA + run_exports: {} + size: 56559 + timestamp: 1777271601895 +- conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.21.0-pyhcf101f3_0.conda + sha256: f5f015ff1bc3e1b7fc08eee096b1865234189ae0b82bebdb86a5369116e42fa0 + md5: 2882dee445dfa45b0c5afce3ffb7730a + depends: + - python >=3.10 + - python + license: BSD-2-Clause + license_family: BSD + run_exports: {} + size: 959376 + timestamp: 1786995678795 +- conda: https://conda.anaconda.org/conda-forge/noarch/pymdown-extensions-13.1-pyhd8ed1ab_0.conda + sha256: 78804f8a554cee0dc29545760a8ac92f798c35ded9623496f7d0a0f7e77b3004 + md5: 76c6f01aa602a93377f74b246caf4fb5 + depends: + - markdown >=3.10.3 + - python >=3.11 + - pyyaml + license: MIT + license_family: MIT + run_exports: {} + size: 185558 + timestamp: 1794435013218 +- conda: https://conda.anaconda.org/conda-forge/noarch/python-gil-3.15.2-h4df99d1_100.conda + sha256: 631a77b41660202c5d4d551aa1816ce550cc6921352ca3d57ac58d0364cab670 + md5: beef54f8f4201e9f86f8733cef15506d + depends: + - cpython 3.15.2.* + - python_abi * *_cp315 + license: Python-2.0 + run_exports: {} + size: 52881 + timestamp: 1793014838911 +- conda: https://conda.anaconda.org/conda-forge/noarch/zensical-ui-0.0.42-pyh5ded981_0.conda + sha256: ffcf5a93a8d57d248f2ec4b817fd7025ec38a4ad320acb3e382e22b6f2705edd + md5: d66c10adf1915fd628db043f3aed8715 + depends: + - python >=3.11 + - python + license: MIT + license_family: MIT + run_exports: {} + size: 4721527 + timestamp: 1794336711109 +- conda: https://prefix.dev/nandi-testing/linux-64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: 1dd3fffd892081df9726d7eb7e0dea6198962ba775bd88842135a4ddb4deb3c9 + md5: a9f577daf3de00bca7c3c76c0ecbd1de + depends: + - __glibc >=2.17,<3.0.a0 + - libgomp >=7.5.0 + constrains: + - openmp_impl <0.0a0 + license: BSD-3-Clause + run_exports: + strong: + - _openmp_mutex >=4.5 + size: 28948 + timestamp: 1770939786096 +- conda: https://prefix.dev/nandi-testing/linux-64/bzip2-1.0.8-hda65f42_10.conda + sha256: 1a0d382c515ebf55f8ee1f38c8b81bc95af5c2acc42ad53b66bc5df932032f96 + md5: e675fabcf81499adc7edf58124fb1e01 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + run_exports: + weak: + - bzip2 >=1.0.8,<2.0a0 + size: 257808 + timestamp: 1785906269155 +- conda: https://prefix.dev/nandi-testing/linux-64/c-ares-1.34.9-hebe6cf0_0.conda + sha256: bd95dd25b80b5c4faf5349542377bf89b2794e23d0f7aa7f1c431e4f3b633f3c + md5: 78b505af04bf7a87ca957ef0cb5946f5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + license: MIT + run_exports: + weak: + - c-ares >=1.34.9,<2.0a0 + size: 233759 + timestamp: 1792507024648 +- conda: https://prefix.dev/nandi-testing/linux-64/icu-78.3-py310h44b86e0_2.conda + sha256: 9f07834f0c546ab14d885ce0366285f61f44e326c0edd1fc63b8294e113ae432 + md5: 72a381cbad04f24b1c2a43ef707f45b4 + depends: + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + license: MIT + run_exports: + weak: + - icu >=78.3,<79.0a0 + size: 14459115 + timestamp: 1786545741408 +- conda: https://prefix.dev/nandi-testing/linux-64/jco-1.41.0-hb0f4dca_0.conda + sha256: a1d13934c0deda1fe1b87477b09bdfbbe0a15f7d0853e86770298f99a48d0eb1 + md5: f604ca17ec935c985f91a5efe179be06 + depends: + - nodejs >=20 + license: Apache-2.0 WITH LLVM-exception + run_exports: {} + size: 76812028 + timestamp: 1794351630770 +- conda: https://prefix.dev/nandi-testing/linux-64/keyutils-1.6.3-h7cc23a3_1.conda + sha256: dd053c96dcb0dcfd59422aefea9d2fe937a190167f34fba7893ec1e10a7e8963 + md5: ba55d1b89fd7775e67de8291029b4059 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + license: LGPL-2.1-or-later + run_exports: + weak: + - keyutils >=1.6.3,<2.0a0 + size: 135295 + timestamp: 1786739238128 +- conda: https://prefix.dev/nandi-testing/linux-64/krb5-1.22.2-hbc21106_2.conda + sha256: 2a5c38c85e63df84c4e69ee71439841ce570d259ae3060627bb9a49a938d66f4 + md5: 53318d715316929a574f83591308b1f8 + depends: + - __glibc >=2.17,<3.0.a0 + - keyutils >=1.6.3,<2.0a0 + - libedit >=3.1.20250104,<3.2.0a0 + - libedit >=3.1.20250104,<4.0a0 + - libgcc >=15 + - libstdcxx >=15 + - openssl >=3.5.7,<4.0a0 + license: MIT + run_exports: + weak: + - krb5 >=1.22.2,<1.23.0a0 + size: 1394333 + timestamp: 1786762112514 +- conda: https://prefix.dev/nandi-testing/linux-64/ld_impl_linux-64-2.46.1-default_hbd61a6d_103.conda + sha256: 901649b1edbe841fd4ee7e2d491a05184ed540eb01cdae506872f344babc1d28 + md5: 2362c70e7e79827c32db35547d9c179b + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.46.1 + license: GPL-3.0-only + run_exports: {} + size: 742109 + timestamp: 1791565468810 +- conda: https://prefix.dev/nandi-testing/linux-64/libabseil-20260526.0-cxx17_h0dc7533_2.conda + sha256: 7bb3d495411b7059e85225aae500d84e7846a4bb02ebd77e4450200b20c180f0 + md5: 6983bfe8e09992014b9cf393769c7a84 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - abseil-cpp =20260526.0 + - libabseil-static =20260526.0=cxx17* + license: Apache-2.0 + license_family: Apache + run_exports: + weak: + - libabseil >=20260526.0,<20260527.0a0 + - libabseil =*=cxx17* + size: 1436888 + timestamp: 1787217011773 +- conda: https://prefix.dev/nandi-testing/linux-64/libbrotlicommon-1.2.1-h39a168f_0.conda + sha256: 8eccfbfdb8ecba32eabfb6ee92f70e818e5f3a35a01c507f7b6bd56e00e4c617 + md5: 9460bdde20bcdf9e6bbef0232b14ad2d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + license: MIT + run_exports: + weak: + - libbrotlicommon >=1.2.1,<1.3.0a0 + size: 80370 + timestamp: 1792653685570 +- conda: https://prefix.dev/nandi-testing/linux-64/libbrotlidec-1.2.1-ha411449_0.conda + sha256: 4b4bda6f70ad511bdff95fdd958dca74b6e0534ae335ddcb1d8c6569774d2429 + md5: 6d934e235f4d452ebec720ec7c3638a6 + depends: + - __glibc >=2.17,<3.0.a0 + - libbrotlicommon 1.2.1 h39a168f_0 + - libgcc >=15 + license: MIT + run_exports: + weak: + - libbrotlidec >=1.2.1,<1.3.0a0 + size: 34703 + timestamp: 1792653694124 +- conda: https://prefix.dev/nandi-testing/linux-64/libbrotlienc-1.2.1-h018ffa1_0.conda + sha256: 61974cf9bb07115ed6725dacf83d0d985443d78dd123cc4f2758856fda5376ec + md5: 8f3078564b4a4cd9602ebaafe78e0b87 + depends: + - __glibc >=2.17,<3.0.a0 + - libbrotlicommon 1.2.1 h39a168f_0 + - libgcc >=15 + license: MIT + run_exports: + weak: + - libbrotlienc >=1.2.1,<1.3.0a0 + size: 298098 + timestamp: 1792653699767 +- conda: https://prefix.dev/nandi-testing/linux-64/libcurl-8.23.0-ha042cf0_0.conda + sha256: d2db14d80efb4f2e76e76561c633f1767f7543987f2bcb54a067a9d264d432ab + md5: 0ad16151226df493aed967f0efce0e80 + depends: + - __glibc >=2.17,<3.0.a0 + - krb5 >=1.22.2,<1.23.0a0 + - libgcc >=15 + - libnghttp2 >=1.68.1,<2.0a0 + - libpsl >=0.23.1,<0.24.0a0 + - libssh2 >=1.11.1,<2.0a0 + - libzlib >=1.3.2,<2.0a0 + - openssl >=3.5.9,<4.0a0 + - zstd >=1.5.7,<1.6.0a0 + license: curl + license_family: MIT + run_exports: + weak: + - libcurl >=8.23.0,<9.0a0 + size: 505683 + timestamp: 1791990900844 +- conda: https://prefix.dev/nandi-testing/linux-64/libedit-3.1.20260512-pl5321h373387f_0.conda + sha256: 45301f14f4eb66da57cfaf2d265f3eeee73f8b07e99614ee3afc5b26eea91126 + md5: 27dbd7e2984b8fe48e069379636ccfdd + depends: + - ncurses + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - ncurses >=6.6,<7.0a0 + license: BSD-2-Clause + run_exports: + weak: + - libedit >=3.1.20260512,<3.2.0a0 + size: 135877 + timestamp: 1791327370514 +- conda: https://prefix.dev/nandi-testing/linux-64/libev-4.33-h280c20c_3.conda + sha256: e4418f68d01a6307c4431b585c71b584f40189877364e542ee87deb777f5e85b + md5: 7bc31538d6e3fb349e897353969237ec + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: BSD-2-Clause OR GPL-2.0-or-later + run_exports: + weak: + - libev >=4.33,<4.34.0a0 + size: 43220 + timestamp: 1785917328200 +- conda: https://prefix.dev/nandi-testing/linux-64/libexpat-2.9.0-hd2095e1_0.conda + sha256: 7b930a8b6bc6553cb754b4977a11f9c862c719a652fc2d128d89270992ce8beb + md5: 317ecabe4a58b3068c7958dc5eb89e43 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + constrains: + - expat 2.9.0.* + license: MIT + license_family: MIT + run_exports: {} + size: 78894 + timestamp: 1793054221966 +- conda: https://prefix.dev/nandi-testing/linux-64/libffi-3.7.0-h81df57d_1.conda + sha256: c8c7583ef063bc3c430f1d48298e5ad24f796a35c22ed5b14183325825a61106 + md5: 6525a0b06aa4fd390795f0740636a9dd + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + license: MIT + run_exports: + weak: + - libffi >=3.7.0,<3.8.0a0 + size: 68004 + timestamp: 1787753412298 +- conda: https://prefix.dev/nandi-testing/linux-64/libgcc-16.2.0-ha9f2e26_7.conda + sha256: e031634c3a928f9594eba868bc46ef5230d6571a364a0c63215b06c4563bfcea + md5: 735629b400b70eeab21a2ba8f5b1c2ce + depends: + - __glibc >=2.17,<3.0.a0 + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==16.2.0=*_7 + - libgomp 16.2.0 he0feb66_7 + license: GPL-3.0-only WITH GCC-exception-3.1 + run_exports: {} + size: 1058444 + timestamp: 1790303109576 +- conda: https://prefix.dev/nandi-testing/linux-64/libgomp-16.2.0-he0feb66_7.conda + sha256: 92a0bb350c7be6a4eedcb4e111c60aefd176018e6b1c009a6e025dbe9bbcd758 + md5: d904c7ddd95e026254b4b80808ee9e12 + depends: + - __glibc >=2.17,<3.0.a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + run_exports: + strong: + - _openmp_mutex >=4.5 + size: 640566 + timestamp: 1790303046034 +- conda: https://prefix.dev/nandi-testing/linux-64/liblzma-5.8.3-hb03c661_1.conda + sha256: 9787df8c22a59c9a70d3e5a10db9ad663485e75e9ccc3f09bd092cb7b95e0dab + md5: 1390b7c5ac0b1d8e447bc5efa6d3c8c2 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - xz 5.8.3.* + license: 0BSD + run_exports: + weak: + - liblzma >=5.8.3,<6.0a0 + size: 112995 + timestamp: 1786348617826 +- conda: https://prefix.dev/nandi-testing/linux-64/libmpdec-4.0.0-hb03c661_2.conda + sha256: 46820b4a835e175940ae20bec00fdddaff804cda27a1408ab1b95e77a2196437 + md5: fcfed1dc5053eb1901b66e7b1fc32588 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-2-Clause + run_exports: {} + size: 92759 + timestamp: 1786650399772 +- conda: https://prefix.dev/nandi-testing/linux-64/libnghttp2-1.71.0-hc5e5977_0.conda + sha256: a4386712ad6d5bc18943b198407c39e2f8ae2fa9c6418bb37bba96f1d382f109 + md5: 726df214814a8b06135a6a674bc54589 + depends: + - libev >=4.33,<5.0a0 + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + - libstdcxx >=15 + - libev >=4.33,<4.34.0a0 + - c-ares >=1.34.9,<2.0a0 + - libzlib >=1.3.2,<2.0a0 + - openssl >=3.5.9,<4.0a0 + license: MIT + run_exports: + weak: + - libnghttp2 >=1.71.0,<2.0a0 + size: 822778 + timestamp: 1793628201366 +- conda: https://prefix.dev/nandi-testing/linux-64/libpsl-0.23.1-hd9e3e90_1.conda + sha256: 09e8effdc89bc5d021349318d32b85594f5b8d8e3ab8f90a85b81f8fe695a566 + md5: 77be60417aa572afcb48cbe0f967401d + depends: + - libstdcxx >=15 + - libgcc >=15 + - __glibc >=2.17,<3.0.a0 + - icu >=78.3,<79.0a0 + license: MIT + license_family: MIT + run_exports: + weak: + - libpsl >=0.23.1,<0.24.0a0 + size: 72519 + timestamp: 1786970753847 +- conda: https://prefix.dev/nandi-testing/linux-64/libsqlite-3.54.1-h13e7031_0.conda + sha256: 07b3c98282022f05781122d073f84e944bfb4299946e8457ece3ce6c384ff78e + md5: 8f15f0ec9b69344df5c3bb5cce1751a1 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.3,<79.0a0 + - libgcc >=15 + - libzlib >=1.3.2,<2.0a0 + license: blessing + run_exports: + weak: + - libsqlite >=3.54.1,<4.0a0 + size: 983668 + timestamp: 1792175587601 +- conda: https://prefix.dev/nandi-testing/linux-64/libssh2-1.11.1-h6154650_1.conda + sha256: 7e463000fa1cba3f3a6597b776f6ab301d425a96e3bc20d0d9d76a3b9f237aa3 + md5: 5c526561e1d2a2e071941174eae84557 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libzlib >=1.3.2,<2.0a0 + - openssl >=3.5.7,<4.0a0 + license: BSD-3-Clause + license_family: BSD + run_exports: + weak: + - libssh2 >=1.11.1,<2.0a0 + size: 306045 + timestamp: 1786713107897 +- conda: https://prefix.dev/nandi-testing/linux-64/libstdcxx-16.2.0-h934c35e_7.conda + sha256: fa7018298629fc429971fffd6ecba3d27a7b02e4e890d6a93ea01ffebe8cb745 + md5: 9b6707e0caca917fa6ea9ee473f37a5d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc 16.2.0 ha9f2e26_7 + constrains: + - libstdcxx-ng ==16.2.0=*_7 + license: GPL-3.0-only WITH GCC-exception-3.1 + run_exports: {} + size: 6615436 + timestamp: 1790303132935 +- conda: https://prefix.dev/nandi-testing/linux-64/libuuid-2.42.4-hcfc3c73_1.conda + sha256: 0e2e8f2daa9306e67f046e31092d637431d8cf0a26c407ab22401d108c2d4631 + md5: d852293faea3c04a6e896b908b43aded + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15 + license: BSD-3-Clause + run_exports: + weak: + - libuuid >=2.42.4,<3.0a0 + size: 36134 + timestamp: 1793891599274 +- conda: https://prefix.dev/nandi-testing/linux-64/libuv-1.52.1-h280c20c_1.conda + sha256: 67761d0206f84140047a367eaf9befe03a7e157a29ee25aee0047b40801cc6b6 + md5: 01c4ed87826af55996768af6dbc936b4 + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: MIT + run_exports: + weak: + - libuv >=1.52.1,<2.0a0 + size: 420040 + timestamp: 1785914567661 +- conda: https://prefix.dev/nandi-testing/linux-64/libzlib-1.3.2-h25fd6f3_3.conda + sha256: eb8a0db0aa570124f7d2a93d7c7f596e3390df5e047818d873baad32985fc736 + md5: 0de0122d9570a8ab637c6b73db268389 + depends: + - __glibc >=2.17,<3.0.a0 + constrains: + - zlib 1.3.2 *_3 + license: Zlib + license_family: Other + run_exports: + weak: + - libzlib >=1.3.2,<2.0a0 + size: 63713 + timestamp: 1785362952714 +- conda: https://prefix.dev/nandi-testing/linux-64/ncurses-6.6-hdb14827_1.conda + sha256: 5d46557214ed184381dafe835b7c94a474a1c3b307a08a250b1ea4779b44ffb3 + md5: ee6c0cd80a60961a1f48aa3e0b91f986 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: X11 AND BSD-3-Clause + run_exports: + weak: + - ncurses >=6.6,<7.0a0 + size: 911196 + timestamp: 1786355078102 +- conda: https://prefix.dev/nandi-testing/linux-64/nodejs-26.10.0-ha5cdc1e_0.conda + sha256: ea1ae98c7352198d6d6a4027f4a60d2b634e05d5fd6f0b97e72fc6c16712b2c7 + md5: 46a3d9861f49b845fbd54897ff07fe4f + depends: + - libgcc >=15 + - __glibc >=2.28,<3.0.a0 + - libstdcxx >=15 + - zstd >=1.5.7,<1.6.0a0 + - libzlib >=1.3.2,<2.0a0 + - libuv >=1.52.1,<2.0a0 + - openssl >=3.5.8,<4.0a0 + - libnghttp2 >=1.68.1,<2.0a0 + - libabseil >=20260526.0,<20260527.0a0 + - libabseil * cxx17* + - icu >=78.3,<79.0a0 + - c-ares >=1.34.8,<2.0a0 + - libsqlite >=3.53.4,<4.0a0 + - libbrotlicommon >=1.2.0,<1.3.0a0 + - libbrotlienc >=1.2.0,<1.3.0a0 + - libbrotlidec >=1.2.0,<1.3.0a0 + license: MIT + run_exports: + weak: + - nodejs >=26.10.0,<27.0a0 + size: 20474429 + timestamp: 1790238478566 +- conda: https://prefix.dev/nandi-testing/linux-64/openssl-3.6.5-h781a0a9_0.conda + sha256: 9c1533f1cf784f0e250919c0c9762d0b0e6bc727a79290ffb7cea1ceca1d038c + md5: 5a51a2ea653f120240b1a9bf76e0aae9 + depends: + - __glibc >=2.17,<3.0.a0 + - ca-certificates + - libgcc >=15 + license: Apache-2.0 + license_family: Apache + run_exports: + weak: + - openssl >=3.6.5,<4.0a0 + size: 3195299 + timestamp: 1791098052301 +- conda: https://prefix.dev/nandi-testing/linux-64/python-3.15.2-h6e52b48_100_cp315.conda + build_number: 100 + sha256: dd6fdef748df5636029673a834ca3632ce44c86d71e4986d70bcdb2ae5607a25 + md5: 38c3edc23439db3ca383be02ae2b702e + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libedit >=3.1.20260512,<3.2.0a0 + - libexpat >=2.8.5,<3.0a0 + - libffi >=3.7.0,<3.8.0a0 + - libgcc >=15 + - liblzma >=5.8.3,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.54.1,<4.0a0 + - libuuid >=2.42.4,<3.0a0 + - libzlib >=1.3.2,<2.0a0 + - ncurses >=6.6,<7.0a0 + - openssl >=3.5.9,<4.0a0 + - python_abi 3.15.* *_cp315 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + run_exports: + weak: + - python_abi 3.15.* *_cp315 + noarch: + - python + size: 29327137 + timestamp: 1793015518763 + python_site_packages_path: lib/python3.15/site-packages +- conda: https://prefix.dev/nandi-testing/linux-64/qt6-wasi-6.8.3-hb0f4dca_0.conda + sha256: 2e4fbae5c9cadf88828935715572474256cb6500d664f0b3214df98b49fa84e9 + md5: 1f76619fb958e5df8dcc62480912857d + depends: + - wasi-sdk 27.* + - cmake >=3.21 + - ninja + - libgcc >=16 + - libstdcxx >=16 + license: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + run_exports: {} + size: 20849123 + timestamp: 1794274326934 +- conda: https://prefix.dev/nandi-testing/linux-64/tk-8.6.13-noxft_h1df4ec4_4.conda + build_number: 104 + sha256: a1a241d172c1ccab067ba245206dd048bc3c2d1b84504b53c9468e99adfc16a1 + md5: 676a2f9b1c4fcf57b70aa5c65f6c60d0 + depends: + - libgcc >=15 + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.2,<2.0a0 + constrains: + - xorg-libx11 >=1.8.13,<2.0a0 + license: TCL + run_exports: + weak: + - tk >=8.6.13,<8.7.0a0 + size: 3566806 + timestamp: 1787272857910 +- conda: https://prefix.dev/nandi-testing/linux-64/wasi-sdk-27.0-hb0f4dca_1.conda + sha256: e8f23f48de592aadf0ae773bc0feda1a46de174b8f49b85006c6ea06e86b8a5b + md5: 0054d5f0e3da6fc37d6510157fbcc03b + license: Apache-2.0 WITH LLVM-exception + run_exports: {} + size: 100198008 + timestamp: 1794273876363 +- conda: https://prefix.dev/nandi-testing/linux-64/wasm-tools-1.239.0-hb0f4dca_0.conda + sha256: 649e7ba5b6476e7ffb4b1d093bc1c22355258693013145e7659e3ee29d8ee40c + md5: aea1c6d0cc71e9027022bcd2856e6b61 + license: Apache-2.0 WITH LLVM-exception + run_exports: {} + size: 5669897 + timestamp: 1794274014481 +- conda: https://prefix.dev/nandi-testing/linux-64/wit-bindgen-0.46.0-hb0f4dca_0.conda + sha256: 48132c985e85cc499e9dc9c899a6da0947c923938d6d0595a78ea780f0941df5 + md5: e54e97c7f9a0690d2a13c2e1e2cf82d1 + license: Apache-2.0 WITH LLVM-exception + run_exports: {} + size: 5453568 + timestamp: 1794273951520 +- conda: https://prefix.dev/nandi-testing/linux-64/zstd-1.5.7-hb78ec9c_7.conda + sha256: 47d682b9f6d6ec9eb1a6e6c3e75ea6273e899e78fb7fc59f81d39745009fbc60 + md5: aa459086047c0e5e27023ab19f8cb86a + depends: + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.2,<2.0a0 + license: BSD-3-Clause + run_exports: + weak: + - zstd >=1.5.7,<1.6.0a0 + size: 601301 + timestamp: 1786599621503 +- conda: https://prefix.dev/nandi-testing/noarch/ca-certificates-2026.10.23-hbd8a1cb_0.conda + sha256: 95619b9c1184be7175392eeb0ee7eeb5ccf25d280951f4225f2d62e725790be3 + md5: 3fd02989038a1e1cee627c14c2d73f29 + depends: + - __unix + license: ISC + run_exports: {} + size: 130057 + timestamp: 1792772446739 +- conda: https://prefix.dev/nandi-testing/noarch/importlib-metadata-9.0.1-pyhcf101f3_0.conda + sha256: 95a074a7d3f58b3494c068d4789c364dcb591c56b70ca6b12f149a540f9aeea4 + md5: 77ec68e0aa61c3fff9ecbf840f93d64e + depends: + - python >=3.10 + - zipp >=3.20 + - python + license: Apache-2.0 + run_exports: {} + size: 34920 + timestamp: 1787943971257 +- conda: https://prefix.dev/nandi-testing/noarch/python_abi-3.15-9_cp315.conda + build_number: 9 + sha256: 976c4a6db967a62385aa633daaab19a929f986b979a7ad836b8b70e15ca7aefd + md5: b23461631fe2abdbade0cb64babe7344 + constrains: + - python 3.15.* *_cp315 + license: BSD-3-Clause + license_family: BSD + run_exports: {} + size: 6800 + timestamp: 1788302827589 +- conda: https://prefix.dev/nandi-testing/noarch/qt2wasm-0.10.6-pyh4616a5c_0.conda + sha256: 54c4ee91b29d1052cc2c95881b45b3ed7282665e9ca3fdf76820dd102cd8e202 + md5: 09279c4ecd79abf9642ae733faaf4ebb + depends: + - python >=3.10 + - python * + - cmake >=3.21 + - ninja + - binaryen + - fonttools + - qt6-wasi 6.8.3.* + - wit-bindgen 0.46.* + - wasm-tools 1.239.* + - wasi-preview1-adapter 36.* + - zensical >=0.1 + - jco 1.41.* + run_exports: {} + size: 74111 + timestamp: 1794580144578 +- conda: https://prefix.dev/nandi-testing/noarch/tomli-2.5.0-pyh5ded981_0.conda + sha256: 93b6f517fb7adff00b62be02b798d384a1b34d0e368fdb576fb248bcb3bb9ec7 + md5: 36d6a162326c52d6339c8b606f43932d + depends: + - python >=3.11 + - python + license: MIT + run_exports: {} + size: 21687 + timestamp: 1791394576814 +- conda: https://prefix.dev/nandi-testing/noarch/tzdata-2026e-h5d301ff_0.conda + sha256: 2b7ca858879f183ce2dcc65b300f48a0133d5430550f35b23d80d405a0788dbf + md5: abccc3810d2b97e570dee487f2b46e38 + license: LicenseRef-Public-Domain + run_exports: {} + size: 119208 + timestamp: 1792758382821 +- conda: https://prefix.dev/nandi-testing/noarch/wasi-preview1-adapter-36.0.0-h4616a5c_0.conda + sha256: 0b1610b24de6cc92d12db20b13e14fe1f989bc43543c972a1b372c0f069a797b + md5: b9137fc4706585a3da7f55c72f93d309 + license: Apache-2.0 WITH LLVM-exception + run_exports: {} + size: 19423 + timestamp: 1794274078296 +- conda: https://prefix.dev/nandi-testing/noarch/zipp-4.1.2-pyh5ded981_0.conda + sha256: 4e5c50cf5ecc00d83a20b987c52d49b78fa96026437ab09b11f4b7c46b7fc061 + md5: 3a99defa674883e167603f141728de7e + depends: + - python >=3.11 + - python + license: MIT + license_family: MIT + run_exports: {} + size: 24791 + timestamp: 1792622774790 diff --git a/wasi/pixi.toml b/wasi/pixi.toml new file mode 100644 index 0000000..4411088 --- /dev/null +++ b/wasi/pixi.toml @@ -0,0 +1,12 @@ +[workspace] +name = "ultra-launcher-wasi" +channels = ["https://prefix.dev/nandi-testing", "conda-forge"] +platforms = ["linux-64"] + +[dependencies] +qt2wasm = "*" +cmake = "*" +ninja = "*" + +[tasks] +build = { cmd = "bash build.sh", description = "Build launcher.wasm (WASI component)" } diff --git a/wasi/src/launcher_window.cpp b/wasi/src/launcher_window.cpp new file mode 100644 index 0000000..cc51ab1 --- /dev/null +++ b/wasi/src/launcher_window.cpp @@ -0,0 +1,780 @@ +#include "launcher_window.h" + +#include "gui.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace { + +gui_string_t toWitStr(const QString &s) { + QByteArray utf8 = s.toUtf8(); + gui_string_t out; + gui_string_dup(&out, utf8.constData()); + return out; +} + +QString fromWitStr(const gui_string_t &s) { + return QString::fromUtf8(reinterpret_cast(s.ptr), int(s.len)); +} + +QByteArray fromWitBytes(const gui_string_t &s) { + return QByteArray(reinterpret_cast(s.ptr), int(s.len)); +} + +} // namespace + +LauncherWindow::LauncherWindow() { + setTitle(QStringLiteral("ultra Home")); + QSurfaceFormat fmt = format(); + fmt.setAlphaBufferSize(8); + setFormat(fmt); + resize(412, 892); + + refreshInsets(); + loadHome(); + refreshApps(); + m_pollTimer.start(100, this); +} + +void LauncherWindow::refreshInsets() { + gui_tuple2_u32_u32_t ins{}; + ultra_launcher_android_insets(&ins); + if (int(ins.f0) != m_physInsetTop || int(ins.f1) != m_physInsetBottom) { + m_physInsetTop = int(ins.f0); + m_physInsetBottom = int(ins.f1); + update(); + } +} + +void LauncherWindow::refreshApps() { + gui_string_t raw{}; + ultra_launcher_android_apps(&raw); + QByteArray json = fromWitBytes(raw); + gui_string_free(&raw); + + QJsonDocument doc = QJsonDocument::fromJson(json); + QJsonArray arr = doc.object().value(QStringLiteral("apps")).toArray(); + + m_apps.clear(); + m_appIndex.clear(); + m_apps.reserve(arr.size()); + for (const QJsonValue &v : arr) { + QJsonObject o = v.toObject(); + AppInfo info; + info.label = o.value(QStringLiteral("label")).toString(); + info.component = o.value(QStringLiteral("component")).toString(); + info.system = o.value(QStringLiteral("system")).toBool(false); + if (!info.component.isEmpty()) { + m_appIndex.insert(info.component, m_apps.size()); + m_apps.append(info); + } + } + update(); +} + +void LauncherWindow::loadHome() { + QFile f(QStringLiteral("/data/home.json")); + if (!f.open(QIODevice::ReadOnly)) return; + QJsonDocument doc = QJsonDocument::fromJson(f.readAll()); + if (!doc.isArray()) return; + m_home.clear(); + for (const QJsonValue &v : doc.array()) { + QJsonObject o = v.toObject(); + if (o.value(QStringLiteral("kind")).toString(QStringLiteral("app")) != QLatin1String("app")) + continue; + QString comp = o.value(QStringLiteral("str")).toString(); + if (comp.isEmpty()) continue; + Layout::HomeSlot slot; + slot.component = comp; + slot.x = o.value(QStringLiteral("x")).toInt(-1); + slot.y = o.value(QStringLiteral("y")).toInt(-1); + m_home.append(slot); + if (m_home.size() >= 200) break; + } +} + +void LauncherWindow::saveHome() const { + QDir().mkpath(QStringLiteral("/data")); + QJsonArray arr; + for (const auto &s : m_home) { + QJsonObject o; + o.insert(QStringLiteral("kind"), QStringLiteral("app")); + o.insert(QStringLiteral("str"), s.component); + o.insert(QStringLiteral("x"), s.x); + o.insert(QStringLiteral("y"), s.y); + arr.append(o); + } + QFile f(QStringLiteral("/data/home.json")); + if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + f.write(QJsonDocument(arr).toJson(QJsonDocument::Compact)); + } +} + +QImage LauncherWindow::iconFor(const QString &component, int px) { + const QString cacheKey = component + QLatin1Char('@') + QString::number(px); + auto it = m_icons.constFind(cacheKey); + if (it != m_icons.constEnd()) return it.value(); + if (m_missingIcons.contains(cacheKey)) return {}; + + gui_string_t witKey = toWitStr(QStringLiteral("a:") + component); + gui_string_t b64{}; + bool ok = ultra_launcher_android_icon(&witKey, uint32_t(px), &b64); + gui_string_free(&witKey); + if (!ok) { + m_missingIcons.insert(cacheKey); + return {}; + } + + QByteArray raw = QByteArray::fromBase64(fromWitBytes(b64)); + gui_string_free(&b64); + const int side = int(std::lround(std::sqrt(raw.size() / 4.0))); + if (side <= 0 || side * side * 4 != raw.size()) { + m_missingIcons.insert(cacheKey); + return {}; + } + QImage img(side, side, QImage::Format_RGBA8888_Premultiplied); + std::memcpy(img.bits(), raw.constData(), size_t(raw.size())); + m_icons.insert(cacheKey, img); + return img; +} + +void LauncherWindow::pollHostEvents() { + gui_list_string_t evs{}; + ultra_launcher_android_poll_events(&evs); + bool changedApps = false; + for (size_t i = 0; i < evs.len; ++i) { + const QString ev = fromWitStr(evs.ptr[i]); + if (ev == QLatin1String("home")) { + closeSheet(); + closeDrawer(); + m_liftedHome = -1; + m_homeScroll = 0.0; + update(); + } else if (ev == QLatin1String("back")) { + if (m_sheet != SheetKind::None) { + closeSheet(); + } else if (m_drawerOpen) { + closeDrawer(); + } else if (m_liftedHome >= 0) { + m_liftedHome = -1; + update(); + } + } else if (ev == QLatin1String("insets")) { + refreshInsets(); + } else if (ev.startsWith(QLatin1String("apps-changed:"))) { + const QString pkgs = ev.mid(13); + if (pkgs.isEmpty()) { + m_icons.clear(); + m_missingIcons.clear(); + } else { + const QStringList list = pkgs.split(QLatin1Char(','), Qt::SkipEmptyParts); + for (const QString &p : list) { + const QString prefix = p + QLatin1Char('/'); + for (auto it = m_icons.begin(); it != m_icons.end();) { + if (it.key().startsWith(prefix)) it = m_icons.erase(it); + else ++it; + } + for (auto it = m_missingIcons.begin(); it != m_missingIcons.end();) { + if (it->startsWith(prefix)) it = m_missingIcons.erase(it); + else ++it; + } + } + } + changedApps = true; + } + } + gui_list_string_free(&evs); + if (changedApps) refreshApps(); +} + +// ---- Geometry ---- + +qreal LauncherWindow::insetTop() const { return m_physInsetTop / devicePixelRatio(); } +qreal LauncherWindow::insetBottom() const { return m_physInsetBottom / devicePixelRatio(); } +qreal LauncherWindow::contentW() const { return std::min(width(), 560.0); } +qreal LauncherWindow::contentX() const { return (width() - contentW()) / 2.0; } +qreal LauncherWindow::gridX() const { return contentX() + 16.0; } +qreal LauncherWindow::gridW() const { return contentW() - 32.0; } +int LauncherWindow::homeCols() const { return width() >= 480 ? 6 : 5; } +qreal LauncherWindow::homeColW() const { + const int cols = homeCols(); + return (gridW() - (cols - 1) * Layout::kColGap) / cols; +} +qreal LauncherWindow::panelY() const { return insetTop() + 16.0; } +qreal LauncherWindow::gridTop() const { return panelY() + 54.0 + 16.0; } + +QRectF LauncherWindow::appsPillRect() const { + return QRectF(gridX(), panelY(), gridW(), 54.0); +} + +QRectF LauncherWindow::drawerSearchRect() const { + const qreal closeW = 72.0; + return QRectF(gridX(), insetTop() + 14.0, gridW() - closeW - 10.0, 48.0); +} + +QRectF LauncherWindow::drawerCloseRect() const { + const QRectF s = drawerSearchRect(); + return QRectF(s.right() + 10.0, s.top(), 72.0, s.height()); +} + +QRectF LauncherWindow::drawerClearRect() const { + const QRectF s = drawerSearchRect(); + return QRectF(s.right() - 40.0, s.top() + 4.0, 36.0, 40.0); +} + +QVector LauncherWindow::filteredApps() const { + if (m_search.trimmed().isEmpty()) return m_apps; + const QString q = m_search.trimmed(); + QVector out; + for (const auto &a : m_apps) { + if (a.label.contains(q, Qt::CaseInsensitive)) out.append(a); + } + return out; +} + +int LauncherWindow::hitHomeSlot(const QPointF &pos) const { + QSet hidden; + const auto packed = Layout::packHome(m_home, homeCols(), hidden); + const qreal cw = homeColW(); + for (int i = 0; i < packed.cells.size(); ++i) { + if (packed.cells[i].col < 0) continue; + QRectF r = Layout::cellBox(packed.cells[i], cw); + r.translate(gridX(), gridTop() - m_homeScroll); + if (r.contains(pos)) return i; + } + return -1; +} + +int LauncherWindow::hitDrawerApp(const QPointF &pos) const { + const QVector list = filteredApps(); + const int cols = width() >= 480 ? 5 : 4; + const qreal cw = (gridW() - (cols - 1) * Layout::kColGap) / cols; + const qreal top = drawerSearchRect().bottom() + 16.0; + if (pos.y() < top) return -1; + for (int i = 0; i < list.size(); ++i) { + const int col = i % cols; + const int row = i / cols; + const QRectF r(gridX() + col * (cw + Layout::kColGap), + top + row * (Layout::kCellH + Layout::kRowGap) - m_drawerScroll, + cw, Layout::kCellH); + if (r.contains(pos)) return i; + } + return -1; +} + +int LauncherWindow::hitSheetButton(const QPointF &pos) const { + const int count = (m_sheet == SheetKind::Menu) ? 3 + : (m_sheet == SheetKind::HomeItem) ? 4 + : (m_sheet == SheetKind::DrawerApp) ? 3 : 0; + if (count == 0) return -1; + const qreal btnH = 52.0; + const qreal pad = 16.0; + const qreal sheetH = pad * 2 + count * btnH + (count - 1) * 8.0 + insetBottom(); + const qreal sheetY = height() - sheetH; + if (pos.y() < sheetY) return -2; // outside sheet + for (int i = 0; i < count; ++i) { + const QRectF r(gridX(), sheetY + pad + i * (btnH + 8.0), gridW(), btnH); + if (r.contains(pos)) return i; + } + return -1; +} + +// ---- Actions ---- + +void LauncherWindow::openDrawer() { + m_drawerOpen = true; + m_drawerScroll = 0.0; + m_search.clear(); + m_searchFocused = false; + update(); +} + +void LauncherWindow::closeDrawer() { + m_drawerOpen = false; + m_search.clear(); + m_searchFocused = false; + if (auto *im = QGuiApplication::inputMethod()) im->hide(); + update(); +} + +void LauncherWindow::openSheet(SheetKind kind, int index) { + m_sheet = kind; + m_sheetIndex = index; + ultra_launcher_android_haptic(); + update(); +} + +void LauncherWindow::closeSheet() { + m_sheet = SheetKind::None; + m_sheetIndex = -1; + update(); +} + +void LauncherWindow::triggerSheetAction(int actionIdx) { + if (m_sheet == SheetKind::Menu) { + closeSheet(); + if (actionIdx == 0) openDrawer(); + else if (actionIdx == 1) ultra_launcher_android_pick_wallpaper(); + else if (actionIdx == 2) ultra_launcher_android_open_settings(); + return; + } + if (m_sheet == SheetKind::HomeItem && m_sheetIndex >= 0 && m_sheetIndex < m_home.size()) { + const QString comp = m_home[m_sheetIndex].component; + const int idx = m_sheetIndex; + closeSheet(); + if (actionIdx == 0) { + gui_string_t c = toWitStr(comp); + ultra_launcher_android_launch(&c); + gui_string_free(&c); + } else if (actionIdx == 1) { + gui_string_t c = toWitStr(comp); + ultra_launcher_android_app_info(&c); + gui_string_free(&c); + } else if (actionIdx == 2) { + m_home.removeAt(idx); + saveHome(); + update(); + } else if (actionIdx == 3) { + gui_string_t c = toWitStr(comp); + ultra_launcher_android_uninstall(&c); + gui_string_free(&c); + } + return; + } + if (m_sheet == SheetKind::DrawerApp) { + const QVector list = filteredApps(); + if (m_sheetIndex >= 0 && m_sheetIndex < list.size()) { + const AppInfo app = list[m_sheetIndex]; + closeSheet(); + if (actionIdx == 0) { + int existing = -1; + for (int i = 0; i < m_home.size(); ++i) { + if (m_home[i].component == app.component) { existing = i; break; } + } + if (existing >= 0) { + m_home.removeAt(existing); + } else if (m_home.size() < 200) { + m_home.append({app.component, -1, -1}); + } + saveHome(); + update(); + } else if (actionIdx == 1) { + gui_string_t c = toWitStr(app.component); + ultra_launcher_android_app_info(&c); + gui_string_free(&c); + } else if (actionIdx == 2 && !app.system) { + gui_string_t c = toWitStr(app.component); + ultra_launcher_android_uninstall(&c); + gui_string_free(&c); + } + } else { + closeSheet(); + } + } +} + +// ---- Painting ---- + +void LauncherWindow::paintEvent(QPaintEvent *) { + QPainter p(this); + p.setRenderHint(QPainter::Antialiasing); + p.setRenderHint(QPainter::SmoothPixmapTransform); + + // Clear to transparent so the Android wallpaper shows behind the launcher. + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(QRect(QPoint(0, 0), size()), Qt::transparent); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + + if (m_drawerOpen) drawDrawer(p); + else drawHome(p); + + if (m_sheet != SheetKind::None) drawSheet(p); +} + +void LauncherWindow::drawIconAndLabel(QPainter &p, const QRectF &box, const QString &component, + const QString &label, int iconSize, bool lifted) { + const qreal scale = lifted ? 1.1 : 1.0; + const qreal sz = iconSize * scale; + const QRectF iconRect(box.center().x() - sz / 2.0, box.top() + 4.0, sz, sz); + + const int px = std::max(48, int(std::ceil(sz * devicePixelRatio()))); + const QImage img = iconFor(component, px); + if (!img.isNull()) { + p.drawImage(iconRect, img); + } else { + p.setPen(Qt::NoPen); + p.setBrush(QColor(255, 255, 255, 46)); + p.drawEllipse(iconRect); + } + + QFont f = p.font(); + f.setPixelSize(12); + f.setWeight(QFont::Medium); + p.setFont(f); + const QRectF textRect(box.left() + 2.0, iconRect.bottom() + 5.0, box.width() - 4.0, 20.0); + const QString elided = p.fontMetrics().elidedText(label, Qt::ElideRight, int(textRect.width())); + p.setPen(QColor(0, 0, 0, 160)); + p.drawText(textRect.translated(0, 1), Qt::AlignHCenter | Qt::AlignTop, elided); + p.setPen(Qt::white); + p.drawText(textRect, Qt::AlignHCenter | Qt::AlignTop, elided); +} + +void LauncherWindow::drawHome(QPainter &p) { + // Top pill ("Apps") + const QRectF pill = appsPillRect(); + p.setPen(QPen(QColor(255, 255, 255, 55), 1.0)); + p.setBrush(QColor(24, 24, 30, 135)); + p.drawRoundedRect(pill, 27.0, 27.0); + + QFont f = p.font(); + f.setPixelSize(16); + f.setWeight(QFont::Medium); + p.setFont(f); + p.setPen(Qt::white); + p.drawText(pill, Qt::AlignCenter, QStringLiteral("Apps")); + + if (m_home.isEmpty()) { + f.setPixelSize(14); + f.setWeight(QFont::Normal); + p.setFont(f); + p.setPen(QColor(255, 255, 255, 190)); + p.drawText(QRectF(gridX(), gridTop() + 40.0, gridW(), 60.0), + Qt::AlignHCenter | Qt::AlignTop | Qt::TextWordWrap, + QStringLiteral("Swipe down or tap Apps • Long press for menu")); + return; + } + + QSet hidden; + const auto packed = Layout::packHome(m_home, homeCols(), hidden); + const qreal cw = homeColW(); + for (int i = 0; i < m_home.size(); ++i) { + if (i == m_liftedHome || packed.cells[i].col < 0) continue; + QRectF r = Layout::cellBox(packed.cells[i], cw); + r.translate(gridX(), gridTop() - m_homeScroll); + if (r.bottom() < gridTop() || r.top() > height()) continue; + const int appIdx = m_appIndex.value(m_home[i].component, -1); + const QString label = appIdx >= 0 ? m_apps[appIdx].label : m_home[i].component.section(QLatin1Char('/'), 0, 0); + drawIconAndLabel(p, r, m_home[i].component, label, 52, false); + } + + if (m_liftedHome >= 0 && m_liftedHome < m_home.size()) { + const QString comp = m_home[m_liftedHome].component; + const int appIdx = m_appIndex.value(comp, -1); + const QString label = appIdx >= 0 ? m_apps[appIdx].label : comp; + const QRectF r(m_liftPos.x() - cw / 2.0, m_liftPos.y() - Layout::kCellH / 2.0, cw, Layout::kCellH); + drawIconAndLabel(p, r, comp, label, 52, true); + } +} + +void LauncherWindow::drawDrawer(QPainter &p) { + p.fillRect(QRect(QPoint(0, 0), size()), QColor(14, 15, 20, 222)); + + const QRectF search = drawerSearchRect(); + p.setPen(QPen(QColor(255, 255, 255, m_searchFocused ? 140 : 60), 1.0)); + p.setBrush(QColor(255, 255, 255, 24)); + p.drawRoundedRect(search, 24.0, 24.0); + + QFont f = p.font(); + f.setPixelSize(16); + f.setWeight(QFont::Normal); + p.setFont(f); + p.setPen(m_search.isEmpty() ? QColor(255, 255, 255, 130) : Qt::white); + p.drawText(search.adjusted(18, 0, -44, 0), Qt::AlignVCenter | Qt::AlignLeft, + m_search.isEmpty() ? QStringLiteral("Search apps") : m_search); + + if (!m_search.isEmpty()) { + p.setPen(QColor(255, 255, 255, 190)); + p.drawText(drawerClearRect(), Qt::AlignCenter, QStringLiteral("✕")); + } + + const QRectF closeBtn = drawerCloseRect(); + p.setPen(Qt::white); + f.setWeight(QFont::Medium); + p.setFont(f); + p.drawText(closeBtn, Qt::AlignCenter, QStringLiteral("Close")); + + const QVector list = filteredApps(); + const int cols = width() >= 480 ? 5 : 4; + const qreal cw = (gridW() - (cols - 1) * Layout::kColGap) / cols; + const qreal top = search.bottom() + 16.0; + + p.save(); + p.setClipRect(QRectF(0, top, width(), height() - top)); + for (int i = 0; i < list.size(); ++i) { + const int col = i % cols; + const int row = i / cols; + const QRectF r(gridX() + col * (cw + Layout::kColGap), + top + row * (Layout::kCellH + Layout::kRowGap) - m_drawerScroll, + cw, Layout::kCellH); + if (r.bottom() < top || r.top() > height()) continue; + drawIconAndLabel(p, r, list[i].component, list[i].label, 52, false); + } + p.restore(); +} + +void LauncherWindow::drawSheet(QPainter &p) { + p.fillRect(QRect(QPoint(0, 0), size()), QColor(0, 0, 0, 140)); + + QStringList items; + if (m_sheet == SheetKind::Menu) { + items = {QStringLiteral("All apps"), QStringLiteral("Wallpaper"), QStringLiteral("Settings")}; + } else if (m_sheet == SheetKind::HomeItem) { + items = {QStringLiteral("Open"), QStringLiteral("App info"), QStringLiteral("Remove from home"), QStringLiteral("Uninstall")}; + } else if (m_sheet == SheetKind::DrawerApp) { + const QVector list = filteredApps(); + bool onHome = false; + bool isSystem = false; + if (m_sheetIndex >= 0 && m_sheetIndex < list.size()) { + isSystem = list[m_sheetIndex].system; + for (const auto &s : m_home) { + if (s.component == list[m_sheetIndex].component) { onHome = true; break; } + } + } + items << (onHome ? QStringLiteral("Remove from home") : QStringLiteral("Add to home")); + items << QStringLiteral("App info"); + items << (isSystem ? QStringLiteral("System app") : QStringLiteral("Uninstall")); + } + + const qreal btnH = 52.0; + const qreal pad = 16.0; + const qreal sheetH = pad * 2 + items.size() * btnH + std::max(0, int(items.size()) - 1) * 8.0 + insetBottom(); + const QRectF panel(contentX(), height() - sheetH, contentW(), sheetH); + + p.setPen(Qt::NoPen); + p.setBrush(QColor(28, 29, 36, 245)); + p.drawRoundedRect(panel.adjusted(0, 0, 0, 24), 24.0, 24.0); + + QFont f = p.font(); + f.setPixelSize(16); + f.setWeight(QFont::Medium); + p.setFont(f); + + for (int i = 0; i < items.size(); ++i) { + const QRectF r(gridX(), panel.top() + pad + i * (btnH + 8.0), gridW(), btnH); + p.setBrush(QColor(255, 255, 255, 22)); + p.drawRoundedRect(r, 14.0, 14.0); + p.setPen(Qt::white); + p.drawText(r, Qt::AlignCenter, items[i]); + p.setPen(Qt::NoPen); + } +} + +// ---- Input & Timers ---- + +void LauncherWindow::resizeEvent(QResizeEvent *event) { + QRasterWindow::resizeEvent(event); + refreshInsets(); + update(); +} + +void LauncherWindow::mousePressEvent(QMouseEvent *event) { + if (event->button() != Qt::LeftButton) return; + m_pressed = true; + m_dragging = false; + m_longPressed = false; + m_pressPos = event->position(); + m_lastPos = m_pressPos; + m_pressTimer.restart(); + + if (m_sheet != SheetKind::None) return; + + if (m_drawerOpen) { + m_pressedDrawer = hitDrawerApp(m_pressPos); + if (m_pressedDrawer >= 0) m_longPressTimer.start(450, this); + } else { + m_pressedHome = hitHomeSlot(m_pressPos); + if (!appsPillRect().contains(m_pressPos)) { + m_longPressTimer.start(450, this); + } + } +} + +void LauncherWindow::mouseMoveEvent(QMouseEvent *event) { + if (!m_pressed) return; + const QPointF pos = event->position(); + const qreal dist = std::hypot(pos.x() - m_pressPos.x(), pos.y() - m_pressPos.y()); + if (dist > 10.0 && !m_dragging) { + m_dragging = true; + m_longPressTimer.stop(); + } + + if (m_liftedHome >= 0) { + m_liftPos = pos; + update(); + return; + } + + if (m_dragging && m_drawerOpen) { + const qreal dy = m_lastPos.y() - pos.y(); + const QVector list = filteredApps(); + const int cols = width() >= 480 ? 5 : 4; + const int rows = (list.size() + cols - 1) / cols; + const qreal top = drawerSearchRect().bottom() + 16.0; + const qreal totalH = rows * (Layout::kCellH + Layout::kRowGap) + insetBottom() + 24.0; + const qreal maxScroll = std::max(0.0, totalH - (height() - top)); + m_drawerScroll = std::clamp(m_drawerScroll + dy, 0.0, maxScroll); + update(); + } + m_lastPos = pos; +} + +void LauncherWindow::mouseReleaseEvent(QMouseEvent *event) { + if (event->button() != Qt::LeftButton || !m_pressed) return; + m_pressed = false; + m_longPressTimer.stop(); + const QPointF pos = event->position(); + + if (m_liftedHome >= 0) { + const int target = hitHomeSlot(pos); + if (target >= 0 && target != m_liftedHome && target < m_home.size()) { + std::swap(m_home[m_liftedHome], m_home[target]); + saveHome(); + } else if (target < 0) { + // Drop into grid coordinates if over empty cell + const qreal localX = pos.x() - gridX(); + const qreal localY = pos.y() - (gridTop() - m_homeScroll); + if (localX >= 0 && localY >= 0) { + const int col = std::clamp(int(localX / (homeColW() + Layout::kColGap)), 0, homeCols() - 1); + const int row = std::max(0, int(localY / (Layout::kCellH + Layout::kRowGap))); + m_home[m_liftedHome].x = col; + m_home[m_liftedHome].y = row; + saveHome(); + } + } + m_liftedHome = -1; + update(); + return; + } + + if (m_longPressed) return; + + if (m_sheet != SheetKind::None) { + const int hit = hitSheetButton(pos); + if (hit == -2) closeSheet(); + else if (hit >= 0) triggerSheetAction(hit); + return; + } + + if (m_drawerOpen) { + if (!m_dragging) { + if (drawerCloseRect().contains(pos)) { + closeDrawer(); + } else if (!m_search.isEmpty() && drawerClearRect().contains(pos)) { + m_search.clear(); + m_drawerScroll = 0.0; + update(); + } else if (drawerSearchRect().contains(pos)) { + m_searchFocused = true; + if (auto *im = QGuiApplication::inputMethod()) im->show(); + update(); + } else { + const int idx = hitDrawerApp(pos); + const QVector list = filteredApps(); + if (idx >= 0 && idx < list.size()) { + gui_string_t c = toWitStr(list[idx].component); + ultra_launcher_android_launch(&c); + gui_string_free(&c); + } + } + } + return; + } + + // Home screen + if (m_dragging) { + // Swipe down opens drawer + if (pos.y() - m_pressPos.y() > 72.0) { + openDrawer(); + } + return; + } + + if (appsPillRect().contains(pos)) { + openDrawer(); + return; + } + + const int idx = hitHomeSlot(pos); + if (idx >= 0 && idx < m_home.size()) { + gui_string_t c = toWitStr(m_home[idx].component); + ultra_launcher_android_launch(&c); + gui_string_free(&c); + } +} + +void LauncherWindow::wheelEvent(QWheelEvent *event) { + if (!m_drawerOpen) return; + const QVector list = filteredApps(); + const int cols = width() >= 480 ? 5 : 4; + const int rows = (list.size() + cols - 1) / cols; + const qreal top = drawerSearchRect().bottom() + 16.0; + const qreal totalH = rows * (Layout::kCellH + Layout::kRowGap) + insetBottom() + 24.0; + const qreal maxScroll = std::max(0.0, totalH - (height() - top)); + m_drawerScroll = std::clamp(m_drawerScroll - event->angleDelta().y() * 0.5, 0.0, maxScroll); + update(); +} + +void LauncherWindow::keyPressEvent(QKeyEvent *event) { + if (!m_drawerOpen) return; + if (event->key() == Qt::Key_Escape) { + closeDrawer(); + return; + } + if (event->key() == Qt::Key_Backspace) { + if (!m_search.isEmpty()) { + m_search.chop(1); + m_drawerScroll = 0.0; + update(); + } + return; + } + if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { + const QVector list = filteredApps(); + if (!list.isEmpty()) { + gui_string_t c = toWitStr(list.first().component); + ultra_launcher_android_launch(&c); + gui_string_free(&c); + } + return; + } + const QString t = event->text(); + if (!t.isEmpty() && t.at(0).isPrint()) { + m_search += t; + m_drawerScroll = 0.0; + update(); + } +} + +void LauncherWindow::timerEvent(QTimerEvent *event) { + if (event->timerId() == m_pollTimer.timerId()) { + pollHostEvents(); + return; + } + if (event->timerId() == m_longPressTimer.timerId()) { + m_longPressTimer.stop(); + if (!m_pressed || m_dragging) return; + m_longPressed = true; + if (m_drawerOpen) { + if (m_pressedDrawer >= 0) openSheet(SheetKind::DrawerApp, m_pressedDrawer); + } else if (m_pressedHome >= 0) { + openSheet(SheetKind::HomeItem, m_pressedHome); + } else { + openSheet(SheetKind::Menu, -1); + } + } +} diff --git a/wasi/src/launcher_window.h b/wasi/src/launcher_window.h new file mode 100644 index 0000000..e78d218 --- /dev/null +++ b/wasi/src/launcher_window.h @@ -0,0 +1,110 @@ +#pragma once + +#include "layout.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct AppInfo { + QString label; + QString component; + bool system = false; +}; + +class LauncherWindow : public QRasterWindow { + Q_OBJECT + +public: + LauncherWindow(); + +protected: + void paintEvent(QPaintEvent *event) override; + void resizeEvent(QResizeEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void wheelEvent(QWheelEvent *event) override; + void keyPressEvent(QKeyEvent *event) override; + void timerEvent(QTimerEvent *event) override; + +private: + enum class SheetKind { None, Menu, HomeItem, DrawerApp }; + + void pollHostEvents(); + void refreshInsets(); + void refreshApps(); + void loadHome(); + void saveHome() const; + QImage iconFor(const QString &component, int px); + + // Geometry helpers (logical px) + qreal insetTop() const; + qreal insetBottom() const; + qreal contentW() const; + qreal contentX() const; + qreal gridX() const; + qreal gridW() const; + int homeCols() const; + qreal homeColW() const; + qreal panelY() const; + qreal gridTop() const; + QRectF appsPillRect() const; + QRectF drawerSearchRect() const; + QRectF drawerCloseRect() const; + QRectF drawerClearRect() const; + QVector filteredApps() const; + int hitHomeSlot(const QPointF &pos) const; + int hitDrawerApp(const QPointF &pos) const; + int hitSheetButton(const QPointF &pos) const; + + void openDrawer(); + void closeDrawer(); + void openSheet(SheetKind kind, int index); + void closeSheet(); + void triggerSheetAction(int actionIdx); + + void drawHome(QPainter &p); + void drawDrawer(QPainter &p); + void drawSheet(QPainter &p); + void drawIconAndLabel(QPainter &p, const QRectF &box, const QString &component, + const QString &label, int iconSize, bool lifted); + + // Host state + int m_physInsetTop = 0; + int m_physInsetBottom = 0; + QVector m_apps; + QHash m_appIndex; + QVector m_home; + QHash m_icons; + QSet m_missingIcons; + + // UI state + bool m_drawerOpen = false; + qreal m_drawerScroll = 0.0; + qreal m_homeScroll = 0.0; + QString m_search; + bool m_searchFocused = false; + SheetKind m_sheet = SheetKind::None; + int m_sheetIndex = -1; + + // Pointer / gesture tracking + bool m_pressed = false; + bool m_dragging = false; + bool m_longPressed = false; + int m_pressedHome = -1; + int m_pressedDrawer = -1; + int m_liftedHome = -1; + QPointF m_pressPos; + QPointF m_lastPos; + QPointF m_liftPos; + QElapsedTimer m_pressTimer; + QBasicTimer m_pollTimer; + QBasicTimer m_longPressTimer; +}; diff --git a/wasi/src/layout.cpp b/wasi/src/layout.cpp new file mode 100644 index 0000000..41567fe --- /dev/null +++ b/wasi/src/layout.cpp @@ -0,0 +1,66 @@ +#include "layout.h" + +#include +#include + +namespace Layout { + +PackedGrid packHome(const QVector &items, int cols, const QSet &hidden) { + PackedGrid out; + out.cells.resize(items.size(), {-1, -1}); + if (cols <= 0) return out; + + // Occupancy grid grows dynamically as rows are needed. + std::vector> occ; + auto ensureRow = [&](int r) { + while (static_cast(occ.size()) <= r) occ.emplace_back(cols, false); + }; + auto isFree = [&](int c, int r) -> bool { + if (c < 0 || c >= cols || r < 0) return false; + if (r >= static_cast(occ.size())) return true; + return !occ[r][c]; + }; + auto occupy = [&](int c, int r) { + ensureRow(r); + occ[r][c] = true; + out.rows = std::max(out.rows, r + 1); + }; + + // Pass 1: place pinned slots first if their cell is free. + QVector placed(items.size(), false); + for (int i = 0; i < items.size(); ++i) { + const auto &s = items[i]; + if (hidden.contains(s.component)) continue; + if (s.x >= 0 && s.x < cols && s.y >= 0 && isFree(s.x, s.y)) { + occupy(s.x, s.y); + out.cells[i] = {s.x, s.y}; + placed[i] = true; + } + } + + // Pass 2: pack remaining visible slots into the earliest free cell. + int cursorR = 0; + int cursorC = 0; + for (int i = 0; i < items.size(); ++i) { + if (placed[i] || hidden.contains(items[i].component)) continue; + while (!isFree(cursorC, cursorR)) { + ++cursorC; + if (cursorC >= cols) { + cursorC = 0; + ++cursorR; + } + } + occupy(cursorC, cursorR); + out.cells[i] = {cursorC, cursorR}; + } + + return out; +} + +QRectF cellBox(const CellPos &cell, qreal colW) { + const qreal x = cell.col * (colW + kColGap); + const qreal y = cell.row * (kCellH + kRowGap); + return QRectF(x, y, colW, kCellH); +} + +} // namespace Layout diff --git a/wasi/src/layout.h b/wasi/src/layout.h new file mode 100644 index 0000000..aa66e40 --- /dev/null +++ b/wasi/src/layout.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include +#include + +namespace Layout { + +inline constexpr qreal kCellH = 92.0; +inline constexpr qreal kColGap = 6.0; +inline constexpr qreal kRowGap = 12.0; + +struct HomeSlot { + QString component; + int x = -1; + int y = -1; +}; + +struct CellPos { + int col = 0; + int row = 0; +}; + +struct PackedGrid { + QVector cells; // Same length as slots; invalid (-1, -1) if hidden. + int rows = 0; +}; + +PackedGrid packHome(const QVector &items, int cols, const QSet &hidden); +QRectF cellBox(const CellPos &cell, qreal colW); + +} // namespace Layout diff --git a/wasi/src/main.cpp b/wasi/src/main.cpp new file mode 100644 index 0000000..1a061fd --- /dev/null +++ b/wasi/src/main.cpp @@ -0,0 +1,9 @@ +#include "launcher_window.h" + +#include + +int qt2wasm_gui_main(int, char **) { + auto *w = new LauncherWindow; + w->show(); + return 0; +} diff --git a/wasi/wit/deps/latha-gui/gui.wit b/wasi/wit/deps/latha-gui/gui.wit new file mode 100644 index 0000000..d4c3160 --- /dev/null +++ b/wasi/wit/deps/latha-gui/gui.wit @@ -0,0 +1,268 @@ +/// latha:gui: a GUI app as one WebAssembly component. +/// +/// The app draws its window into a frame buffer and the host shows it: the +/// host owns the native window, its event loop and the clock; the app is a +/// reactor and only runs inside an export call. A host is a small, generic +/// loader (perry-gui in kwi-wasm: a GTK4 window), and any component that +/// exports `app` and imports nothing but `host` (plus `pty`, and WASI) runs +/// in it. qt2wasm builds such components from QtGui programs +/// (`qt2wasm build --gui`, its `qt2wasmgui` platform plugin). +/// +/// Life of an app: +/// 1. `start(args)`: build the UI. The host then calls `resize` with the +/// real surface size before the first `paint`. +/// 2. input arrives as `key` / `text` / `pointer` / `wheel` / `focus`; +/// 3. after anything that may have changed the picture, and whenever the +/// app asked with `host.request-frame`, the host calls `paint`, which +/// returns the pixels to move (scrolling) and the damaged rectangles; +/// the host moves those in its own copy, then copies each damaged +/// rectangle with `frame-pixels`; +/// 4. `tick` runs due timers and queued work; it returns how long until the +/// app next wants one (none: only when something happens); +/// 5. `close` when the user closes the window; the app answers whether the +/// host may close now (it can also leave any time with `host.quit`). +/// +/// Coordinates and sizes are device pixels, origin top left. Pixels cross the +/// boundary base64 encoded in a string: hosts lift a `list` element by +/// element, a string in one copy. +package latha:gui@0.2.3; + +interface types { + /// A rectangle in device pixels. + record rect { + x: s32, + y: s32, + width: u32, + height: u32, + } + + record size { + width: u32, + height: u32, + } + + /// Move the pixels inside `area` by (`dx`, `dy`), as a scrolled view + /// does: the host copies them within the frame it already shows, so they + /// need not cross the boundary again. Only `area` changes: what moves out + /// of it is dropped, and the strip it uncovers keeps its old pixels until + /// a damaged rectangle repaints it. + record move { + area: rect, + dx: s32, + dy: s32, + } + + /// What changed since the last `paint`: first apply `moves`, in order, + /// to the shown frame, then copy each of `rects` with `frame-pixels`. + record damage { + moves: list, + rects: list, + } + + /// Keyboard modifiers held during an event. `keypad` marks a key on the + /// numeric keypad. + flags modifiers { + shift, + ctrl, + alt, + meta, + keypad, + } + + /// Mouse buttons held during an event. + flags buttons { + left, + right, + middle, + back, + forward, + } + + enum button { + none, + left, + right, + middle, + back, + forward, + } + + enum pointer-kind { + press, + release, + move, + /// The pointer entered the surface. + enter, + /// The pointer left the surface. + leave, + } + + record pointer-event { + kind: pointer-kind, + /// The button that changed (`press` / `release`), else `none`. + button: button, + /// The buttons held after the event. + buttons: buttons, + modifiers: modifiers, + x: f64, + y: f64, + /// For `press`: 1 for a single click, 2 for a double click, ... + clicks: u32, + } + + record key-event { + /// true on press (and auto-repeat), false on release. + pressed: bool, + repeat: bool, + /// The X11 / xkbcommon keysym (XK_*, e.g. 0xff0d Return, 0x61 `a`), + /// as GDK, Wayland and X11 report it; 0 if unknown. + keysym: u32, + /// The hardware key code (evdev + 8 on Linux), 0 if unknown. + scancode: u32, + modifiers: modifiers, + /// The text the press types, if any (control characters included, + /// e.g. "\r" for Return, "\u{3}" for Ctrl+C). Text from an input + /// method arrives through `app.text` instead. + text: string, + } + + record wheel-event { + x: f64, + y: f64, + /// Wheel notches (1.0 = one notch; positive = down / right). + steps-x: f64, + steps-y: f64, + /// Smooth scrolling (touchpads), in device pixels; 0 if not known. + pixels-x: f64, + pixels-y: f64, + modifiers: modifiers, + } + + /// Pointer shapes (CSS cursor names). + enum cursor { + default, + text, + pointer, + crosshair, + wait, + progress, + help, + move, + not-allowed, + grab, + grabbing, + ew-resize, + ns-resize, + nesw-resize, + nwse-resize, + col-resize, + row-resize, + none, + } +} + +/// What the host gives the app. +interface host { + use types.{cursor, size}; + + /// The picture changed: call `paint` soon (once per host frame at most). + request-frame: func(); + /// Call `tick` after `delay-ms` (0: as soon as possible), e.g. for a + /// timer the app just started. A later request replaces an earlier one. + request-tick: func(delay-ms: u32); + set-title: func(title: string); + set-cursor: func(shape: cursor); + /// The smallest window size the app can use (device pixels); 0 x 0: any. + set-min-size: func(min: size); + /// The clipboard's text, empty if it holds none. + clipboard-text: func() -> string; + set-clipboard-text: func(text: string); + /// The X11 primary selection (middle-click paste); hosts without one + /// return "" and ignore the set. + primary-text: func() -> string; + set-primary-text: func(text: string); + /// Whether the desktop prefers a dark color scheme. + prefers-dark: func() -> bool; + /// The desktop's accent color (selection, focus, active tab) as + /// 0xRRGGBB, none if the desktop has none. Since 0.2.1; a change arrives + /// as `app.color-scheme`. + accent-color: func() -> option; + bell: func(); + set-text-input: func(active: bool); + /// Open `url` (http, https, mailto, file, ...) the desktop's way: in + /// the user's browser, mail client, file manager. False if the host + /// cannot or will not. Since 0.2.2. + open-url: func(url: string) -> bool; + /// Leave: the host closes the window and exits with `code`. + quit: func(code: s32); +} + +/// What the app gives the host. +interface app { + use types.{rect, size, damage, key-event, pointer-event, wheel-event}; + + /// Build the UI. `args` are the command line after the component's + /// path, with the app's name (the wasm file's stem) first. Returns the + /// window size the app would like (device pixels at scale 1), 0 x 0 for + /// the host's default, or an error that makes the host exit. + start: func(args: list) -> result; + /// The surface is now `width` x `height` device pixels at `scale` + /// device pixels per logical pixel. + resize: func(width: u32, height: u32, scale: f64); + key: func(event: key-event); + /// Text committed by an input method (compose, dead keys, CJK, ...). + text: func(text: string); + pointer: func(event: pointer-event); + wheel: func(event: wheel-event); + focus: func(focused: bool); + /// The desktop's appearance changed: the dark / light preference (see + /// `host.prefers-dark`) or the accent color (`host.accent-color`, read it + /// again). + color-scheme: func(dark: bool); + /// The user asked to close the window: true lets the host close it. + close: func() -> bool; + /// Run due timers and queued work. Returns the delay in ms until the app + /// next needs a tick, none if only an event or `request-tick` will. + tick: func() -> option; + /// Bring the frame up to date. Returns what changed since the last + /// `paint`: pixels that moved, then rectangles to copy (both empty: + /// nothing changed). The frame is the surface's size once `resize` was + /// called; after a resize the first paint reports the whole frame and no + /// moves. + paint: func() -> damage; + frame-size: func() -> size; + /// `r`'s pixels, base64: `r.height` rows of `r.width` pixels, each + /// 4 bytes B, G, R, A with premultiplied alpha (little-endian 0xAARRGGBB: + /// cairo's ARGB32, Qt's ARGB32_Premultiplied). + frame-pixels: func(r: rect) -> string; +} + +/// Pseudo-terminals, for apps that run programs (terminal emulators). +/// Output is polled: the host calls `app.tick` when a pty has data or ends. +interface pty { + /// Start `argv` (argv[0] looked up in PATH; empty: the user's shell) on a + /// new pty of `cols` x `rows`, with `env` added to the host's + /// environment and `cwd` (none: the user's home). Returns its id. + spawn: func(argv: list, env: list>, cwd: option, + cols: u16, rows: u16) -> result; + write: func(id: u32, data: list); + /// Everything the program wrote since the last read, base64 ("" = nothing). + read: func(id: u32) -> string; + resize: func(id: u32, cols: u16, rows: u16); + /// Its exit code once it has ended and its output was read, else none. + exit-code: func(id: u32) -> option; + /// Hang up (SIGHUP) and forget it. + close: func(id: u32); +} + +/// A GUI app. +world gui { + import host; + export app; +} + +/// A GUI app that also runs programs on pseudo-terminals. +world gui-pty { + include gui; + import pty; +} diff --git a/wasi/wit/launcher.wit b/wasi/wit/launcher.wit new file mode 100644 index 0000000..f26c682 --- /dev/null +++ b/wasi/wit/launcher.wit @@ -0,0 +1,23 @@ +package ultra:launcher@0.1.0; + +interface android { + /// JSON array of {"label": string, "component": string, "system"?: bool}. + apps: func() -> string; + /// Base64-encoded premultiplied RGBA8888 pixels (size * size * 4 bytes) for "a:COMPONENT". + icon: func(key: string, size: u32) -> option; + launch: func(component: string); + app-info: func(component: string); + uninstall: func(component: string); + open-settings: func(); + pick-wallpaper: func(); + haptic: func(); + /// System bar insets in physical screen pixels: (top, bottom). + insets: func() -> tuple; + /// Drain queued host events ("home", "back", "insets", "apps-changed:"). + poll-events: func() -> list; +} + +world gui { + include latha:gui/gui@0.2.3; + import android; +}