diff --git a/Cargo.lock b/Cargo.lock index ffaee96..583f8df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + [[package]] name = "ab_glyph" version = "0.2.23" @@ -46,6 +52,30 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aliasable" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" + +[[package]] +name = "android-activity" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" +dependencies = [ + "android-properties", + "bitflags 1.3.2", + "cc", + "jni-sys", + "libc", + "log", + "ndk 0.7.0", + "ndk-context", + "ndk-sys 0.4.1+23.1.7779620", + "num_enum 0.6.1", +] + [[package]] name = "android-activity" version = "0.5.2" @@ -60,10 +90,10 @@ dependencies = [ "jni-sys", "libc", "log", - "ndk", + "ndk 0.8.0", "ndk-context", - "ndk-sys", - "num_enum", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum 0.7.2", "thiserror", ] @@ -142,13 +172,32 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "block-sys" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +dependencies = [ + "objc-sys 0.2.0-beta.2", +] + [[package]] name = "block-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" dependencies = [ - "objc-sys", + "objc-sys 0.3.2", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys 0.1.0-beta.1", + "objc2-encode 2.0.0-pre.2", ] [[package]] @@ -157,8 +206,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "block-sys", - "objc2", + "block-sys 0.2.1", + "objc2 0.4.1", ] [[package]] @@ -185,6 +234,20 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "calloop" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" +dependencies = [ + "bitflags 1.3.2", + "log", + "nix 0.25.1", + "slotmap", + "thiserror", + "vec_map", +] + [[package]] name = "calloop" version = "0.12.4" @@ -205,10 +268,10 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ - "calloop", + "calloop 0.12.4", "rustix", "wayland-backend", - "wayland-client", + "wayland-client 0.31.2", ] [[package]] @@ -272,6 +335,16 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -288,6 +361,19 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types 0.3.2", + "libc", +] + [[package]] name = "core-graphics" version = "0.23.1" @@ -312,6 +398,25 @@ dependencies = [ "libc", ] +[[package]] +name = "cosmic-text" +version = "0.6.0" +source = "git+https://github.com/pop-os/cosmic-text?rev=e00109d77f06d5a2e3057865eda3f530bc40a046#e00109d77f06d5a2e3057865eda3f530bc40a046" +dependencies = [ + "fontdb 0.10.0", + "libm", + "log", + "ouroboros", + "rangemap", + "rustybuzz 0.6.0", + "swash", + "sys-locale 0.2.4", + "unicode-bidi", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", +] + [[package]] name = "cosmic-text" version = "0.11.2" @@ -319,7 +424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c578f2b9abb4d5f3fbb12aba4008084d435dc6a8425c195cfe0b3594bfea0c25" dependencies = [ "bitflags 2.4.2", - "fontdb", + "fontdb 0.16.2", "libm", "log", "rangemap", @@ -327,8 +432,8 @@ dependencies = [ "rustybuzz 0.12.1", "self_cell", "swash", - "sys-locale", - "ttf-parser", + "sys-locale 0.3.1", + "ttf-parser 0.20.0", "unicode-bidi", "unicode-linebreak", "unicode-script", @@ -381,6 +486,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" +[[package]] +name = "data-url" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5" + [[package]] name = "dispatch" version = "0.2.0" @@ -393,7 +504,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading", + "libloading 0.8.1", ] [[package]] @@ -433,6 +544,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "euclid" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f253bc5c813ca05792837a0ff4b3a580336b224512d48f7eda1d7dd9210787" +dependencies = [ + "num-traits", +] + [[package]] name = "exr" version = "1.72.0" @@ -466,24 +586,38 @@ dependencies = [ [[package]] name = "femtovg" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18ab822e58e8bc2b89840dc5dde49afe39302e129c60d39c8520200c085404a7" +version = "0.9.0" dependencies = [ "bitflags 2.4.2", + "console_error_panic_hook", + "cosmic-text 0.6.0", + "euclid", "fnv", - "generational-arena", + "getrandom", "glow", + "glutin 0.30.10", + "glutin-winit 0.3.0", "image", "imgref", + "instant", + "lazy_static", "log", "lru", + "rand", + "raw-window-handle 0.5.2", + "resource", "rgb", - "rustybuzz 0.11.0", + "rustybuzz 0.13.0", + "serde", + "slotmap", + "svg", + "swash", "unicode-bidi", "unicode-segmentation", + "usvg", "wasm-bindgen", "web-sys", + "winit 0.28.7", ] [[package]] @@ -496,6 +630,12 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" + [[package]] name = "flume" version = "0.11.0" @@ -523,7 +663,32 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a595cb550439a117696039dfc69830492058211b771a2a165379f2a1a53d84d" dependencies = [ - "roxmltree", + "roxmltree 0.19.0", +] + +[[package]] +name = "fontdb" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8131752b3f3b876a20f42b3d08233ad177d6e7ec6d18aaa6954489a201071be5" +dependencies = [ + "log", + "memmap2 0.5.10", + "ttf-parser 0.17.1", +] + +[[package]] +name = "fontdb" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8d8cbea8f21307d7e84bca254772981296f058a1d36b461bf4d83a7499fc9e" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2 0.6.2", + "slotmap", + "tinyvec", + "ttf-parser 0.19.2", ] [[package]] @@ -534,10 +699,10 @@ checksum = "b0299020c3ef3f60f526a4f64ab4a3d4ce116b1acbf24cdd22da0068e5d81dc3" dependencies = [ "fontconfig-parser", "log", - "memmap2", + "memmap2 0.9.4", "slotmap", "tinyvec", - "ttf-parser", + "ttf-parser 0.20.0", ] [[package]] @@ -567,7 +732,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] @@ -647,7 +812,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] @@ -680,15 +845,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generational-arena" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e94aff08e743b651baaea359664321055749b398adff8740a7399af7796e7" -dependencies = [ - "cfg-if", -] - [[package]] name = "gethostname" version = "0.4.3" @@ -706,8 +862,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -749,6 +907,29 @@ dependencies = [ "web-sys", ] +[[package]] +name = "glutin" +version = "0.30.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc93b03242719b8ad39fb26ed2b01737144ce7bd4bfc7adadcef806596760fe" +dependencies = [ + "bitflags 1.3.2", + "cfg_aliases", + "cgl", + "core-foundation", + "dispatch", + "glutin_egl_sys 0.5.1", + "glutin_glx_sys 0.4.0", + "glutin_wgl_sys 0.4.0", + "libloading 0.7.4", + "objc2 0.3.0-beta.3.patch-leaks.3", + "once_cell", + "raw-window-handle 0.5.2", + "wayland-sys 0.30.1", + "windows-sys 0.45.0", + "x11-dl", +] + [[package]] name = "glutin" version = "0.31.3" @@ -760,19 +941,31 @@ dependencies = [ "cgl", "core-foundation", "dispatch", - "glutin_egl_sys", - "glutin_glx_sys", - "glutin_wgl_sys", + "glutin_egl_sys 0.6.0", + "glutin_glx_sys 0.5.0", + "glutin_wgl_sys 0.5.0", "icrate", - "libloading", - "objc2", + "libloading 0.8.1", + "objc2 0.4.1", "once_cell", "raw-window-handle 0.5.2", - "wayland-sys", + "wayland-sys 0.31.1", "windows-sys 0.48.0", "x11-dl", ] +[[package]] +name = "glutin-winit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "629a873fc04062830bfe8f97c03773bcd7b371e23bcc465d0a61448cd1588fa4" +dependencies = [ + "cfg_aliases", + "glutin 0.30.10", + "raw-window-handle 0.5.2", + "winit 0.28.7", +] + [[package]] name = "glutin-winit" version = "0.4.2" @@ -780,9 +973,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebcdfba24f73b8412c5181e56f092b5eff16671c514ce896b258a0a64bd7735" dependencies = [ "cfg_aliases", - "glutin", + "glutin 0.31.3", "raw-window-handle 0.5.2", - "winit", + "winit 0.29.10", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af784eb26c5a68ec85391268e074f0aa618c096eadb5d6330b0911cf34fe57c5" +dependencies = [ + "gl_generator", + "windows-sys 0.45.0", ] [[package]] @@ -795,6 +998,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "glutin_glx_sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494" +dependencies = [ + "gl_generator", + "x11-dl", +] + [[package]] name = "glutin_glx_sys" version = "0.5.0" @@ -805,6 +1018,15 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "glutin_wgl_sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165" +dependencies = [ + "gl_generator", +] + [[package]] name = "glutin_wgl_sys" version = "0.5.0" @@ -938,9 +1160,9 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" dependencies = [ - "block2", + "block2 0.3.0", "dispatch", - "objc2", + "objc2 0.4.1", ] [[package]] @@ -971,6 +1193,12 @@ dependencies = [ "tiff", ] +[[package]] +name = "imagesize" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" + [[package]] name = "imgref" version = "1.10.1" @@ -987,6 +1215,18 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -1045,6 +1285,15 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" +[[package]] +name = "kurbo" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b" +dependencies = [ + "arrayvec", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1063,6 +1312,16 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + [[package]] name = "libloading" version = "0.8.1" @@ -1134,27 +1393,29 @@ dependencies = [ "bytes", "futures", "image", + "lazy_static", "mangui", "reqwest", "serde", "serde_json", "tokio", + "uno-gen", ] [[package]] name = "mangui" version = "0.1.0" dependencies = [ - "cosmic-text", + "cosmic-text 0.11.2", "femtovg", - "glutin", - "glutin-winit", + "glutin 0.31.3", + "glutin-winit 0.4.2", "lazy_static", "raw-window-handle 0.5.2", "swash", "taffy", "weak-table", - "winit", + "winit 0.29.10", ] [[package]] @@ -1163,6 +1424,24 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memmap2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d28bba84adfe6646737845bc5ebbfa2c08424eb1c37e94a1fd2a82adb56a872" +dependencies = [ + "libc", +] + [[package]] name = "memmap2" version = "0.9.4" @@ -1172,6 +1451,15 @@ dependencies = [ "libc", ] +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.17" @@ -1195,6 +1483,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", + "log", "wasi", "windows-sys 0.48.0", ] @@ -1217,6 +1506,20 @@ dependencies = [ "tempfile", ] +[[package]] +name = "ndk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys 0.4.1+23.1.7779620", + "num_enum 0.5.11", + "raw-window-handle 0.5.2", + "thiserror", +] + [[package]] name = "ndk" version = "0.8.0" @@ -1226,8 +1529,8 @@ dependencies = [ "bitflags 2.4.2", "jni-sys", "log", - "ndk-sys", - "num_enum", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum 0.7.2", "raw-window-handle 0.5.2", "raw-window-handle 0.6.0", "thiserror", @@ -1239,6 +1542,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" +[[package]] +name = "ndk-sys" +version = "0.4.1+23.1.7779620" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +dependencies = [ + "jni-sys", +] + [[package]] name = "ndk-sys" version = "0.5.0+25.2.9519653" @@ -1248,6 +1560,31 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", +] + [[package]] name = "num-traits" version = "0.2.18" @@ -1267,13 +1604,55 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive 0.6.1", +] + [[package]] name = "num_enum" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.7.2", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 2.0.50", ] [[package]] @@ -1282,26 +1661,52 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] +[[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + [[package]] name = "objc-sys" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7c71324e4180d0899963fc83d9d241ac39e699609fc1025a850aadac8257459" +[[package]] +name = "objc2" +version = "0.3.0-beta.3.patch-leaks.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" +dependencies = [ + "block2 0.2.0-alpha.6", + "objc-sys 0.2.0-beta.2", + "objc2-encode 2.0.0-pre.2", +] + [[package]] name = "objc2" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" dependencies = [ - "objc-sys", - "objc2-encode", + "objc-sys 0.3.2", + "objc2-encode 3.0.0", +] + +[[package]] +name = "objc2-encode" +version = "2.0.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +dependencies = [ + "objc-sys 0.2.0-beta.2", ] [[package]] @@ -1348,7 +1753,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] @@ -1378,13 +1783,36 @@ dependencies = [ "libredox", ] +[[package]] +name = "ouroboros" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" +dependencies = [ + "aliasable", + "ouroboros_macro", +] + +[[package]] +name = "ouroboros_macro" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" +dependencies = [ + "Inflector", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "owned_ttf_parser" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7" dependencies = [ - "ttf-parser", + "ttf-parser 0.20.0", ] [[package]] @@ -1416,6 +1844,12 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1461,13 +1895,53 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + [[package]] name = "proc-macro-crate" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit", + "toml_edit 0.21.1", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", ] [[package]] @@ -1506,6 +1980,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "rangemap" version = "1.5.0" @@ -1544,6 +2048,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rctree" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f" + [[package]] name = "read-fonts" version = "0.15.5" @@ -1611,6 +2121,12 @@ dependencies = [ "winreg", ] +[[package]] +name = "resource" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a7f6703c396037a02da99195e49138c37f3cc5146cb95f2f7d26debc0c5622" + [[package]] name = "rgb" version = "0.8.37" @@ -1620,6 +2136,28 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "rosvgtree" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad747e7384940e7bf33b15ba433b7bad9f44c0c6d5287a67c2cb22cd1743d497" +dependencies = [ + "log", + "roxmltree 0.18.1", + "simplecss", + "siphasher", + "svgtypes", +] + +[[package]] +name = "roxmltree" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862340e351ce1b271a378ec53f304a5558f7db87f3769dc655a8f6ecbb68b302" +dependencies = [ + "xmlparser", +] + [[package]] name = "roxmltree" version = "0.19.0" @@ -1677,17 +2215,34 @@ dependencies = [ [[package]] name = "rustybuzz" -version = "0.11.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee8fe2a8461a0854a37101fe7a1b13998d0cfa987e43248e81d2a5f4570f6fa" +checksum = "ab9e34ecf6900625412355a61bda0bd68099fe674de707c67e5e4aed2c05e489" +dependencies = [ + "bitflags 1.3.2", + "bytemuck", + "libm", + "smallvec", + "ttf-parser 0.17.1", + "unicode-bidi-mirroring 0.1.0", + "unicode-ccc 0.1.2", + "unicode-general-category", + "unicode-script", +] + +[[package]] +name = "rustybuzz" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162bdf42e261bee271b3957691018634488084ef577dddeb6420a9684cab2a6a" dependencies = [ "bitflags 1.3.2", "bytemuck", "smallvec", - "ttf-parser", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-properties", + "ttf-parser 0.18.1", + "unicode-bidi-mirroring 0.1.0", + "unicode-ccc 0.1.2", + "unicode-general-category", "unicode-script", ] @@ -1701,9 +2256,25 @@ dependencies = [ "bytemuck", "libm", "smallvec", - "ttf-parser", - "unicode-bidi-mirroring", - "unicode-ccc", + "ttf-parser 0.20.0", + "unicode-bidi-mirroring 0.1.0", + "unicode-ccc 0.1.2", + "unicode-properties", + "unicode-script", +] + +[[package]] +name = "rustybuzz" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88117946aa1bfb53c2ae0643ceac6506337f44887f8c9fbfb43587b1cc52ba49" +dependencies = [ + "bitflags 2.4.2", + "bytemuck", + "smallvec", + "ttf-parser 0.20.0", + "unicode-bidi-mirroring 0.2.0", + "unicode-ccc 0.2.0", "unicode-properties", "unicode-script", ] @@ -1752,8 +2323,8 @@ checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550" dependencies = [ "ab_glyph", "log", - "memmap2", - "smithay-client-toolkit", + "memmap2 0.9.4", + "smithay-client-toolkit 0.18.1", "tiny-skia", ] @@ -1803,7 +2374,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] @@ -1844,6 +2415,21 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +[[package]] +name = "simplecss" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a11be7c62927d9427e9f40f3444d5499d868648e2edbc4e2116de69e7ec0e89d" +dependencies = [ + "log", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "slab" version = "0.4.9" @@ -1868,6 +2454,25 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +[[package]] +name = "smithay-client-toolkit" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870427e30b8f2cbe64bf43ec4b86e88fe39b0a84b3f15efd9c9c2d020bc86eb9" +dependencies = [ + "bitflags 1.3.2", + "calloop 0.10.6", + "dlib", + "lazy_static", + "log", + "memmap2 0.5.10", + "nix 0.24.3", + "pkg-config", + "wayland-client 0.29.5", + "wayland-cursor 0.29.5", + "wayland-protocols 0.29.5", +] + [[package]] name = "smithay-client-toolkit" version = "0.18.1" @@ -1875,21 +2480,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" dependencies = [ "bitflags 2.4.2", - "calloop", + "calloop 0.12.4", "calloop-wayland-source", "cursor-icon", "libc", "log", - "memmap2", + "memmap2 0.9.4", "rustix", "thiserror", "wayland-backend", - "wayland-client", + "wayland-client 0.31.2", "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", + "wayland-cursor 0.31.1", + "wayland-protocols 0.31.2", "wayland-protocols-wlr", - "wayland-scanner", + "wayland-scanner 0.31.1", "xkeysym", ] @@ -1926,6 +2531,25 @@ name = "strict-num" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + +[[package]] +name = "svg" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d703a3635418d4e4d0e410009ddbfb65047ef9468b1d29afd3b057a5bc4c217" + +[[package]] +name = "svgtypes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4b0611e7f3277f68c0fa18e385d9e2d26923691379690039548f867cef02a7" +dependencies = [ + "kurbo", + "siphasher", +] [[package]] name = "swash" @@ -1938,6 +2562,17 @@ dependencies = [ "zeno", ] +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.50" @@ -1955,6 +2590,19 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sys-locale" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a11bd9c338fdba09f7881ab41551932ad42e405f61d01e8406baea71c07aee" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", + "windows-sys 0.45.0", +] + [[package]] name = "sys-locale" version = "0.3.1" @@ -2027,7 +2675,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] @@ -2108,7 +2756,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] @@ -2141,6 +2789,17 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + [[package]] name = "toml_edit" version = "0.21.1" @@ -2183,6 +2842,24 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "ttf-parser" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff" + +[[package]] +name = "ttf-parser" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" + +[[package]] +name = "ttf-parser" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" + [[package]] name = "ttf-parser" version = "0.20.0" @@ -2201,12 +2878,30 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694" +[[package]] +name = "unicode-bidi-mirroring" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" + [[package]] name = "unicode-ccc" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" +[[package]] +name = "unicode-ccc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656" + +[[package]] +name = "unicode-general-category" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7" + [[package]] name = "unicode-ident" version = "1.0.12" @@ -2246,6 +2941,20 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +[[package]] +name = "unicode-vo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" + +[[package]] +name = "uno-gen" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", +] + [[package]] name = "url" version = "2.5.0" @@ -2257,12 +2966,78 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "usvg" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae32eb823aab35fc343b19c4d354f70e713b442ce34cdfa8497bf6c39af8a342" +dependencies = [ + "base64", + "log", + "pico-args", + "usvg-parser", + "usvg-text-layout", + "usvg-tree", + "xmlwriter", +] + +[[package]] +name = "usvg-parser" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7529174e721c8078d62b08399258469b1d68b4e5f2983b347d6a9d39779366c" +dependencies = [ + "data-url", + "flate2", + "imagesize", + "kurbo", + "log", + "rosvgtree", + "strict-num", + "svgtypes", + "usvg-tree", +] + +[[package]] +name = "usvg-text-layout" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e672fbc19261c6553113cc04ff2ff38ae52fadbd90f2d814040857795fb5c50" +dependencies = [ + "fontdb 0.14.1", + "kurbo", + "log", + "rustybuzz 0.7.0", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "usvg-tree", +] + +[[package]] +name = "usvg-tree" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a56e9cd3be5eb6d6744477e95b82d52d393fc1dba4b5b090912c33af337c20b" +dependencies = [ + "kurbo", + "rctree", + "strict-num", + "svgtypes", +] + [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.4" @@ -2315,7 +3090,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.50", "wasm-bindgen-shared", ] @@ -2349,7 +3124,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2371,7 +3146,23 @@ dependencies = [ "rustix", "scoped-tls", "smallvec", - "wayland-sys", + "wayland-sys 0.31.1", +] + +[[package]] +name = "wayland-client" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +dependencies = [ + "bitflags 1.3.2", + "downcast-rs", + "libc", + "nix 0.24.3", + "scoped-tls", + "wayland-commons", + "wayland-scanner 0.29.5", + "wayland-sys 0.29.5", ] [[package]] @@ -2383,7 +3174,19 @@ dependencies = [ "bitflags 2.4.2", "rustix", "wayland-backend", - "wayland-scanner", + "wayland-scanner 0.31.1", +] + +[[package]] +name = "wayland-commons" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +dependencies = [ + "nix 0.24.3", + "once_cell", + "smallvec", + "wayland-sys 0.29.5", ] [[package]] @@ -2397,6 +3200,17 @@ dependencies = [ "wayland-backend", ] +[[package]] +name = "wayland-cursor" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" +dependencies = [ + "nix 0.24.3", + "wayland-client 0.29.5", + "xcursor", +] + [[package]] name = "wayland-cursor" version = "0.31.1" @@ -2404,10 +3218,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71ce5fa868dd13d11a0d04c5e2e65726d0897be8de247c0c5a65886e283231ba" dependencies = [ "rustix", - "wayland-client", + "wayland-client 0.31.2", "xcursor", ] +[[package]] +name = "wayland-protocols" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +dependencies = [ + "bitflags 1.3.2", + "wayland-client 0.29.5", + "wayland-commons", + "wayland-scanner 0.29.5", +] + [[package]] name = "wayland-protocols" version = "0.31.2" @@ -2416,8 +3242,8 @@ checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" dependencies = [ "bitflags 2.4.2", "wayland-backend", - "wayland-client", - "wayland-scanner", + "wayland-client 0.31.2", + "wayland-scanner 0.31.1", ] [[package]] @@ -2428,9 +3254,9 @@ checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" dependencies = [ "bitflags 2.4.2", "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", + "wayland-client 0.31.2", + "wayland-protocols 0.31.2", + "wayland-scanner 0.31.1", ] [[package]] @@ -2441,9 +3267,20 @@ checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" dependencies = [ "bitflags 2.4.2", "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", + "wayland-client 0.31.2", + "wayland-protocols 0.31.2", + "wayland-scanner 0.31.1", +] + +[[package]] +name = "wayland-scanner" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", ] [[package]] @@ -2457,6 +3294,28 @@ dependencies = [ "quote", ] +[[package]] +name = "wayland-sys" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +dependencies = [ + "dlib", + "pkg-config", +] + +[[package]] +name = "wayland-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06" +dependencies = [ + "dlib", + "lazy_static", + "log", + "pkg-config", +] + [[package]] name = "wayland-sys" version = "0.31.1" @@ -2730,6 +3589,40 @@ version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" +[[package]] +name = "winit" +version = "0.28.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" +dependencies = [ + "android-activity 0.4.3", + "bitflags 1.3.2", + "cfg_aliases", + "core-foundation", + "core-graphics 0.22.3", + "dispatch", + "instant", + "libc", + "log", + "mio", + "ndk 0.7.0", + "objc2 0.3.0-beta.3.patch-leaks.3", + "once_cell", + "orbclient", + "percent-encoding", + "raw-window-handle 0.5.2", + "redox_syscall 0.3.5", + "smithay-client-toolkit 0.16.1", + "wasm-bindgen", + "wayland-client 0.29.5", + "wayland-commons", + "wayland-protocols 0.29.5", + "wayland-scanner 0.29.5", + "web-sys", + "windows-sys 0.45.0", + "x11-dl", +] + [[package]] name = "winit" version = "0.29.10" @@ -2737,23 +3630,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c824f11941eeae66ec71111cc2674373c772f482b58939bb4066b642aa2ffcf" dependencies = [ "ahash", - "android-activity", + "android-activity 0.5.2", "atomic-waker", "bitflags 2.4.2", "bytemuck", - "calloop", + "calloop 0.12.4", "cfg_aliases", "core-foundation", - "core-graphics", + "core-graphics 0.23.1", "cursor-icon", "icrate", "js-sys", "libc", "log", - "memmap2", - "ndk", - "ndk-sys", - "objc2", + "memmap2 0.9.4", + "ndk 0.8.0", + "ndk-sys 0.5.0+25.2.9519653", + "objc2 0.4.1", "once_cell", "orbclient", "percent-encoding", @@ -2762,14 +3655,14 @@ dependencies = [ "redox_syscall 0.3.5", "rustix", "sctk-adwaita", - "smithay-client-toolkit", + "smithay-client-toolkit 0.18.1", "smol_str", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", "wayland-backend", - "wayland-client", - "wayland-protocols", + "wayland-client 0.31.2", + "wayland-protocols 0.31.2", "wayland-protocols-plasma", "web-sys", "web-time", @@ -2818,7 +3711,7 @@ dependencies = [ "as-raw-xcb-connection", "gethostname", "libc", - "libloading", + "libloading 0.8.1", "once_cell", "rustix", "x11rb-protocol", @@ -2861,6 +3754,18 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" +[[package]] +name = "xmlparser" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" + +[[package]] +name = "xmlwriter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + [[package]] name = "yazi" version = "0.1.6" @@ -2890,7 +3795,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2262c0f..df5dda2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,5 +6,6 @@ members = [ "mangades", "rusalka", "rusalka-macro", - "mangades-plain" + "mangades-plain", + "uno-gen" ] \ No newline at end of file diff --git a/mangades-plain/src/main.rs b/mangades-plain/src/main.rs index 3e39895..4f6248c 100644 --- a/mangades-plain/src/main.rs +++ b/mangades-plain/src/main.rs @@ -4,7 +4,7 @@ use mangui::{MainEntry, SharedNode}; use mangui::femtovg::Paint; use mangui::nodes::text::Text; use mangui::nodes::{Style, TaffyStyle, ToShared}; -use mangui::taffy::{AlignItems, FlexDirection, JustifyContent, LengthPercentage, Rect}; +use mangui::taffy::{AlignItems, FlexDirection, JustifyContent, LengthPercentage, LengthPercentageAuto, Point, Rect}; use uno_gen::uno; use crate::anilist::load_demo_async; use crate::tokens::TEXT_LARGE; @@ -57,16 +57,11 @@ async fn main() { ..Default::default() }) .to_shared(); - let i = 2; - uno!(gap-1 flex p-5px mt-1 mb-2 ml-[i] overflow-hidden); + let i = LengthPercentageAuto::Length(5.); let title = Text::new("Mangades".to_owned(), TEXT_LARGE) .style(Style { - layout: TaffyStyle { - padding: Rect { left: LengthPercentage::Length(10.), right: LengthPercentage::Length(10.), top: LengthPercentage::Length(10.), bottom: LengthPercentage::Length(10.) }, - ..Default::default() - }, text_fill: Some(Paint::color(*tokens::WHITE)), - ..Default::default() + ..uno!(p-10) }) .to_shared(); diff --git a/mangades-plain/src/tokens.rs b/mangades-plain/src/tokens.rs new file mode 100644 index 0000000..0456257 --- /dev/null +++ b/mangades-plain/src/tokens.rs @@ -0,0 +1,23 @@ +use lazy_static::lazy_static; +use mangui::cosmic_text::Metrics; +use mangui::femtovg::Color; + +lazy_static!{ + pub static ref BACKGROUND: Color = Color::hex("282C34"); + pub static ref RED: Color = Color::hex("E06C75"); + pub static ref GREEN: Color = Color::hex("98C379"); + pub static ref YELLOW: Color = Color::hex("E5C07B"); + pub static ref BLUE: Color = Color::hex("61AFEF"); + pub static ref MAGENTA: Color = Color::hex("C678DD"); + pub static ref CYAN: Color = Color::hex("56B6C2"); + pub static ref GRAY: Color = Color::hex("ABB2BF"); + pub static ref WHITE: Color = Color::hex("FFFFFF"); + pub static ref BLACK: Color = Color::hex("000000"); +} + +pub static TEXT_NORMAL: Metrics = Metrics::new(16., 20.); +pub static TEXT_SMALL: Metrics = Metrics::new(14., 18.); +pub static TEXT_TINY: Metrics = Metrics::new(12., 16.); +pub static TEXT_LARGE: Metrics = Metrics::new(20., 24.); +pub static TEXT_HUGE: Metrics = Metrics::new(24., 30.); +pub static TEXT_GIANT: Metrics = Metrics::new(32., 36.); \ No newline at end of file diff --git a/mangades-plain/src/utils.rs b/mangades-plain/src/utils.rs index bc2088c..5c84e9e 100644 --- a/mangades-plain/src/utils.rs +++ b/mangades-plain/src/utils.rs @@ -2,20 +2,20 @@ use std::sync::Arc; use mangui::SharedNode; pub fn detach(node: &SharedNode) { - if let Some(parent) = node.read().unwrap().parent() { - parent.write().unwrap().remove_child(node).unwrap(); + if let Some(parent) = node.lock().unwrap().parent() { + parent.lock().unwrap().remove_child(node).unwrap(); } - node.clone().write().unwrap().set_parent(None); + node.clone().lock().unwrap().set_parent(None); } pub fn insert(parent: &SharedNode, node: &SharedNode, before: Option<&SharedNode>) { - if node.read().unwrap().parent().is_some() && !Arc::ptr_eq(&node.read().unwrap().parent().unwrap(), parent) { + if node.lock().unwrap().parent().is_some() && !Arc::ptr_eq(&node.lock().unwrap().parent().unwrap(), parent) { detach(node); } match before { Some(before) => { - parent.write().unwrap().add_child_before(node.clone(), before).unwrap(); - node.write().unwrap().set_parent(Some(Arc::downgrade(parent))); + parent.lock().unwrap().add_child_before(node.clone(), before).unwrap(); + node.lock().unwrap().set_parent(Some(Arc::downgrade(parent))); }, None => { append(parent, node); @@ -24,6 +24,6 @@ pub fn insert(parent: &SharedNode, node: &SharedNode, before: Option<&SharedNode } pub fn append(parent: &SharedNode, node: &SharedNode) { - parent.write().unwrap().add_child(node.clone()).unwrap(); - node.write().unwrap().set_parent(Some(Arc::downgrade(parent))); + parent.lock().unwrap().add_child(node.clone()).unwrap(); + node.lock().unwrap().set_parent(Some(Arc::downgrade(parent))); } \ No newline at end of file diff --git a/ui/Cargo.toml b/ui/Cargo.toml index f4313a8..6c537d7 100644 --- a/ui/Cargo.toml +++ b/ui/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -femtovg = "0.8.2" +femtovg = { path = "../femtovg" } glutin = "0.31.3" raw-window-handle = "0.5.0" winit = { version = "0.29.10" } diff --git a/ui/src/events/handler.rs b/ui/src/events/handler.rs index da8d2a4..a9ccf5a 100644 --- a/ui/src/events/handler.rs +++ b/ui/src/events/handler.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, fmt::Debug, sync::{Arc, Mutex}}; use super::NodeEvent; /// A node event handler -pub type EventHandler = dyn FnMut(&NodeEvent); +pub type EventHandler = dyn FnMut(&NodeEvent) + Send; pub type InnerEventHandlerDataset = Arc>>>>>; diff --git a/ui/src/lib.rs b/ui/src/lib.rs index a49e70d..c166540 100644 --- a/ui/src/lib.rs +++ b/ui/src/lib.rs @@ -31,16 +31,17 @@ use crate::nodes::{update_taffynode_children, MeasureContext, Node, render_recur pub mod nodes; pub mod events; + pub use taffy; pub use femtovg; pub use cosmic_text; pub type CurrentRenderer = OpenGl; -pub type SharedNode = Arc>; -pub type WeakSharedNode = Weak>; -type WeakNode = Weak>; +pub type SharedNode = Arc>; +pub type WeakSharedNode = Weak>; +type WeakNode = Weak>; type NodePtr = Option>; -type NodeLayoutMap = PtrWeakKeyHashMap>, taffy::tree::NodeId>; +type NodeLayoutMap = PtrWeakKeyHashMap>, taffy::tree::NodeId>; lazy_static::lazy_static! { pub static ref FONT_SYSTEM: Mutex = Mutex::new(FontSystem::new()); @@ -80,7 +81,7 @@ pub fn run_event_loop(entry: MainEntry) -> () { let mut taffy_map = NodeLayoutMap::new(); { let cloned = entry.root.clone(); - let root = cloned.read().unwrap(); + let root = cloned.lock().unwrap(); let root_style = root.deref().style(); let root_layout = root_style.layout.to_owned(); let taffy_root_node = taffy.new_leaf(root_layout).unwrap(); @@ -241,7 +242,7 @@ pub fn run_event_loop(entry: MainEntry) -> () { let width: NonZeroU32 = NonZeroU32::new(size.width).unwrap(); let height: NonZeroU32 = NonZeroU32::new(size.height).unwrap(); surface.resize(&buffer_context, width, height); - let mut groot = entry.root.write().unwrap(); + let mut groot = entry.root.lock().unwrap(); // let scale_factor = window.scale_factor(); groot.resize(size.width as f32, size.height as f32); drop(groot); @@ -263,7 +264,7 @@ pub fn run_event_loop(entry: MainEntry) -> () { } prepare_render_recursively(&root, &mut context); for (node, taffy_node) in context.node_layout.iter() { - let node = node.read().unwrap(); + let node = node.lock().unwrap(); let node_style = node.style(); context.taffy.set_style(*taffy_node, node_style.layout.to_owned()).unwrap(); } @@ -279,7 +280,7 @@ pub fn run_event_loop(entry: MainEntry) -> () { Some(node) => { match node.upgrade() { Some(node) => { - node.write().unwrap().measure(&mut measure_context, known_dimensions, available_space) + node.lock().unwrap().measure(&mut measure_context, known_dimensions, available_space) }, None => Size::ZERO } diff --git a/ui/src/nodes/image.rs b/ui/src/nodes/image.rs index 33ebc3b..c40fd82 100644 --- a/ui/src/nodes/image.rs +++ b/ui/src/nodes/image.rs @@ -45,8 +45,6 @@ pub struct Image { pub style: Style, /// The image to be rendered. pub image: ImageLoad, - /// Border radius - pub radius: f32, pub events: EventHandlerDatabase, pub parent: Option } @@ -58,10 +56,6 @@ impl Image { ..Default::default() } } - pub fn radius(mut self, radius: f32) -> Image { - self.radius = radius; - self - } pub fn style(mut self, style: Style) -> Image { self.style = style; self @@ -123,10 +117,13 @@ impl Node for Image { 0., layout.size.width, layout.size.height, - self.radius + self.style.border_radius ); match &self.image { ImageLoad::Loaded(image) => { + if let Some(background) = &self.style.background { + context.canvas.fill_path(&path, background); + } context.canvas.fill_path( &path, &Paint::image(image.image, 0., 0., layout.size.width, layout.size.height, 0., 1.) diff --git a/ui/src/nodes/layout.rs b/ui/src/nodes/layout.rs index 37768dc..f1f96bb 100644 --- a/ui/src/nodes/layout.rs +++ b/ui/src/nodes/layout.rs @@ -1,7 +1,10 @@ use std::fmt::{Debug, Formatter}; use std::sync::{Arc, RwLock}; +use femtovg::{Paint, Path}; use crate::{nodes::{Node, NodeChildren, Style}, events::handler::EventHandlerDatabase, WeakNode, SharedNode}; use taffy::style::Dimension; +use crate::nodes::primitives::draw_rect; +use crate::nodes::RenderContext; /// A simple layout node which contains children. #[derive(Default)] @@ -18,7 +21,7 @@ impl Layout { style: Style::default(), children, events: EventHandlerDatabase::default(), - parent: None + ..Default::default() } } pub fn empty() -> Layout { @@ -26,7 +29,7 @@ impl Layout { style: Style::default(), children: NodeChildren::default(), events: EventHandlerDatabase::default(), - parent: None + ..Default::default() } } @@ -56,6 +59,10 @@ impl Node for Layout { self.style.layout.size.width = Dimension::Length(width); self.style.layout.size.height = Dimension::Length(height); } + + fn render_pre_children(&mut self, context: &mut RenderContext, layout: taffy::Layout) { + if let Some(background) = &self.style.background { draw_rect(layout.size, background, self.style.border_radius, &mut context.canvas); } + } fn add_child_at(&mut self, child: crate::SharedNode, index: usize) -> Result<(), super::ChildAddError> { let mut index = index; diff --git a/ui/src/nodes/mod.rs b/ui/src/nodes/mod.rs index da980a7..4f204d6 100644 --- a/ui/src/nodes/mod.rs +++ b/ui/src/nodes/mod.rs @@ -6,14 +6,14 @@ pub mod text; pub mod text_render_cache; use std::fmt::Debug; -use std::sync::{Arc, RwLock}; -use femtovg::{Canvas, Color}; +use std::sync::{Arc, Mutex, RwLock}; +use femtovg::{Canvas, Color, Paint}; use crate::events::Location; use crate::events::handler::InnerEventHandlerDataset; use crate::{NodeLayoutMap, NodePtr, CurrentRenderer, SharedNode, WeakNode}; pub use taffy::style::Style as TaffyStyle; -use taffy::{Layout, Overflow, Size, TaffyTree}; +use taffy::{Layout, Overflow, Point, Size, TaffyTree}; pub type CanvasRenderer = Canvas; @@ -38,9 +38,9 @@ impl RenderContext { pub fn fill_rect(&mut self, x: u32, y: u32, width: u32, height: u32, color: Color) { let transform = self.canvas.transform(); let x = transform[0] * x as f32 + transform[2] * y as f32 + transform[4]; - let y = transform[1] * x as f32 + transform[3] * y as f32 + transform[5]; + let y = transform[1] * x + transform[3] * y as f32 + transform[5]; let width = transform[0] * width as f32 + transform[2] * height as f32; - let height = transform[1] * width as f32 + transform[3] * height as f32; + let height = transform[1] * width + transform[3] * height as f32; self.canvas.clear_rect(x as u32, y as u32, width as u32, height as u32, color); } } @@ -50,10 +50,34 @@ pub enum Cursor { #[default] Default } + +#[derive(Clone, Default, Debug)] +/// Transform is handled by UI lib - components shouldn't need to read this. +pub struct Transform { + /// Translation in x and y direction (in pixels; scaled by parents) + pub position: Point, + /// Scale in x and y direction + pub scale: Size, + /// Rotation in radians + pub rotation: f32 +} + +/// Styles for the node. Note that the styles aren't inherited (yet?) #[derive(Clone, Default, Debug)] pub struct Style { pub layout: TaffyStyle, - pub cursor: Cursor + pub cursor: Cursor, + pub background: Option, + /// defaults to black + pub text_fill: Option, + /// font size in pixels. Default is 16 + pub font_size: Option, + /// multiplier of line height in relation to font size. Default is 1.2 + pub line_height: Option, + /// border radius in pixels + pub border_radius: f32, + /// Various transformation (position, scale and rotation) + pub transform: Option } type NodeChildren = Vec; @@ -105,7 +129,7 @@ pub enum ChildAddError { /// - [`Node::render_pre_children`] is called /// - children are rendered /// - [`Node::render_post_children`] is called -pub trait Node: Debug { +pub trait Node: Debug + Send { /// Return style. ///insert /// If you're using [`Style`] in your struct directly, your implementation can be as simple as: @@ -172,7 +196,7 @@ pub trait Node: Debug { /// Add a child to the node at the given index. If the node does not support children, returns error ChildrenNotSupported. /// Adding the same child multiple times or to multiple parents is not supported and will result in undefined behavior. /// Arc> does **NOT** mean that it's safe to add the same node multiple times. - /// + /// /// Note that this doesn't set the parent of the child. You need to do that manually. /// /// Implementors can check [`Node::has_child`] to check if the child already exists. Default implementation throws [`ChildAddError::ChildrenNotSupported`]. @@ -275,7 +299,7 @@ pub trait ToShared { impl ToShared for T { fn to_shared(self) -> SharedNode { - Arc::new(RwLock::new(self)) + Arc::new(Mutex::new(self)) } } @@ -283,7 +307,7 @@ impl ToShared for T { /// The target element should be the last one in path (event handlers are ran in reverse order) pub(crate) fn run_event_handlers(path: Vec, event: crate::events::NodeEvent) { for node in path.iter().rev() { - let node = node.read().unwrap(); + let node = node.lock().unwrap(); if let Some(handlers) = node.event_handlers() { drop(node); for handler in handlers.lock().unwrap().values_mut() { @@ -294,7 +318,7 @@ pub(crate) fn run_event_handlers(path: Vec, event: crate::events::No } pub(crate) fn run_single_event_handlers(node: SharedNode, event: crate::events::NodeEvent) { - let node = node.read().unwrap(); + let node = node.lock().unwrap(); if let Some(handlers) = node.event_handlers() { drop(node); for handler in handlers.lock().unwrap().values_mut() { @@ -305,7 +329,7 @@ pub(crate) fn run_single_event_handlers(node: SharedNode, event: crate::events:: /// Attempts to get path to the element at the target location. Assumes elements are always inside their parents. pub(crate) fn get_element_at(node: &SharedNode, context: &RenderContext, location: Location) -> Option> { - let node_borrowed = node.read().unwrap(); + let node_borrowed = node.lock().unwrap(); let children = node_borrowed.children(); let taffy_node = context.node_layout.get(node); let taffy_node = match taffy_node { @@ -340,7 +364,7 @@ pub(crate) fn update_taffynode_children(node: &SharedNode, context: &mut RenderC Some(taffy_node) => taffy_node, None => { let taffy_node = context.taffy.new_leaf_with_context( - node.read().unwrap().style().layout.to_owned(), + node.lock().unwrap().style().layout.to_owned(), Arc::downgrade(node) ).unwrap(); context.node_layout.insert(node.clone(), taffy_node); @@ -350,13 +374,13 @@ pub(crate) fn update_taffynode_children(node: &SharedNode, context: &mut RenderC let taffy_node = taffy_node.to_owned(); - match node.read().unwrap().children() { + match node.lock().unwrap().children() { None => {}, Some(children) => { let mut t_children = Vec::with_capacity(children.len()); for child in children { t_children.push(update_taffynode_children(child, context).to_owned()); - child.write().unwrap().set_parent(Some(Arc::downgrade(node))); + child.lock().unwrap().set_parent(Some(Arc::downgrade(node))); } context.taffy.set_children(taffy_node, t_children.as_slice()).unwrap(); } @@ -366,13 +390,18 @@ pub(crate) fn update_taffynode_children(node: &SharedNode, context: &mut RenderC } pub(crate) fn render_recursively(node: &SharedNode, context: &mut RenderContext) { - let read_node = node.read().unwrap(); + let read_node = node.lock().unwrap(); let styles = read_node.style(); let taffy_node = context.node_layout.get(node).unwrap(); let layout = *context.taffy.layout(*taffy_node).unwrap(); let sself = node.clone(); context.canvas.save(); - context.canvas.translate(layout.location.x, layout.location.y); + let offset = styles.transform.as_ref().map(|t| (t.position.x, t.position.y)).unwrap_or((0., 0.)); + context.canvas.translate(layout.location.x + offset.0, layout.location.y + offset.1); + if let Some(transform) = &styles.transform { + context.canvas.scale(transform.scale.width, transform.scale.height); + context.canvas.rotate(transform.rotation); + } let clip_width = matches!(styles.layout.overflow.x, Overflow::Hidden | Overflow::Clip); let clip_height = matches!(styles.layout.overflow.y, Overflow::Hidden | Overflow::Clip); if clip_width || clip_height { @@ -384,18 +413,18 @@ pub(crate) fn render_recursively(node: &SharedNode, context: &mut RenderContext) ); } drop(read_node); - sself.write().unwrap().render_pre_children(context, layout); - if let Some(children) = sself.read().unwrap().children() { + sself.lock().unwrap().render_pre_children(context, layout); + if let Some(children) = sself.lock().unwrap().children() { for child in children { render_recursively(child, context); } } - sself.write().unwrap().render_post_children(context, layout); + sself.lock().unwrap().render_post_children(context, layout); context.canvas.restore(); } pub(crate) fn prepare_render_recursively(node: &SharedNode, context: &mut RenderContext) { - let mut write_node = node.write().unwrap(); + let mut write_node = node.lock().unwrap(); write_node.prepare_render(context); if let Some(children) = write_node.children() { for child in children { diff --git a/ui/src/nodes/primitives.rs b/ui/src/nodes/primitives.rs index 9e8310f..5cf3994 100644 --- a/ui/src/nodes/primitives.rs +++ b/ui/src/nodes/primitives.rs @@ -1,12 +1,11 @@ use femtovg::{Color, Paint, Path}; -use taffy::Layout; +use taffy::{Layout, Size}; use crate::{nodes::{Node, NodeChildren, RenderContext, Style}, events::handler::EventHandlerDatabase, WeakNode, SharedNode}; +use crate::nodes::CanvasRenderer; #[derive(Default, Debug)] pub struct Rectangle { pub style: Style, - pub fill: Paint, - pub radius: f32, pub events: EventHandlerDatabase, pub parent: Option } @@ -15,8 +14,6 @@ impl Rectangle { pub fn new() -> Rectangle { Rectangle { style: Style::default(), - fill: Paint::color(Color::rgb(0, 0, 0)), - radius: 0., events: EventHandlerDatabase::default(), parent: None } @@ -31,18 +28,7 @@ impl Node for Rectangle { None } fn render_pre_children(&mut self, context: &mut RenderContext, layout: Layout) { - let mut path = Path::new(); - path.rounded_rect( - 0., - 0., - layout.size.width, - layout.size.height, - self.radius - ); - context.canvas.fill_path( - &path, - &self.fill - ); + draw_rect(layout.size, self.style.background.as_ref().unwrap_or(&Paint::color(Color::black())), self.style.border_radius, &mut context.canvas); } fn event_handlers(&self) -> Option { Some(self.events.handlers.clone()) @@ -56,4 +42,19 @@ impl Node for Rectangle { None => None } } +} + +pub fn draw_rect(size: Size, fill: &Paint, radius: f32, canvas: &mut CanvasRenderer) { + let mut path = Path::new(); + path.rounded_rect( + 0., + 0., + size.width, + size.height, + radius + ); + canvas.fill_path( + &path, + fill + ); } \ No newline at end of file diff --git a/ui/src/nodes/text.rs b/ui/src/nodes/text.rs index 31975c9..219a8f1 100644 --- a/ui/src/nodes/text.rs +++ b/ui/src/nodes/text.rs @@ -1,10 +1,10 @@ use std::fmt::Debug; -use std::sync::{Arc, RwLock}; use crate::{events::handler::EventHandlerDatabase, SharedNode, WeakNode, FONT_SYSTEM}; use super::{text_render_cache::RENDER_CACHE, Node, NodeChildren, Style, MeasureContext, RenderContext}; -use cosmic_text::{Attrs, Buffer, Family, Metrics, Shaping, Stretch}; -use femtovg::{Color, Paint, Path}; +use cosmic_text::{Attrs, Buffer, Metrics, Shaping}; use taffy::{AvailableSpace, Size}; +use femtovg::{Color, Paint, Path}; +use crate::nodes::primitives::draw_rect; use crate::nodes::text_render_cache::TextConfig; #[derive(Debug, Default)] @@ -13,16 +13,13 @@ pub struct Text { pub text: String, pub events: EventHandlerDatabase, pub parent: Option, - pub metrics: Metrics, - pub buffer: Option, - pub paint: Paint + pub buffer: Option } impl Text { pub fn new(text: String, metrics: Metrics) -> Text { Text { text, - metrics, ..Default::default() } } @@ -30,18 +27,18 @@ impl Text { self.text = text; self } - pub fn metrics(mut self, metrics: Metrics) -> Self { - self.metrics = metrics; - self - } - pub fn paint(mut self, paint: Paint) -> Self { - self.paint = paint; - self - } pub fn style(mut self, style: Style) -> Self { self.style = style; self } + + fn get_metrics(&self) -> Metrics { + let fontSize = self.style.font_size.unwrap_or(16.); + Metrics { + font_size: fontSize, + line_height: fontSize * self.style.line_height.unwrap_or(1.2) + } + } } impl Node for Text { @@ -55,7 +52,7 @@ impl Node for Text { fn prepare_render(&mut self, _context: &mut RenderContext) { if let None = self.buffer { - self.buffer = Some(Buffer::new(&mut FONT_SYSTEM.lock().unwrap(), self.metrics)); + self.buffer = Some(Buffer::new(&mut FONT_SYSTEM.lock().unwrap(), self.get_metrics())); } let buf = self.buffer.as_mut().unwrap(); let mut font = FONT_SYSTEM.lock().unwrap(); @@ -63,6 +60,8 @@ impl Node for Text { } fn render_pre_children(&mut self, context: &mut super::RenderContext, layout: taffy::prelude::Layout) { + if let Some(background) = &self.style.background { draw_rect(layout.size, background, self.style.border_radius, &mut context.canvas); } + let metrics = self.get_metrics(); // this can crash, but it should crash earlier during measure -> see the comment there. let buf = self.buffer.as_mut().unwrap(); let mut font = FONT_SYSTEM.lock().unwrap(); @@ -72,41 +71,17 @@ impl Node for Text { ); // the height * scale factor is an ugly hack to fix height of the text... not sure why it's wrong in the first place buf.set_size(&mut font, layout.content_size.width - offset_size.0, (layout.content_size.height * context.scale_factor) - offset_size.1); - buf.set_metrics(&mut font, self.metrics.scale(context.scale_factor)); + buf.set_metrics(&mut font, metrics.scale(context.scale_factor)); // fill_to_cmds requires FONT_SYSTEM lock. drop(font); - let mut path = Path::new(); - path.rounded_rect( - 0., - 0., - layout.size.width, - layout.size.height, - 0. - ); - context.canvas.fill_path( - &path, - &Paint::color(Color::rgb(255, 0, 0)) - ); let position = ( layout.padding.left + layout.border.left, layout.padding.top + layout.border.top ); - let mut path = Path::new(); - path.rounded_rect( - position.0, - position.1, - layout.content_size.width - offset_size.0, - layout.content_size.height - offset_size.1, - 0. - ); - context.canvas.fill_path( - &path, - &Paint::color(Color::rgb(0, 0, 255)) - ); let cmds = RENDER_CACHE.lock().unwrap() .fill_to_cmds(&mut context.canvas, buf, position, context.scale_factor, TextConfig { hint: false, subpixel: false }) .unwrap(); - context.canvas.draw_glyph_commands(cmds, &self.paint, context.scale_factor); + context.canvas.draw_glyph_commands(cmds, self.style.text_fill.as_ref().unwrap_or(&Paint::color(Color::black())), context.scale_factor); } fn measure(&mut self, context: &mut MeasureContext, known_dimensions: Size>, available_space: Size) -> Size { @@ -115,12 +90,13 @@ impl Node for Text { AvailableSpace::MaxContent => f32::INFINITY, AvailableSpace::Definite(width) => width, }); + let metrics = self.get_metrics(); // yes, this can crash if someone removes `buffer` during render from another thread. // though they're asking for it, so let them crash. let buf = self.buffer.as_mut().unwrap(); let mut font = FONT_SYSTEM.lock().unwrap(); buf.set_size(&mut font, width_constraint, f32::INFINITY); - buf.set_metrics(&mut font, self.metrics.scale(context.scale_factor)); + buf.set_metrics(&mut font, metrics.scale(context.scale_factor)); // Compute layout buf.shape_until_scroll(&mut font, true); diff --git a/uno-gen/src/lib.rs b/uno-gen/src/lib.rs index 1517667..968aea3 100644 --- a/uno-gen/src/lib.rs +++ b/uno-gen/src/lib.rs @@ -1,7 +1,85 @@ use proc_macro2::{Span, TokenStream, TokenTree}; -use quote::{IdentFragment, quote_spanned}; +use quote::{IdentFragment, quote, quote_spanned, ToTokens}; use quote::spanned::Spanned; +macro_rules! impl_enum_totokens { + ( + $name:ident, + $prefix:path + $(, $( $variant:ident ),+)? + $(; $( $qvariant:ident ( $( $qual:ident ),+ ) ),* )? + $(| $( $qvariant2:ident ( $( $qual2:ident => $qtype:tt ),+ ) ),* )? + ) => { + impl ToTokens for $name { + fn to_tokens(&self, stream: &mut TokenStream) { + stream.extend(match self { + $( + $( + $name::$variant => { + quote! { + $prefix::$variant + } + } + ),+ + )? + $( + $( + $name::$qvariant($($qual),+) => { + quote! { + $prefix::$qvariant($(#$qual),+) + } + } + )+ + )? + $( + $( + $name::$qvariant2($($qual2),+) => { + quote! { + $prefix::$qvariant2($( $qtype ),+) + } + } + )+ + )? + }); + } + } + } +} + +macro_rules! impl_struct_usersettable_totokens { + ( + $name:ident, + $prefix:path, + $($variant:ident),+ + $(| $( $qvariant:ident => $qtype:tt ),* )? + ) => { + impl ToTokens for $name { + fn to_tokens(&self, stream: &mut TokenStream) { + let $name { $($variant),+, .. } = self; + let mut substream = TokenStream::new(); + $( + if !$variant.is_empty() { + substream.extend(quote! { $variant: #$variant, }); + } + )+ + $( + $( + if !$qvariant.is_empty() { + substream.extend(quote! { $qvariant: #$qtype, }); + } + ),* + )? + stream.extend(quote! { + $prefix { + #substream + ..Default::default() + } + }); + } + } + } +} + #[derive(Clone, Default, Debug)] enum UserSettable { Value(T), @@ -28,6 +106,14 @@ impl UserSettable { } } } + + fn is_empty(&self) -> bool { + match self { + UserSettable::Value(_) => false, + UserSettable::Arbitrary(_) => false, + UserSettable::None => true + } + } } impl UserSettable { @@ -48,18 +134,79 @@ impl UserSettable { } } +impl ToTokens for UserSettable { + fn to_tokens(&self, stream: &mut TokenStream) { + stream.extend(match self { + UserSettable::Value(value) => value.to_token_stream(), + UserSettable::Arbitrary(stream) => stream.clone(), + UserSettable::None => quote! { Default::default() } + }); + } +} + #[derive(Clone, Default, Debug)] struct Point { x: UserSettable, y: UserSettable } +impl ToTokens for Point { + fn to_tokens(&self, stream: &mut TokenStream) { + let Point { x, y } = self; + stream.extend(quote! { + mangui::taffy::Point { x: #x, y: #y } + }); + } +} + #[derive(Clone, Default, Debug)] struct Size { width: UserSettable, height: UserSettable } +impl ToTokens for Size { + fn to_tokens(&self, stream: &mut TokenStream) { + let Size { width, height } = self; + stream.extend(quote! { + mangui::taffy::Size { width: #width, height: #height } + }); + } +} + +#[derive(Clone, Default, Debug)] +struct Rect { + pub left: UserSettable, + pub right: UserSettable, + pub top: UserSettable, + pub bottom: UserSettable, +} + +impl ToTokens for Rect { + fn to_tokens(&self, stream: &mut TokenStream) { + let Rect { left, right, top, bottom } = self; + let mut substream = TokenStream::new(); + if !left.is_empty() { + substream.extend(quote! { left: #left, }); + } + if !right.is_empty() { + substream.extend(quote! { right: #right, }); + } + if !top.is_empty() { + substream.extend(quote! { top: #top, }); + } + if !bottom.is_empty() { + substream.extend(quote! { bottom: #bottom, }); + } + if left.is_empty() || right.is_empty() || top.is_empty() || bottom.is_empty() { + substream.extend(quote! { ..Rect::zero() }); + } + stream.extend(quote! { + mangui::taffy::geometry::Rect { #substream } + }); + } +} + #[derive(Clone, Default, Debug)] struct Color { r: f32, @@ -68,6 +215,15 @@ struct Color { a: f32 } +impl ToTokens for Color { + fn to_tokens(&self, stream: &mut TokenStream) { + let Color { r, g, b, a } = self; + stream.extend(quote! { + mangui::femtovg::Color::rgba(#r, #g, #b, #a) + }); + } +} + #[derive(Clone, Debug)] enum Paint { Color(Color) @@ -84,12 +240,26 @@ impl Default for Paint { } } +impl ToTokens for Paint { + fn to_tokens(&self, stream: &mut TokenStream) { + stream.extend(match self { + Paint::Color(color) => { + quote! { + mangui::femtovg::Paint::color(#color) + } + } + }); + } +} + #[derive(Copy, Clone, Default, Debug)] enum Cursor { #[default] Default } +impl_enum_totokens!(Cursor, mangui::femtovg::Cursor, Default); + #[derive(Clone, Default, Debug)] struct Transform { pub position: UserSettable>, @@ -97,6 +267,8 @@ struct Transform { pub rotation: UserSettable } +impl_struct_usersettable_totokens!(Transform, mangui::nodes::Transform, position, scale, rotation); + #[derive(Clone, Default, Debug)] struct Style { pub layout: UserSettable, @@ -109,13 +281,11 @@ struct Style { pub transform: UserSettable } -#[derive(Clone, Default, Debug)] -struct Rect { - pub left: UserSettable, - pub right: UserSettable, - pub top: UserSettable, - pub bottom: UserSettable, -} +impl_struct_usersettable_totokens!( + Style, + mangui::nodes::Style, + layout, cursor, background, text_fill, font_size, line_height, border_radius, transform +); #[derive(Clone, Default, Debug)] enum Position { @@ -124,6 +294,8 @@ enum Position { Absolute, } +impl_enum_totokens!(Position, mangui::taffy::Position, Relative, Absolute); + #[derive(Clone, Default, Debug)] enum Display { Block, @@ -133,6 +305,8 @@ enum Display { None, } +impl_enum_totokens!(Display, mangui::taffy::Display, Block, Flex, Grid, None); + #[derive(Clone, Default, Debug)] enum Overflow { #[default] @@ -142,6 +316,8 @@ enum Overflow { Scroll, } +impl_enum_totokens!(Overflow, mangui::taffy::Overflow, Visible, Clip, Hidden, Scroll); + #[derive(Clone, Default, Debug)] enum LengthPercentageAuto { Length(f32), @@ -150,6 +326,8 @@ enum LengthPercentageAuto { Auto, } +impl_enum_totokens!(LengthPercentageAuto, mangui::taffy::LengthPercentageAuto, Auto; Length(i), Percent(i)); + #[derive(Clone, Default, Debug)] enum Dimension { Length(f32), @@ -158,12 +336,16 @@ enum Dimension { Auto, } +impl_enum_totokens!(Dimension, mangui::taffy::Dimension, Auto; Length(i), Percent(i)); + #[derive(Clone, Debug)] enum LengthPercentage { Length(f32), Percent(f32), } +impl_enum_totokens!(LengthPercentage, mangui::taffy::LengthPercentage; Length(i), Percent(i)); + impl Default for LengthPercentage { fn default() -> Self { LengthPercentage::Length(0.) @@ -181,6 +363,8 @@ enum AlignItems { Stretch, } +impl_enum_totokens!(AlignItems, mangui::taffy::AlignItems, Start, End, FlexStart, FlexEnd, Center, Baseline, Stretch); + type AlignSelf = AlignItems; #[derive(Clone, Debug)] @@ -197,6 +381,8 @@ enum AlignContent { } type JustifyContent = AlignContent; +impl_enum_totokens!(AlignContent, mangui::taffy::AlignContent, Start, End, FlexStart, FlexEnd, Center, Stretch, SpaceBetween, SpaceEvenly, SpaceAround); + #[derive(Clone, Default, Debug)] enum FlexDirection { #[default] @@ -206,6 +392,8 @@ enum FlexDirection { ColumnReverse, } +impl_enum_totokens!(FlexDirection, mangui::taffy::FlexDirection, Row, Column, RowReverse, ColumnReverse); + #[derive(Clone, Default, Debug)] enum FlexWrap { #[default] @@ -214,6 +402,8 @@ enum FlexWrap { WrapReverse, } +impl_enum_totokens!(FlexWrap, mangui::taffy::FlexWrap, NoWrap, Wrap, WrapReverse); + #[derive(Clone, Default, Debug)] struct Line { @@ -221,11 +411,30 @@ struct Line { pub end: T, } +impl ToTokens for Line { + fn to_tokens(&self, stream: &mut TokenStream) { + let Line { start, end } = self; + stream.extend(quote! { + mangui::taffy::Line::new(#start, #end) + }); + } +} + #[derive(Clone, Debug)] struct MinMax { pub min: Min, pub max: Max, } + +impl ToTokens for MinMax { + fn to_tokens(&self, stream: &mut TokenStream) { + let MinMax { min, max } = self; + stream.extend(quote! { + mangui::taffy::MinMax::new(#min, #max) + }); + } +} + #[derive(Clone, Debug)] enum MinTrackSizingFunction { Fixed(LengthPercentage), @@ -233,6 +442,9 @@ enum MinTrackSizingFunction { MaxContent, Auto, } + +impl_enum_totokens!(MinTrackSizingFunction, mangui::taffy::MinTrackSizingFunction, MinContent, MaxContent, Auto; Fixed(i)); + #[derive(Clone, Debug)] enum MaxTrackSizingFunction { Fixed(LengthPercentage), @@ -243,6 +455,9 @@ enum MaxTrackSizingFunction { Fraction(f32), } type NonRepeatedTrackSizingFunction = MinMax; + +impl_enum_totokens!(MaxTrackSizingFunction, mangui::taffy::MaxTrackSizingFunction, MinContent, MaxContent, Auto; FitContent(i), Fraction(i), Fixed(i)); + #[derive(Clone, Debug)] enum GridTrackRepetition { AutoFill, @@ -250,12 +465,16 @@ enum GridTrackRepetition { Count(u16), } +impl_enum_totokens!(GridTrackRepetition, mangui::taffy::GridTrackRepetition, AutoFill, AutoFit; Count(i)); + #[derive(Clone, Debug)] enum TrackSizingFunction { Single(NonRepeatedTrackSizingFunction), Repeat(GridTrackRepetition, Vec), } +impl_enum_totokens!(TrackSizingFunction, mangui::taffy::TrackSizingFunction; Single(i) | Repeat(repeat => (#repeat), functions => (vec![#( #functions ),*]))); + #[derive(Clone, Default, Debug)] enum GridAutoFlow { #[default] @@ -265,8 +484,20 @@ enum GridAutoFlow { ColumnDense, } +impl_enum_totokens!(GridAutoFlow, mangui::taffy::GridAutoFlow, Row, Column, RowDense, ColumnDense); + #[derive(Clone, Debug)] struct GridLine(i16); + +impl ToTokens for GridLine { + fn to_tokens(&self, stream: &mut TokenStream) { + let GridLine(line) = self; + stream.extend(quote! { + mangui::taffy::GridLine::new(#line) + }); + } +} + #[derive(Clone, Default, Debug)] enum GridPlacement { #[default] @@ -274,6 +505,10 @@ enum GridPlacement { Line(GridLine), Span(u16), } + +impl_enum_totokens!(GridPlacement, mangui::taffy::GridPlacement, Auto; Line(i), Span(i)); + +/// Styles for positioning. Note that grid template rows/columns and auto rows/columns are not supported yet (generated) #[derive(Clone, Default, Debug)] struct TaffyStyle { pub display: UserSettable, @@ -309,6 +544,17 @@ struct TaffyStyle { pub grid_column: UserSettable>, } +impl_struct_usersettable_totokens!( + TaffyStyle, + mangui::taffy::Style, + display, overflow, scrollbar_width, position, inset, size, min_size, max_size, + aspect_ratio, margin, padding, border, + align_items, align_self, justify_items, justify_self, align_content, justify_content, + gap, + flex_direction, flex_wrap, flex_basis, flex_grow, flex_shrink, + grid_auto_flow, grid_row, grid_column +); + trait ValueToUserSettable { fn to_user_settable(self, span: Span, inverse: bool) -> Result, RuleParseError>; } @@ -479,7 +725,6 @@ struct RuleParseError { #[proc_macro] pub fn uno(item: proc_macro::TokenStream) -> proc_macro::TokenStream { let item = TokenStream::from(item); - let mut output = TokenStream::new(); dbg!(&item); let rules = parse_rules(item); @@ -503,9 +748,9 @@ pub fn uno(item: proc_macro::TokenStream) -> proc_macro::TokenStream { } }; - dbg!(style); + dbg!(&style); - output.into() + style.to_token_stream().into() } fn process_rules(rules: Vec) -> Result {