From 06833f4fa8e63ecc55fe3fc874a9e397e77a5709 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 1 Apr 2024 13:03:39 -0300 Subject: [PATCH] feat(ipc): enhance request URL checks, update wry, refactor file drop (#9100) * feat(ipc): enhance request URL checks * actually use req url * fix windows, tests * wry 0.38, file drop refactor * wry 0.38.1 * adjust for windows [skip ci] * wry 0.38.2 [skip ci] * update to latest tao, wry, muda and tray-icon * change tag * serde * use published crates * downgrade cargo-platform to 0.1.7 --------- Co-authored-by: amrbashir --- .changes/enhance-ipc-url-check.md | 5 + .changes/http-v1.md | 7 + .changes/ipc-request-param-refactor.md | 6 + .changes/rect-strcut.md | 5 + .changes/rename-file-drop.md | 9 + .changes/runtime-dpi-mod-moved.md | 5 + .changes/tray-rect.md | 9 + .changes/webview-bounds.md | 5 + .changes/wry-0.38.md | 5 + Cargo.lock | 926 ++++++++---------- core/tauri-config-schema/schema.json | 4 +- core/tauri-runtime-wry/Cargo.toml | 12 +- core/tauri-runtime-wry/src/lib.rs | 333 ++++--- .../src/undecorated_resizing.rs | 6 +- core/tauri-runtime/Cargo.toml | 5 +- core/tauri-runtime/src/lib.rs | 35 +- core/tauri-runtime/src/monitor.rs | 2 +- core/tauri-runtime/src/webview.rs | 27 +- core/tauri-runtime/src/window.rs | 36 +- core/tauri-runtime/src/window/dpi.rs | 401 -------- core/tauri-utils/src/config.rs | 14 +- core/tauri/Cargo.toml | 12 +- core/tauri/scripts/bundle.global.js | 2 +- core/tauri/src/app.rs | 20 +- core/tauri/src/ipc/protocol.rs | 32 +- core/tauri/src/lib.rs | 8 +- core/tauri/src/manager/webview.rs | 23 +- core/tauri/src/manager/window.rs | 41 +- core/tauri/src/menu/menu.rs | 2 +- core/tauri/src/menu/mod.rs | 19 - core/tauri/src/menu/plugin.rs | 2 +- core/tauri/src/menu/submenu.rs | 2 +- core/tauri/src/test/mock_runtime.rs | 14 +- core/tauri/src/test/mod.rs | 3 + core/tauri/src/tray/mod.rs | 44 +- core/tauri/src/webview/mod.rs | 39 +- core/tauri/src/webview/plugin.rs | 20 +- core/tauri/src/webview/webview_window.rs | 14 +- core/tauri/src/window/mod.rs | 4 +- examples/api/src-tauri/Cargo.lock | 315 ++---- tooling/api/src/event.ts | 7 +- tooling/api/src/webview.ts | 65 +- tooling/api/src/webviewWindow.ts | 4 +- tooling/api/src/window.ts | 46 +- tooling/cli/schema.json | 4 +- 45 files changed, 1061 insertions(+), 1538 deletions(-) create mode 100644 .changes/enhance-ipc-url-check.md create mode 100644 .changes/http-v1.md create mode 100644 .changes/ipc-request-param-refactor.md create mode 100644 .changes/rect-strcut.md create mode 100644 .changes/rename-file-drop.md create mode 100644 .changes/runtime-dpi-mod-moved.md create mode 100644 .changes/tray-rect.md create mode 100644 .changes/webview-bounds.md create mode 100644 .changes/wry-0.38.md delete mode 100644 core/tauri-runtime/src/window/dpi.rs diff --git a/.changes/enhance-ipc-url-check.md b/.changes/enhance-ipc-url-check.md new file mode 100644 index 000000000..834b2c2f5 --- /dev/null +++ b/.changes/enhance-ipc-url-check.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:enhance +--- + +Enhance the IPC URL check by using the Origin header on the custom protocol IPC and the new request URI field on the postMessage IPC instead of using `Webview::url()` which only returns the URL of the main frame and is not suitable for iframes (iframe URL fetch is still not supported on Android and on Linux when using the postMessage IPC). diff --git a/.changes/http-v1.md b/.changes/http-v1.md new file mode 100644 index 000000000..646717162 --- /dev/null +++ b/.changes/http-v1.md @@ -0,0 +1,7 @@ +--- +'tauri': 'patch:deps' +'tauri-runtime': 'patch' +'tauri-runtime-wry': 'patch' +--- + +Updated `http` crate to `1.1` diff --git a/.changes/ipc-request-param-refactor.md b/.changes/ipc-request-param-refactor.md new file mode 100644 index 000000000..6562c2f88 --- /dev/null +++ b/.changes/ipc-request-param-refactor.md @@ -0,0 +1,6 @@ +--- +"tauri-runtime": patch:breaking +"tauri-runtime-wry": patch:breaking +--- + +The IPC handler closure now receives a `http::Request` instead of a String representing the request body. diff --git a/.changes/rect-strcut.md b/.changes/rect-strcut.md new file mode 100644 index 000000000..923f7777b --- /dev/null +++ b/.changes/rect-strcut.md @@ -0,0 +1,5 @@ +--- +'tauri': 'patch:feat' +--- + +Added `Rect` struct. diff --git a/.changes/rename-file-drop.md b/.changes/rename-file-drop.md new file mode 100644 index 000000000..26fd3bd0c --- /dev/null +++ b/.changes/rename-file-drop.md @@ -0,0 +1,9 @@ +--- +"tauri": patch:breaking +"tauri-runtime": patch:breaking +"tauri-utils": patch:breaking +"tauri-runtime-wry": patch:breaking +"@tauri-apps/api": patch:breaking +--- + +Rename `FileDrop` to `DragDrop` on structs, enums and enum variants. Also renamed `file_drop` to `drag_drop` on fields and function names. diff --git a/.changes/runtime-dpi-mod-moved.md b/.changes/runtime-dpi-mod-moved.md new file mode 100644 index 000000000..51629e345 --- /dev/null +++ b/.changes/runtime-dpi-mod-moved.md @@ -0,0 +1,5 @@ +--- +'tauri-runtime': 'major:breaking' +--- + +Moved `window::dpi` module to the root of the crate. diff --git a/.changes/tray-rect.md b/.changes/tray-rect.md new file mode 100644 index 000000000..28f8528cd --- /dev/null +++ b/.changes/tray-rect.md @@ -0,0 +1,9 @@ +--- +'tauri': 'patch:breaking' +--- + +Refactored the tray icon event struct: + +- Changed `TrayIconEvent.icon_rect` type to use the new `tauri::Rect` type. +- Removed `TrayIconEvent.x` and `TrayIconEvent.y` fields and combined them into `TrayIconEvent.position` field. +- Removed `tauri::tray::Rectangle` struct. diff --git a/.changes/webview-bounds.md b/.changes/webview-bounds.md new file mode 100644 index 000000000..eb0c4db25 --- /dev/null +++ b/.changes/webview-bounds.md @@ -0,0 +1,5 @@ +--- +'tauri': 'minor:feat' +--- + +Add `Webview::bounds` and `Webview::set_bounds` APIs. diff --git a/.changes/wry-0.38.md b/.changes/wry-0.38.md new file mode 100644 index 000000000..dd35e9dee --- /dev/null +++ b/.changes/wry-0.38.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime-wry": patch:deps +--- + +Upgraded to `wry@0.38.0` diff --git a/Cargo.lock b/Cargo.lock index 54059da6d..9507cc681 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -102,15 +102,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" - -[[package]] -name = "as-raw-xcb-connection" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "atk" @@ -137,15 +131,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -191,9 +185,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -215,9 +209,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -236,29 +230,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.3" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "bytemuck" -version = "1.14.3" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.51", -] +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" [[package]] name = "byteorder" @@ -268,9 +248,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" dependencies = [ "serde", ] @@ -281,7 +261,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cairo-sys-rs", "glib", "libc", @@ -344,9 +324,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.88" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cesu8" @@ -395,15 +375,15 @@ checksum = "77e53693616d3075149f4ead59bdeecd204ac6b8192d8969757601b74bddf00f" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -588,7 +568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -598,7 +578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -631,7 +611,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -642,7 +622,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -717,7 +697,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.1", + "libloading 0.8.3", ] [[package]] @@ -740,52 +720,16 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] -name = "downcast-rs" -version = "1.2.0" +name = "dpi" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "drm" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" +checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" dependencies = [ - "bitflags 2.4.2", - "bytemuck", - "drm-ffi", - "drm-fourcc", - "rustix", -] - -[[package]] -name = "drm-ffi" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6" -dependencies = [ - "drm-sys", - "rustix", -] - -[[package]] -name = "drm-fourcc" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" - -[[package]] -name = "drm-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d09ff881f92f118b11105ba5e34ff8f4adf27b30dae8f12e28c193af1c83176" -dependencies = [ - "libc", - "linux-raw-sys 0.6.4", + "serde", ] [[package]] @@ -817,16 +761,16 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "embed-resource" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bde55e389bea6a966bd467ad1ad7da0ae14546a5bc794d16d1e55e7fca44881" +checksum = "c6985554d0688b687c5cb73898a34fbe3ad6c24c58c238a4d91d5e840670ee9d" dependencies = [ "cc", "memchr", "rustc_version", "toml 0.8.2", "vswhom", - "winreg 0.51.0", + "winreg 0.52.0", ] [[package]] @@ -841,15 +785,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - [[package]] name = "env_logger" version = "0.8.4" @@ -878,9 +813,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fdeflate" @@ -944,7 +879,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -1018,7 +953,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -1160,16 +1095,15 @@ dependencies = [ [[package]] name = "generator" -version = "0.7.6" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b25e5b3e733153bcab35ee4671b46604b42516163cae442d1601cb716f2ac5" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" dependencies = [ "cc", - "cfg-if", "libc", "log", "rustversion", - "windows 0.53.0", + "windows 0.48.0", ] [[package]] @@ -1182,16 +1116,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "gethostname" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" -dependencies = [ - "libc", - "windows-targets 0.48.5", -] - [[package]] name = "getrandom" version = "0.1.16" @@ -1216,9 +1140,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ "opaque-debug", "polyval", @@ -1268,7 +1192,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "futures-channel", "futures-core", "futures-executor", @@ -1291,12 +1215,12 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-crate 2.0.2", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -1375,26 +1299,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.51", -] - -[[package]] -name = "h2" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 2.2.3", - "slab", - "tokio", - "tokio-util", - "tracing", + "syn 2.0.57", ] [[package]] @@ -1416,10 +1321,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "hermit-abi" -version = "0.3.8" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379dada1584ad501b383485dd706b8afb7a70fcbc7f4da7d780638a5a6124a60" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1443,23 +1354,35 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", - "itoa 1.0.10", + "itoa 1.0.11", ] [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", "pin-project-lite", ] @@ -1475,61 +1398,76 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" -version = "0.14.28" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", - "h2", "http", "http-body", "httparse", - "httpdate", - "itoa 1.0.10", + "itoa 1.0.11", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", "http", "hyper", + "hyper-util", "rustls", + "rustls-pki-types", "tokio", "tokio-rustls", + "tower-service", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1607,9 +1545,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1636,15 +1574,14 @@ dependencies = [ [[package]] name = "insta" -version = "1.35.1" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c985c1bef99cf13c58fade470483d81a2bfe846ebde60ed28cc2dddec2df9e2" +checksum = "3eab73f58e59ca6526037208f0e98851159ec1633cf17b6cd2e1f2c3fd5d53cc" dependencies = [ "console", "lazy_static", "linked-hash-map", "similar", - "yaml-rust", ] [[package]] @@ -1670,9 +1607,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "javascriptcore-rs" @@ -1721,9 +1658,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1757,7 +1694,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "serde", "unicode-segmentation", ] @@ -1823,12 +1760,12 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "windows-targets 0.52.4", ] [[package]] @@ -1839,13 +1776,12 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", - "redox_syscall", ] [[package]] @@ -1869,12 +1805,9 @@ dependencies = [ [[package]] name = "line-wrap" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] +checksum = "dd1bc4d24ad230d21fb898d1116b1801d7adfc449d42026475862ab48b11e70e" [[package]] name = "linked-hash-map" @@ -1888,12 +1821,6 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" -[[package]] -name = "linux-raw-sys" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b5399f6804fbab912acbd8878ed3532d506b7c951b8f9f164ef90fef39e3f4" - [[package]] name = "lock_api" version = "0.4.11" @@ -1971,24 +1898,15 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "memmap2" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" -dependencies = [ - "libc", -] +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -2022,12 +1940,13 @@ dependencies = [ [[package]] name = "muda" -version = "0.12.1" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e27c56b8cb9b3214d196556227b0eaa12db8393b4f919a0a93ffb67ed17d185" +checksum = "f428b4e9db3d17e2f809dfb1ff9ddfbbf16c71790d1656d10aee320877e1392f" dependencies = [ "cocoa", "crossbeam-channel", + "dpi", "gtk", "keyboard-types", "libxdo", @@ -2088,9 +2007,9 @@ dependencies = [ [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nodrop" @@ -2200,9 +2119,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" @@ -2210,7 +2129,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types 0.3.2", "libc", @@ -2227,7 +2146,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -2247,9 +2166,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.101" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -2320,9 +2239,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" +checksum = "56f8023d0fb78c8e03784ea1c7f3fa36e68a723138990b8d5a47d916b651e7a8" dependencies = [ "memchr", "thiserror", @@ -2331,9 +2250,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1288dbd7786462961e69bfd4df7848c1e37e8b74303dbdab82c3a9cdd2809" +checksum = "b0d24f72393fd16ab6ac5738bc33cdb6a9aa73f8b902e8fe29cf4e67d7dd1026" dependencies = [ "pest", "pest_generator", @@ -2341,22 +2260,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1381c29a877c6d34b8c176e734f35d7f7f5b3adaefe940cb4d1bb7af94678e2e" +checksum = "fdc17e2a6c7d0a492f0158d7a4bd66cc17280308bbaff78d5bef566dca35ab80" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] name = "pest_meta" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0934d6907f148c22a3acbda520c7eed243ad7487a30f51f6ce52b58b7077a8a" +checksum = "934cd7631c050f4674352a6e835d5f6711ffbfb9345c2fc0107155ac495ae293" dependencies = [ "once_cell", "pest", @@ -2467,7 +2386,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -2498,10 +2417,30 @@ dependencies = [ ] [[package]] -name = "pin-project-lite" -version = "0.2.13" +name = "pin-project" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.57", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2517,12 +2456,12 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plist" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" +checksum = "d9d34169e64b3c7a80c8621a48adaf44e0cf62c78a9b25dd9dd35f1881a17cf9" dependencies = [ "base64 0.21.7", - "indexmap 2.2.3", + "indexmap 2.2.6", "line-wrap", "quick-xml", "serde", @@ -2544,9 +2483,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", @@ -2624,9 +2563,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -2639,13 +2578,13 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "lazy_static", "num-traits", "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", "rusty-fork", "tempfile", "unarray", @@ -2810,9 +2749,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom 0.2.12", "libredox", @@ -2821,14 +2760,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", - "regex-syntax 0.8.2", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -2842,13 +2781,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -2859,27 +2798,27 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.24" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338" dependencies = [ "base64 0.21.7", "bytes", - "encoding_rs", "futures-core", "futures-util", - "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-rustls", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -2890,11 +2829,11 @@ dependencies = [ "pin-project-lite", "rustls", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", @@ -2949,27 +2888,29 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", - "linux-raw-sys 0.4.13", + "linux-raw-sys", "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.10" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" dependencies = [ "log", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] @@ -2982,12 +2923,19 @@ dependencies = [ ] [[package]] -name = "rustls-webpki" -version = "0.101.7" +name = "rustls-pki-types" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" + +[[package]] +name = "rustls-webpki" +version = "0.102.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] @@ -3015,12 +2963,6 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - [[package]] name = "same-file" version = "1.0.6" @@ -3077,21 +3019,11 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -3102,9 +3034,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -3156,7 +3088,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -3172,11 +3104,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ - "itoa 1.0.10", + "itoa 1.0.11", "ryu", "serde", ] @@ -3189,7 +3121,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -3208,22 +3140,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.10", + "itoa 1.0.11", "ryu", "serde", ] [[package]] name = "serde_with" -version = "3.6.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" +checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.3", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", @@ -3233,14 +3165,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" +checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -3312,9 +3244,9 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "similar" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" +checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" [[package]] name = "siphasher" @@ -3333,9 +3265,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -3353,29 +3285,20 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071916a85d1db274b4ed57af3a14afb66bd836ae7f82ebb6f1fd3455107830d9" dependencies = [ - "as-raw-xcb-connection", "bytemuck", "cfg_aliases 0.2.0", "cocoa", "core-graphics", - "drm", - "fastrand", "foreign-types 0.5.0", "js-sys", "log", - "memmap2", "objc", "raw-window-handle 0.6.0", "redox_syscall", - "rustix", - "tiny-xlib", "wasm-bindgen", - "wayland-backend", - "wayland-client", "wayland-sys", "web-sys", "windows-sys 0.52.0", - "x11rb", ] [[package]] @@ -3487,9 +3410,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.51" +version = "2.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" dependencies = [ "proc-macro2", "quote", @@ -3502,35 +3425,14 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "system-deps" -version = "6.2.0" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck", + "heck 0.5.0", "pkg-config", "toml 0.8.2", "version-compare", @@ -3538,9 +3440,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.26.1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccba570365293ca309d60f30fdac2c5271b732dc762e6154e59c85d2c762a0a1" +checksum = "bd5b6ec2c43abd15155f040c765001098f50f425414b679225d471a1cd782753" dependencies = [ "bitflags 1.3.2", "cocoa", @@ -3549,10 +3451,10 @@ dependencies = [ "crossbeam-channel", "dispatch", "dlopen2", + "dpi", "gdkwayland-sys", "gdkx11-sys", "gtk", - "image", "instant", "jni", "lazy_static", @@ -3564,14 +3466,12 @@ dependencies = [ "objc", "once_cell", "parking_lot", - "png", "raw-window-handle 0.6.0", "scopeguard", "tao-macros", "unicode-segmentation", "url", - "windows 0.52.0", - "windows-implement", + "windows 0.54.0", "windows-version", "x11-dl", ] @@ -3608,7 +3508,7 @@ dependencies = [ "getrandom 0.2.12", "glob", "gtk", - "heck", + "heck 0.4.1", "http", "http-range", "image", @@ -3646,7 +3546,7 @@ dependencies = [ "webkit2gtk", "webview2-com", "window-vibrancy", - "windows 0.52.0", + "windows 0.54.0", ] [[package]] @@ -3657,7 +3557,7 @@ dependencies = [ "cargo_toml", "dirs-next", "glob", - "heck", + "heck 0.4.1", "json-patch", "quote", "schemars", @@ -3688,7 +3588,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "syn 2.0.51", + "syn 2.0.57", "tauri-utils", "thiserror", "time", @@ -3712,10 +3612,10 @@ dependencies = [ name = "tauri-macros" version = "2.0.0-beta.10" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", "tauri-codegen", "tauri-utils", ] @@ -3739,6 +3639,7 @@ dependencies = [ name = "tauri-runtime" version = "2.0.0-beta.10" dependencies = [ + "dpi", "gtk", "http", "jni", @@ -3748,7 +3649,7 @@ dependencies = [ "tauri-utils", "thiserror", "url", - "windows 0.52.0", + "windows 0.54.0", ] [[package]] @@ -3770,7 +3671,7 @@ dependencies = [ "url", "webkit2gtk", "webview2-com", - "windows 0.52.0", + "windows 0.54.0", "wry", ] @@ -3785,7 +3686,7 @@ dependencies = [ "dunce", "getrandom 0.2.12", "glob", - "heck", + "heck 0.4.1", "html5ever", "infer", "json-patch", @@ -3852,22 +3753,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -3887,7 +3788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", - "itoa 1.0.10", + "itoa 1.0.11", "num-conv", "powerfmt", "serde", @@ -3911,18 +3812,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-xlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4098d49269baa034a8d1eae9bd63e9fa532148d772121dace3bcd6a6c98eb6d" -dependencies = [ - "as-raw-xcb-connection", - "ctor", - "libloading 0.8.1", - "tracing", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3940,9 +3829,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -3965,7 +3854,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -3980,11 +3869,12 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ "rustls", + "rustls-pki-types", "tokio", ] @@ -4041,7 +3931,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -4054,13 +3944,35 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", "winnow", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -4073,6 +3985,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4086,7 +3999,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -4130,9 +4043,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "454035ff34b8430638c894e6197748578d6b4d449c6edaf8ea854d94e2dd862b" +checksum = "8713f74e697917aa794800289e15bce534fc91450312ab2d3edf5b8907f7301a" dependencies = [ "cocoa", "core-graphics", @@ -4298,9 +4211,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom 0.2.12", ] @@ -4319,9 +4232,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version-compare" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" @@ -4360,9 +4273,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -4391,9 +4304,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4401,24 +4314,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -4428,9 +4341,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4438,22 +4351,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-streams" @@ -4468,43 +4381,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wayland-backend" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40" -dependencies = [ - "cc", - "downcast-rs", - "rustix", - "scoped-tls", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-client" -version = "0.31.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" -dependencies = [ - "bitflags 2.4.2", - "rustix", - "wayland-backend", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283" -dependencies = [ - "proc-macro2", - "quick-xml", - "quote", -] - [[package]] name = "wayland-sys" version = "0.31.1" @@ -4513,15 +4389,14 @@ checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ "dlib", "log", - "once_cell", "pkg-config", ] [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -4573,20 +4448,23 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.4" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] [[package]] name = "webview2-com" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ae9c7e420783826cf769d2c06ac9ba462f450eca5893bb8c6c6529a4e5dd33" +checksum = "38d5949fc3f537e90240c3e4f78dda2fa0431b671d50845a2f582173ef8a1201" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows 0.52.0", - "windows-core 0.52.0", + "windows 0.54.0", + "windows-core 0.54.0", "windows-implement", "windows-interface", ] @@ -4599,18 +4477,18 @@ checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] name = "webview2-com-sys" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ad85fceee6c42fa3d61239eba5a11401bf38407a849ed5ea1b407df08cca72" +checksum = "cd1eaa1be63d6fdcadf893c40d7d53c889a6342b3a94930d34e6964d5bb7e8db" dependencies = [ "thiserror", - "windows 0.52.0", - "windows-core 0.52.0", + "windows 0.54.0", + "windows-core 0.54.0", ] [[package]] @@ -4659,24 +4537,23 @@ dependencies = [ [[package]] name = "windows" -version = "0.52.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-core 0.52.0", - "windows-implement", - "windows-interface", - "windows-targets 0.52.3", + "windows-targets 0.48.5", ] [[package]] name = "windows" -version = "0.53.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" dependencies = [ - "windows-core 0.53.0", - "windows-targets 0.52.3", + "windows-core 0.54.0", + "windows-implement", + "windows-interface", + "windows-targets 0.52.4", ] [[package]] @@ -4685,39 +4562,39 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] name = "windows-core" -version = "0.53.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" dependencies = [ "windows-result", - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] name = "windows-implement" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" +checksum = "942ac266be9249c84ca862f0a164a39533dc2f6f33dc98ec89c8da99b82ea0bd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] name = "windows-interface" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" +checksum = "da33557140a288fae4e1d5f8873aaf9eb6613a9cf82c3e070223ff177f598b60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.57", ] [[package]] @@ -4726,7 +4603,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -4753,7 +4630,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -4788,17 +4665,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.3", - "windows_aarch64_msvc 0.52.3", - "windows_i686_gnu 0.52.3", - "windows_i686_msvc 0.52.3", - "windows_x86_64_gnu 0.52.3", - "windows_x86_64_gnullvm 0.52.3", - "windows_x86_64_msvc 0.52.3", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -4807,7 +4684,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75aa004c988e080ad34aff5739c39d0312f4684699d6d71fc8a198d057b8b9b4" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -4824,9 +4701,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -4842,9 +4719,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -4860,9 +4737,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -4878,9 +4755,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -4896,9 +4773,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -4914,9 +4791,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -4932,9 +4809,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winnow" @@ -4957,9 +4834,9 @@ dependencies = [ [[package]] name = "winreg" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", @@ -4967,9 +4844,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.37.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b717040ba9771fd88eb428c6ea6b555f8e734ff8534f02c13e8f10d97f5935e" +checksum = "4eca9d50437c04fc67e82c196ddd31d8e35794150713ae2d647f3a58c7f45d1a" dependencies = [ "base64 0.21.7", "block", @@ -4977,6 +4854,7 @@ dependencies = [ "cocoa", "core-graphics", "crossbeam-channel", + "dpi", "dunce", "gdkx11", "gtk", @@ -4986,7 +4864,6 @@ dependencies = [ "jni", "kuchikiki", "libc", - "log", "ndk", "ndk-context", "ndk-sys", @@ -4995,8 +4872,6 @@ dependencies = [ "once_cell", "percent-encoding", "raw-window-handle 0.6.0", - "serde", - "serde_json", "sha2", "soup3", "tao-macros", @@ -5005,8 +4880,7 @@ dependencies = [ "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows 0.52.0", - "windows-implement", + "windows 0.54.0", "windows-version", "x11-dl", ] @@ -5033,31 +4907,7 @@ dependencies = [ ] [[package]] -name = "x11rb" -version = "0.13.0" +name = "zeroize" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" -dependencies = [ - "as-raw-xcb-connection", - "gethostname", - "libc", - "libloading 0.8.1", - "once_cell", - "rustix", - "x11rb-protocol", -] - -[[package]] -name = "x11rb-protocol" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/core/tauri-config-schema/schema.json b/core/tauri-config-schema/schema.json index 8f6b61c8a..2261211b3 100644 --- a/core/tauri-config-schema/schema.json +++ b/core/tauri-config-schema/schema.json @@ -221,8 +221,8 @@ "null" ] }, - "fileDropEnabled": { - "description": "Whether the file drop is enabled or not on the webview. By default it is enabled.\n\nDisabling it is required to use drag and drop on the frontend on Windows.", + "dragDropEnabled": { + "description": "Whether the drag and drop is enabled or not on the webview. By default it is enabled.\n\nDisabling it is required to use HTML5 drag and drop on the frontend on Windows.", "default": true, "type": "boolean" }, diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 5c2212d17..60bee603e 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -13,22 +13,22 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { version = "0.37", default-features = false, features = [ "file-drop", "protocol", "os-webview" ] } -tao = { version = "0.26", default-features = false, features = [ "rwh_06" ] } +wry = { version = "0.39", default-features = false, features = [ "drag-drop", "protocol", "os-webview" ] } +tao = { version = "0.27", default-features = false, features = [ "rwh_06" ] } tauri-runtime = { version = "2.0.0-beta.10", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-beta.10", path = "../tauri-utils" } raw-window-handle = "0.6" -http = "0.2" +http = "1.1" url = "2" tracing = { version = "0.1", optional = true } log = "0.4" [target."cfg(windows)".dependencies] -webview2-com = "0.28" -softbuffer = "0.4" +webview2-com = "0.29" +softbuffer = { version = "0.4", default-features = false } [target."cfg(windows)".dependencies.windows] - version = "0.52" + version = "0.54" features = [ "Win32_Foundation" ] [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 75bc3fa1c..0d3d71bce 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -11,14 +11,15 @@ html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" )] +use http::Request; use raw_window_handle::{DisplayHandle, HasDisplayHandle, HasWindowHandle}; use tauri_runtime::{ + dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, monitor::Monitor, webview::{DetachedWebview, DownloadEvent, PendingWebview, WebviewIpcHandler}, window::{ - dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, - CursorIcon, DetachedWindow, FileDropEvent, PendingWindow, RawWindow, WebviewEvent, + CursorIcon, DetachedWindow, DragDropEvent, PendingWindow, RawWindow, WebviewEvent, WindowBuilder, WindowBuilderBase, WindowEvent, WindowId, }, DeviceEventFilter, Error, EventLoopProxy, ExitRequestedEventAction, Icon, ProgressBarState, @@ -62,7 +63,7 @@ use tauri_utils::TitleBarStyle; use tauri_utils::{config::WindowConfig, Theme}; use url::Url; use wry::{ - FileDropEvent as WryFileDropEvent, ProxyConfig, ProxyEndpoint, WebContext, WebView, + DragDropEvent as WryDragDropEvent, ProxyConfig, ProxyEndpoint, WebContext, WebView, WebViewBuilder, }; @@ -112,7 +113,7 @@ use std::{ }; pub type WebviewId = u32; -type IpcHandler = dyn Fn(String) + 'static; +type IpcHandler = dyn Fn(Request) + 'static; #[cfg(any( windows, @@ -415,6 +416,16 @@ impl From for DeviceEventFilterWrapper { } } +pub struct RectWrapper(pub wry::Rect); +impl From for RectWrapper { + fn from(value: tauri_runtime::Rect) -> Self { + RectWrapper(wry::Rect { + position: value.position, + size: value.size, + }) + } +} + /// Wrapper around a [`tao::window::Icon`] that can be created from an [`Icon`]. pub struct TaoIcon(pub TaoWindowIcon); @@ -1144,14 +1155,14 @@ pub enum WindowMessage { #[derive(Debug, Clone)] pub enum SynthesizedWindowEvent { Focused(bool), - FileDrop(FileDropEvent), + DragDrop(DragDropEvent), } impl From for WindowEventWrapper { fn from(event: SynthesizedWindowEvent) -> Self { let event = match event { SynthesizedWindowEvent::Focused(focused) => WindowEvent::Focused(focused), - SynthesizedWindowEvent::FileDrop(event) => WindowEvent::FileDrop(event), + SynthesizedWindowEvent::DragDrop(event) => WindowEvent::DragDrop(event), }; Self(Some(event)) } @@ -1170,13 +1181,15 @@ pub enum WebviewMessage { Close, SetPosition(Position), SetSize(Size), + SetBounds(tauri_runtime::Rect), SetFocus, - Reparent(WindowId), + Reparent(WindowId, Sender>), SetAutoResize(bool), // Getters - Url(Sender), - Position(Sender>), - Size(Sender>), + Url(Sender>), + Bounds(Sender>), + Position(Sender>>), + Size(Sender>>), WithWebview(Box), // Devtools #[cfg(any(debug_assertions, feature = "devtools"))] @@ -1289,15 +1302,19 @@ impl WebviewDispatch for WryWebviewDispatcher { // Getters fn url(&self) -> Result { - webview_getter!(self, WebviewMessage::Url) + webview_getter!(self, WebviewMessage::Url)? + } + + fn bounds(&self) -> Result { + webview_getter!(self, WebviewMessage::Bounds)? } fn position(&self) -> Result> { - webview_getter!(self, WebviewMessage::Position) + webview_getter!(self, WebviewMessage::Position)? } fn size(&self) -> Result> { - webview_getter!(self, WebviewMessage::Size) + webview_getter!(self, WebviewMessage::Size)? } // Setters @@ -1335,6 +1352,17 @@ impl WebviewDispatch for WryWebviewDispatcher { ) } + fn set_bounds(&self, bounds: tauri_runtime::Rect) -> Result<()> { + send_user_message( + &self.context, + Message::Webview( + *self.window_id.lock().unwrap(), + self.webview_id, + WebviewMessage::SetBounds(bounds), + ), + ) + } + fn set_size(&self, size: Size) -> Result<()> { send_user_message( &self.context, @@ -1370,15 +1398,18 @@ impl WebviewDispatch for WryWebviewDispatcher { fn reparent(&self, window_id: WindowId) -> Result<()> { let mut current_window_id = self.window_id.lock().unwrap(); + let (tx, rx) = channel(); send_user_message( &self.context, Message::Webview( *current_window_id, self.webview_id, - WebviewMessage::Reparent(window_id), + WebviewMessage::Reparent(window_id, tx), ), )?; + rx.recv().unwrap()?; + *current_window_id = window_id; Ok(()) } @@ -2746,7 +2777,7 @@ fn handle_user_message( target_os = "netbsd", target_os = "openbsd" ))] - if let WebviewMessage::Reparent(new_parent_window_id) = webview_message { + if let WebviewMessage::Reparent(new_parent_window_id, tx) = webview_message { let webview_handle = windows.0.borrow_mut().get_mut(&window_id).and_then(|w| { w.webviews .iter() @@ -2762,16 +2793,13 @@ fn handle_user_message( .map(|w| (w.inner.clone(), &mut w.webviews)) { #[cfg(target_os = "macos")] - { + let reparent_result = { use wry::WebViewExtMacOS; - webview.inner.reparent(new_parent_window.ns_window() as _); - new_parent_window_webviews.push(webview); - } + webview.inner.reparent(new_parent_window.ns_window() as _) + }; #[cfg(windows)] - { - webview.inner.reparent(new_parent_window.hwnd()); - new_parent_window_webviews.push(webview); - } + let reparent_result = { webview.inner.reparent(new_parent_window.hwnd()) }; + #[cfg(any( target_os = "linux", target_os = "dragonfly", @@ -2779,13 +2807,27 @@ fn handle_user_message( target_os = "netbsd", target_os = "openbsd" ))] - { + let reparent_result = { if let Some(container) = new_parent_window.default_vbox() { - webview.inner.reparent(container); + webview.inner.reparent(container) + } else { + Err(wry::Error::MessageSender) + } + }; + + match reparent_result { + Ok(_) => { new_parent_window_webviews.push(webview); + tx.send(Ok(())).unwrap(); + } + Err(e) => { + log::error!("failed to reparent webview: {e}"); + tx.send(Err(Error::FailedToSendMessage)).unwrap(); } } } + } else { + tx.send(Err(Error::FailedToSendMessage)).unwrap(); } return; @@ -2801,7 +2843,7 @@ fn handle_user_message( match webview_message { WebviewMessage::WebviewEvent(_) => { /* already handled */ } WebviewMessage::SynthesizedWindowEvent(_) => { /* already handled */ } - WebviewMessage::Reparent(_window_id) => { /* already handled */ } + WebviewMessage::Reparent(_window_id, _tx) => { /* already handled */ } WebviewMessage::AddEventListener(id, listener) => { webview .webview_event_listeners @@ -2824,7 +2866,11 @@ fn handle_user_message( log::error!("{}", e); } } - WebviewMessage::Navigate(url) => webview.load_url(url.as_str()), + WebviewMessage::Navigate(url) => { + if let Err(e) = webview.load_url(url.as_str()) { + log::error!("failed to navigate to url {}: {}", url, e); + } + } WebviewMessage::Print => { let _ = webview.print(); } @@ -2836,67 +2882,133 @@ fn handle_user_message( window }); } - WebviewMessage::SetSize(size) => { - let mut bounds = webview.bounds(); - let size = size.to_logical(window.scale_factor()); - bounds.width = size.width; - bounds.height = size.height; + WebviewMessage::SetBounds(bounds) => { + let bounds: RectWrapper = bounds.into(); + let bounds = bounds.0; if let Some(b) = &mut *webview.bounds.lock().unwrap() { - let window_size = window.inner_size().to_logical::(window.scale_factor()); - b.width_rate = size.width as f32 / window_size.width; - b.height_rate = size.height as f32 / window_size.height; + let scale_factor = window.scale_factor(); + let size = bounds.size.to_logical::(scale_factor); + let position = bounds.position.to_logical::(scale_factor); + let window_size = window.inner_size().to_logical::(scale_factor); + b.width_rate = size.width / window_size.width; + b.height_rate = size.height / window_size.height; + b.x_rate = position.x / window_size.width; + b.y_rate = position.y / window_size.height; } - webview.set_bounds(bounds); - } - WebviewMessage::SetPosition(position) => { - let mut bounds = webview.bounds(); - let position = position.to_logical(window.scale_factor()); - bounds.x = position.x; - bounds.y = position.y; - - if let Some(b) = &mut *webview.bounds.lock().unwrap() { - let window_size = window.inner_size().to_logical::(window.scale_factor()); - b.x_rate = position.x as f32 / window_size.width; - b.y_rate = position.y as f32 / window_size.height; + if let Err(e) = webview.set_bounds(bounds) { + log::error!("failed to set webview size: {e}"); } - - webview.set_bounds(bounds); } + WebviewMessage::SetSize(size) => match webview.bounds() { + Ok(mut bounds) => { + bounds.size = size; + + let scale_factor = window.scale_factor(); + let size = size.to_logical::(scale_factor); + + if let Some(b) = &mut *webview.bounds.lock().unwrap() { + let window_size = window.inner_size().to_logical::(scale_factor); + b.width_rate = size.width / window_size.width; + b.height_rate = size.height / window_size.height; + } + + if let Err(e) = webview.set_bounds(bounds) { + log::error!("failed to set webview size: {e}"); + } + } + Err(e) => { + log::error!("failed to get webview bounds: {e}"); + } + }, + WebviewMessage::SetPosition(position) => match webview.bounds() { + Ok(mut bounds) => { + bounds.position = position; + + let scale_factor = window.scale_factor(); + let position = position.to_logical::(scale_factor); + + if let Some(b) = &mut *webview.bounds.lock().unwrap() { + let window_size = window.inner_size().to_logical::(scale_factor); + b.x_rate = position.x / window_size.width; + b.y_rate = position.y / window_size.height; + } + + if let Err(e) = webview.set_bounds(bounds) { + log::error!("failed to set webview position: {e}"); + } + } + Err(e) => { + log::error!("failed to get webview bounds: {e}"); + } + }, // Getters WebviewMessage::Url(tx) => { - tx.send(webview.url().parse().unwrap()).unwrap(); + tx.send( + webview + .url() + .map(|u| u.parse().expect("invalid webview URL")) + .map_err(|_| Error::FailedToSendMessage), + ) + .unwrap(); + } + WebviewMessage::Bounds(tx) => { + tx.send( + webview + .bounds() + .map(|bounds| tauri_runtime::Rect { + size: bounds.size, + position: bounds.position, + }) + .map_err(|_| Error::FailedToSendMessage), + ) + .unwrap(); } WebviewMessage::Position(tx) => { - let bounds = webview.bounds(); - let position = - LogicalPosition::new(bounds.x, bounds.y).to_physical(window.scale_factor()); - tx.send(position).unwrap(); + tx.send( + webview + .bounds() + .map(|bounds| bounds.position.to_physical(window.scale_factor())) + .map_err(|_| Error::FailedToSendMessage), + ) + .unwrap(); } WebviewMessage::Size(tx) => { - let bounds = webview.bounds(); - let size = - LogicalSize::new(bounds.width, bounds.height).to_physical(window.scale_factor()); - tx.send(size).unwrap(); + tx.send( + webview + .bounds() + .map(|bounds| bounds.size.to_physical(window.scale_factor())) + .map_err(|_| Error::FailedToSendMessage), + ) + .unwrap(); } WebviewMessage::SetFocus => { - webview.focus(); - } - WebviewMessage::SetAutoResize(auto_resize) => { - let bounds = webview.bounds(); - let window_size = window.inner_size().to_logical::(window.scale_factor()); - *webview.bounds.lock().unwrap() = if auto_resize { - Some(WebviewBounds { - x_rate: (bounds.x as f32) / window_size.width, - y_rate: (bounds.y as f32) / window_size.height, - width_rate: (bounds.width as f32) / window_size.width, - height_rate: (bounds.height as f32) / window_size.height, - }) - } else { - None - }; + if let Err(e) = webview.focus() { + log::error!("failed to focus webview: {e}"); + } } + WebviewMessage::SetAutoResize(auto_resize) => match webview.bounds() { + Ok(bounds) => { + let scale_factor = window.scale_factor(); + let window_size = window.inner_size().to_logical::(scale_factor); + *webview.bounds.lock().unwrap() = if auto_resize { + let size = bounds.size.to_logical::(scale_factor); + let position = bounds.position.to_logical::(scale_factor); + Some(WebviewBounds { + x_rate: position.x / window_size.width, + y_rate: position.y / window_size.height, + width_rate: size.width / window_size.width, + height_rate: size.height / window_size.height, + }) + } else { + None + }; + } + Err(e) => { + log::error!("failed to get webview bounds: {e}"); + } + }, WebviewMessage::WithWebview(f) => { #[cfg(any( target_os = "linux", @@ -3182,7 +3294,9 @@ fn handle_event_loop( TaoTheme::Light => wry::Theme::Light, _ => wry::Theme::Light, }; - webview.set_theme(theme); + if let Err(e) = webview.set_theme(theme) { + log::error!("failed to set theme: {e}"); + } } } } @@ -3216,12 +3330,14 @@ fn handle_event_loop( let size = size.to_logical::(window.scale_factor()); for webview in &webviews { if let Some(b) = &*webview.bounds.lock().unwrap() { - webview.set_bounds(wry::Rect { - x: (size.width * b.x_rate) as i32, - y: (size.height * b.y_rate) as i32, - width: (size.width * b.width_rate) as u32, - height: (size.height * b.height_rate) as u32, - }); + if let Err(e) = webview.set_bounds(wry::Rect { + position: LogicalPosition::new(size.width * b.x_rate, size.height * b.y_rate) + .into(), + size: LogicalSize::new(size.width * b.width_rate, size.height * b.height_rate) + .into(), + }) { + log::error!("failed to autoresize webview: {e}"); + } } } #[cfg(windows)] @@ -3590,33 +3706,36 @@ fn create_webview( webview_builder = webview_builder.with_initialization_script(undecorated_resizing::SCRIPT); } - if webview_attributes.file_drop_handler_enabled { + if webview_attributes.drag_drop_handler_enabled { let proxy = context.proxy.clone(); let window_id_ = window_id.clone(); - webview_builder = webview_builder.with_file_drop_handler(move |event| { + webview_builder = webview_builder.with_drag_drop_handler(move |event| { let event = match event { - WryFileDropEvent::Hovered { + WryDragDropEvent::Enter { paths, position: (x, y), - } => FileDropEvent::Hovered { + } => DragDropEvent::Dragged { paths, position: PhysicalPosition::new(x as _, y as _), }, - WryFileDropEvent::Dropped { + WryDragDropEvent::Over { position: (x, y) } => DragDropEvent::DragOver { + position: PhysicalPosition::new(x as _, y as _), + }, + WryDragDropEvent::Drop { paths, position: (x, y), - } => FileDropEvent::Dropped { + } => DragDropEvent::Dropped { paths, position: PhysicalPosition::new(x as _, y as _), }, - WryFileDropEvent::Cancelled => FileDropEvent::Cancelled, + WryDragDropEvent::Leave => DragDropEvent::Cancelled, _ => unimplemented!(), }; let message = if kind == WebviewKind::WindowContent { - WebviewMessage::SynthesizedWindowEvent(SynthesizedWindowEvent::FileDrop(event)) + WebviewMessage::SynthesizedWindowEvent(SynthesizedWindowEvent::DragDrop(event)) } else { - WebviewMessage::WebviewEvent(WebviewEvent::FileDrop(event)) + WebviewMessage::WebviewEvent(WebviewEvent::DragDrop(event)) }; let _ = proxy.send_event(Message::Webview(*window_id_.lock().unwrap(), id, message)); @@ -3633,24 +3752,24 @@ fn create_webview( }); } - let webview_bounds = if let Some((position, size)) = webview_attributes.bounds { - let size = size.to_logical(window.scale_factor()); - let position = position.to_logical(window.scale_factor()); - webview_builder = webview_builder.with_bounds(wry::Rect { - x: position.x, - y: position.y, - width: size.width, - height: size.height, - }); + let webview_bounds = if let Some(bounds) = webview_attributes.bounds { + let bounds: RectWrapper = bounds.into(); + let bounds = bounds.0; - let window_size = window.inner_size().to_logical::(window.scale_factor()); + let scale_factor = window.scale_factor(); + let position = bounds.position.to_logical::(scale_factor); + let size = bounds.size.to_logical::(scale_factor); + + webview_builder = webview_builder.with_bounds(bounds); + + let window_size = window.inner_size().to_logical::(scale_factor); if webview_attributes.auto_resize { Some(WebviewBounds { - x_rate: (position.x as f32) / window_size.width, - y_rate: (position.y as f32) / window_size.height, - width_rate: (size.width as f32) / window_size.width, - height_rate: (size.height as f32) / window_size.height, + x_rate: position.x / window_size.width, + y_rate: position.y / window_size.height, + width_rate: size.width / window_size.width, + height_rate: size.height / window_size.height, }) } else { None @@ -3658,13 +3777,9 @@ fn create_webview( } else { #[cfg(feature = "unstable")] { - let window_size = window.inner_size().to_logical::(window.scale_factor()); - webview_builder = webview_builder.with_bounds(wry::Rect { - x: 0, - y: 0, - width: window_size.width, - height: window_size.height, + position: LogicalPosition::new(0, 0).into(), + size: window.inner_size().into(), }); Some(WebviewBounds { x_rate: 0., diff --git a/core/tauri-runtime-wry/src/undecorated_resizing.rs b/core/tauri-runtime-wry/src/undecorated_resizing.rs index 50f602ce6..5ec301d7b 100644 --- a/core/tauri-runtime-wry/src/undecorated_resizing.rs +++ b/core/tauri-runtime-wry/src/undecorated_resizing.rs @@ -154,9 +154,9 @@ mod windows { pub fn handle_request( context: crate::Context, window_id: crate::WindowId, - request: &str, + request: &http::Request, ) -> bool { - if let Some(args) = request.strip_prefix(MESSAGE_MOUSEMOVE) { + if let Some(args) = request.body().strip_prefix(MESSAGE_MOUSEMOVE) { if let Some(window) = context.main_thread.windows.0.borrow().get(&window_id) { if let Some(w) = window.inner.as_ref() { if !w.is_decorated() @@ -177,7 +177,7 @@ mod windows { return true; } - if let Some(args) = request.strip_prefix(MESSAGE_MOUSEDOWN) { + if let Some(args) = request.body().strip_prefix(MESSAGE_MOUSEDOWN) { if let Some(window) = context.main_thread.windows.0.borrow().get(&window_id) { if let Some(w) = window.inner.as_ref() { if !w.is_decorated() diff --git a/core/tauri-runtime/Cargo.toml b/core/tauri-runtime/Cargo.toml index 593330fb2..25cc1edf8 100644 --- a/core/tauri-runtime/Cargo.toml +++ b/core/tauri-runtime/Cargo.toml @@ -30,12 +30,13 @@ serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" tauri-utils = { version = "2.0.0-beta.10", path = "../tauri-utils" } -http = "0.2.4" +http = "1.1" raw-window-handle = "0.6" url = { version = "2" } +dpi = { version = "0.1", features = ["serde"] } [target."cfg(windows)".dependencies.windows] -version = "0.52" +version = "0.54" features = [ "Win32_Foundation" ] [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] diff --git a/core/tauri-runtime/src/lib.rs b/core/tauri-runtime/src/lib.rs index 399bfbeec..b31d3d75c 100644 --- a/core/tauri-runtime/src/lib.rs +++ b/core/tauri-runtime/src/lib.rs @@ -13,7 +13,7 @@ #![cfg_attr(docsrs, feature(doc_cfg))] use raw_window_handle::DisplayHandle; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use std::{borrow::Cow, fmt::Debug, sync::mpsc::Sender}; use tauri_utils::Theme; use url::Url; @@ -24,11 +24,9 @@ pub mod monitor; pub mod webview; pub mod window; +use dpi::{PhysicalPosition, PhysicalSize, Position, Size}; use monitor::Monitor; -use window::{ - dpi::{PhysicalPosition, PhysicalSize, Position, Size}, - CursorIcon, DetachedWindow, PendingWindow, RawWindow, WebviewEvent, WindowEvent, -}; +use window::{CursorIcon, DetachedWindow, PendingWindow, RawWindow, WebviewEvent, WindowEvent}; use window::{WindowBuilder, WindowId}; use http::{ @@ -37,9 +35,30 @@ use http::{ status::InvalidStatusCode, }; +/// UI scaling utilities. +pub use dpi; + pub type WindowEventId = u32; pub type WebviewEventId = u32; +/// A rectangular region. +#[derive(Clone, Copy, Debug, Serialize)] +pub struct Rect { + /// Rect position. + pub position: dpi::Position, + /// Rect size. + pub size: dpi::Size, +} + +impl Default for Rect { + fn default() -> Self { + Self { + position: Position::Logical((0, 0).into()), + size: Size::Logical((0, 0).into()), + } + } +} + /// Progress bar status. #[derive(Debug, Clone, Copy, Deserialize)] #[serde(rename_all = "camelCase")] @@ -421,6 +440,9 @@ pub trait WebviewDispatch: Debug + Clone + Send + Sync + Sized + ' /// Returns the webview's current URL. fn url(&self) -> Result; + /// Returns the webview's bounds. + fn bounds(&self) -> Result; + /// Returns the position of the top-left hand corner of the webviews's client area relative to the top-left hand corner of the window. fn position(&self) -> Result>; @@ -438,6 +460,9 @@ pub trait WebviewDispatch: Debug + Clone + Send + Sync + Sized + ' /// Closes the webview. fn close(&self) -> Result<()>; + /// Sets the webview's bounds. + fn set_bounds(&self, bounds: Rect) -> Result<()>; + /// Resizes the webview. fn set_size(&self, size: Size) -> Result<()>; diff --git a/core/tauri-runtime/src/monitor.rs b/core/tauri-runtime/src/monitor.rs index a5b199ef2..0bedbbf4f 100644 --- a/core/tauri-runtime/src/monitor.rs +++ b/core/tauri-runtime/src/monitor.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use super::window::dpi::{PhysicalPosition, PhysicalSize}; +use crate::dpi::{PhysicalPosition, PhysicalSize}; /// Monitor descriptor. #[derive(Debug, Clone)] diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index 784643838..c2938ead0 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -4,14 +4,9 @@ //! A layer between raw [`Runtime`] webviews and Tauri. //! -use crate::{ - window::{ - dpi::{Position, Size}, - is_label_valid, - }, - Runtime, UserEvent, -}; +use crate::{window::is_label_valid, Rect, Runtime, UserEvent}; +use http::Request; use tauri_utils::config::{WebviewUrl, WindowConfig, WindowEffectsConfig}; use url::Url; @@ -202,14 +197,14 @@ pub struct WebviewAttributes { pub user_agent: Option, pub initialization_scripts: Vec, pub data_directory: Option, - pub file_drop_handler_enabled: bool, + pub drag_drop_handler_enabled: bool, pub clipboard: bool, pub accept_first_mouse: bool, pub additional_browser_args: Option, pub window_effects: Option, pub incognito: bool, pub transparent: bool, - pub bounds: Option<(Position, Size)>, + pub bounds: Option, pub auto_resize: bool, pub proxy_url: Option, } @@ -223,8 +218,8 @@ impl From<&WindowConfig> for WebviewAttributes { builder = builder.transparent(config.transparent); } builder = builder.accept_first_mouse(config.accept_first_mouse); - if !config.file_drop_enabled { - builder = builder.disable_file_drop_handler(); + if !config.drag_drop_enabled { + builder = builder.disable_drag_drop_handler(); } if let Some(user_agent) = &config.user_agent { builder = builder.user_agent(user_agent); @@ -250,7 +245,7 @@ impl WebviewAttributes { user_agent: None, initialization_scripts: Vec::new(), data_directory: None, - file_drop_handler_enabled: true, + drag_drop_handler_enabled: true, clipboard: false, accept_first_mouse: false, additional_browser_args: None, @@ -284,10 +279,10 @@ impl WebviewAttributes { self } - /// Disables the file drop handler. This is required to use drag and drop APIs on the front end on Windows. + /// Disables the drag and drop handler. This is required to use HTML5 drag and drop APIs on the frontend on Windows. #[must_use] - pub fn disable_file_drop_handler(mut self) -> Self { - self.file_drop_handler_enabled = false; + pub fn disable_drag_drop_handler(mut self) -> Self { + self.drag_drop_handler_enabled = false; self } @@ -353,4 +348,4 @@ impl WebviewAttributes { } /// IPC handler. -pub type WebviewIpcHandler = Box, String) + Send>; +pub type WebviewIpcHandler = Box, Request) + Send>; diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index ce9ca4a41..a52088c31 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -21,11 +21,6 @@ use std::{ sync::mpsc::Sender, }; -use self::dpi::PhysicalPosition; - -/// UI scaling utilities. -pub mod dpi; - /// An event from a window. #[derive(Debug, Clone)] pub enum WindowEvent { @@ -57,8 +52,8 @@ pub enum WindowEvent { /// The window inner size. new_inner_size: dpi::PhysicalSize, }, - /// An event associated with the file drop action. - FileDrop(FileDropEvent), + /// An event associated with the drag and drop action. + DragDrop(DragDropEvent), /// The system window theme has changed. /// /// Applications might wish to react to this to change the theme of the content of the window when the system changes the window theme. @@ -68,27 +63,34 @@ pub enum WindowEvent { /// An event from a window. #[derive(Debug, Clone)] pub enum WebviewEvent { - /// An event associated with the file drop action. - FileDrop(FileDropEvent), + /// An event associated with the drag and drop action. + DragDrop(DragDropEvent), } -/// The file drop event payload. +/// The drag drop event payload. #[derive(Debug, Clone)] #[non_exhaustive] -pub enum FileDropEvent { - /// The file(s) have been dragged onto the window, but have not been dropped yet. - Hovered { +pub enum DragDropEvent { + /// A drag operation started. + Dragged { + /// Paths of the files that are being dragged. paths: Vec, /// The position of the mouse cursor. - position: PhysicalPosition, + position: dpi::PhysicalPosition, }, - /// The file(s) have been dropped onto the window. + /// The files have been dragged onto the window, but have not been dropped yet. + DragOver { + /// The position of the mouse cursor. + position: dpi::PhysicalPosition, + }, + /// The user dropped the operation. Dropped { + /// Path of the files that were dropped. paths: Vec, /// The position of the mouse cursor. - position: PhysicalPosition, + position: dpi::PhysicalPosition, }, - /// The file drop was aborted. + /// The drag operation was cancelled. Cancelled, } diff --git a/core/tauri-runtime/src/window/dpi.rs b/core/tauri-runtime/src/window/dpi.rs deleted file mode 100644 index 8bb06728e..000000000 --- a/core/tauri-runtime/src/window/dpi.rs +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use serde::{Deserialize, Serialize}; - -pub trait Pixel: Copy + Into { - fn from_f64(f: f64) -> Self; - fn cast(self) -> P { - P::from_f64(self.into()) - } -} - -impl Pixel for u8 { - fn from_f64(f: f64) -> Self { - f.round() as u8 - } -} -impl Pixel for u16 { - fn from_f64(f: f64) -> Self { - f.round() as u16 - } -} -impl Pixel for u32 { - fn from_f64(f: f64) -> Self { - f.round() as u32 - } -} -impl Pixel for i8 { - fn from_f64(f: f64) -> Self { - f.round() as i8 - } -} -impl Pixel for i16 { - fn from_f64(f: f64) -> Self { - f.round() as i16 - } -} -impl Pixel for i32 { - fn from_f64(f: f64) -> Self { - f.round() as i32 - } -} -impl Pixel for f32 { - fn from_f64(f: f64) -> Self { - f as f32 - } -} -impl Pixel for f64 { - fn from_f64(f: f64) -> Self { - f - } -} - -/// Checks that the scale factor is a normal positive `f64`. -/// -/// All functions that take a scale factor assert that this will return `true`. If you're sourcing scale factors from -/// anywhere other than tao, it's recommended to validate them using this function before passing them to tao; -/// otherwise, you risk panics. -#[inline] -pub fn validate_scale_factor(scale_factor: f64) -> bool { - scale_factor.is_sign_positive() && scale_factor.is_normal() -} - -/// A position represented in logical pixels. -/// -/// The position is stored as floats, so please be careful. Casting floats to integers truncates the -/// fractional part, which can cause noticeable issues. To help with that, an `Into<(i32, i32)>` -/// implementation is provided which does the rounding for you. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Default, Hash, Serialize, Deserialize)] -pub struct LogicalPosition

{ - pub x: P, - pub y: P, -} - -impl

LogicalPosition

{ - #[inline] - pub const fn new(x: P, y: P) -> Self { - LogicalPosition { x, y } - } -} - -impl LogicalPosition

{ - #[inline] - pub fn from_physical>, X: Pixel>( - physical: T, - scale_factor: f64, - ) -> Self { - physical.into().to_logical(scale_factor) - } - - #[inline] - pub fn to_physical(&self, scale_factor: f64) -> PhysicalPosition { - assert!(validate_scale_factor(scale_factor)); - let x = self.x.into() * scale_factor; - let y = self.y.into() * scale_factor; - PhysicalPosition::new(x, y).cast() - } - - #[inline] - pub fn cast(&self) -> LogicalPosition { - LogicalPosition { - x: self.x.cast(), - y: self.y.cast(), - } - } -} - -impl From<(X, X)> for LogicalPosition

{ - fn from((x, y): (X, X)) -> LogicalPosition

{ - LogicalPosition::new(x.cast(), y.cast()) - } -} - -impl From> for (X, X) { - fn from(pos: LogicalPosition

) -> Self { - (pos.x.cast(), pos.y.cast()) - } -} - -impl From<[X; 2]> for LogicalPosition

{ - fn from([x, y]: [X; 2]) -> LogicalPosition

{ - LogicalPosition::new(x.cast(), y.cast()) - } -} - -impl From> for [X; 2] { - fn from(pos: LogicalPosition

) -> Self { - [pos.x.cast(), pos.y.cast()] - } -} - -/// A position represented in physical pixels. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Default, Hash, Serialize, Deserialize)] -pub struct PhysicalPosition

{ - pub x: P, - pub y: P, -} - -impl

PhysicalPosition

{ - #[inline] - pub const fn new(x: P, y: P) -> Self { - PhysicalPosition { x, y } - } -} - -impl PhysicalPosition

{ - #[inline] - pub fn from_logical>, X: Pixel>( - logical: T, - scale_factor: f64, - ) -> Self { - logical.into().to_physical(scale_factor) - } - - #[inline] - pub fn to_logical(&self, scale_factor: f64) -> LogicalPosition { - assert!(validate_scale_factor(scale_factor)); - let x = self.x.into() / scale_factor; - let y = self.y.into() / scale_factor; - LogicalPosition::new(x, y).cast() - } - - #[inline] - pub fn cast(&self) -> PhysicalPosition { - PhysicalPosition { - x: self.x.cast(), - y: self.y.cast(), - } - } -} - -impl From<(X, X)> for PhysicalPosition

{ - fn from((x, y): (X, X)) -> PhysicalPosition

{ - PhysicalPosition::new(x.cast(), y.cast()) - } -} - -impl From> for (X, X) { - fn from(pos: PhysicalPosition

) -> Self { - (pos.x.cast(), pos.y.cast()) - } -} - -impl From<[X; 2]> for PhysicalPosition

{ - fn from([x, y]: [X; 2]) -> PhysicalPosition

{ - PhysicalPosition::new(x.cast(), y.cast()) - } -} - -impl From> for [X; 2] { - fn from(pos: PhysicalPosition

) -> Self { - [pos.x.cast(), pos.y.cast()] - } -} - -/// A size represented in logical pixels. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Default, Hash, Serialize, Deserialize)] -pub struct LogicalSize

{ - pub width: P, - pub height: P, -} - -impl

LogicalSize

{ - #[inline] - pub const fn new(width: P, height: P) -> Self { - LogicalSize { width, height } - } -} - -impl LogicalSize

{ - #[inline] - pub fn from_physical>, X: Pixel>(physical: T, scale_factor: f64) -> Self { - physical.into().to_logical(scale_factor) - } - - #[inline] - pub fn to_physical(&self, scale_factor: f64) -> PhysicalSize { - assert!(validate_scale_factor(scale_factor)); - let width = self.width.into() * scale_factor; - let height = self.height.into() * scale_factor; - PhysicalSize::new(width, height).cast() - } - - #[inline] - pub fn cast(&self) -> LogicalSize { - LogicalSize { - width: self.width.cast(), - height: self.height.cast(), - } - } -} - -impl From<(X, X)> for LogicalSize

{ - fn from((x, y): (X, X)) -> LogicalSize

{ - LogicalSize::new(x.cast(), y.cast()) - } -} - -impl From> for (X, X) { - fn from(size: LogicalSize

) -> Self { - (size.width.cast(), size.height.cast()) - } -} - -impl From<[X; 2]> for LogicalSize

{ - fn from([x, y]: [X; 2]) -> LogicalSize

{ - LogicalSize::new(x.cast(), y.cast()) - } -} - -impl From> for [X; 2] { - fn from(size: LogicalSize

) -> Self { - [size.width.cast(), size.height.cast()] - } -} - -/// A size represented in physical pixels. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Default, Hash, Serialize, Deserialize)] -pub struct PhysicalSize

{ - pub width: P, - pub height: P, -} - -impl

PhysicalSize

{ - #[inline] - pub const fn new(width: P, height: P) -> Self { - PhysicalSize { width, height } - } -} - -impl PhysicalSize

{ - #[inline] - pub fn from_logical>, X: Pixel>(logical: T, scale_factor: f64) -> Self { - logical.into().to_physical(scale_factor) - } - - #[inline] - pub fn to_logical(&self, scale_factor: f64) -> LogicalSize { - assert!(validate_scale_factor(scale_factor)); - let width = self.width.into() / scale_factor; - let height = self.height.into() / scale_factor; - LogicalSize::new(width, height).cast() - } - - #[inline] - pub fn cast(&self) -> PhysicalSize { - PhysicalSize { - width: self.width.cast(), - height: self.height.cast(), - } - } -} - -impl From<(X, X)> for PhysicalSize

{ - fn from((x, y): (X, X)) -> PhysicalSize

{ - PhysicalSize::new(x.cast(), y.cast()) - } -} - -impl From> for (X, X) { - fn from(size: PhysicalSize

) -> Self { - (size.width.cast(), size.height.cast()) - } -} - -impl From<[X; 2]> for PhysicalSize

{ - fn from([x, y]: [X; 2]) -> PhysicalSize

{ - PhysicalSize::new(x.cast(), y.cast()) - } -} - -impl From> for [X; 2] { - fn from(size: PhysicalSize

) -> Self { - [size.width.cast(), size.height.cast()] - } -} - -/// A size that's either physical or logical. -#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] -#[serde(tag = "type", content = "data")] -pub enum Size { - Physical(PhysicalSize), - Logical(LogicalSize), -} - -impl Size { - pub fn new>(size: S) -> Size { - size.into() - } - - pub fn to_logical(&self, scale_factor: f64) -> LogicalSize

{ - match *self { - Size::Physical(size) => size.to_logical(scale_factor), - Size::Logical(size) => size.cast(), - } - } - - pub fn to_physical(&self, scale_factor: f64) -> PhysicalSize

{ - match *self { - Size::Physical(size) => size.cast(), - Size::Logical(size) => size.to_physical(scale_factor), - } - } -} - -impl From> for Size { - #[inline] - fn from(size: PhysicalSize

) -> Size { - Size::Physical(size.cast()) - } -} - -impl From> for Size { - #[inline] - fn from(size: LogicalSize

) -> Size { - Size::Logical(size.cast()) - } -} - -/// A position that's either physical or logical. -#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] -#[serde(tag = "type", content = "data")] -pub enum Position { - Physical(PhysicalPosition), - Logical(LogicalPosition), -} - -impl Position { - pub fn new>(position: S) -> Position { - position.into() - } - - pub fn to_logical(&self, scale_factor: f64) -> LogicalPosition

{ - match *self { - Position::Physical(position) => position.to_logical(scale_factor), - Position::Logical(position) => position.cast(), - } - } - - pub fn to_physical(&self, scale_factor: f64) -> PhysicalPosition

{ - match *self { - Position::Physical(position) => position.cast(), - Position::Logical(position) => position.to_physical(scale_factor), - } - } -} - -impl From> for Position { - #[inline] - fn from(position: PhysicalPosition

) -> Position { - Position::Physical(position.cast()) - } -} - -impl From> for Position { - #[inline] - fn from(position: LogicalPosition

) -> Position { - Position::Logical(position.cast()) - } -} diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 2c161e6b0..a9afc6e6b 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -1104,11 +1104,11 @@ pub struct WindowConfig { /// The user agent for the webview #[serde(alias = "user-agent")] pub user_agent: Option, - /// Whether the file drop is enabled or not on the webview. By default it is enabled. + /// Whether the drag and drop is enabled or not on the webview. By default it is enabled. /// - /// Disabling it is required to use drag and drop on the frontend on Windows. - #[serde(default = "default_true", alias = "file-drop-enabled")] - pub file_drop_enabled: bool, + /// Disabling it is required to use HTML5 drag and drop on the frontend on Windows. + #[serde(default = "default_true", alias = "drag-drop-enabled")] + pub drag_drop_enabled: bool, /// Whether or not the window starts centered or not. #[serde(default)] pub center: bool, @@ -1284,7 +1284,7 @@ impl Default for WindowConfig { label: default_window_label(), url: WebviewUrl::default(), user_agent: None, - file_drop_enabled: true, + drag_drop_enabled: true, center: false, x: None, y: None, @@ -2205,7 +2205,7 @@ mod build { let label = str_lit(&self.label); let url = &self.url; let user_agent = opt_str_lit(self.user_agent.as_ref()); - let file_drop_enabled = self.file_drop_enabled; + let drag_drop_enabled = self.drag_drop_enabled; let center = self.center; let x = opt_lit(self.x.as_ref()); let y = opt_lit(self.y.as_ref()); @@ -2249,7 +2249,7 @@ mod build { label, url, user_agent, - file_drop_enabled, + drag_drop_enabled, center, x, y, diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 59c2e7701..a110ae020 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -57,10 +57,10 @@ tauri-runtime-wry = { version = "2.0.0-beta.10", path = "../tauri-runtime-wry", getrandom = "0.2" serde_repr = "0.1" state = "0.6" -http = "0.2" +http = "1.1" dirs-next = "2.0" percent-encoding = "2.3" -reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ] } +reqwest = { version = "0.12", default-features = false, features = [ "json", "stream" ] } bytes = { version = "1", features = [ "serde" ] } raw-window-handle = "0.6" glob = "0.3" @@ -75,8 +75,8 @@ heck = "0.4" log = "0.4" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies] -muda = { version = "0.12", default-features = false, features = [ "serde" ] } -tray-icon = { version = "0.12", default-features = false, features = [ "serde" ], optional = true } +muda = { version = "0.13", default-features = false, features = [ "serde" ] } +tray-icon = { version = "0.13", default-features = false, features = [ "serde" ], optional = true } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.18", features = [ "v3_24" ] } @@ -89,11 +89,11 @@ objc = "0.2" window-vibrancy = "0.5" [target."cfg(windows)".dependencies] -webview2-com = "0.28" +webview2-com = "0.29" window-vibrancy = "0.5" [target."cfg(windows)".dependencies.windows] - version = "0.52" + version = "0.54" features = [ "Win32_Foundation" ] [target."cfg(target_os = \"android\")".dependencies] diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index 36971f692..5beb3525c 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1 +1 @@ -var __TAURI_IIFE__=function(e){"use strict";function t(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function n(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var i,r,a,s;function l(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}"function"==typeof SuppressedError&&SuppressedError;class o{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,i.set(this,(()=>{})),r.set(this,0),a.set(this,{}),this.id=l((({message:e,id:s})=>{if(s===t(this,r,"f")){n(this,r,s+1,"f"),t(this,i,"f").call(this,e);const l=Object.keys(t(this,a,"f"));if(l.length>0){let e=s+1;for(const n of l.sort()){if(parseInt(n)!==e)break;{const r=t(this,a,"f")[n];delete t(this,a,"f")[n],t(this,i,"f").call(this,r),e+=1}}}}else t(this,a,"f")[s.toString()]=e}))}set onmessage(e){n(this,i,e,"f")}get onmessage(){return t(this,i,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}i=new WeakMap,r=new WeakMap,a=new WeakMap;class u{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return c(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function c(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class d{get rid(){return t(this,s,"f")}constructor(e){s.set(this,void 0),n(this,s,e,"f")}async close(){return c("plugin:resources|close",{rid:this.rid})}}s=new WeakMap;var p=Object.freeze({__proto__:null,Channel:o,PluginListener:u,Resource:d,addPluginListener:async function(e,t,n){const i=new o;return i.onmessage=n,c(`plugin:${e}|register_listener`,{event:t,handler:i}).then((()=>new u(e,t,i.id)))},convertFileSrc:function(e,t="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,t)},invoke:c,transformCallback:l});var h,y=Object.freeze({__proto__:null,getName:async function(){return c("plugin:app|name")},getTauriVersion:async function(){return c("plugin:app|tauri_version")},getVersion:async function(){return c("plugin:app|version")},hide:async function(){return c("plugin:app|app_hide")},show:async function(){return c("plugin:app|app_show")}});async function w(e,t){await c("plugin:event|unlisten",{event:e,eventId:t})}async function g(e,t,n){const i="string"==typeof n?.target?{kind:"AnyLabel",label:n.target}:n?.target??{kind:"Any"};return c("plugin:event|listen",{event:e,target:i,handler:l(t)}).then((t=>async()=>w(e,t)))}async function b(e,t,n){return g(e,(n=>{t(n),w(e,n.id).catch((()=>{}))}),n)}async function _(e,t){await c("plugin:event|emit",{event:e,payload:t})}async function m(e,t,n){const i="string"==typeof e?{kind:"AnyLabel",label:e}:e;await c("plugin:event|emit_to",{target:i,event:t,payload:n})}!function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.FILE_DROP="tauri://file-drop",e.FILE_DROP_HOVER="tauri://file-drop-hover",e.FILE_DROP_CANCELLED="tauri://file-drop-cancelled"}(h||(h={}));var f=Object.freeze({__proto__:null,get TauriEvent(){return h},emit:_,emitTo:m,listen:g,once:b});class v{constructor(e,t){this.type="Logical",this.width=e,this.height=t}}class k{constructor(e,t){this.type="Physical",this.width=e,this.height=t}toLogical(e){return new v(this.width/e,this.height/e)}}class A{constructor(e,t){this.type="Logical",this.x=e,this.y=t}}class E{constructor(e,t){this.type="Physical",this.x=e,this.y=t}toLogical(e){return new A(this.x/e,this.y/e)}}var D=Object.freeze({__proto__:null,LogicalPosition:A,LogicalSize:v,PhysicalPosition:E,PhysicalSize:k});class L extends d{constructor(e){super(e)}static async new(e,t,n){return c("plugin:image|new",{rgba:P(e),width:t,height:n}).then((e=>new L(e)))}static async fromBytes(e){return c("plugin:image|from_bytes",{bytes:P(e)}).then((e=>new L(e)))}static async fromPath(e){return c("plugin:image|from_path",{path:e}).then((e=>new L(e)))}async rgba(){return c("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return c("plugin:image|size",{rid:this.rid})}}function P(e){return null==e?null:"string"==typeof e?e:e instanceof Uint8Array?Array.from(e):e instanceof ArrayBuffer?Array.from(new Uint8Array(e)):e instanceof L?e.rid:e}var I,S,T=Object.freeze({__proto__:null,Image:L,transformImage:P});!function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"}(I||(I={}));class C{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function x(){return new O(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function z(){return window.__TAURI_INTERNALS__.metadata.windows.map((e=>new O(e.label,{skip:!0})))}!function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"}(S||(S={}));const R=["tauri://created","tauri://error"];class O{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||c("plugin:window|create",{options:{...t,parent:"string"==typeof t.parent?t.parent:t.parent?.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return z().find((t=>t.label===e))??null}static getCurrent(){return x()}static getAll(){return z()}static async getFocusedWindow(){for(const e of z())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):g(e,t,{target:{kind:"Window",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):b(e,t,{target:{kind:"Window",label:this.label}})}async emit(e,t){if(R.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return Promise.resolve()}return _(e,t)}async emitTo(e,t,n){if(R.includes(t)){for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return Promise.resolve()}return m(e,t,n)}_handleTauriEvent(e,t){return!!R.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async scaleFactor(){return c("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return c("plugin:window|inner_position",{label:this.label}).then((({x:e,y:t})=>new E(e,t)))}async outerPosition(){return c("plugin:window|outer_position",{label:this.label}).then((({x:e,y:t})=>new E(e,t)))}async innerSize(){return c("plugin:window|inner_size",{label:this.label}).then((({width:e,height:t})=>new k(e,t)))}async outerSize(){return c("plugin:window|outer_size",{label:this.label}).then((({width:e,height:t})=>new k(e,t)))}async isFullscreen(){return c("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return c("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return c("plugin:window|is_maximized",{label:this.label})}async isFocused(){return c("plugin:window|is_focused",{label:this.label})}async isDecorated(){return c("plugin:window|is_decorated",{label:this.label})}async isResizable(){return c("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return c("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return c("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return c("plugin:window|is_closable",{label:this.label})}async isVisible(){return c("plugin:window|is_visible",{label:this.label})}async title(){return c("plugin:window|title",{label:this.label})}async theme(){return c("plugin:window|theme",{label:this.label})}async center(){return c("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===I.Critical?{type:"Critical"}:{type:"Informational"}),c("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return c("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return c("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return c("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return c("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return c("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return c("plugin:window|maximize",{label:this.label})}async unmaximize(){return c("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return c("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return c("plugin:window|minimize",{label:this.label})}async unminimize(){return c("plugin:window|unminimize",{label:this.label})}async show(){return c("plugin:window|show",{label:this.label})}async hide(){return c("plugin:window|hide",{label:this.label})}async close(){return c("plugin:window|close",{label:this.label})}async destroy(){return c("plugin:window|destroy",{label:this.label})}async setDecorations(e){return c("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return c("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return c("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return c("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return c("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return c("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return c("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:window|set_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setMinSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:window|set_min_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setMaxSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:window|set_max_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return c("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return c("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return c("plugin:window|set_focus",{label:this.label})}async setIcon(e){return c("plugin:window|set_icon",{label:this.label,value:P(e)})}async setSkipTaskbar(e){return c("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return c("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return c("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return c("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setCursorPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return c("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return c("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return c("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return c("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setProgressBar(e){return c("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return c("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async onResized(e){return this.listen(h.WINDOW_RESIZED,(t=>{t.payload=U(t.payload),e(t)}))}async onMoved(e){return this.listen(h.WINDOW_MOVED,(t=>{t.payload=M(t.payload),e(t)}))}async onCloseRequested(e){return this.listen(h.WINDOW_CLOSE_REQUESTED,(t=>{const n=new C(t);Promise.resolve(e(n)).then((()=>{if(!n.isPreventDefault())return this.destroy()}))}))}async onFileDropEvent(e){const t=await this.listen(h.FILE_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload.paths,position:M(t.payload.position)}})})),n=await this.listen(h.FILE_DROP_HOVER,(t=>{e({...t,payload:{type:"hover",paths:t.payload.paths,position:M(t.payload.position)}})})),i=await this.listen(h.FILE_DROP_CANCELLED,(t=>{e({...t,payload:{type:"cancel"}})}));return()=>{t(),n(),i()}}async onFocusChanged(e){const t=await this.listen(h.WINDOW_FOCUS,(t=>{e({...t,payload:!0})})),n=await this.listen(h.WINDOW_BLUR,(t=>{e({...t,payload:!1})}));return()=>{t(),n()}}async onScaleChanged(e){return this.listen(h.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(h.WINDOW_THEME_CHANGED,e)}}var F,W;function N(e){return null===e?null:{name:e.name,scaleFactor:e.scaleFactor,position:M(e.position),size:U(e.size)}}function M(e){return new E(e.x,e.y)}function U(e){return new k(e.width,e.height)}!function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"}(F||(F={})),function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"}(W||(W={}));var B=Object.freeze({__proto__:null,CloseRequestedEvent:C,get Effect(){return F},get EffectState(){return W},LogicalPosition:A,LogicalSize:v,PhysicalPosition:E,PhysicalSize:k,get ProgressBarStatus(){return S},get UserAttentionType(){return I},Window:O,availableMonitors:async function(){return c("plugin:window|available_monitors").then((e=>e.map(N)))},currentMonitor:async function(){return c("plugin:window|current_monitor").then(N)},getAll:z,getCurrent:x,primaryMonitor:async function(){return c("plugin:window|primary_monitor").then(N)}});function j(){return new G(x(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}function V(){return window.__TAURI_INTERNALS__.metadata.webviews.map((e=>new G(O.getByLabel(e.windowLabel),e.label,{skip:!0})))}const H=["tauri://created","tauri://error"];class G{constructor(e,t,n){this.window=e,this.label=t,this.listeners=Object.create(null),n?.skip||c("plugin:webview|create_webview",{windowLabel:e.label,label:t,options:n}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return V().find((t=>t.label===e))??null}static getCurrent(){return j()}static getAll(){return V()}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):g(e,t,{target:{kind:"Webview",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):b(e,t,{target:{kind:"Webview",label:this.label}})}async emit(e,t){if(H.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return Promise.resolve()}return _(e,t)}async emitTo(e,t,n){if(H.includes(t)){for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return Promise.resolve()}return m(e,t,n)}_handleTauriEvent(e,t){return!!H.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async position(){return c("plugin:webview|webview_position",{label:this.label}).then((({x:e,y:t})=>new E(e,t)))}async size(){return c("plugin:webview|webview_size",{label:this.label}).then((({width:e,height:t})=>new k(e,t)))}async close(){return c("plugin:webview|close",{label:this.label})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:webview|set_webview_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return c("plugin:webview|set_webview_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFocus(){return c("plugin:webview|set_webview_focus",{label:this.label})}async reparent(e){return c("plugin:webview|set_webview_focus",{label:this.label,window:"string"==typeof e?e:e.label})}async onFileDropEvent(e){const t=await this.listen(h.FILE_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload.paths,position:q(t.payload.position)}})})),n=await this.listen(h.FILE_DROP_HOVER,(t=>{e({...t,payload:{type:"hover",paths:t.payload.paths,position:q(t.payload.position)}})})),i=await this.listen(h.FILE_DROP_CANCELLED,(t=>{e({...t,payload:{type:"cancel"}})}));return()=>{t(),n(),i()}}}function q(e){return new E(e.x,e.y)}var Q,$,Z=Object.freeze({__proto__:null,Webview:G,getAll:V,getCurrent:j});function J(){const e=j();return new Y(e.label,{skip:!0})}function K(){return window.__TAURI_INTERNALS__.metadata.webviews.map((e=>new Y(e.label,{skip:!0})))}class Y{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||c("plugin:webview|create_webview_window",{options:{...t,parent:"string"==typeof t.parent?t.parent:t.parent?.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){const t=K().find((t=>t.label===e))??null;return t?new Y(t.label,{skip:!0}):null}static getCurrent(){return J()}static getAll(){return K().map((e=>new Y(e.label,{skip:!0})))}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):g(e,t,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):b(e,t,{target:{kind:"WebviewWindow",label:this.label}})}}Q=Y,$=[O,G],(Array.isArray($)?$:[$]).forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((t=>{"object"==typeof Q.prototype&&Q.prototype&&t in Q.prototype||Object.defineProperty(Q.prototype,t,Object.getOwnPropertyDescriptor(e.prototype,t)??Object.create(null))}))}));var X,ee=Object.freeze({__proto__:null,WebviewWindow:Y,getAll:K,getCurrent:J});!function(e){e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template"}(X||(X={}));var te=Object.freeze({__proto__:null,get BaseDirectory(){return X},appCacheDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppCache})},appConfigDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppConfig})},appDataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppData})},appLocalDataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppLocalData})},appLogDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppLog})},audioDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Audio})},basename:async function(e,t){return c("plugin:path|basename",{path:e,ext:t})},cacheDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Cache})},configDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Config})},dataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Data})},delimiter:function(){return window.__TAURI_INTERNALS__.plugins.path.delimiter},desktopDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Desktop})},dirname:async function(e){return c("plugin:path|dirname",{path:e})},documentDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Document})},downloadDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Download})},executableDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Executable})},extname:async function(e){return c("plugin:path|extname",{path:e})},fontDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Font})},homeDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Home})},isAbsolute:async function(e){return c("plugin:path|isAbsolute",{path:e})},join:async function(...e){return c("plugin:path|join",{paths:e})},localDataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.LocalData})},normalize:async function(e){return c("plugin:path|normalize",{path:e})},pictureDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Picture})},publicDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Public})},resolve:async function(...e){return c("plugin:path|resolve",{paths:e})},resolveResource:async function(e){return c("plugin:path|resolve_directory",{directory:X.Resource,path:e})},resourceDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Resource})},runtimeDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Runtime})},sep:function(){return window.__TAURI_INTERNALS__.plugins.path.sep},tempDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Temp})},templateDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Template})},videoDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Video})}});class ne extends d{constructor(e,t){super(e),this.id=t}static async getById(e){return c("plugin:tray|get_by_id",{id:e}).then((t=>t?new ne(t,e):null))}static async removeById(e){return c("plugin:tray|remove_by_id",{id:e})}static async new(e){e?.menu&&(e.menu=[e.menu.rid,e.menu.kind]),e?.icon&&(e.icon=P(e.icon));const t=new o;return e?.action&&(t.onmessage=e.action,delete e.action),c("plugin:tray|new",{options:e??{},handler:t}).then((([e,t])=>new ne(e,t)))}async setIcon(e){let t=null;return e&&(t=P(e)),c("plugin:tray|set_icon",{rid:this.rid,icon:t})}async setMenu(e){return e&&(e=[e.rid,e.kind]),c("plugin:tray|set_menu",{rid:this.rid,menu:e})}async setTooltip(e){return c("plugin:tray|set_tooltip",{rid:this.rid,tooltip:e})}async setTitle(e){return c("plugin:tray|set_title",{rid:this.rid,title:e})}async setVisible(e){return c("plugin:tray|set_visible",{rid:this.rid,visible:e})}async setTempDirPath(e){return c("plugin:tray|set_temp_dir_path",{rid:this.rid,path:e})}async setIconAsTemplate(e){return c("plugin:tray|set_icon_as_template",{rid:this.rid,asTemplate:e})}async setMenuOnLeftClick(e){return c("plugin:tray|set_show_menu_on_left_click",{rid:this.rid,onLeft:e})}}var ie,re,ae,se=Object.freeze({__proto__:null,TrayIcon:ne});function le(e){if("items"in e)e.items=e.items?.map((e=>"rid"in e?e:le(e)));else if("action"in e&&e.action){const t=new o;return t.onmessage=e.action,delete e.action,{...e,handler:t}}return e}async function oe(e,t){const n=new o;let i=null;return t&&"object"==typeof t&&("action"in t&&t.action&&(n.onmessage=t.action,delete t.action),"items"in t&&t.items&&(i=t.items.map((e=>"rid"in e?[e.rid,e.kind]:("item"in e&&"object"==typeof e.item&&e.item.About?.icon&&(e.item.About.icon=P(e.item.About.icon)),"icon"in e&&e.icon&&(e.icon=P(e.icon)),le(e)))))),c("plugin:menu|new",{kind:e,options:t?{...t,items:i}:void 0,handler:n})}class ue extends d{get id(){return t(this,ie,"f")}get kind(){return t(this,re,"f")}constructor(e,t,i){super(e),ie.set(this,void 0),re.set(this,void 0),n(this,ie,t,"f"),n(this,re,i,"f")}}ie=new WeakMap,re=new WeakMap;class ce extends ue{constructor(e,t){super(e,t,"MenuItem")}static async new(e){return oe("MenuItem",e).then((([e,t])=>new ce(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return c("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}}class de extends ue{constructor(e,t){super(e,t,"Check")}static async new(e){return oe("Check",e).then((([e,t])=>new de(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return c("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async isChecked(){return c("plugin:menu|is_checked",{rid:this.rid})}async setChecked(e){return c("plugin:menu|set_checked",{rid:this.rid,checked:e})}}!function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"}(ae||(ae={}));class pe extends ue{constructor(e,t){super(e,t,"Icon")}static async new(e){return oe("Icon",e).then((([e,t])=>new pe(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return c("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async setIcon(e){return c("plugin:menu|set_icon",{rid:this.rid,icon:P(e)})}}class he extends ue{constructor(e,t){super(e,t,"Predefined")}static async new(e){return oe("Predefined",e).then((([e,t])=>new he(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}}function ye([e,t,n]){switch(n){case"Submenu":return new we(e,t);case"Predefined":return new he(e,t);case"Check":return new de(e,t);case"Icon":return new pe(e,t);default:return new ce(e,t)}}class we extends ue{constructor(e,t){super(e,t,"Submenu")}static async new(e){return oe("Submenu",e).then((([e,t])=>new we(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async append(e){return c("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async prepend(e){return c("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async insert(e,t){return c("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e)),position:t})}async remove(e){return c("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return c("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(ye)}async items(){return c("plugin:menu|items",{rid:this.rid,kind:this.kind}).then((e=>e.map(ye)))}async get(e){return c("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then((e=>e?ye(e):null))}async popup(e,t){let n=null;return e&&(n={type:e instanceof E?"Physical":"Logical",data:e}),c("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:t?.label??null,at:n})}async setAsWindowsMenuForNSApp(){return c("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return c("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}}function ge([e,t,n]){switch(n){case"Submenu":return new we(e,t);case"Predefined":return new he(e,t);case"Check":return new de(e,t);case"Icon":return new pe(e,t);default:return new ce(e,t)}}class be extends ue{constructor(e,t){super(e,t,"Menu")}static async new(e){return oe("Menu",e).then((([e,t])=>new be(e,t)))}static async default(){return c("plugin:menu|create_default").then((([e,t])=>new be(e,t)))}async append(e){return c("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async prepend(e){return c("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async insert(e,t){return c("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e)),position:t})}async remove(e){return c("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return c("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(ge)}async items(){return c("plugin:menu|items",{rid:this.rid,kind:this.kind}).then((e=>e.map(ge)))}async get(e){return c("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then((e=>e?ge(e):null))}async popup(e,t){let n=null;return e&&(n={type:e instanceof E?"Physical":"Logical",data:e}),c("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:t?.label??null,at:n})}async setAsAppMenu(){return c("plugin:menu|set_as_app_menu",{rid:this.rid}).then((e=>e?new be(e[0],e[1]):null))}async setAsWindowMenu(e){return c("plugin:menu|set_as_window_menu",{rid:this.rid,window:e?.label??null}).then((e=>e?new be(e[0],e[1]):null))}}var _e=Object.freeze({__proto__:null,CheckMenuItem:de,IconMenuItem:pe,Menu:be,MenuItem:ce,get NativeIcon(){return ae},PredefinedMenuItem:he,Submenu:we});return e.app=y,e.core=p,e.dpi=D,e.event=f,e.image=T,e.menu=_e,e.path=te,e.tray=se,e.webview=Z,e.webviewWindow=ee,e.window=B,e}({});window.__TAURI__=__TAURI_IIFE__; +var __TAURI_IIFE__=function(e){"use strict";function t(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function n(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var i,r,a,s;function l(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}"function"==typeof SuppressedError&&SuppressedError;class o{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,i.set(this,(()=>{})),r.set(this,0),a.set(this,{}),this.id=l((({message:e,id:s})=>{if(s===t(this,r,"f")){n(this,r,s+1,"f"),t(this,i,"f").call(this,e);const l=Object.keys(t(this,a,"f"));if(l.length>0){let e=s+1;for(const n of l.sort()){if(parseInt(n)!==e)break;{const r=t(this,a,"f")[n];delete t(this,a,"f")[n],t(this,i,"f").call(this,r),e+=1}}}}else t(this,a,"f")[s.toString()]=e}))}set onmessage(e){n(this,i,e,"f")}get onmessage(){return t(this,i,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}i=new WeakMap,r=new WeakMap,a=new WeakMap;class u{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return c(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function c(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class d{get rid(){return t(this,s,"f")}constructor(e){s.set(this,void 0),n(this,s,e,"f")}async close(){return c("plugin:resources|close",{rid:this.rid})}}s=new WeakMap;var p=Object.freeze({__proto__:null,Channel:o,PluginListener:u,Resource:d,addPluginListener:async function(e,t,n){const i=new o;return i.onmessage=n,c(`plugin:${e}|register_listener`,{event:t,handler:i}).then((()=>new u(e,t,i.id)))},convertFileSrc:function(e,t="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,t)},invoke:c,transformCallback:l});var h,y=Object.freeze({__proto__:null,getName:async function(){return c("plugin:app|name")},getTauriVersion:async function(){return c("plugin:app|tauri_version")},getVersion:async function(){return c("plugin:app|version")},hide:async function(){return c("plugin:app|app_hide")},show:async function(){return c("plugin:app|app_show")}});async function w(e,t){await c("plugin:event|unlisten",{event:e,eventId:t})}async function g(e,t,n){const i="string"==typeof n?.target?{kind:"AnyLabel",label:n.target}:n?.target??{kind:"Any"};return c("plugin:event|listen",{event:e,target:i,handler:l(t)}).then((t=>async()=>w(e,t)))}async function b(e,t,n){return g(e,(n=>{t(n),w(e,n.id).catch((()=>{}))}),n)}async function _(e,t){await c("plugin:event|emit",{event:e,payload:t})}async function m(e,t,n){const i="string"==typeof e?{kind:"AnyLabel",label:e}:e;await c("plugin:event|emit_to",{target:i,event:t,payload:n})}!function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG="tauri://drag",e.DROP="tauri://drop",e.DROP_OVER="tauri://drop-over",e.DROP_CANCELLED="tauri://drag-cancelled"}(h||(h={}));var f=Object.freeze({__proto__:null,get TauriEvent(){return h},emit:_,emitTo:m,listen:g,once:b});class v{constructor(e,t){this.type="Logical",this.width=e,this.height=t}}class k{constructor(e,t){this.type="Physical",this.width=e,this.height=t}toLogical(e){return new v(this.width/e,this.height/e)}}class A{constructor(e,t){this.type="Logical",this.x=e,this.y=t}}class D{constructor(e,t){this.type="Physical",this.x=e,this.y=t}toLogical(e){return new A(this.x/e,this.y/e)}}var E=Object.freeze({__proto__:null,LogicalPosition:A,LogicalSize:v,PhysicalPosition:D,PhysicalSize:k});class P extends d{constructor(e){super(e)}static async new(e,t,n){return c("plugin:image|new",{rgba:L(e),width:t,height:n}).then((e=>new P(e)))}static async fromBytes(e){return c("plugin:image|from_bytes",{bytes:L(e)}).then((e=>new P(e)))}static async fromPath(e){return c("plugin:image|from_path",{path:e}).then((e=>new P(e)))}async rgba(){return c("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return c("plugin:image|size",{rid:this.rid})}}function L(e){return null==e?null:"string"==typeof e?e:e instanceof Uint8Array?Array.from(e):e instanceof ArrayBuffer?Array.from(new Uint8Array(e)):e instanceof P?e.rid:e}var S,I,T=Object.freeze({__proto__:null,Image:P,transformImage:L});!function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"}(S||(S={}));class C{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function x(){return new O(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function R(){return window.__TAURI_INTERNALS__.metadata.windows.map((e=>new O(e.label,{skip:!0})))}!function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"}(I||(I={}));const z=["tauri://created","tauri://error"];class O{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||c("plugin:window|create",{options:{...t,parent:"string"==typeof t.parent?t.parent:t.parent?.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return R().find((t=>t.label===e))??null}static getCurrent(){return x()}static getAll(){return R()}static async getFocusedWindow(){for(const e of R())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):g(e,t,{target:{kind:"Window",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):b(e,t,{target:{kind:"Window",label:this.label}})}async emit(e,t){if(z.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return Promise.resolve()}return _(e,t)}async emitTo(e,t,n){if(z.includes(t)){for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return Promise.resolve()}return m(e,t,n)}_handleTauriEvent(e,t){return!!z.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async scaleFactor(){return c("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return c("plugin:window|inner_position",{label:this.label}).then((({x:e,y:t})=>new D(e,t)))}async outerPosition(){return c("plugin:window|outer_position",{label:this.label}).then((({x:e,y:t})=>new D(e,t)))}async innerSize(){return c("plugin:window|inner_size",{label:this.label}).then((({width:e,height:t})=>new k(e,t)))}async outerSize(){return c("plugin:window|outer_size",{label:this.label}).then((({width:e,height:t})=>new k(e,t)))}async isFullscreen(){return c("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return c("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return c("plugin:window|is_maximized",{label:this.label})}async isFocused(){return c("plugin:window|is_focused",{label:this.label})}async isDecorated(){return c("plugin:window|is_decorated",{label:this.label})}async isResizable(){return c("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return c("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return c("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return c("plugin:window|is_closable",{label:this.label})}async isVisible(){return c("plugin:window|is_visible",{label:this.label})}async title(){return c("plugin:window|title",{label:this.label})}async theme(){return c("plugin:window|theme",{label:this.label})}async center(){return c("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===S.Critical?{type:"Critical"}:{type:"Informational"}),c("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return c("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return c("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return c("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return c("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return c("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return c("plugin:window|maximize",{label:this.label})}async unmaximize(){return c("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return c("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return c("plugin:window|minimize",{label:this.label})}async unminimize(){return c("plugin:window|unminimize",{label:this.label})}async show(){return c("plugin:window|show",{label:this.label})}async hide(){return c("plugin:window|hide",{label:this.label})}async close(){return c("plugin:window|close",{label:this.label})}async destroy(){return c("plugin:window|destroy",{label:this.label})}async setDecorations(e){return c("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return c("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return c("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return c("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return c("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return c("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return c("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:window|set_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setMinSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:window|set_min_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setMaxSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:window|set_max_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return c("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return c("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return c("plugin:window|set_focus",{label:this.label})}async setIcon(e){return c("plugin:window|set_icon",{label:this.label,value:L(e)})}async setSkipTaskbar(e){return c("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return c("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return c("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return c("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setCursorPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return c("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return c("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return c("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return c("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setProgressBar(e){return c("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return c("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async onResized(e){return this.listen(h.WINDOW_RESIZED,(t=>{t.payload=U(t.payload),e(t)}))}async onMoved(e){return this.listen(h.WINDOW_MOVED,(t=>{t.payload=M(t.payload),e(t)}))}async onCloseRequested(e){return this.listen(h.WINDOW_CLOSE_REQUESTED,(t=>{const n=new C(t);Promise.resolve(e(n)).then((()=>{if(!n.isPreventDefault())return this.destroy()}))}))}async onDragDropEvent(e){const t=await this.listen(h.DRAG,(t=>{e({...t,payload:{type:"dragged",paths:t.payload.paths,position:M(t.payload.position)}})})),n=await this.listen(h.DROP,(t=>{e({...t,payload:{type:"dropped",paths:t.payload.paths,position:M(t.payload.position)}})})),i=await this.listen(h.DROP_OVER,(t=>{e({...t,payload:{type:"dragOver",position:M(t.payload.position)}})})),r=await this.listen(h.DROP_CANCELLED,(t=>{e({...t,payload:{type:"cancelled"}})}));return()=>{t(),n(),i(),r()}}async onFocusChanged(e){const t=await this.listen(h.WINDOW_FOCUS,(t=>{e({...t,payload:!0})})),n=await this.listen(h.WINDOW_BLUR,(t=>{e({...t,payload:!1})}));return()=>{t(),n()}}async onScaleChanged(e){return this.listen(h.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(h.WINDOW_THEME_CHANGED,e)}}var W,N;function F(e){return null===e?null:{name:e.name,scaleFactor:e.scaleFactor,position:M(e.position),size:U(e.size)}}function M(e){return new D(e.x,e.y)}function U(e){return new k(e.width,e.height)}!function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"}(W||(W={})),function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"}(N||(N={}));var B=Object.freeze({__proto__:null,CloseRequestedEvent:C,get Effect(){return W},get EffectState(){return N},LogicalPosition:A,LogicalSize:v,PhysicalPosition:D,PhysicalSize:k,get ProgressBarStatus(){return I},get UserAttentionType(){return S},Window:O,availableMonitors:async function(){return c("plugin:window|available_monitors").then((e=>e.map(F)))},currentMonitor:async function(){return c("plugin:window|current_monitor").then(F)},getAll:R,getCurrent:x,primaryMonitor:async function(){return c("plugin:window|primary_monitor").then(F)}});function j(){return new H(x(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}function V(){return window.__TAURI_INTERNALS__.metadata.webviews.map((e=>new H(O.getByLabel(e.windowLabel),e.label,{skip:!0})))}const G=["tauri://created","tauri://error"];class H{constructor(e,t,n){this.window=e,this.label=t,this.listeners=Object.create(null),n?.skip||c("plugin:webview|create_webview",{windowLabel:e.label,label:t,options:n}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return V().find((t=>t.label===e))??null}static getCurrent(){return j()}static getAll(){return V()}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):g(e,t,{target:{kind:"Webview",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):b(e,t,{target:{kind:"Webview",label:this.label}})}async emit(e,t){if(G.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return Promise.resolve()}return _(e,t)}async emitTo(e,t,n){if(G.includes(t)){for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return Promise.resolve()}return m(e,t,n)}_handleTauriEvent(e,t){return!!G.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async position(){return c("plugin:webview|webview_position",{label:this.label}).then((({x:e,y:t})=>new D(e,t)))}async size(){return c("plugin:webview|webview_size",{label:this.label}).then((({width:e,height:t})=>new k(e,t)))}async close(){return c("plugin:webview|close",{label:this.label})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return c("plugin:webview|set_webview_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return c("plugin:webview|set_webview_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFocus(){return c("plugin:webview|set_webview_focus",{label:this.label})}async reparent(e){return c("plugin:webview|set_webview_focus",{label:this.label,window:"string"==typeof e?e:e.label})}async onDragDropEvent(e){const t=await this.listen(h.DRAG,(t=>{e({...t,payload:{type:"dragged",paths:t.payload.paths,position:q(t.payload.position)}})})),n=await this.listen(h.DROP,(t=>{e({...t,payload:{type:"dropped",paths:t.payload.paths,position:q(t.payload.position)}})})),i=await this.listen(h.DROP_CANCELLED,(t=>{e({...t,payload:{type:"dragOver",position:q(t.payload.position)}})})),r=await this.listen(h.DROP_CANCELLED,(t=>{e({...t,payload:{type:"cancelled"}})}));return()=>{t(),n(),i(),r()}}}function q(e){return new D(e.x,e.y)}var Q,$,Z=Object.freeze({__proto__:null,Webview:H,getAll:V,getCurrent:j});function J(){const e=j();return new Y(e.label,{skip:!0})}function K(){return window.__TAURI_INTERNALS__.metadata.webviews.map((e=>new Y(e.label,{skip:!0})))}class Y{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||c("plugin:webview|create_webview_window",{options:{...t,parent:"string"==typeof t.parent?t.parent:t.parent?.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){const t=K().find((t=>t.label===e))??null;return t?new Y(t.label,{skip:!0}):null}static getCurrent(){return J()}static getAll(){return K().map((e=>new Y(e.label,{skip:!0})))}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):g(e,t,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(t),1)})):b(e,t,{target:{kind:"WebviewWindow",label:this.label}})}}Q=Y,$=[O,H],(Array.isArray($)?$:[$]).forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((t=>{"object"==typeof Q.prototype&&Q.prototype&&t in Q.prototype||Object.defineProperty(Q.prototype,t,Object.getOwnPropertyDescriptor(e.prototype,t)??Object.create(null))}))}));var X,ee=Object.freeze({__proto__:null,WebviewWindow:Y,getAll:K,getCurrent:J});!function(e){e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template"}(X||(X={}));var te=Object.freeze({__proto__:null,get BaseDirectory(){return X},appCacheDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppCache})},appConfigDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppConfig})},appDataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppData})},appLocalDataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppLocalData})},appLogDir:async function(){return c("plugin:path|resolve_directory",{directory:X.AppLog})},audioDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Audio})},basename:async function(e,t){return c("plugin:path|basename",{path:e,ext:t})},cacheDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Cache})},configDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Config})},dataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Data})},delimiter:function(){return window.__TAURI_INTERNALS__.plugins.path.delimiter},desktopDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Desktop})},dirname:async function(e){return c("plugin:path|dirname",{path:e})},documentDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Document})},downloadDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Download})},executableDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Executable})},extname:async function(e){return c("plugin:path|extname",{path:e})},fontDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Font})},homeDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Home})},isAbsolute:async function(e){return c("plugin:path|isAbsolute",{path:e})},join:async function(...e){return c("plugin:path|join",{paths:e})},localDataDir:async function(){return c("plugin:path|resolve_directory",{directory:X.LocalData})},normalize:async function(e){return c("plugin:path|normalize",{path:e})},pictureDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Picture})},publicDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Public})},resolve:async function(...e){return c("plugin:path|resolve",{paths:e})},resolveResource:async function(e){return c("plugin:path|resolve_directory",{directory:X.Resource,path:e})},resourceDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Resource})},runtimeDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Runtime})},sep:function(){return window.__TAURI_INTERNALS__.plugins.path.sep},tempDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Temp})},templateDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Template})},videoDir:async function(){return c("plugin:path|resolve_directory",{directory:X.Video})}});class ne extends d{constructor(e,t){super(e),this.id=t}static async getById(e){return c("plugin:tray|get_by_id",{id:e}).then((t=>t?new ne(t,e):null))}static async removeById(e){return c("plugin:tray|remove_by_id",{id:e})}static async new(e){e?.menu&&(e.menu=[e.menu.rid,e.menu.kind]),e?.icon&&(e.icon=L(e.icon));const t=new o;return e?.action&&(t.onmessage=e.action,delete e.action),c("plugin:tray|new",{options:e??{},handler:t}).then((([e,t])=>new ne(e,t)))}async setIcon(e){let t=null;return e&&(t=L(e)),c("plugin:tray|set_icon",{rid:this.rid,icon:t})}async setMenu(e){return e&&(e=[e.rid,e.kind]),c("plugin:tray|set_menu",{rid:this.rid,menu:e})}async setTooltip(e){return c("plugin:tray|set_tooltip",{rid:this.rid,tooltip:e})}async setTitle(e){return c("plugin:tray|set_title",{rid:this.rid,title:e})}async setVisible(e){return c("plugin:tray|set_visible",{rid:this.rid,visible:e})}async setTempDirPath(e){return c("plugin:tray|set_temp_dir_path",{rid:this.rid,path:e})}async setIconAsTemplate(e){return c("plugin:tray|set_icon_as_template",{rid:this.rid,asTemplate:e})}async setMenuOnLeftClick(e){return c("plugin:tray|set_show_menu_on_left_click",{rid:this.rid,onLeft:e})}}var ie,re,ae,se=Object.freeze({__proto__:null,TrayIcon:ne});function le(e){if("items"in e)e.items=e.items?.map((e=>"rid"in e?e:le(e)));else if("action"in e&&e.action){const t=new o;return t.onmessage=e.action,delete e.action,{...e,handler:t}}return e}async function oe(e,t){const n=new o;let i=null;return t&&"object"==typeof t&&("action"in t&&t.action&&(n.onmessage=t.action,delete t.action),"items"in t&&t.items&&(i=t.items.map((e=>"rid"in e?[e.rid,e.kind]:("item"in e&&"object"==typeof e.item&&e.item.About?.icon&&(e.item.About.icon=L(e.item.About.icon)),"icon"in e&&e.icon&&(e.icon=L(e.icon)),le(e)))))),c("plugin:menu|new",{kind:e,options:t?{...t,items:i}:void 0,handler:n})}class ue extends d{get id(){return t(this,ie,"f")}get kind(){return t(this,re,"f")}constructor(e,t,i){super(e),ie.set(this,void 0),re.set(this,void 0),n(this,ie,t,"f"),n(this,re,i,"f")}}ie=new WeakMap,re=new WeakMap;class ce extends ue{constructor(e,t){super(e,t,"MenuItem")}static async new(e){return oe("MenuItem",e).then((([e,t])=>new ce(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return c("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}}class de extends ue{constructor(e,t){super(e,t,"Check")}static async new(e){return oe("Check",e).then((([e,t])=>new de(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return c("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async isChecked(){return c("plugin:menu|is_checked",{rid:this.rid})}async setChecked(e){return c("plugin:menu|set_checked",{rid:this.rid,checked:e})}}!function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"}(ae||(ae={}));class pe extends ue{constructor(e,t){super(e,t,"Icon")}static async new(e){return oe("Icon",e).then((([e,t])=>new pe(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return c("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async setIcon(e){return c("plugin:menu|set_icon",{rid:this.rid,icon:L(e)})}}class he extends ue{constructor(e,t){super(e,t,"Predefined")}static async new(e){return oe("Predefined",e).then((([e,t])=>new he(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}}function ye([e,t,n]){switch(n){case"Submenu":return new we(e,t);case"Predefined":return new he(e,t);case"Check":return new de(e,t);case"Icon":return new pe(e,t);default:return new ce(e,t)}}class we extends ue{constructor(e,t){super(e,t,"Submenu")}static async new(e){return oe("Submenu",e).then((([e,t])=>new we(e,t)))}async text(){return c("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return c("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return c("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return c("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async append(e){return c("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async prepend(e){return c("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async insert(e,t){return c("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e)),position:t})}async remove(e){return c("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return c("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(ye)}async items(){return c("plugin:menu|items",{rid:this.rid,kind:this.kind}).then((e=>e.map(ye)))}async get(e){return c("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then((e=>e?ye(e):null))}async popup(e,t){let n=null;return e&&(n={type:e instanceof D?"Physical":"Logical",data:e}),c("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:t?.label??null,at:n})}async setAsWindowsMenuForNSApp(){return c("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return c("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}}function ge([e,t,n]){switch(n){case"Submenu":return new we(e,t);case"Predefined":return new he(e,t);case"Check":return new de(e,t);case"Icon":return new pe(e,t);default:return new ce(e,t)}}class be extends ue{constructor(e,t){super(e,t,"Menu")}static async new(e){return oe("Menu",e).then((([e,t])=>new be(e,t)))}static async default(){return c("plugin:menu|create_default").then((([e,t])=>new be(e,t)))}async append(e){return c("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async prepend(e){return c("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e))})}async insert(e,t){return c("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map((e=>"rid"in e?[e.rid,e.kind]:e)),position:t})}async remove(e){return c("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return c("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(ge)}async items(){return c("plugin:menu|items",{rid:this.rid,kind:this.kind}).then((e=>e.map(ge)))}async get(e){return c("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then((e=>e?ge(e):null))}async popup(e,t){let n=null;return e&&(n={type:e instanceof D?"Physical":"Logical",data:e}),c("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:t?.label??null,at:n})}async setAsAppMenu(){return c("plugin:menu|set_as_app_menu",{rid:this.rid}).then((e=>e?new be(e[0],e[1]):null))}async setAsWindowMenu(e){return c("plugin:menu|set_as_window_menu",{rid:this.rid,window:e?.label??null}).then((e=>e?new be(e[0],e[1]):null))}}var _e=Object.freeze({__proto__:null,CheckMenuItem:de,IconMenuItem:pe,Menu:be,MenuItem:ce,get NativeIcon(){return ae},PredefinedMenuItem:he,Submenu:we});return e.app=y,e.core=p,e.dpi=E,e.event=f,e.image=T,e.menu=_e,e.path=te,e.tray=se,e.webview=Z,e.webviewWindow=ee,e.window=B,e}({});window.__TAURI__=__TAURI_IIFE__; diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 0f125f078..4fa98bb4e 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -35,10 +35,8 @@ use tauri_macros::default_runtime; #[cfg(desktop)] use tauri_runtime::EventLoopProxy; use tauri_runtime::{ - window::{ - dpi::{PhysicalPosition, PhysicalSize}, - FileDropEvent, - }, + dpi::{PhysicalPosition, PhysicalSize}, + window::DragDropEvent, RuntimeInitArgs, }; use tauri_utils::PackageInfo; @@ -132,8 +130,8 @@ pub enum WindowEvent { /// The window inner size. new_inner_size: PhysicalSize, }, - /// An event associated with the file drop action. - FileDrop(FileDropEvent), + /// An event associated with the drag and drop action. + DragDrop(DragDropEvent), /// The system window theme has changed. Only delivered if the window [`theme`](`crate::window::WindowBuilder#method.theme`) is `None`. /// /// Applications might wish to react to this to change the theme of the content of the window when the system changes the window theme. @@ -161,7 +159,7 @@ impl From for WindowEvent { scale_factor, new_inner_size, }, - RuntimeWindowEvent::FileDrop(event) => Self::FileDrop(event), + RuntimeWindowEvent::DragDrop(event) => Self::DragDrop(event), RuntimeWindowEvent::ThemeChanged(theme) => Self::ThemeChanged(theme), } } @@ -171,14 +169,14 @@ impl From for WindowEvent { #[derive(Debug, Clone)] #[non_exhaustive] pub enum WebviewEvent { - /// An event associated with the file drop action. - FileDrop(FileDropEvent), + /// An event associated with the drag and drop action. + DragDrop(DragDropEvent), } impl From for WebviewEvent { fn from(event: RuntimeWebviewEvent) -> Self { match event { - RuntimeWebviewEvent::FileDrop(e) => Self::FileDrop(e), + RuntimeWebviewEvent::DragDrop(e) => Self::DragDrop(e), } } } @@ -1392,7 +1390,7 @@ tauri::Builder::default() /// ``` /// tauri::Builder::default() /// .on_webview_event(|window, event| match event { - /// tauri::WebviewEvent::FileDrop(event) => { + /// tauri::WebviewEvent::DragDrop(event) => { /// println!("{:?}", event); /// } /// _ => {} diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 4b29c372b..152c0b64e 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -11,8 +11,9 @@ use crate::{ }; use http::{ header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN, CONTENT_TYPE}, - HeaderValue, Method, StatusCode, + HeaderValue, Method, Request, StatusCode, }; +use url::Url; use super::{CallbackFn, InvokeBody, InvokeResponse}; @@ -161,11 +162,16 @@ pub fn get(manager: Arc>, label: String) -> UriSchemeP }) } -fn handle_ipc_message(message: String, manager: &AppManager, label: &str) { +fn handle_ipc_message(request: Request, manager: &AppManager, label: &str) { if let Some(webview) = manager.get_webview(label) { #[cfg(feature = "tracing")] - let _span = - tracing::trace_span!("ipc::request", kind = "post-message", request = message).entered(); + let _span = tracing::trace_span!( + "ipc::request", + kind = "post-message", + uri = request.uri().to_string(), + body = request.body() + ) + .entered(); use serde::{Deserialize, Deserializer}; @@ -227,7 +233,7 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe let _span = tracing::trace_span!("ipc::request::decrypt_isolation_payload").entered(); invoke_message.replace( - serde_json::from_str::>(&message) + serde_json::from_str::>(request.body()) .map_err(Into::into) .and_then(|message| { Ok(Message { @@ -245,7 +251,7 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe let message = invoke_message.unwrap_or_else(|| { #[cfg(feature = "tracing")] let _span = tracing::trace_span!("ipc::request::deserialize").entered(); - serde_json::from_str::(&message).map_err(Into::into) + serde_json::from_str::(request.body()).map_err(Into::into) }); match message { @@ -254,6 +260,7 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe cmd: message.cmd, callback: message.callback, error: message.error, + url: Url::parse(&request.uri().to_string()).expect("invalid IPC request URL"), body: message.payload.into(), headers: message.options.map(|o| o.headers.0).unwrap_or_default(), }; @@ -389,6 +396,16 @@ fn parse_invoke_request( } } + let url = Url::parse( + parts + .headers + .get("Origin") + .ok_or("missing Origin header")? + .to_str() + .map_err(|_| "Origin header value must be a string")?, + ) + .map_err(|_| "Origin header is not a valid URL")?; + let callback = CallbackFn( parts .headers @@ -412,7 +429,7 @@ fn parse_invoke_request( let content_type = parts .headers - .get(reqwest::header::CONTENT_TYPE) + .get(http::header::CONTENT_TYPE) .and_then(|h| h.to_str().ok()) .map(|mime| mime.parse()) .unwrap_or(Ok(mime::APPLICATION_OCTET_STREAM)) @@ -443,6 +460,7 @@ fn parse_invoke_request( cmd, callback, error, + url, body, headers: parts.headers, }; diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index cfc077c2d..b06b9458d 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -217,12 +217,10 @@ pub use { }, self::manager::Asset, self::runtime::{ + dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Pixel, Position, Size}, webview::WebviewAttributes, - window::{ - dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Pixel, Position, Size}, - CursorIcon, FileDropEvent, - }, - DeviceEventFilter, UserAttentionType, + window::{CursorIcon, DragDropEvent}, + DeviceEventFilter, Rect, UserAttentionType, }, self::state::{State, StateManager}, self::utils::{ diff --git a/core/tauri/src/manager/webview.rs b/core/tauri/src/manager/webview.rs index cd2e75e13..176522379 100644 --- a/core/tauri/src/manager/webview.rs +++ b/core/tauri/src/manager/webview.rs @@ -14,7 +14,7 @@ use serde::Serialize; use serialize_to_javascript::{default_template, DefaultTemplate, Template}; use tauri_runtime::{ webview::{DetachedWebview, PendingWebview}, - window::FileDropEvent, + window::DragDropEvent, }; use tauri_utils::config::WebviewUrl; use url::Url; @@ -29,7 +29,10 @@ use crate::{ }; use super::{ - window::{FileDropPayload, DROP_CANCELLED_EVENT, DROP_EVENT, DROP_HOVER_EVENT}, + window::{ + DragDropPayload, DragOverPayload, DRAG_EVENT, DROP_CANCELLED_EVENT, DROP_EVENT, + DROP_HOVER_EVENT, + }, AppManager, }; @@ -654,12 +657,16 @@ impl Webview { fn on_webview_event(webview: &Webview, event: &WebviewEvent) -> crate::Result<()> { match event { - WebviewEvent::FileDrop(event) => match event { - FileDropEvent::Hovered { paths, position } => { - let payload = FileDropPayload { paths, position }; + WebviewEvent::DragDrop(event) => match event { + DragDropEvent::Dragged { paths, position } => { + let payload = DragDropPayload { paths, position }; + webview.emit_to_webview(DRAG_EVENT, payload)? + } + DragDropEvent::DragOver { position } => { + let payload = DragOverPayload { position }; webview.emit_to_webview(DROP_HOVER_EVENT, payload)? } - FileDropEvent::Dropped { paths, position } => { + DragDropEvent::Dropped { paths, position } => { let scopes = webview.state::(); for path in paths { if path.is_file() { @@ -668,10 +675,10 @@ fn on_webview_event(webview: &Webview, event: &WebviewEvent) -> c let _ = scopes.allow_directory(path, false); } } - let payload = FileDropPayload { paths, position }; + let payload = DragDropPayload { paths, position }; webview.emit_to_webview(DROP_EVENT, payload)? } - FileDropEvent::Cancelled => webview.emit_to_webview(DROP_CANCELLED_EVENT, ())?, + DragDropEvent::Cancelled => webview.emit_to_webview(DROP_CANCELLED_EVENT, ())?, _ => unimplemented!(), }, } diff --git a/core/tauri/src/manager/window.rs b/core/tauri/src/manager/window.rs index b93ccbd98..c2ce19d0e 100644 --- a/core/tauri/src/manager/window.rs +++ b/core/tauri/src/manager/window.rs @@ -11,11 +11,9 @@ use std::{ use serde::Serialize; use tauri_runtime::{ + dpi::{PhysicalPosition, PhysicalSize}, window::WindowBuilder, - window::{ - dpi::{PhysicalPosition, PhysicalSize}, - DetachedWindow, FileDropEvent, PendingWindow, - }, + window::{DetachedWindow, DragDropEvent, PendingWindow}, }; use crate::{ @@ -31,9 +29,10 @@ const WINDOW_FOCUS_EVENT: &str = "tauri://focus"; const WINDOW_BLUR_EVENT: &str = "tauri://blur"; const WINDOW_SCALE_FACTOR_CHANGED_EVENT: &str = "tauri://scale-change"; const WINDOW_THEME_CHANGED: &str = "tauri://theme-changed"; -pub const DROP_EVENT: &str = "tauri://file-drop"; -pub const DROP_HOVER_EVENT: &str = "tauri://file-drop-hover"; -pub const DROP_CANCELLED_EVENT: &str = "tauri://file-drop-cancelled"; +pub const DRAG_EVENT: &str = "tauri://drag"; +pub const DROP_EVENT: &str = "tauri://drop"; +pub const DROP_HOVER_EVENT: &str = "tauri://drop-over"; +pub const DROP_CANCELLED_EVENT: &str = "tauri://drag-cancelled"; pub struct WindowManager { pub windows: Mutex>>, @@ -145,11 +144,16 @@ impl Window { } #[derive(Serialize, Clone)] -pub struct FileDropPayload<'a> { +pub struct DragDropPayload<'a> { pub paths: &'a Vec, pub position: &'a PhysicalPosition, } +#[derive(Serialize, Clone)] +pub struct DragOverPayload<'a> { + pub position: &'a PhysicalPosition, +} + fn on_window_event(window: &Window, event: &WindowEvent) -> crate::Result<()> { match event { WindowEvent::Resized(size) => window.emit_to_window(WINDOW_RESIZED_EVENT, size)?, @@ -190,9 +194,18 @@ fn on_window_event(window: &Window, event: &WindowEvent) -> crate size: *new_inner_size, }, )?, - WindowEvent::FileDrop(event) => match event { - FileDropEvent::Hovered { paths, position } => { - let payload = FileDropPayload { paths, position }; + WindowEvent::DragDrop(event) => match event { + DragDropEvent::Dragged { paths, position } => { + let payload = DragDropPayload { paths, position }; + + if window.is_webview_window() { + window.emit_to(EventTarget::labeled(window.label()), DRAG_EVENT, payload)? + } else { + window.emit_to_window(DRAG_EVENT, payload)? + } + } + DragDropEvent::DragOver { position } => { + let payload = DragOverPayload { position }; if window.is_webview_window() { window.emit_to( EventTarget::labeled(window.label()), @@ -203,7 +216,7 @@ fn on_window_event(window: &Window, event: &WindowEvent) -> crate window.emit_to_window(DROP_HOVER_EVENT, payload)? } } - FileDropEvent::Dropped { paths, position } => { + DragDropEvent::Dropped { paths, position } => { let scopes = window.state::(); for path in paths { if path.is_file() { @@ -212,7 +225,7 @@ fn on_window_event(window: &Window, event: &WindowEvent) -> crate let _ = scopes.allow_directory(path, true); } } - let payload = FileDropPayload { paths, position }; + let payload = DragDropPayload { paths, position }; if window.is_webview_window() { window.emit_to(EventTarget::labeled(window.label()), DROP_EVENT, payload)? @@ -220,7 +233,7 @@ fn on_window_event(window: &Window, event: &WindowEvent) -> crate window.emit_to_window(DROP_EVENT, payload)? } } - FileDropEvent::Cancelled => { + DragDropEvent::Cancelled => { if window.is_webview_window() { window.emit_to( EventTarget::labeled(window.label()), diff --git a/core/tauri/src/menu/menu.rs b/core/tauri/src/menu/menu.rs index 172e80831..27d232e8c 100644 --- a/core/tauri/src/menu/menu.rs +++ b/core/tauri/src/menu/menu.rs @@ -40,7 +40,7 @@ impl ContextMenuBase for Menu { window: crate::Window, position: Option

, ) -> crate::Result<()> { - let position = position.map(Into::into).map(super::into_position); + let position = position.map(Into::into); run_item_main_thread!(self, move |self_: Self| { #[cfg(target_os = "macos")] if let Ok(view) = window.ns_view() { diff --git a/core/tauri/src/menu/mod.rs b/core/tauri/src/menu/mod.rs index 31eefed57..de1bf7870 100644 --- a/core/tauri/src/menu/mod.rs +++ b/core/tauri/src/menu/mod.rs @@ -762,22 +762,3 @@ pub(crate) mod sealed { ) -> crate::Result<()>; } } - -pub(crate) fn into_logical_position( - p: crate::LogicalPosition

, -) -> muda::LogicalPosition

{ - muda::LogicalPosition { x: p.x, y: p.y } -} - -pub(crate) fn into_physical_position( - p: crate::PhysicalPosition

, -) -> muda::PhysicalPosition

{ - muda::PhysicalPosition { x: p.x, y: p.y } -} - -pub(crate) fn into_position(p: crate::Position) -> muda::Position { - match p { - crate::Position::Physical(p) => muda::Position::Physical(into_physical_position(p)), - crate::Position::Logical(p) => muda::Position::Logical(into_logical_position(p)), - } -} diff --git a/core/tauri/src/menu/plugin.rs b/core/tauri/src/menu/plugin.rs index eee93de87..9b1536a34 100644 --- a/core/tauri/src/menu/plugin.rs +++ b/core/tauri/src/menu/plugin.rs @@ -8,7 +8,7 @@ use std::{ }; use serde::{Deserialize, Serialize}; -use tauri_runtime::window::dpi::Position; +use tauri_runtime::dpi::Position; use super::{sealed::ContextMenuBase, *}; use crate::{ diff --git a/core/tauri/src/menu/submenu.rs b/core/tauri/src/menu/submenu.rs index b5aef2b56..785d8f09b 100644 --- a/core/tauri/src/menu/submenu.rs +++ b/core/tauri/src/menu/submenu.rs @@ -32,7 +32,7 @@ impl ContextMenuBase for Submenu { window: crate::Window, position: Option

, ) -> crate::Result<()> { - let position = position.map(Into::into).map(super::into_position); + let position = position.map(Into::into); run_item_main_thread!(self, move |self_: Self| { #[cfg(target_os = "macos")] if let Ok(view) = window.ns_view() { diff --git a/core/tauri/src/test/mock_runtime.rs b/core/tauri/src/test/mock_runtime.rs index 8fb386ad5..4c9d88c8b 100644 --- a/core/tauri/src/test/mock_runtime.rs +++ b/core/tauri/src/test/mock_runtime.rs @@ -6,12 +6,10 @@ #![allow(missing_docs)] use tauri_runtime::{ + dpi::{PhysicalPosition, PhysicalSize, Position, Size}, monitor::Monitor, webview::{DetachedWebview, PendingWebview}, - window::{ - dpi::{PhysicalPosition, PhysicalSize, Position, Size}, - CursorIcon, DetachedWindow, PendingWindow, RawWindow, WindowEvent, WindowId, - }, + window::{CursorIcon, DetachedWindow, PendingWindow, RawWindow, WindowEvent, WindowId}, window::{WindowBuilder, WindowBuilderBase}, DeviceEventFilter, Error, EventLoopProxy, ExitRequestedEventAction, Icon, ProgressBarState, Result, RunEvent, Runtime, RuntimeHandle, RuntimeInitArgs, UserAttentionType, UserEvent, @@ -505,6 +503,10 @@ impl WebviewDispatch for MockWebviewDispatcher { .map_err(|_| Error::FailedToReceiveMessage) } + fn bounds(&self) -> Result { + Ok(tauri_runtime::Rect::default()) + } + fn position(&self) -> Result> { Ok(PhysicalPosition { x: 0, y: 0 }) } @@ -529,6 +531,10 @@ impl WebviewDispatch for MockWebviewDispatcher { Ok(()) } + fn set_bounds(&self, bounds: tauri_runtime::Rect) -> Result<()> { + Ok(()) + } + fn set_size(&self, _size: Size) -> Result<()> { Ok(()) } diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index 156d24576..37f35ef56 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -39,6 +39,7 @@ //! cmd: "ping".into(), //! callback: tauri::ipc::CallbackFn(0), //! error: tauri::ipc::CallbackFn(1), +//! url: "http://tauri.localhost".parse().unwrap(), //! body: tauri::ipc::InvokeBody::default(), //! headers: Default::default(), //! }, @@ -186,6 +187,7 @@ pub fn mock_app() -> App { /// cmd: "ping".into(), /// callback: tauri::ipc::CallbackFn(0), /// error: tauri::ipc::CallbackFn(1), +/// url: "http://tauri.localhost".parse().unwrap(), /// body: tauri::ipc::InvokeBody::default(), /// headers: Default::default(), /// }, @@ -242,6 +244,7 @@ pub fn assert_ipc_response< /// cmd: "ping".into(), /// callback: tauri::ipc::CallbackFn(0), /// error: tauri::ipc::CallbackFn(1), +/// url: "http://tauri.localhost".parse().unwrap(), /// body: tauri::ipc::InvokeBody::default(), /// headers: Default::default(), /// }, diff --git a/core/tauri/src/tray/mod.rs b/core/tauri/src/tray/mod.rs index 5e84aa22c..99f008002 100644 --- a/core/tauri/src/tray/mod.rs +++ b/core/tauri/src/tray/mod.rs @@ -12,24 +12,13 @@ use crate::app::{GlobalMenuEventListener, GlobalTrayIconEventListener}; use crate::menu::ContextMenu; use crate::menu::MenuEvent; use crate::resources::Resource; -use crate::{image::Image, menu::run_item_main_thread, AppHandle, Manager, Runtime}; +use crate::{ + image::Image, menu::run_item_main_thread, AppHandle, Manager, PhysicalPosition, Rect, Runtime, +}; use serde::Serialize; use std::path::Path; pub use tray_icon::TrayIconId; -/// Describes a rectangle including position (x - y axis) and size. -#[derive(Debug, PartialEq, Clone, Copy, Default, Serialize)] -pub struct Rectangle { - /// The x-coordinate of the upper-left corner of the rectangle. - pub left: f64, - /// The y-coordinate of the upper-left corner of the rectangle. - pub top: f64, - /// The x-coordinate of the lower-right corner of the rectangle. - pub right: f64, - /// The y-coordinate of the lower-right corner of the rectangle. - pub bottom: f64, -} - /// Describes the click type that triggered this tray icon event. #[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize)] pub enum ClickType { @@ -58,12 +47,10 @@ impl Default for ClickType { pub struct TrayIconEvent { /// Id of the tray icon which triggered this event. pub id: TrayIconId, - /// Physical X Position of the click the triggered this event. - pub x: f64, - /// Physical Y Position of the click the triggered this event. - pub y: f64, + /// Physical Position of the click the triggered this event. + pub position: PhysicalPosition, /// Position and size of the tray icon - pub icon_rect: Rectangle, + pub icon_rect: Rect, /// The click type that triggered this event. pub click_type: ClickType, } @@ -75,17 +62,6 @@ impl TrayIconEvent { } } -impl From for Rectangle { - fn from(value: tray_icon::Rectangle) -> Self { - Self { - bottom: value.bottom, - left: value.left, - top: value.top, - right: value.right, - } - } -} - impl From for ClickType { fn from(value: tray_icon::ClickType) -> Self { match value { @@ -100,9 +76,11 @@ impl From for TrayIconEvent { fn from(value: tray_icon::TrayIconEvent) -> Self { Self { id: value.id, - x: value.x, - y: value.y, - icon_rect: value.icon_rect.into(), + position: value.position, + icon_rect: Rect { + position: value.icon_rect.position.into(), + size: value.icon_rect.size.into(), + }, click_type: value.click_type.into(), } } diff --git a/core/tauri/src/webview/mod.rs b/core/tauri/src/webview/mod.rs index c64fdba1c..792b8c37d 100644 --- a/core/tauri/src/webview/mod.rs +++ b/core/tauri/src/webview/mod.rs @@ -13,15 +13,15 @@ use http::HeaderMap; use serde::Serialize; use tauri_macros::default_runtime; pub use tauri_runtime::webview::PageLoadEvent; -use tauri_runtime::{ - webview::{DetachedWebview, PendingWebview, WebviewAttributes}, - WebviewDispatch, -}; #[cfg(desktop)] use tauri_runtime::{ - window::dpi::{PhysicalPosition, PhysicalSize, Position, Size}, + dpi::{PhysicalPosition, PhysicalSize, Position, Size}, WindowDispatch, }; +use tauri_runtime::{ + webview::{DetachedWebview, PendingWebview, WebviewAttributes}, + Rect, WebviewDispatch, +}; use tauri_utils::config::{WebviewUrl, WindowConfig}; pub use url::Url; @@ -118,6 +118,8 @@ pub struct InvokeRequest { pub callback: CallbackFn, /// The error callback. pub error: CallbackFn, + /// URL of the frame that requested this command. + pub url: Url, /// The body of the request. pub body: InvokeBody, /// The request headers. @@ -616,7 +618,7 @@ tauri::Builder::default() let mut pending = self.into_pending_webview(&window, window.label(), &window_labels, &webview_labels)?; - pending.webview_attributes.bounds = Some((position, size)); + pending.webview_attributes.bounds = Some(Rect { size, position }); let webview = match &mut window.runtime() { RuntimeOrDispatch::Dispatch(dispatcher) => dispatcher.create_webview(pending), @@ -714,10 +716,10 @@ fn main() { self } - /// Disables the file drop handler. This is required to use drag and drop APIs on the front end on Windows. + /// Disables the drag and drop handler. This is required to use HTML5 drag and drop APIs on the frontend on Windows. #[must_use] - pub fn disable_file_drop_handler(mut self) -> Self { - self.webview_attributes.file_drop_handler_enabled = false; + pub fn disable_drag_drop_handler(mut self) -> Self { + self.webview_attributes.drag_drop_handler_enabled = false; self } @@ -882,6 +884,15 @@ impl Webview { Ok(()) } + /// Resizes this webview. + pub fn set_bounds(&self, bounds: Rect) -> crate::Result<()> { + self + .webview + .dispatcher + .set_bounds(bounds) + .map_err(Into::into) + } + /// Resizes this webview. pub fn set_size>(&self, size: S) -> crate::Result<()> { self @@ -929,6 +940,11 @@ impl Webview { .map_err(Into::into) } + /// Returns the bounds of the webviews's client area. + pub fn bounds(&self) -> crate::Result { + self.webview.dispatcher.bounds().map_err(Into::into) + } + /// Returns the webview position. /// /// - For child webviews, returns the position of the top-left hand corner of the webviews's client area relative to the top-left hand corner of the parent window. @@ -1081,8 +1097,7 @@ fn main() { /// Handles this window receiving an [`InvokeRequest`]. pub fn on_message(self, request: InvokeRequest, responder: Box>) { let manager = self.manager_owned(); - let current_url = self.url(); - let is_local = self.is_local_url(¤t_url); + let is_local = self.is_local_url(&request.url); let custom_responder = self.manager().webview.invoke_responder.clone(); @@ -1118,7 +1133,7 @@ fn main() { Origin::Local } else { Origin::Remote { - url: current_url.clone(), + url: request.url.clone(), } }; let (resolved_acl, has_app_acl_manifest) = { diff --git a/core/tauri/src/webview/plugin.rs b/core/tauri/src/webview/plugin.rs index 2237f39ea..c529c727b 100644 --- a/core/tauri/src/webview/plugin.rs +++ b/core/tauri/src/webview/plugin.rs @@ -13,7 +13,7 @@ use crate::{ mod desktop_commands { use serde::Deserialize; - use tauri_runtime::window::dpi::{Position, Size}; + use tauri_runtime::dpi::{Position, Size}; use tauri_utils::config::{WebviewUrl, WindowConfig}; use super::*; @@ -28,7 +28,7 @@ mod desktop_commands { #[serde(default)] url: WebviewUrl, user_agent: Option, - file_drop_enabled: Option, + drag_drop_enabled: Option, x: f64, y: f64, width: f64, @@ -71,8 +71,8 @@ mod desktop_commands { let mut builder = crate::webview::WebviewBuilder::new(label, options.url); builder.webview_attributes.user_agent = options.user_agent; - builder.webview_attributes.file_drop_handler_enabled = - options.file_drop_enabled.unwrap_or(true); + builder.webview_attributes.drag_drop_handler_enabled = + options.drag_drop_enabled.unwrap_or(true); builder.webview_attributes.transparent = options.transparent; builder.webview_attributes.accept_first_mouse = options.accept_first_mouse; builder.webview_attributes.window_effects = options.window_effects; @@ -80,8 +80,8 @@ mod desktop_commands { window.add_child( builder, - tauri_runtime::window::dpi::LogicalPosition::new(options.x, options.y), - tauri_runtime::window::dpi::LogicalSize::new(options.width, options.height), + tauri_runtime::dpi::LogicalPosition::new(options.x, options.y), + tauri_runtime::dpi::LogicalSize::new(options.width, options.height), )?; Ok(()) @@ -144,13 +144,9 @@ mod desktop_commands { getter!( webview_position, position, - tauri_runtime::window::dpi::PhysicalPosition - ); - getter!( - webview_size, - size, - tauri_runtime::window::dpi::PhysicalSize + tauri_runtime::dpi::PhysicalPosition ); + getter!(webview_size, size, tauri_runtime::dpi::PhysicalSize); //getter!(is_focused, bool); setter!(print); diff --git a/core/tauri/src/webview/webview_window.rs b/core/tauri/src/webview/webview_window.rs index 7a000193e..e62628be0 100644 --- a/core/tauri/src/webview/webview_window.rs +++ b/core/tauri/src/webview/webview_window.rs @@ -8,7 +8,7 @@ use std::{borrow::Cow, path::PathBuf, sync::Arc}; use crate::{ event::EventTarget, - runtime::window::dpi::{PhysicalPosition, PhysicalSize}, + runtime::dpi::{PhysicalPosition, PhysicalSize}, window::Monitor, }; #[cfg(desktop)] @@ -16,10 +16,8 @@ use crate::{ image::Image, menu::{ContextMenu, Menu}, runtime::{ - window::{ - dpi::{Position, Size}, - CursorIcon, - }, + dpi::{Position, Size}, + window::CursorIcon, UserAttentionType, }, }; @@ -792,10 +790,10 @@ fn main() { self } - /// Disables the file drop handler. This is required to use drag and drop APIs on the front end on Windows. + /// Disables the drag and drop handler. This is required to use HTML5 drag and drop APIs on the frontend on Windows. #[must_use] - pub fn disable_file_drop_handler(mut self) -> Self { - self.webview_builder = self.webview_builder.disable_file_drop_handler(); + pub fn disable_drag_drop_handler(mut self) -> Self { + self.webview_builder = self.webview_builder.disable_drag_drop_handler(); self } diff --git a/core/tauri/src/window/mod.rs b/core/tauri/src/window/mod.rs index 80c3bf182..4c20a78d4 100644 --- a/core/tauri/src/window/mod.rs +++ b/core/tauri/src/window/mod.rs @@ -7,8 +7,8 @@ pub(crate) mod plugin; use tauri_runtime::{ + dpi::{PhysicalPosition, PhysicalSize}, webview::PendingWebview, - window::dpi::{PhysicalPosition, PhysicalSize}, }; pub use tauri_utils::{config::Color, WindowEffect as Effect, WindowEffectState as EffectState}; @@ -36,7 +36,7 @@ use crate::{ image::Image, menu::{ContextMenu, Menu, MenuId}, runtime::{ - window::dpi::{Position, Size}, + dpi::{Position, Size}, UserAttentionType, }, CursorIcon, diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index aa51749a3..a3806a653 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -110,12 +110,6 @@ dependencies = [ "tiny_http", ] -[[package]] -name = "as-raw-xcb-connection" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" - [[package]] name = "ascii" version = "1.1.0" @@ -240,20 +234,6 @@ name = "bytemuck" version = "1.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] [[package]] name = "byteorder" @@ -726,51 +706,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "drm" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" -dependencies = [ - "bitflags 2.4.2", - "bytemuck", - "drm-ffi", - "drm-fourcc", - "rustix", -] - -[[package]] -name = "drm-ffi" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6" -dependencies = [ - "drm-sys", - "rustix", -] - -[[package]] -name = "drm-fourcc" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" - -[[package]] -name = "drm-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d09ff881f92f118b11105ba5e34ff8f4adf27b30dae8f12e28c193af1c83176" -dependencies = [ - "libc", - "linux-raw-sys 0.6.4", -] - [[package]] name = "dtoa" version = "1.0.9" @@ -833,22 +768,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - [[package]] name = "fdeflate" version = "0.3.4" @@ -1134,16 +1053,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "gethostname" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" -dependencies = [ - "libc", - "windows-targets 0.48.5", -] - [[package]] name = "getrandom" version = "0.1.16" @@ -1752,18 +1661,6 @@ dependencies = [ "safemem", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - -[[package]] -name = "linux-raw-sys" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b5399f6804fbab912acbd8878ed3532d506b7c951b8f9f164ef90fef39e3f4" - [[package]] name = "lock_api" version = "0.4.11" @@ -1845,15 +1742,6 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" -[[package]] -name = "memmap2" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" -dependencies = [ - "libc", -] - [[package]] name = "memoffset" version = "0.9.0" @@ -1892,9 +1780,9 @@ dependencies = [ [[package]] name = "muda" -version = "0.11.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c47e7625990fc1af2226ea4f34fb2412b03c12639fcb91868581eb3a6893453" +checksum = "3e27c56b8cb9b3214d196556227b0eaa12db8393b4f919a0a93ffb67ed17d185" dependencies = [ "cocoa", "crossbeam-channel", @@ -2610,19 +2498,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.38.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" -dependencies = [ - "bitflags 2.4.2", - "errno", - "libc", - "linux-raw-sys 0.4.13", - "windows-sys 0.52.0", -] - [[package]] name = "rustversion" version = "1.0.14" @@ -2916,29 +2791,20 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071916a85d1db274b4ed57af3a14afb66bd836ae7f82ebb6f1fd3455107830d9" dependencies = [ - "as-raw-xcb-connection", "bytemuck", "cfg_aliases 0.2.0", "cocoa", "core-graphics", - "drm", - "fastrand", "foreign-types", "js-sys", "log", - "memmap2", "objc", "raw-window-handle 0.6.0", "redox_syscall", - "rustix", - "tiny-xlib", "wasm-bindgen", - "wayland-backend", - "wayland-client", "wayland-sys", "web-sys", "windows-sys 0.52.0", - "x11rb", ] [[package]] @@ -3128,7 +2994,7 @@ dependencies = [ "unicode-segmentation", "url", "windows 0.52.0", - "windows-implement", + "windows-implement 0.52.0", "windows-version", "x11-dl", ] @@ -3152,7 +3018,7 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "2.0.0-beta.11" +version = "2.0.0-beta.12" dependencies = [ "anyhow", "bytes", @@ -3196,12 +3062,12 @@ dependencies = [ "webkit2gtk", "webview2-com", "window-vibrancy", - "windows 0.52.0", + "windows 0.54.0", ] [[package]] name = "tauri-build" -version = "2.0.0-beta.9" +version = "2.0.0-beta.10" dependencies = [ "anyhow", "cargo_toml", @@ -3223,7 +3089,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-beta.9" +version = "2.0.0-beta.10" dependencies = [ "base64 0.22.0", "brotli", @@ -3248,7 +3114,7 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-beta.9" +version = "2.0.0-beta.10" dependencies = [ "heck", "proc-macro2", @@ -3260,7 +3126,7 @@ dependencies = [ [[package]] name = "tauri-plugin" -version = "2.0.0-beta.9" +version = "2.0.0-beta.10" dependencies = [ "anyhow", "glob", @@ -3286,7 +3152,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.0.0-beta.9" +version = "2.0.0-beta.10" dependencies = [ "gtk", "http", @@ -3297,12 +3163,12 @@ dependencies = [ "tauri-utils", "thiserror", "url", - "windows 0.52.0", + "windows 0.54.0", ] [[package]] name = "tauri-runtime-wry" -version = "2.0.0-beta.9" +version = "2.0.0-beta.10" dependencies = [ "cocoa", "gtk", @@ -3318,13 +3184,13 @@ dependencies = [ "url", "webkit2gtk", "webview2-com", - "windows 0.52.0", + "windows 0.54.0", "wry", ] [[package]] name = "tauri-utils" -version = "2.0.0-beta.9" +version = "2.0.0-beta.10" dependencies = [ "aes-gcm", "brotli", @@ -3446,18 +3312,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-xlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4098d49269baa034a8d1eae9bd63e9fa532148d772121dace3bcd6a6c98eb6d" -dependencies = [ - "as-raw-xcb-connection", - "ctor", - "libloading 0.8.1", - "tracing", -] - [[package]] name = "tiny_http" version = "0.11.0" @@ -3644,9 +3498,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4d9ddd4a7c0f3b6862af1c4911b529a49db4ee89310d3a258859c2f5053fdd" +checksum = "454035ff34b8430638c894e6197748578d6b4d449c6edaf8ea854d94e2dd862b" dependencies = [ "cocoa", "core-graphics", @@ -3949,43 +3803,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wayland-backend" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40" -dependencies = [ - "cc", - "downcast-rs", - "rustix", - "scoped-tls", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-client" -version = "0.31.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" -dependencies = [ - "bitflags 2.4.2", - "rustix", - "wayland-backend", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283" -dependencies = [ - "proc-macro2", - "quick-xml", - "quote", -] - [[package]] name = "wayland-sys" version = "0.31.1" @@ -3994,7 +3811,6 @@ checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ "dlib", "log", - "once_cell", "pkg-config", ] @@ -4054,16 +3870,16 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ae9c7e420783826cf769d2c06ac9ba462f450eca5893bb8c6c6529a4e5dd33" +checksum = "38d5949fc3f537e90240c3e4f78dda2fa0431b671d50845a2f582173ef8a1201" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows 0.52.0", - "windows-core 0.52.0", - "windows-implement", - "windows-interface", + "windows 0.54.0", + "windows-core 0.54.0", + "windows-implement 0.53.0", + "windows-interface 0.53.0", ] [[package]] @@ -4079,13 +3895,13 @@ dependencies = [ [[package]] name = "webview2-com-sys" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ad85fceee6c42fa3d61239eba5a11401bf38407a849ed5ea1b407df08cca72" +checksum = "cd1eaa1be63d6fdcadf893c40d7d53c889a6342b3a94930d34e6964d5bb7e8db" dependencies = [ "thiserror", - "windows 0.52.0", - "windows-core 0.52.0", + "windows 0.54.0", + "windows-core 0.54.0", ] [[package]] @@ -4139,8 +3955,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core 0.52.0", - "windows-implement", - "windows-interface", + "windows-implement 0.52.0", + "windows-interface 0.52.0", "windows-targets 0.52.4", ] @@ -4154,6 +3970,18 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-implement 0.53.0", + "windows-interface 0.53.0", + "windows-targets 0.52.4", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -4173,6 +4001,16 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result", + "windows-targets 0.52.4", +] + [[package]] name = "windows-implement" version = "0.52.0" @@ -4184,6 +4022,17 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "windows-implement" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942ac266be9249c84ca862f0a164a39533dc2f6f33dc98ec89c8da99b82ea0bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "windows-interface" version = "0.52.0" @@ -4195,6 +4044,17 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "windows-interface" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da33557140a288fae4e1d5f8873aaf9eb6613a9cf82c3e070223ff177f598b60" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "windows-result" version = "0.1.0" @@ -4442,9 +4302,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.37.0" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b717040ba9771fd88eb428c6ea6b555f8e734ff8534f02c13e8f10d97f5935e" +checksum = "741261f2571990873d0dd5953cff8087f39a16fb37550edd0acf7221b9c8d65b" dependencies = [ "base64 0.21.7", "block", @@ -4461,7 +4321,6 @@ dependencies = [ "jni", "kuchikiki", "libc", - "log", "ndk", "ndk-context", "ndk-sys", @@ -4470,8 +4329,6 @@ dependencies = [ "once_cell", "percent-encoding", "raw-window-handle 0.6.0", - "serde", - "serde_json", "sha2", "soup3", "tao-macros", @@ -4479,8 +4336,7 @@ dependencies = [ "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows 0.52.0", - "windows-implement", + "windows 0.54.0", "windows-version", "x11-dl", ] @@ -4505,24 +4361,3 @@ dependencies = [ "once_cell", "pkg-config", ] - -[[package]] -name = "x11rb" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" -dependencies = [ - "as-raw-xcb-connection", - "gethostname", - "libc", - "libloading 0.8.1", - "once_cell", - "rustix", - "x11rb-protocol", -] - -[[package]] -name = "x11rb-protocol" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" diff --git a/tooling/api/src/event.ts b/tooling/api/src/event.ts index 36cd92dde..249965873 100644 --- a/tooling/api/src/event.ts +++ b/tooling/api/src/event.ts @@ -57,9 +57,10 @@ enum TauriEvent { WINDOW_THEME_CHANGED = 'tauri://theme-changed', WINDOW_CREATED = 'tauri://window-created', WEBVIEW_CREATED = 'tauri://webview-created', - FILE_DROP = 'tauri://file-drop', - FILE_DROP_HOVER = 'tauri://file-drop-hover', - FILE_DROP_CANCELLED = 'tauri://file-drop-cancelled' + DRAG = 'tauri://drag', + DROP = 'tauri://drop', + DROP_OVER = 'tauri://drop-over', + DROP_CANCELLED = 'tauri://drag-cancelled' } /** diff --git a/tooling/api/src/webview.ts b/tooling/api/src/webview.ts index 850c67ed4..4178c1644 100644 --- a/tooling/api/src/webview.ts +++ b/tooling/api/src/webview.ts @@ -33,16 +33,21 @@ import { invoke } from './core' import { Window, getCurrent as getCurrentWindow } from './window' import { WebviewWindow } from './webviewWindow' -interface FileDropPayload { +interface DragDropPayload { paths: string[] position: PhysicalPosition } -/** The file drop event types. */ -type FileDropEvent = - | ({ type: 'hover' } & FileDropPayload) - | ({ type: 'drop' } & FileDropPayload) - | { type: 'cancel' } +interface DragOverPayload { + position: PhysicalPosition +} + +/** The drag and drop event types. */ +type DragDropEvent = + | ({ type: 'dragged' } & DragDropPayload) + | ({ type: 'dragOver' } & DragOverPayload) + | ({ type: 'dropped' } & DragDropPayload) + | { type: 'cancelled' } /** * Get an instance of `Webview` for the current webview. @@ -502,7 +507,7 @@ class Webview { * @example * ```typescript * import { getCurrent } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrent().onFileDropEvent((event) => { + * const unlisten = await getCurrent().onDragDropEvent((event) => { * if (event.payload.type === 'hover') { * console.log('User hovering', event.payload.paths); * } else if (event.payload.type === 'drop') { @@ -519,16 +524,16 @@ class Webview { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. */ - async onFileDropEvent( - handler: EventCallback + async onDragDropEvent( + handler: EventCallback ): Promise { - const unlistenFileDrop = await this.listen( - TauriEvent.FILE_DROP, + const unlistenDrag = await this.listen( + TauriEvent.DRAG, (event) => { handler({ ...event, payload: { - type: 'drop', + type: 'dragged', paths: event.payload.paths, position: mapPhysicalPosition(event.payload.position) } @@ -536,13 +541,13 @@ class Webview { } ) - const unlistenFileHover = await this.listen( - TauriEvent.FILE_DROP_HOVER, + const unlistenDrop = await this.listen( + TauriEvent.DROP, (event) => { handler({ ...event, payload: { - type: 'hover', + type: 'dropped', paths: event.payload.paths, position: mapPhysicalPosition(event.payload.position) } @@ -550,16 +555,30 @@ class Webview { } ) + const unlistenDragOver = await this.listen( + TauriEvent.DROP_CANCELLED, + (event) => { + handler({ + ...event, + payload: { + type: 'dragOver', + position: mapPhysicalPosition(event.payload.position) + } + }) + } + ) + const unlistenCancel = await this.listen( - TauriEvent.FILE_DROP_CANCELLED, + TauriEvent.DROP_CANCELLED, (event) => { - handler({ ...event, payload: { type: 'cancel' } }) + handler({ ...event, payload: { type: 'cancelled' } }) } ) return () => { - unlistenFileDrop() - unlistenFileHover() + unlistenDrag() + unlistenDrop() + unlistenDragOver() unlistenCancel() } } @@ -598,11 +617,11 @@ interface WebviewOptions { */ transparent?: boolean /** - * Whether the file drop is enabled or not on the webview. By default it is enabled. + * Whether the drag and drop is enabled or not on the webview. By default it is enabled. * - * Disabling it is required to use drag and drop on the frontend on Windows. + * Disabling it is required to use HTML5 drag and drop on the frontend on Windows. */ - fileDropEnabled?: boolean + dragDropEnabled?: boolean /** * Whether clicking an inactive webview also clicks through to the webview on macOS. */ @@ -633,4 +652,4 @@ interface WebviewOptions { export { Webview, getCurrent, getAll } -export type { FileDropEvent, FileDropPayload, WebviewOptions } +export type { DragDropEvent, DragDropPayload, WebviewOptions } diff --git a/tooling/api/src/webviewWindow.ts b/tooling/api/src/webviewWindow.ts index 947c881be..d2bf8ca69 100644 --- a/tooling/api/src/webviewWindow.ts +++ b/tooling/api/src/webviewWindow.ts @@ -13,7 +13,7 @@ import { Window } from './window' import { listen, once } from './event' import type { EventName, EventCallback, UnlistenFn } from './event' import { invoke } from './core' -import type { FileDropEvent, FileDropPayload } from './webview' +import type { DragDropEvent, DragDropPayload } from './webview' /** * Get an instance of `Webview` for the current webview window. @@ -231,4 +231,4 @@ function applyMixins( } export { WebviewWindow, getCurrent, getAll } -export type { FileDropEvent, FileDropPayload } +export type { DragDropEvent, DragDropPayload } diff --git a/tooling/api/src/window.ts b/tooling/api/src/window.ts index 3210107fe..dc2e28007 100644 --- a/tooling/api/src/window.ts +++ b/tooling/api/src/window.ts @@ -35,7 +35,7 @@ import { } from './event' import { invoke } from './core' import { WebviewWindow } from './webviewWindow' -import type { FileDropEvent, FileDropPayload } from './webview' +import type { DragDropEvent, DragDropPayload } from './webview' import { Image, transformImage } from './image' /** @@ -1717,7 +1717,7 @@ class Window { * @example * ```typescript * import { getCurrent } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrent().onFileDropEvent((event) => { + * const unlisten = await getCurrent().onDragDropEvent((event) => { * if (event.payload.type === 'hover') { * console.log('User hovering', event.payload.paths); * } else if (event.payload.type === 'drop') { @@ -1734,16 +1734,16 @@ class Window { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. */ - async onFileDropEvent( - handler: EventCallback + async onDragDropEvent( + handler: EventCallback ): Promise { - const unlistenFileDrop = await this.listen( - TauriEvent.FILE_DROP, + const unlistenDrag = await this.listen( + TauriEvent.DRAG, (event) => { handler({ ...event, payload: { - type: 'drop', + type: 'dragged', paths: event.payload.paths, position: mapPhysicalPosition(event.payload.position) } @@ -1751,13 +1751,13 @@ class Window { } ) - const unlistenFileHover = await this.listen( - TauriEvent.FILE_DROP_HOVER, + const unlistenDrop = await this.listen( + TauriEvent.DROP, (event) => { handler({ ...event, payload: { - type: 'hover', + type: 'dropped', paths: event.payload.paths, position: mapPhysicalPosition(event.payload.position) } @@ -1765,16 +1765,30 @@ class Window { } ) + const unlistenDragOver = await this.listen( + TauriEvent.DROP_OVER, + (event) => { + handler({ + ...event, + payload: { + type: 'dragOver', + position: mapPhysicalPosition(event.payload.position) + } + }) + } + ) + const unlistenCancel = await this.listen( - TauriEvent.FILE_DROP_CANCELLED, + TauriEvent.DROP_CANCELLED, (event) => { - handler({ ...event, payload: { type: 'cancel' } }) + handler({ ...event, payload: { type: 'cancelled' } }) } ) return () => { - unlistenFileDrop() - unlistenFileHover() + unlistenDrag() + unlistenDrop() + unlistenDragOver() unlistenCancel() } } @@ -2264,6 +2278,6 @@ export type { ScaleFactorChanged, WindowOptions, Color, - FileDropEvent, - FileDropPayload + DragDropEvent, + DragDropPayload } diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 8f6b61c8a..2261211b3 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -221,8 +221,8 @@ "null" ] }, - "fileDropEnabled": { - "description": "Whether the file drop is enabled or not on the webview. By default it is enabled.\n\nDisabling it is required to use drag and drop on the frontend on Windows.", + "dragDropEnabled": { + "description": "Whether the drag and drop is enabled or not on the webview. By default it is enabled.\n\nDisabling it is required to use HTML5 drag and drop on the frontend on Windows.", "default": true, "type": "boolean" },