diff --git a/.changes/config.json b/.changes/config.json index 212c3df5..aea71dac 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -41,7 +41,7 @@ "app", "log-plugin", "cli", - "clipboard", + "clipboard-manager", "dialog", "fs", "global-shortcut", @@ -52,7 +52,8 @@ "shell", "updater", "window" - ] + ], + "postversion": "pnpm install" }, "api-example-js": { "path": "./examples/api", @@ -62,7 +63,7 @@ "app-js", "log-js", "cli-js", - "clipboard-js", + "clipboard-manager-js", "dialog-js", "fs-js", "global-shortcut-js", diff --git a/.changes/http-response.md b/.changes/http-response.md new file mode 100644 index 00000000..4be8f924 --- /dev/null +++ b/.changes/http-response.md @@ -0,0 +1,5 @@ +--- +"http": patch +--- + +Improve response performance by using the new IPC streaming data. diff --git a/.changes/positioner-tray-flag.md b/.changes/positioner-tray-flag.md new file mode 100644 index 00000000..4cf24118 --- /dev/null +++ b/.changes/positioner-tray-flag.md @@ -0,0 +1,5 @@ +--- +"positioner": patch +--- + +Change `system-tray` feature flag to `tray-icon`. diff --git a/.changes/pre.json b/.changes/pre.json index a95db7bb..0a7cec70 100644 --- a/.changes/pre.json +++ b/.changes/pre.json @@ -1,9 +1,34 @@ { "tag": "alpha", "changes": [ + ".changes/dialog-async-message-dialog.md", + ".changes/disable-window-controls-api-options.md", + ".changes/disable-window-controls-api.md", + ".changes/fix-docs-build.md", + ".changes/fs-wiret-binary-file.md", + ".changes/http-multipart-refactor.md", + ".changes/http-plugin-refactor.md", ".changes/notification-init-script.md", + ".changes/notification-revert-sound.md", ".changes/notification-sound.md", + ".changes/os-plugin-refactor.md", + ".changes/persisted-scope-asset.md", + ".changes/persisted-scope-glob.md", + ".changes/positioner-tray-flag.md", + ".changes/shell-command-apis.md", + ".changes/shell-detached.md", + ".changes/stronghold-arg-name.md", ".changes/stronghold-constructor.md", - ".changes/v2-alpha.md" + ".changes/tauri-alpha.11.md", + ".changes/updater-nsis-admin.md", + ".changes/updater-nsis.md", + ".changes/updater-plugin-refactor.md", + ".changes/v2-alpha.md", + ".changes/window-incognito.md", + ".changes/window-is-focused.md", + ".changes/window-plugin-refactor.md", + ".changes/window-set-effects.md", + ".changes/window-state-decorated.md", + ".changes/window-state-promise.md" ] } diff --git a/.changes/tauri-alpha.11.md b/.changes/tauri-alpha.11.md new file mode 100644 index 00000000..0f5a7a0c --- /dev/null +++ b/.changes/tauri-alpha.11.md @@ -0,0 +1,53 @@ +--- +"app": patch +"app-js": patch +"authenticator": patch +"authenticator-js": patch +"autostart": patch +"autostart-js": patch +"cli": patch +"cli-js": patch +"clipboard-manager": patch +"clipboard-manager-js": patch +"dialog": patch +"dialog-js": patch +"fs": patch +"fs-js": patch +"global-shortcut": patch +"global-shortcut-js": patch +"http": patch +"http-js": patch +"localhost": patch +"log-plugin": patch +"log-js": patch +"notification": patch +"notification-js": patch +"os": patch +"os-js": patch +"persisted-scope": patch +"positioner": patch +"positioner-js": patch +"process": patch +"process-js": patch +"shell": patch +"shell-js": patch +"single-instance": patch +"sql": patch +"sql-js": patch +"store": patch +"store-js": patch +"stronghold": patch +"stronghold-js": patch +"updater": patch +"updater-js": patch +"upload": patch +"upload-js": patch +"websocket": patch +"websocket-js": patch +"window": patch +"window-js": patch +"window-state": patch +"window-state-js": patch +--- + +Update to alpha.11. diff --git a/Cargo.lock b/Cargo.lock index 457bbe4d..20b042b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -230,7 +230,7 @@ checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "api" -version = "2.0.0-alpha.1" +version = "2.0.0-alpha.2" dependencies = [ "log", "serde", @@ -275,7 +275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6041616acea41d67c4a984709ddab1587fd0b10efe5cc563fee954d2f011854" dependencies = [ "clipboard-win", - "core-graphics", + "core-graphics 0.22.3", "image", "log", "objc", @@ -927,8 +927,24 @@ dependencies = [ "block", "cocoa-foundation", "core-foundation", - "core-graphics", - "foreign-types", + "core-graphics 0.22.3", + "foreign-types 0.3.2", + "libc", + "objc", +] + +[[package]] +name = "cocoa" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation", + "core-graphics 0.23.1", + "foreign-types 0.5.0", "libc", "objc", ] @@ -943,7 +959,7 @@ dependencies = [ "block", "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", "libc", "objc", ] @@ -1078,7 +1094,20 @@ dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types 0.5.0", "libc", ] @@ -1668,7 +1697,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", ] [[package]] @@ -1677,6 +1727,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + [[package]] name = "form_urlencoded" version = "1.2.0" @@ -2310,9 +2366,9 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.25.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" +checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" dependencies = [ "log", "mac", @@ -2436,16 +2492,6 @@ dependencies = [ "cc", ] -[[package]] -name = "ico" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031530fe562d8c8d71c0635013d6d155bbfe8ba0aa4b4d2d24ce8af6b71047bd" -dependencies = [ - "byteorder", - "png", -] - [[package]] name = "ico" version = "0.3.0" @@ -2531,18 +2577,18 @@ dependencies = [ [[package]] name = "infer" -version = "0.9.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f178e61cdbfe084aa75a2f4f7a25a5bb09701a47ae1753608f194b15783c937a" +checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3" dependencies = [ "cfb", ] [[package]] name = "infer" -version = "0.12.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3" +checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199" dependencies = [ "cfb", ] @@ -2729,9 +2775,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "javascriptcore-rs" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110b9902c80c12bf113c432d0b71c7a94490b294a8234f326fd0abca2fac0b00" +checksum = "4cfcc681b896b083864a4a3c3b3ea196f14ff66b8641a68fde209c6d84434056" dependencies = [ "bitflags 1.3.2", "glib", @@ -2740,9 +2786,9 @@ dependencies = [ [[package]] name = "javascriptcore-rs-sys" -version = "0.5.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a216519a52cd941a733a0ad3f1023cfdb1cd47f3955e8e863ed56f558f916c" +checksum = "b0983ba5b3ab9a0c0918de02c42dc71f795d6de08092f88a98ce9fdfdee4ba91" dependencies = [ "glib-sys", "gobject-sys", @@ -2752,16 +2798,18 @@ dependencies = [ [[package]] name = "jni" -version = "0.20.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" dependencies = [ "cesu8", + "cfg-if", "combine", "jni-sys", "log", "thiserror", "walkdir", + "windows-sys 0.45.0", ] [[package]] @@ -2838,13 +2886,14 @@ dependencies = [ ] [[package]] -name = "kuchiki" -version = "0.8.1" +name = "kuchikiki" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" +checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" dependencies = [ "cssparser", "html5ever", + "indexmap 1.9.3", "matches", "selectors", ] @@ -3047,13 +3096,13 @@ dependencies = [ [[package]] name = "markup5ever" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" +checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" dependencies = [ "log", - "phf 0.8.0", - "phf_codegen", + "phf 0.10.1", + "phf_codegen 0.10.0", "string_cache", "string_cache_codegen", "tendril", @@ -3190,6 +3239,25 @@ dependencies = [ "similar", ] +[[package]] +name = "muda" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e33f46fb20f85553edb85e30a6a5231567f4103276ccdb5a2050613d253b1d" +dependencies = [ + "cocoa 0.25.0", + "crossbeam-channel", + "gdk", + "gdk-pixbuf", + "gtk", + "keyboard-types", + "objc", + "once_cell", + "png", + "thiserror", + "windows-sys 0.48.0", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -3210,14 +3278,15 @@ dependencies = [ [[package]] name = "ndk" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags 1.3.2", "jni-sys", "ndk-sys", "num_enum", + "raw-window-handle", "thiserror", ] @@ -3229,9 +3298,9 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.3.0" +version = "0.4.1+23.1.7779620" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" +checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" dependencies = [ "jni-sys", ] @@ -3514,7 +3583,7 @@ checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags 1.3.2", "cfg-if", - "foreign-types", + "foreign-types 0.3.2", "libc", "once_cell", "openssl-macros", @@ -3734,6 +3803,16 @@ dependencies = [ "phf_shared 0.8.0", ] +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + [[package]] name = "phf_generator" version = "0.8.0" @@ -4617,7 +4696,7 @@ dependencies = [ "log", "matches", "phf 0.8.0", - "phf_codegen", + "phf_codegen 0.8.0", "precomputed-hash", "servo_arc", "smallvec", @@ -5166,9 +5245,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "state" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe866e1e51e8260c9eed836a042a5e7f6726bb2b411dffeaa712e19c388f23b" +checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" dependencies = [ "loom", ] @@ -5293,9 +5372,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "swift-rs" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e51d6f2b5fff4808614f429f8a7655ac8bcfe218185413f3a60c508482c2d6" +checksum = "1bbdb58577b6301f8d17ae2561f32002a5bae056d444e0f69e611e504a276204" dependencies = [ "base64 0.21.2", "serde", @@ -5349,18 +5428,17 @@ dependencies = [ [[package]] name = "tao" -version = "0.19.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "746ae5d0ca57ae275a792f109f6e992e0b41a443abdf3f5c6eff179ef5b3443a" +checksum = "60279ecb16c33a6cef45cd37a9602455c190942d20e360bd8499bff49f2a48f3" dependencies = [ "bitflags 1.3.2", "cairo-rs", "cc", - "cocoa", + "cocoa 0.24.1", "core-foundation", - "core-graphics", + "core-graphics 0.22.3", "crossbeam-channel", - "dirs-next", "dispatch", "gdk", "gdk-pixbuf", @@ -5375,7 +5453,6 @@ dependencies = [ "instant", "jni", "lazy_static", - "libappindicator", "libc", "log", "ndk", @@ -5390,10 +5467,12 @@ dependencies = [ "serde", "tao-macros", "unicode-segmentation", + "url", "uuid", - "windows 0.44.0", + "windows 0.48.0", "windows-implement", "x11-dl", + "zbus", ] [[package]] @@ -5426,13 +5505,13 @@ checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e" [[package]] name = "tauri" -version = "2.0.0-alpha.10" +version = "2.0.0-alpha.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e18377a75e314aa1d476896af881ed63f57a78ca84889fe63e69067f0de158d" +checksum = "fad0a5c32ce9e3e9862fb8cd433abf63e65ffea9b80dcc44d3d991e6794ea9a6" dependencies = [ "anyhow", "bytes 1.4.0", - "cocoa", + "cocoa 0.25.0", "dirs-next", "embed_plist", "futures-util", @@ -5441,11 +5520,13 @@ dependencies = [ "gtk", "heck", "http", - "ico 0.2.0", - "infer 0.9.0", + "ico", + "infer 0.15.0", "jni", "libc", "log", + "mime", + "muda", "objc", "once_cell", "percent-encoding", @@ -5453,7 +5534,6 @@ dependencies = [ "rand 0.8.5", "raw-window-handle", "reqwest", - "semver", "serde", "serde_json", "serde_repr", @@ -5465,26 +5545,27 @@ dependencies = [ "tauri-runtime", "tauri-runtime-wry", "tauri-utils", - "tempfile", "thiserror", "tokio", + "tray-icon", "url", "uuid", "webkit2gtk", "webview2-com", - "windows 0.44.0", + "windows 0.48.0", ] [[package]] name = "tauri-build" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a52990870fd043f1d3bd6719ae713ef2e0c50431334d7249f6ae8509d1b8c326" +checksum = "dc47d3c84f4aeac397cd956267f3b8060c5a2dba78288a5ccf9a8b7a8c1e7025" dependencies = [ "anyhow", "cargo_toml", "heck", "json-patch", + "plist", "quote", "semver", "serde", @@ -5498,13 +5579,13 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1f1611ab0896f2693163ba4e8f3e39c02a1b70cdca4314286b5e365a5e08c6" +checksum = "7f98a67c7ef3cb3c25de91fe1fa16cc3681997f6ec99da0a7496d6feae2ea91e" dependencies = [ "base64 0.21.2", "brotli", - "ico 0.3.0", + "ico", "json-patch", "plist", "png", @@ -5524,9 +5605,9 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22752425c6dd6f3a058f376db7371f1d5bac250e340d40ba6c97ecf7182eef29" +checksum = "b01cb5f945c71e040c5d191c32598565ae26cc266a9d5d4f7dd2dc324c5cfdd0" dependencies = [ "heck", "proc-macro2", @@ -5538,14 +5619,14 @@ dependencies = [ [[package]] name = "tauri-plugin-app" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "tauri", ] [[package]] name = "tauri-plugin-authenticator" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "authenticator", "base64 0.21.2", @@ -5564,7 +5645,7 @@ dependencies = [ [[package]] name = "tauri-plugin-autostart" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "auto-launch", "log", @@ -5576,7 +5657,7 @@ dependencies = [ [[package]] name = "tauri-plugin-cli" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "clap", "log", @@ -5588,7 +5669,7 @@ dependencies = [ [[package]] name = "tauri-plugin-clipboard-manager" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "arboard", "log", @@ -5601,7 +5682,7 @@ dependencies = [ [[package]] name = "tauri-plugin-dialog" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "glib", "log", @@ -5617,7 +5698,7 @@ dependencies = [ [[package]] name = "tauri-plugin-fs" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "anyhow", "glob", @@ -5631,7 +5712,7 @@ dependencies = [ [[package]] name = "tauri-plugin-global-shortcut" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "global-hotkey", "log", @@ -5643,7 +5724,7 @@ dependencies = [ [[package]] name = "tauri-plugin-http" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "data-url", "glob", @@ -5659,7 +5740,7 @@ dependencies = [ [[package]] name = "tauri-plugin-localhost" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "http", "log", @@ -5672,11 +5753,11 @@ dependencies = [ [[package]] name = "tauri-plugin-log" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "android_logger", "byte-unit", - "cocoa", + "cocoa 0.24.1", "fern", "log", "objc", @@ -5691,7 +5772,7 @@ dependencies = [ [[package]] name = "tauri-plugin-notification" -version = "2.0.0-alpha.1" +version = "2.0.0-alpha.2" dependencies = [ "log", "notify-rust", @@ -5709,7 +5790,7 @@ dependencies = [ [[package]] name = "tauri-plugin-os" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "gethostname 0.4.3", "log", @@ -5724,7 +5805,7 @@ dependencies = [ [[package]] name = "tauri-plugin-persisted-scope" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "aho-corasick", "bincode", @@ -5738,7 +5819,7 @@ dependencies = [ [[package]] name = "tauri-plugin-positioner" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "log", "serde", @@ -5750,14 +5831,14 @@ dependencies = [ [[package]] name = "tauri-plugin-process" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "tauri", ] [[package]] name = "tauri-plugin-shell" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "encoding_rs", "log", @@ -5773,7 +5854,7 @@ dependencies = [ [[package]] name = "tauri-plugin-single-instance" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "log", "serde", @@ -5786,7 +5867,7 @@ dependencies = [ [[package]] name = "tauri-plugin-sql" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "futures-core", "log", @@ -5801,7 +5882,7 @@ dependencies = [ [[package]] name = "tauri-plugin-store" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "log", "serde", @@ -5812,7 +5893,7 @@ dependencies = [ [[package]] name = "tauri-plugin-stronghold" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "hex", "iota-crypto 0.23.0", @@ -5829,7 +5910,7 @@ dependencies = [ [[package]] name = "tauri-plugin-updater" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "base64 0.21.2", "dirs-next", @@ -5854,7 +5935,7 @@ dependencies = [ [[package]] name = "tauri-plugin-upload" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "futures-util", "log", @@ -5870,7 +5951,7 @@ dependencies = [ [[package]] name = "tauri-plugin-websocket" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "futures-util", "log", @@ -5885,7 +5966,7 @@ dependencies = [ [[package]] name = "tauri-plugin-window" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "serde", "tauri", @@ -5894,7 +5975,7 @@ dependencies = [ [[package]] name = "tauri-plugin-window-state" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" dependencies = [ "bincode", "bitflags 2.3.3", @@ -5907,9 +5988,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.13.0-alpha.6" +version = "1.0.0-alpha.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ce19f1309299bbc38ee9236307fad4943bd8fb09dd3fea5e9dd93c1d0898d6" +checksum = "f5ba2ea1c0b7a2c3e53259edc3c78527e9f40fa7b45f73c52ab5165e42f9d18a" dependencies = [ "gtk", "http", @@ -5923,16 +6004,16 @@ dependencies = [ "thiserror", "url", "uuid", - "windows 0.44.0", + "windows 0.48.0", ] [[package]] name = "tauri-runtime-wry" -version = "0.13.0-alpha.6" +version = "1.0.0-alpha.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1231be42085f3a8b150e615601f8a070bd16bf579771a5dafe2931970a05b518" +checksum = "095d8a6cb312211bd0ed6b51f078be2e5bba4e3244b5fdbe39fce2ebfc0d7a15" dependencies = [ - "cocoa", + "cocoa 0.24.1", "gtk", "jni", "percent-encoding", @@ -5943,15 +6024,15 @@ dependencies = [ "uuid", "webkit2gtk", "webview2-com", - "windows 0.44.0", + "windows 0.48.0", "wry", ] [[package]] name = "tauri-utils" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2812e0cdfffb892c654555b2f1b8c84a035b4c56eb1646cb3eb5a9d8164d8e" +checksum = "06bcd7c6f67fd6371dcc22da7d7f26ec12c4eae26ad7bc54943bb9f35b5db302" dependencies = [ "aes-gcm 0.10.2", "brotli", @@ -5963,7 +6044,7 @@ dependencies = [ "html5ever", "infer 0.12.0", "json-patch", - "kuchiki", + "kuchikiki", "memchr", "phf 0.10.1", "proc-macro2", @@ -5976,7 +6057,7 @@ dependencies = [ "thiserror", "url", "walkdir", - "windows 0.44.0", + "windows 0.48.0", ] [[package]] @@ -6345,6 +6426,25 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tray-icon" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b0e5bec13da15e62330e9bcf8b9fd42489b5acfe29ac8fec7ed659dbee21d9" +dependencies = [ + "cocoa 0.25.0", + "core-graphics 0.23.1", + "crossbeam-channel", + "dirs-next", + "libappindicator", + "muda", + "objc", + "once_cell", + "png", + "thiserror", + "windows-sys 0.48.0", +] + [[package]] name = "treediff" version = "4.0.2" @@ -6760,9 +6860,9 @@ dependencies = [ [[package]] name = "webkit2gtk" -version = "0.19.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8eea819afe15eb8dcdff4f19d8bfda540bae84d874c10e6f4b8faf2d6704bd1" +checksum = "3ba4cce9085e0fb02575cfd45c328740dde78253cba516b1e8be2ca0f57bd8bf" dependencies = [ "bitflags 1.3.2", "cairo-rs", @@ -6784,9 +6884,9 @@ dependencies = [ [[package]] name = "webkit2gtk-sys" -version = "0.19.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ac7a95ddd3fdfcaf83d8e513b4b1ad101b95b413b6aa6662ed95f284fc3d5b" +checksum = "f4489eb24e8cf0a3d0555fd3a8f7adec2a5ece34c1e7b7c9a62da7822fd40a59" dependencies = [ "bitflags 1.3.2", "cairo-sys-rs", @@ -6841,38 +6941,39 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.22.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11296e5daf3a653b79bf47d66c380e4143d5b9c975818871179a3bda79499562" +checksum = "79e563ffe8e84d42e43ffacbace8780c0244fc8910346f334613559d92e203ad" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows 0.44.0", + "windows 0.48.0", "windows-implement", + "windows-interface", ] [[package]] name = "webview2-com-macros" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac" +checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.28", ] [[package]] name = "webview2-com-sys" -version = "0.22.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde542bed28058a5b028d459689ee57f1d06685bb6c266da3b91b1be6703952f" +checksum = "19d39576804304cf9ead192467ef47f7859a1a12fec3bd459d5ba34b8cd65ed5" dependencies = [ "regex", "serde", "serde_json", "thiserror", - "windows 0.44.0", + "windows 0.48.0", "windows-bindgen", "windows-metadata", ] @@ -6951,7 +7052,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29d30320647cfc3dc45554c8ad825b84831def81f967a2f7589931328ff9b16d" dependencies = [ - "cocoa", + "cocoa 0.24.1", "objc", "raw-window-handle", "windows-sys 0.42.0", @@ -6989,8 +7090,6 @@ version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" dependencies = [ - "windows-implement", - "windows-interface", "windows-targets 0.42.2", ] @@ -7000,14 +7099,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ + "windows-implement", + "windows-interface", "windows-targets 0.48.1", ] [[package]] name = "windows-bindgen" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222204ecf46521382a4d88b4a1bbefca9f8855697b4ab7d20803901425e061a3" +checksum = "1fe21a77bc54b7312dbd66f041605e098990c98be48cd52967b85b5e60e75ae6" dependencies = [ "windows-metadata", "windows-tokens", @@ -7015,9 +7116,9 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce87ca8e3417b02dc2a8a22769306658670ec92d78f1bd420d6310a67c245c6" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" dependencies = [ "proc-macro2", "quote", @@ -7026,9 +7127,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853f69a591ecd4f810d29f17e902d40e349fb05b0b11fff63b08b826bfe39c7f" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" dependencies = [ "proc-macro2", "quote", @@ -7037,9 +7138,9 @@ dependencies = [ [[package]] name = "windows-metadata" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee78911e3f4ce32c1ad9d3c7b0bd95389662ad8d8f1a3155688fed70bd96e2b6" +checksum = "422ee0e5f0e2cc372bb6addbfff9a8add712155cd743df9c15f6ab000f31432d" [[package]] name = "windows-sys" @@ -7119,9 +7220,9 @@ dependencies = [ [[package]] name = "windows-tokens" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4251900975a0d10841c5d4bde79c56681543367ef811f3fabb8d1803b0959b" +checksum = "b34c9a3b28cb41db7385546f7f9a8179348dffc89923dde66857b1ba5312f6b4" [[package]] name = "windows_aarch64_gnullvm" @@ -7307,14 +7408,14 @@ dependencies = [ [[package]] name = "wry" -version = "0.28.3" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d15f9f827d537cefe6d047be3930f5d89b238dfb85e08ba6a319153217635aa" +checksum = "4c6289018fa3cbc051c13f4ae1a102d80c3f35a527456c75567eb2cad6989020" dependencies = [ - "base64 0.13.1", + "base64 0.21.2", "block", - "cocoa", - "core-graphics", + "cocoa 0.24.1", + "core-graphics 0.22.3", "crossbeam-channel", "dunce", "gdk", @@ -7324,7 +7425,7 @@ dependencies = [ "html5ever", "http", "javascriptcore-rs", - "kuchiki", + "kuchikiki", "libc", "log", "objc", @@ -7340,7 +7441,7 @@ dependencies = [ "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows 0.44.0", + "windows 0.48.0", "windows-implement", ] diff --git a/Cargo.toml b/Cargo.toml index fce72255..163cc4df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ resolver = "2" [workspace.dependencies] serde = { version = "1", features = ["derive"] } log = "0.4" -tauri = "2.0.0-alpha.10" -tauri-build = "2.0.0-alpha.6" +tauri = "2.0.0-alpha.11" +tauri-build = "2.0.0-alpha.8" serde_json = "1" thiserror = "1" diff --git a/examples/api/CHANGELOG.md b/examples/api/CHANGELOG.md index 4da28c4f..d0297688 100644 --- a/examples/api/CHANGELOG.md +++ b/examples/api/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## \[2.0.0-alpha.1] + +### Dependencies + +- Upgraded to `window-js@2.0.0-alpha.1` +- Upgraded to `fs-js@2.0.0-alpha.1` +- Upgraded to `http-js@2.0.0-alpha.1` +- Upgraded to `os-js@2.0.0-alpha.1` +- Upgraded to `app-js@2.0.0-alpha.1` +- Upgraded to `cli-js@2.0.0-alpha.1` +- Upgraded to `dialog-js@2.0.0-alpha.1` +- Upgraded to `global-shortcut-js@2.0.0-alpha.1` +- Upgraded to `log-js@2.0.0-alpha.1` +- Upgraded to `notification-js@2.0.0-alpha.1` +- Upgraded to `process-js@2.0.0-alpha.1` +- Upgraded to `shell-js@2.0.0-alpha.1` +- Upgraded to `updater-js@2.0.0-alpha.1` + ## \[2.0.0-alpha.0] ### Dependencies diff --git a/examples/api/package.json b/examples/api/package.json index d6cc383d..d42e8bc9 100644 --- a/examples/api/package.json +++ b/examples/api/package.json @@ -1,7 +1,7 @@ { "name": "svelte-app", "private": true, - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "type": "module", "scripts": { "dev": "vite --clearScreen false", @@ -9,27 +9,27 @@ "serve": "vite preview" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5", - "@tauri-apps/plugin-app": "2.0.0-alpha.0", - "@tauri-apps/plugin-cli": "2.0.0-alpha.0", - "@tauri-apps/plugin-clipboard-manager": "2.0.0-alpha.0", - "@tauri-apps/plugin-dialog": "2.0.0-alpha.0", - "@tauri-apps/plugin-fs": "2.0.0-alpha.0", - "@tauri-apps/plugin-global-shortcut": "2.0.0-alpha.0", - "@tauri-apps/plugin-http": "2.0.0-alpha.0", - "@tauri-apps/plugin-notification": "2.0.0-alpha.0", - "@tauri-apps/plugin-os": "2.0.0-alpha.0", - "@tauri-apps/plugin-process": "2.0.0-alpha.0", - "@tauri-apps/plugin-shell": "2.0.0-alpha.0", - "@tauri-apps/plugin-updater": "2.0.0-alpha.0", - "@tauri-apps/plugin-window": "2.0.0-alpha.0", + "@tauri-apps/api": "2.0.0-alpha.6", + "@tauri-apps/plugin-app": "2.0.0-alpha.1", + "@tauri-apps/plugin-cli": "2.0.0-alpha.1", + "@tauri-apps/plugin-clipboard-manager": "2.0.0-alpha.1", + "@tauri-apps/plugin-dialog": "2.0.0-alpha.1", + "@tauri-apps/plugin-fs": "2.0.0-alpha.1", + "@tauri-apps/plugin-global-shortcut": "2.0.0-alpha.1", + "@tauri-apps/plugin-http": "2.0.0-alpha.1", + "@tauri-apps/plugin-notification": "2.0.0-alpha.1", + "@tauri-apps/plugin-os": "2.0.0-alpha.1", + "@tauri-apps/plugin-process": "2.0.0-alpha.1", + "@tauri-apps/plugin-shell": "2.0.0-alpha.1", + "@tauri-apps/plugin-updater": "2.0.0-alpha.1", + "@tauri-apps/plugin-window": "2.0.0-alpha.1", "@zerodevx/svelte-json-view": "1.0.5" }, "devDependencies": { "@iconify-json/codicon": "^1.1.26", "@iconify-json/ph": "^1.1.5", "@sveltejs/vite-plugin-svelte": "^2.4.1", - "@tauri-apps/cli": "2.0.0-alpha.10", + "@tauri-apps/cli": "2.0.0-alpha.11", "@unocss/extractor-svelte": "^0.53.1", "internal-ip": "^8.0.0", "svelte": "^3.59.1", diff --git a/examples/api/src-tauri/CHANGELOG.md b/examples/api/src-tauri/CHANGELOG.md index 22d9cf7a..7071e366 100644 --- a/examples/api/src-tauri/CHANGELOG.md +++ b/examples/api/src-tauri/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## \[2.0.0-alpha.2] + +### Dependencies + +- Upgraded to `dialog@2.0.0-alpha.1` +- Upgraded to `window@2.0.0-alpha.1` +- Upgraded to `app@2.0.0-alpha.1` +- Upgraded to `cli@2.0.0-alpha.1` +- Upgraded to `fs@2.0.0-alpha.1` +- Upgraded to `global-shortcut@2.0.0-alpha.1` +- Upgraded to `http@2.0.0-alpha.1` +- Upgraded to `log-plugin@2.0.0-alpha.1` +- Upgraded to `notification@2.0.0-alpha.2` +- Upgraded to `os@2.0.0-alpha.1` +- Upgraded to `process@2.0.0-alpha.1` +- Upgraded to `shell@2.0.0-alpha.1` +- Upgraded to `updater@2.0.0-alpha.1` + ## \[2.0.0-alpha.1] ### Dependencies diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index b1f1b09d..ed87aab0 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "api" publish = false -version = "2.0.0-alpha.1" +version = "2.0.0-alpha.2" description = "An example Tauri Application showcasing the api" edition = "2021" rust-version = { workspace = true } @@ -18,17 +18,17 @@ serde_json = { workspace = true } serde = { workspace = true } tiny_http = "0.11" log = { workspace = true } -tauri-plugin-app = { path = "../../../plugins/app", version = "2.0.0-alpha.0" } -tauri-plugin-log = { path = "../../../plugins/log", version = "2.0.0-alpha.0" } -tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.0-alpha.0" } +tauri-plugin-app = { path = "../../../plugins/app", version = "2.0.0-alpha.1" } +tauri-plugin-log = { path = "../../../plugins/log", version = "2.0.0-alpha.1" } +tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.0-alpha.1" } tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.0.0-alpha.0" } -tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.0-alpha.0" } -tauri-plugin-http = { path = "../../../plugins/http", features = [ "multipart" ], version = "2.0.0-alpha.0" } -tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.0.0-alpha.0", features = [ "windows7-compat" ] } -tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-alpha.0" } -tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-alpha.0" } -tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-alpha.0" } -tauri-plugin-window = { path = "../../../plugins/window", version = "2.0.0-alpha.0", features = [ "devtools", "icon-ico", "icon-png" ] } +tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.0-alpha.1" } +tauri-plugin-http = { path = "../../../plugins/http", features = [ "multipart" ], version = "2.0.0-alpha.1" } +tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.0.0-alpha.2", features = [ "windows7-compat" ] } +tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-alpha.1" } +tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-alpha.1" } +tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-alpha.1" } +tauri-plugin-window = { path = "../../../plugins/window", version = "2.0.0-alpha.1", features = [ "devtools", "icon-ico", "icon-png" ] } [dependencies.tauri] workspace = true @@ -37,14 +37,14 @@ tauri-plugin-window = { path = "../../../plugins/window", version = "2.0.0-alpha "icon-png", "isolation", "macos-private-api", - "system-tray", + "tray-icon", "protocol-asset" ] [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-alpha.0" } -tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-alpha.0" } -tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alpha.0" } +tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-alpha.1" } +tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-alpha.1" } +tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alpha.1" } [target."cfg(target_os = \"windows\")".dependencies] window-shadows = "0.2" diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index 00da3ebc..c3bd535e 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -44,7 +44,7 @@ pub fn run() { .setup(move |app| { #[cfg(desktop)] { - tray::create_tray(app)?; + tray::create_tray(app.handle())?; app.handle().plugin(tauri_plugin_cli::init())?; app.handle() .plugin(tauri_plugin_global_shortcut::Builder::new().build())?; @@ -124,7 +124,7 @@ pub fn run() { #[cfg(target_os = "macos")] { - builder = builder.menu(tauri::Menu::os_default("Tauri API Validation")); + builder = builder.menu(tauri::menu::Menu::default); } #[allow(unused_mut)] diff --git a/examples/api/src-tauri/src/tray.rs b/examples/api/src-tauri/src/tray.rs index fdd815d0..cff7ebb7 100644 --- a/examples/api/src-tauri/src/tray.rs +++ b/examples/api/src-tauri/src/tray.rs @@ -4,140 +4,113 @@ use std::sync::atomic::{AtomicBool, Ordering}; use tauri::{ - CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowBuilder, WindowUrl, + menu::{Menu, MenuItem}, + tray::{ClickType, TrayIconBuilder}, + Manager, Runtime, WindowBuilder, WindowUrl, }; -use tauri_plugin_dialog::DialogExt; -use tauri_plugin_shell::ShellExt; - -pub fn create_tray(app: &tauri::App) -> tauri::Result<()> { - let mut tray_menu1 = SystemTrayMenu::new() - .add_item(CustomMenuItem::new("toggle", "Toggle")) - .add_item(CustomMenuItem::new("new", "New window")) - .add_item(CustomMenuItem::new("icon_1", "Tray Icon 1")) - .add_item(CustomMenuItem::new("icon_2", "Tray Icon 2")); +pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { + let toggle_i = MenuItem::with_id(app, "toggle", "Toggle", true, None); + let new_window_i = MenuItem::with_id(app, "new-window", "New window", true, None); + let icon_i_1 = MenuItem::with_id(app, "icon-1", "Icon 1", true, None); + let icon_i_2 = MenuItem::with_id(app, "icon-2", "Icon 2", true, None); #[cfg(target_os = "macos")] - { - tray_menu1 = tray_menu1.add_item(CustomMenuItem::new("set_title", "Set Title")); - } - - tray_menu1 = tray_menu1 - .add_item(CustomMenuItem::new("switch_menu", "Switch Menu")) - .add_item(CustomMenuItem::new("about", "About")) - .add_item(CustomMenuItem::new("exit_app", "Quit")) - .add_item(CustomMenuItem::new("destroy", "Destroy")); + let set_title_i = MenuItem::with_id(app, "set-title", "Set Title", true, None); + let switch_i = MenuItem::with_id(app, "switch-menu", "Switch Menu", true, None); + let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None); + let remove_tray_i = MenuItem::with_id(app, "remove-tray", "Remove Tray icon", true, None); + let menu1 = Menu::with_items( + app, + &[ + &toggle_i, + &new_window_i, + &icon_i_1, + &icon_i_2, + #[cfg(target_os = "macos")] + &set_title_i, + &switch_i, + &quit_i, + &remove_tray_i, + ], + )?; + let menu2 = Menu::with_items( + app, + &[&toggle_i, &new_window_i, &switch_i, &quit_i, &remove_tray_i], + )?; - let tray_menu2 = SystemTrayMenu::new() - .add_item(CustomMenuItem::new("toggle", "Toggle")) - .add_item(CustomMenuItem::new("new", "New window")) - .add_item(CustomMenuItem::new("switch_menu", "Switch Menu")) - .add_item(CustomMenuItem::new("about", "About")) - .add_item(CustomMenuItem::new("exit_app", "Quit")) - .add_item(CustomMenuItem::new("destroy", "Destroy")); let is_menu1 = AtomicBool::new(true); - let handle = app.handle(); - let tray_id = "my-tray".to_string(); - SystemTray::new() - .with_id(&tray_id) - .with_menu(tray_menu1.clone()) - .with_tooltip("Tauri") - .on_event(move |event| { - let tray_handle = handle.tray_handle_by_id(&tray_id).unwrap(); - match event { - SystemTrayEvent::LeftClick { - position: _, - size: _, - .. - } => { - let window = handle.get_window("main").unwrap(); - window.show().unwrap(); - window.set_focus().unwrap(); + let _ = TrayIconBuilder::with_id("tray-1") + .tooltip("Tauri") + .icon(app.default_window_icon().unwrap().clone()) + .menu(&menu1) + .menu_on_left_click(false) + .on_menu_event(move |app, event| match event.id.as_ref() { + "quit" => { + app.exit(0); + } + "remove-tray" => { + app.remove_tray_by_id("tray-1"); + } + "toggle" => { + if let Some(window) = app.get_window("main") { + let new_title = if window.is_visible().unwrap_or_default() { + let _ = window.hide(); + "Show" + } else { + let _ = window.show(); + let _ = window.set_focus(); + "Hide" + }; + toggle_i.set_text(new_title).unwrap(); } - SystemTrayEvent::MenuItemClick { id, .. } => { - let item_handle = tray_handle.get_item(&id); - match id.as_str() { - "exit_app" => { - // exit the app - handle.exit(0); - } - "destroy" => { - tray_handle.destroy().unwrap(); - } - "toggle" => { - let window = handle.get_window("main").unwrap(); - let new_title = if window.is_visible().unwrap() { - window.hide().unwrap(); - "Show" - } else { - window.show().unwrap(); - "Hide" - }; - item_handle.set_title(new_title).unwrap(); - } - "new" => { - WindowBuilder::new(&handle, "new", WindowUrl::App("index.html".into())) - .title("Tauri") - .build() - .unwrap(); - } - "set_title" => { - #[cfg(target_os = "macos")] - tray_handle.set_title("Tauri").unwrap(); - } - "icon_1" => { - #[cfg(target_os = "macos")] - tray_handle.set_icon_as_template(true).unwrap(); - - tray_handle - .set_icon(tauri::Icon::Raw( - include_bytes!("../icons/tray_icon_with_transparency.png") - .to_vec(), - )) - .unwrap(); - } - "icon_2" => { - #[cfg(target_os = "macos")] - tray_handle.set_icon_as_template(true).unwrap(); + } + "new-window" => { + let _ = WindowBuilder::new(app, "new", WindowUrl::App("index.html".into())) + .title("Tauri") + .build(); + } + #[cfg(target_os = "macos")] + "set-title" => { + if let Some(tray) = app.tray_by_id("tray-1") { + let _ = tray.set_title(Some("Tauri")); + } + } + i @ "icon-1" | i @ "icon-2" => { + if let Some(tray) = app.tray_by_id("tray-1") { + let _ = tray.set_icon(Some(tauri::Icon::Raw(if i == "icon-1" { + include_bytes!("../icons/icon.ico").to_vec() + } else { + include_bytes!("../icons/tray_icon_with_transparency.png").to_vec() + }))); + } + } + "switch-menu" => { + let flag = is_menu1.load(Ordering::Relaxed); + let (menu, tooltip) = if flag { + (menu2.clone(), "Menu 2") + } else { + (menu1.clone(), "Tauri") + }; + if let Some(tray) = app.tray_by_id("tray-1") { + let _ = tray.set_menu(Some(menu)); + let _ = tray.set_tooltip(Some(tooltip)); + } + is_menu1.store(!flag, Ordering::Relaxed); + } - tray_handle - .set_icon(tauri::Icon::Raw( - include_bytes!("../icons/icon.ico").to_vec(), - )) - .unwrap(); - } - "switch_menu" => { - let flag = is_menu1.load(Ordering::Relaxed); - let (menu, tooltip) = if flag { - (tray_menu2.clone(), "Menu 2") - } else { - (tray_menu1.clone(), "Tauri") - }; - tray_handle.set_menu(menu).unwrap(); - tray_handle.set_tooltip(tooltip).unwrap(); - is_menu1.store(!flag, Ordering::Relaxed); - } - "about" => { - let window = handle.get_window("main").unwrap(); - window - .dialog() - .message("Tauri demo app") - .title("About app") - .parent(&window) - .ok_button_label("Homepage") - .cancel_button_label("Cancel") - .show(move |ok| { - if ok { - window.shell().open("https://tauri.app/", None).unwrap(); - } - }); - } - _ => {} - } + _ => {} + }) + .on_tray_event(|tray, event| { + if event.click_type == ClickType::Left { + let app = tray.app_handle(); + if let Some(window) = app.get_window("main") { + let _ = window.show(); + let _ = window.set_focus(); } - _ => {} } }) - .build(app) - .map(|_| ()) + .build(app); + + Ok(()) } diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index 6f5f422d..147c3ba0 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -124,6 +124,7 @@ "security": { "csp": { "default-src": "'self' customprotocol: asset:", + "connect-src": "ipc: https://ipc.localhost", "font-src": ["https://fonts.gstatic.com"], "img-src": "'self' asset: https://asset.localhost blob: data:", "style-src": "'unsafe-inline' 'self' https://fonts.googleapis.com" @@ -136,11 +137,6 @@ "deny": ["$APPDATA/db/*.stronghold"] } } - }, - "systemTray": { - "iconPath": "icons/tray_icon_with_transparency.png", - "iconAsTemplate": true, - "menuOnLeftClick": false } } } diff --git a/plugins/app/CHANGELOG.md b/plugins/app/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/app/CHANGELOG.md +++ b/plugins/app/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/app/Cargo.toml b/plugins/app/Cargo.toml index 267a39dc..8a4ccdc4 100644 --- a/plugins/app/Cargo.toml +++ b/plugins/app/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-app" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "APIs to read application metadata and change app visibility on macOS." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/app/package.json b/plugins/app/package.json index eabb80de..844b5240 100644 --- a/plugins/app/package.json +++ b/plugins/app/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-app", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.5.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/authenticator/CHANGELOG.md b/plugins/authenticator/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/authenticator/CHANGELOG.md +++ b/plugins/authenticator/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/authenticator/Cargo.toml b/plugins/authenticator/Cargo.toml index 11269de2..f56d6070 100644 --- a/plugins/authenticator/Cargo.toml +++ b/plugins/authenticator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-authenticator" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Use hardware security-keys in your Tauri App." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/authenticator/package.json b/plugins/authenticator/package.json index ff353189..9d43f1d7 100644 --- a/plugins/authenticator/package.json +++ b/plugins/authenticator/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-authenticator", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Use hardware security-keys in your Tauri App.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/autostart/CHANGELOG.md b/plugins/autostart/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/autostart/CHANGELOG.md +++ b/plugins/autostart/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/autostart/Cargo.toml b/plugins/autostart/Cargo.toml index 1b7476be..b7f69176 100644 --- a/plugins/autostart/Cargo.toml +++ b/plugins/autostart/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-autostart" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Automatically launch your application at startup." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/autostart/package.json b/plugins/autostart/package.json index 96ee8030..98644506 100644 --- a/plugins/autostart/package.json +++ b/plugins/autostart/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-autostart", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/cli/CHANGELOG.md b/plugins/cli/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/cli/CHANGELOG.md +++ b/plugins/cli/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/cli/Cargo.toml b/plugins/cli/Cargo.toml index 3eb1075b..0a680821 100644 --- a/plugins/cli/Cargo.toml +++ b/plugins/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-cli" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Parse arguments from your Tauri application's command line interface." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/cli/package.json b/plugins/cli/package.json index 27531d7b..42984805 100644 --- a/plugins/cli/package.json +++ b/plugins/cli/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-cli", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.4.1" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/clipboard-manager/CHANGELOG.md b/plugins/clipboard-manager/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/clipboard-manager/CHANGELOG.md +++ b/plugins/clipboard-manager/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/clipboard-manager/Cargo.toml b/plugins/clipboard-manager/Cargo.toml index 9b36b2e8..ef24d853 100644 --- a/plugins/clipboard-manager/Cargo.toml +++ b/plugins/clipboard-manager/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-clipboard-manager" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Read and write to the system clipboard." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/clipboard-manager/package.json b/plugins/clipboard-manager/package.json index a241b0db..355ff3ec 100644 --- a/plugins/clipboard-manager/package.json +++ b/plugins/clipboard-manager/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-clipboard-manager", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.4.1" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/dialog/CHANGELOG.md b/plugins/dialog/CHANGELOG.md index a70b10ec..8dea25ed 100644 --- a/plugins/dialog/CHANGELOG.md +++ b/plugins/dialog/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +d6e80b)([#545](https://github.com/tauri-apps/plugins-workspace/pull/545)) Fixes docs.rs build by enabling the `tauri/dox` feature flag. +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +### Dependencies + +- Upgraded to `fs@2.0.0-alpha.1` + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/dialog/Cargo.toml b/plugins/dialog/Cargo.toml index df4398a9..202acfd8 100644 --- a/plugins/dialog/Cargo.toml +++ b/plugins/dialog/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-dialog" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Native system dialogs for opening and saving files along with message dialogs on your Tauri application." edition = { workspace = true } authors = { workspace = true } @@ -16,7 +16,7 @@ serde_json = { workspace = true } tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -tauri-plugin-fs = { path = "../fs", version = "2.0.0-alpha.0" } +tauri-plugin-fs = { path = "../fs", version = "2.0.0-alpha.1" } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] glib = "0.16" diff --git a/plugins/dialog/package.json b/plugins/dialog/package.json index 39d1950f..b15767cc 100644 --- a/plugins/dialog/package.json +++ b/plugins/dialog/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-dialog", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.4.1" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/fs/CHANGELOG.md b/plugins/fs/CHANGELOG.md index a70b10ec..e697b957 100644 --- a/plugins/fs/CHANGELOG.md +++ b/plugins/fs/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`0bba693`](https://github.com/tauri-apps/plugins-workspace/commit/0bba6932c09da5267a9dbf75ba52252e39458420)([#454](https://github.com/tauri-apps/plugins-workspace/pull/454)) Fix `writeBinaryFile` crashing with `command 'write_binary_file' not found` +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/fs/Cargo.toml b/plugins/fs/Cargo.toml index 2a8b5910..0c6c6eff 100644 --- a/plugins/fs/Cargo.toml +++ b/plugins/fs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-fs" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Access the file system." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/fs/package.json b/plugins/fs/package.json index 2943c568..b2e470f5 100644 --- a/plugins/fs/package.json +++ b/plugins/fs/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-fs", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Access the file system.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "^2.4.1" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/fs/src/api-iife.js b/plugins/fs/src/api-iife.js index 6bc30442..1de2933a 100644 --- a/plugins/fs/src/api-iife.js +++ b/plugins/fs/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_FS__=function(e){"use strict";var t=Object.defineProperty,n=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},r=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},i=(e,t,n)=>(r(e,t,"read from private field"),n?n.call(e):t.get(e)),o=(e,t,n,i)=>(r(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function a(e,t=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${n}`;return Object.defineProperty(window,r,{value:n=>(t&&Reflect.deleteProperty(window,r),e?.(n)),writable:!1,configurable:!0}),n}n({},{Channel:()=>s,PluginListener:()=>u,addPluginListener:()=>p,convertFileSrc:()=>_,invoke:()=>l,transformCallback:()=>a});var c,s=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,c,(()=>{})),this.id=a((e=>{i(this,c).call(this,e)}))}set onmessage(e){o(this,c,e)}get onmessage(){return i(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var u=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return l(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function p(e,t,n){let r=new s;return r.onmessage=n,l(`plugin:${e}|register_listener`,{event:t,handler:r}).then((()=>new u(e,t,r.id)))}async function l(e,t={}){return new Promise(((n,r)=>{let i=a((e=>{n(e),Reflect.deleteProperty(window,`_${o}`)}),!0),o=a((e=>{r(e),Reflect.deleteProperty(window,`_${i}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:i,error:o,...t})}))}function _(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}n({},{BaseDirectory:()=>y,appCacheDir:()=>g,appConfigDir:()=>f,appDataDir:()=>h,appLocalDataDir:()=>w,appLogDir:()=>x,audioDir:()=>m,basename:()=>W,cacheDir:()=>v,configDir:()=>A,dataDir:()=>D,delimiter:()=>k,desktopDir:()=>I,dirname:()=>S,documentDir:()=>R,downloadDir:()=>T,executableDir:()=>b,extname:()=>H,fontDir:()=>U,homeDir:()=>E,isAbsolute:()=>J,join:()=>M,localDataDir:()=>O,normalize:()=>B,pictureDir:()=>C,publicDir:()=>N,resolve:()=>z,resolveResource:()=>V,resourceDir:()=>P,runtimeDir:()=>j,sep:()=>$,tempDir:()=>L,templateDir:()=>F,videoDir:()=>K});var d,y=((d=y||{})[d.Audio=1]="Audio",d[d.Cache=2]="Cache",d[d.Config=3]="Config",d[d.Data=4]="Data",d[d.LocalData=5]="LocalData",d[d.Document=6]="Document",d[d.Download=7]="Download",d[d.Picture=8]="Picture",d[d.Public=9]="Public",d[d.Video=10]="Video",d[d.Resource=11]="Resource",d[d.Temp=12]="Temp",d[d.AppConfig=13]="AppConfig",d[d.AppData=14]="AppData",d[d.AppLocalData=15]="AppLocalData",d[d.AppCache=16]="AppCache",d[d.AppLog=17]="AppLog",d[d.Desktop=18]="Desktop",d[d.Executable=19]="Executable",d[d.Font=20]="Font",d[d.Home=21]="Home",d[d.Runtime=22]="Runtime",d[d.Template=23]="Template",d);async function f(){return l("plugin:path|resolve_directory",{directory:13})}async function h(){return l("plugin:path|resolve_directory",{directory:14})}async function w(){return l("plugin:path|resolve_directory",{directory:15})}async function g(){return l("plugin:path|resolve_directory",{directory:16})}async function m(){return l("plugin:path|resolve_directory",{directory:1})}async function v(){return l("plugin:path|resolve_directory",{directory:2})}async function A(){return l("plugin:path|resolve_directory",{directory:3})}async function D(){return l("plugin:path|resolve_directory",{directory:4})}async function I(){return l("plugin:path|resolve_directory",{directory:18})}async function R(){return l("plugin:path|resolve_directory",{directory:6})}async function T(){return l("plugin:path|resolve_directory",{directory:7})}async function b(){return l("plugin:path|resolve_directory",{directory:19})}async function U(){return l("plugin:path|resolve_directory",{directory:20})}async function E(){return l("plugin:path|resolve_directory",{directory:21})}async function O(){return l("plugin:path|resolve_directory",{directory:5})}async function C(){return l("plugin:path|resolve_directory",{directory:8})}async function N(){return l("plugin:path|resolve_directory",{directory:9})}async function P(){return l("plugin:path|resolve_directory",{directory:11})}async function V(e){return l("plugin:path|resolve_directory",{directory:11,path:e})}async function j(){return l("plugin:path|resolve_directory",{directory:22})}async function F(){return l("plugin:path|resolve_directory",{directory:23})}async function K(){return l("plugin:path|resolve_directory",{directory:10})}async function x(){return l("plugin:path|resolve_directory",{directory:17})}async function L(e){return l("plugin:path|resolve_directory",{directory:12})}function $(){return window.__TAURI__.path.__sep}function k(){return window.__TAURI__.path.__delimiter}async function z(...e){return l("plugin:path|resolve",{paths:e})}async function B(e){return l("plugin:path|normalize",{path:e})}async function M(...e){return l("plugin:path|join",{paths:e})}async function S(e){return l("plugin:path|dirname",{path:e})}async function H(e){return l("plugin:path|extname",{path:e})}async function W(e,t){return l("plugin:path|basename",{path:e,ext:t})}async function J(e){return l("plugin:path|isAbsolute",{path:e})}async function q(e,t,n){"object"==typeof n&&Object.freeze(n),"object"==typeof e&&Object.freeze(e);const r={path:"",contents:""};let i=n;return"string"==typeof e?r.path=e:(r.path=e.path,r.contents=e.contents),"string"==typeof t?r.contents=null!=t?t:"":i=t,await window.__TAURI_INVOKE__("plugin:fs|write_file",{path:r.path,contents:Array.from((new TextEncoder).encode(r.contents)),options:i})}return e.BaseDirectory=y,e.Dir=y,e.copyFile=async function(e,t,n={}){return await window.__TAURI_INVOKE__("plugin:fs|copy_file",{source:e,destination:t,options:n})},e.createDir=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|create_dir",{path:e,options:t})},e.exists=async function(e){return await window.__TAURI_INVOKE__("plugin:fs|exists",{path:e})},e.metadata=async function(e){return await window.__TAURI_INVOKE__("plugin:fs|metadata",{path:e}).then((e=>{const{accessedAtMs:t,createdAtMs:n,modifiedAtMs:r,...i}=e;return{accessedAt:new Date(t),createdAt:new Date(n),modifiedAt:new Date(r),...i}}))},e.readBinaryFile=async function(e,t={}){const n=await window.__TAURI_INVOKE__("plugin:fs|read_file",{path:e,options:t});return Uint8Array.from(n)},e.readDir=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|read_dir",{path:e,options:t})},e.readTextFile=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|read_text_file",{path:e,options:t})},e.removeDir=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|remove_dir",{path:e,options:t})},e.removeFile=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|remove_file",{path:e,options:t})},e.renameFile=async function(e,t,n={}){return await window.__TAURI_INVOKE__("plugin:fs|rename_file",{oldPath:e,newPath:t,options:n})},e.writeBinaryFile=async function(e,t,n){"object"==typeof n&&Object.freeze(n),"object"==typeof e&&Object.freeze(e);const r={path:"",contents:[]};let i=n;return"string"==typeof e?r.path=e:(r.path=e.path,r.contents=e.contents),t&&"dir"in t?i=t:"string"==typeof e&&(r.contents=null!=t?t:[]),await window.__TAURI_INVOKE__("plugin:fs|write_file",{path:r.path,contents:Array.from(r.contents instanceof ArrayBuffer?new Uint8Array(r.contents):r.contents),options:i})},e.writeFile=q,e.writeTextFile=q,e}({});Object.defineProperty(window.__TAURI__,"fs",{value:__TAURI_FS__})} +if("__TAURI__"in window){var __TAURI_FS__=function(e){"use strict";var t=Object.defineProperty,n=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},r=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},i=(e,t,n)=>(r(e,t,"read from private field"),n?n.call(e):t.get(e)),o=(e,t,n,i)=>(r(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function a(e,t=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${n}`;return Object.defineProperty(window,r,{value:n=>(t&&Reflect.deleteProperty(window,r),e?.(n)),writable:!1,configurable:!0}),n}n({},{Channel:()=>s,PluginListener:()=>u,addPluginListener:()=>p,convertFileSrc:()=>_,invoke:()=>l,transformCallback:()=>a});var c,s=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,c,(()=>{})),this.id=a((e=>{i(this,c).call(this,e)}))}set onmessage(e){o(this,c,e)}get onmessage(){return i(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var u=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return l(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function p(e,t,n){let r=new s;return r.onmessage=n,l(`plugin:${e}|register_listener`,{event:t,handler:r}).then((()=>new u(e,t,r.id)))}async function l(e,t={},n){return new Promise(((r,i)=>{let o=a((e=>{r(e),Reflect.deleteProperty(window,`_${c}`)}),!0),c=a((e=>{i(e),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:o,error:c,payload:t,options:n})}))}function _(e,t="asset"){return window.__TAURI__.convertFileSrc(e,t)}n({},{BaseDirectory:()=>y,appCacheDir:()=>g,appConfigDir:()=>f,appDataDir:()=>h,appLocalDataDir:()=>w,appLogDir:()=>x,audioDir:()=>m,basename:()=>W,cacheDir:()=>v,configDir:()=>A,dataDir:()=>D,delimiter:()=>z,desktopDir:()=>I,dirname:()=>M,documentDir:()=>R,downloadDir:()=>T,executableDir:()=>b,extname:()=>H,fontDir:()=>U,homeDir:()=>E,isAbsolute:()=>J,join:()=>B,localDataDir:()=>O,normalize:()=>$,pictureDir:()=>C,publicDir:()=>N,resolve:()=>S,resolveResource:()=>V,resourceDir:()=>P,runtimeDir:()=>F,sep:()=>k,tempDir:()=>L,templateDir:()=>j,videoDir:()=>K});var d,y=((d=y||{})[d.Audio=1]="Audio",d[d.Cache=2]="Cache",d[d.Config=3]="Config",d[d.Data=4]="Data",d[d.LocalData=5]="LocalData",d[d.Document=6]="Document",d[d.Download=7]="Download",d[d.Picture=8]="Picture",d[d.Public=9]="Public",d[d.Video=10]="Video",d[d.Resource=11]="Resource",d[d.Temp=12]="Temp",d[d.AppConfig=13]="AppConfig",d[d.AppData=14]="AppData",d[d.AppLocalData=15]="AppLocalData",d[d.AppCache=16]="AppCache",d[d.AppLog=17]="AppLog",d[d.Desktop=18]="Desktop",d[d.Executable=19]="Executable",d[d.Font=20]="Font",d[d.Home=21]="Home",d[d.Runtime=22]="Runtime",d[d.Template=23]="Template",d);async function f(){return l("plugin:path|resolve_directory",{directory:13})}async function h(){return l("plugin:path|resolve_directory",{directory:14})}async function w(){return l("plugin:path|resolve_directory",{directory:15})}async function g(){return l("plugin:path|resolve_directory",{directory:16})}async function m(){return l("plugin:path|resolve_directory",{directory:1})}async function v(){return l("plugin:path|resolve_directory",{directory:2})}async function A(){return l("plugin:path|resolve_directory",{directory:3})}async function D(){return l("plugin:path|resolve_directory",{directory:4})}async function I(){return l("plugin:path|resolve_directory",{directory:18})}async function R(){return l("plugin:path|resolve_directory",{directory:6})}async function T(){return l("plugin:path|resolve_directory",{directory:7})}async function b(){return l("plugin:path|resolve_directory",{directory:19})}async function U(){return l("plugin:path|resolve_directory",{directory:20})}async function E(){return l("plugin:path|resolve_directory",{directory:21})}async function O(){return l("plugin:path|resolve_directory",{directory:5})}async function C(){return l("plugin:path|resolve_directory",{directory:8})}async function N(){return l("plugin:path|resolve_directory",{directory:9})}async function P(){return l("plugin:path|resolve_directory",{directory:11})}async function V(e){return l("plugin:path|resolve_directory",{directory:11,path:e})}async function F(){return l("plugin:path|resolve_directory",{directory:22})}async function j(){return l("plugin:path|resolve_directory",{directory:23})}async function K(){return l("plugin:path|resolve_directory",{directory:10})}async function x(){return l("plugin:path|resolve_directory",{directory:17})}async function L(e){return l("plugin:path|resolve_directory",{directory:12})}function k(){return window.__TAURI__.path.__sep}function z(){return window.__TAURI__.path.__delimiter}async function S(...e){return l("plugin:path|resolve",{paths:e})}async function $(e){return l("plugin:path|normalize",{path:e})}async function B(...e){return l("plugin:path|join",{paths:e})}async function M(e){return l("plugin:path|dirname",{path:e})}async function H(e){return l("plugin:path|extname",{path:e})}async function W(e,t){return l("plugin:path|basename",{path:e,ext:t})}async function J(e){return l("plugin:path|isAbsolute",{path:e})}async function q(e,t,n){"object"==typeof n&&Object.freeze(n),"object"==typeof e&&Object.freeze(e);const r={path:"",contents:""};let i=n;return"string"==typeof e?r.path=e:(r.path=e.path,r.contents=e.contents),"string"==typeof t?r.contents=null!=t?t:"":i=t,await window.__TAURI_INVOKE__("plugin:fs|write_file",{path:r.path,contents:Array.from((new TextEncoder).encode(r.contents)),options:i})}return e.BaseDirectory=y,e.Dir=y,e.copyFile=async function(e,t,n={}){return await window.__TAURI_INVOKE__("plugin:fs|copy_file",{source:e,destination:t,options:n})},e.createDir=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|create_dir",{path:e,options:t})},e.exists=async function(e){return await window.__TAURI_INVOKE__("plugin:fs|exists",{path:e})},e.metadata=async function(e){return await window.__TAURI_INVOKE__("plugin:fs|metadata",{path:e}).then((e=>{const{accessedAtMs:t,createdAtMs:n,modifiedAtMs:r,...i}=e;return{accessedAt:new Date(t),createdAt:new Date(n),modifiedAt:new Date(r),...i}}))},e.readBinaryFile=async function(e,t={}){const n=await window.__TAURI_INVOKE__("plugin:fs|read_file",{path:e,options:t});return Uint8Array.from(n)},e.readDir=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|read_dir",{path:e,options:t})},e.readTextFile=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|read_text_file",{path:e,options:t})},e.removeDir=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|remove_dir",{path:e,options:t})},e.removeFile=async function(e,t={}){return await window.__TAURI_INVOKE__("plugin:fs|remove_file",{path:e,options:t})},e.renameFile=async function(e,t,n={}){return await window.__TAURI_INVOKE__("plugin:fs|rename_file",{oldPath:e,newPath:t,options:n})},e.writeBinaryFile=async function(e,t,n){"object"==typeof n&&Object.freeze(n),"object"==typeof e&&Object.freeze(e);const r={path:"",contents:[]};let i=n;return"string"==typeof e?r.path=e:(r.path=e.path,r.contents=e.contents),t&&"dir"in t?i=t:"string"==typeof e&&(r.contents=null!=t?t:[]),await window.__TAURI_INVOKE__("plugin:fs|write_file",{path:r.path,contents:Array.from(r.contents instanceof ArrayBuffer?new Uint8Array(r.contents):r.contents),options:i})},e.writeFile=q,e.writeTextFile=q,e}({});Object.defineProperty(window.__TAURI__,"fs",{value:__TAURI_FS__})} diff --git a/plugins/fs/src/watcher.rs b/plugins/fs/src/watcher.rs index 647342c7..8c2a36fb 100644 --- a/plugins/fs/src/watcher.rs +++ b/plugins/fs/src/watcher.rs @@ -5,7 +5,7 @@ use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher}; use notify_debouncer_mini::{new_debouncer, DebounceEventResult, Debouncer}; use serde::Deserialize; -use tauri::{api::ipc::Channel, command, Runtime, State}; +use tauri::{command, ipc::Channel, State}; use crate::Result; @@ -30,7 +30,7 @@ enum WatcherKind { Watcher(RecommendedWatcher), } -fn watch_raw(on_event: Channel, rx: Receiver>) { +fn watch_raw(on_event: Channel, rx: Receiver>) { spawn(move || { while let Ok(event) = rx.recv() { if let Ok(event) = event { @@ -41,7 +41,7 @@ fn watch_raw(on_event: Channel, rx: Receiver(on_event: Channel, rx: Receiver) { +fn watch_debounced(on_event: Channel, rx: Receiver) { spawn(move || { while let Ok(event) = rx.recv() { if let Ok(event) = event { @@ -60,12 +60,12 @@ pub struct WatchOptions { } #[command] -pub async fn watch( +pub async fn watch( watchers: State<'_, WatcherCollection>, id: Id, paths: Vec, options: WatchOptions, - on_event: Channel, + on_event: Channel, ) -> Result<()> { let mode = if options.recursive { RecursiveMode::Recursive diff --git a/plugins/global-shortcut/CHANGELOG.md b/plugins/global-shortcut/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/global-shortcut/CHANGELOG.md +++ b/plugins/global-shortcut/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/global-shortcut/Cargo.toml b/plugins/global-shortcut/Cargo.toml index cb37c08b..68991ff8 100644 --- a/plugins/global-shortcut/Cargo.toml +++ b/plugins/global-shortcut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-global-shortcut" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Register global hotkeys listeners on your Tauri application." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/global-shortcut/guest-js/index.ts b/plugins/global-shortcut/guest-js/index.ts index 541530c4..aa566702 100644 --- a/plugins/global-shortcut/guest-js/index.ts +++ b/plugins/global-shortcut/guest-js/index.ts @@ -8,14 +8,7 @@ * @module */ -declare global { - interface Window { - __TAURI_INVOKE__: (cmd: string, args?: unknown) => Promise; - __TAURI__: { - transformCallback: (cb: (payload: T) => void) => number; - }; - } -} +import { invoke, Channel } from "@tauri-apps/api/tauri"; export type ShortcutHandler = (shortcut: string) => void; @@ -38,9 +31,12 @@ async function register( shortcut: string, handler: ShortcutHandler, ): Promise { - return await window.__TAURI_INVOKE__("plugin:globalShortcut|register", { + const h = new Channel(); + h.onmessage = handler; + + return await invoke("plugin:globalShortcut|register", { shortcut, - handler: window.__TAURI__.transformCallback(handler), + handler: h, }); } @@ -63,9 +59,12 @@ async function registerAll( shortcuts: string[], handler: ShortcutHandler, ): Promise { - return await window.__TAURI_INVOKE__("plugin:globalShortcut|register_all", { + const h = new Channel(); + h.onmessage = handler; + + return await invoke("plugin:globalShortcut|register_all", { shortcuts, - handler: window.__TAURI__.transformCallback(handler), + handler: h, }); } @@ -85,7 +84,7 @@ async function registerAll( * @since 2.0.0 */ async function isRegistered(shortcut: string): Promise { - return await window.__TAURI_INVOKE__("plugin:globalShortcut|is_registered", { + return await invoke("plugin:globalShortcut|is_registered", { shortcut, }); } @@ -103,7 +102,7 @@ async function isRegistered(shortcut: string): Promise { * @since 2.0.0 */ async function unregister(shortcut: string): Promise { - return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister", { + return await invoke("plugin:globalShortcut|unregister", { shortcut, }); } @@ -119,7 +118,7 @@ async function unregister(shortcut: string): Promise { * @since 2.0.0 */ async function unregisterAll(): Promise { - return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister_all"); + return await invoke("plugin:globalShortcut|unregister_all"); } export { register, registerAll, isRegistered, unregister, unregisterAll }; diff --git a/plugins/global-shortcut/package.json b/plugins/global-shortcut/package.json index 5d198350..ae5fcfea 100644 --- a/plugins/global-shortcut/package.json +++ b/plugins/global-shortcut/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-global-shortcut", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.4.1" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/global-shortcut/src/api-iife.js b/plugins/global-shortcut/src/api-iife.js index 542aa04f..a685b11e 100644 --- a/plugins/global-shortcut/src/api-iife.js +++ b/plugins/global-shortcut/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_GLOBALSHORTCUT__=function(_){"use strict";return _.isRegistered=async function(_){return await window.__TAURI_INVOKE__("plugin:globalShortcut|is_registered",{shortcut:_})},_.register=async function(_,t){return await window.__TAURI_INVOKE__("plugin:globalShortcut|register",{shortcut:_,handler:window.__TAURI__.transformCallback(t)})},_.registerAll=async function(_,t){return await window.__TAURI_INVOKE__("plugin:globalShortcut|register_all",{shortcuts:_,handler:window.__TAURI__.transformCallback(t)})},_.unregister=async function(_){return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister",{shortcut:_})},_.unregisterAll=async function(){return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister_all")},_}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_GLOBALSHORTCUT__})} +if("__TAURI__"in window){var __TAURI_GLOBALSHORTCUT__=function(e){"use strict";var t=Object.defineProperty,n=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},r=(e,t,r)=>(n(e,t,"read from private field"),r?r.call(e):t.get(e)),i=(e,t,r,i)=>(n(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);function a(e,t=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${n}`;return Object.defineProperty(window,r,{value:n=>(t&&Reflect.deleteProperty(window,r),e?.(n)),writable:!1,configurable:!0}),n}((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})({},{Channel:()=>s,PluginListener:()=>l,addPluginListener:()=>c,convertFileSrc:()=>_,invoke:()=>u,transformCallback:()=>a});var o,s=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,o,(()=>{})),this.id=a((e=>{r(this,o).call(this,e)}))}set onmessage(e){i(this,o,e)}get onmessage(){return r(this,o)}toJSON(){return`__CHANNEL__:${this.id}`}};o=new WeakMap;var l=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function c(e,t,n){let r=new s;return r.onmessage=n,u(`plugin:${e}|register_listener`,{event:t,handler:r}).then((()=>new l(e,t,r.id)))}async function u(e,t={},n){return new Promise(((r,i)=>{let o=a((e=>{r(e),Reflect.deleteProperty(window,`_${s}`)}),!0),s=a((e=>{i(e),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:o,error:s,payload:t,options:n})}))}function _(e,t="asset"){return window.__TAURI__.convertFileSrc(e,t)}return e.isRegistered=async function(e){return await u("plugin:globalShortcut|is_registered",{shortcut:e})},e.register=async function(e,t){const n=new s;return n.onmessage=t,await u("plugin:globalShortcut|register",{shortcut:e,handler:n})},e.registerAll=async function(e,t){const n=new s;return n.onmessage=t,await u("plugin:globalShortcut|register_all",{shortcuts:e,handler:n})},e.unregister=async function(e){return await u("plugin:globalShortcut|unregister",{shortcut:e})},e.unregisterAll=async function(){return await u("plugin:globalShortcut|unregister_all")},e}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_GLOBALSHORTCUT__})} diff --git a/plugins/global-shortcut/src/lib.rs b/plugins/global-shortcut/src/lib.rs index 96fab9d8..85e0910a 100644 --- a/plugins/global-shortcut/src/lib.rs +++ b/plugins/global-shortcut/src/lib.rs @@ -23,7 +23,7 @@ use std::{ pub use global_hotkey::hotkey::{Code, HotKey as Shortcut, Modifiers}; use global_hotkey::{GlobalHotKeyEvent, GlobalHotKeyManager}; use tauri::{ - api::ipc::CallbackFn, + ipc::Channel, plugin::{Builder as PluginBuilder, TauriPlugin}, AppHandle, Manager, Runtime, State, Window, }; @@ -35,21 +35,15 @@ type Result = std::result::Result; type HotKeyId = u32; type HandlerFn = Box; -enum ShortcutSource { - Ipc { - window: Window, - handler: CallbackFn, - }, +enum ShortcutSource { + Ipc(Channel), Rust, } -impl Clone for ShortcutSource { +impl Clone for ShortcutSource { fn clone(&self) -> Self { match self { - Self::Ipc { window, handler } => Self::Ipc { - window: window.clone(), - handler: *handler, - }, + Self::Ipc(channel) => Self::Ipc(channel.clone()), Self::Rust => Self::Rust, } } @@ -70,8 +64,8 @@ impl TryFrom<&str> for ShortcutWrapper { } } -struct RegisteredShortcut { - source: ShortcutSource, +struct RegisteredShortcut { + source: ShortcutSource, shortcut: (Shortcut, Option), } @@ -79,14 +73,14 @@ pub struct GlobalShortcut { #[allow(dead_code)] app: AppHandle, manager: std::result::Result, - shortcuts: Arc>>>, + shortcuts: Arc>>, } impl GlobalShortcut { fn register_internal( &self, shortcut: (Shortcut, Option), - source: ShortcutSource, + source: ShortcutSource, ) -> Result<()> { let id = shortcut.0.id(); acquire_manager(&self.manager)?.register(shortcut.0)?; @@ -100,7 +94,7 @@ impl GlobalShortcut { fn register_all_internal)>>( &self, shortcuts: S, - source: ShortcutSource, + source: ShortcutSource, ) -> Result<()> { let hotkeys = shortcuts .into_iter() @@ -218,29 +212,29 @@ where #[tauri::command] fn register( - window: Window, + _window: Window, global_shortcut: State<'_, GlobalShortcut>, shortcut: String, - handler: CallbackFn, + handler: Channel, ) -> Result<()> { global_shortcut.register_internal( (parse_shortcut(&shortcut)?, Some(shortcut)), - ShortcutSource::Ipc { window, handler }, + ShortcutSource::Ipc(handler), ) } #[tauri::command] fn register_all( - window: Window, + _window: Window, global_shortcut: State<'_, GlobalShortcut>, shortcuts: Vec, - handler: CallbackFn, + handler: Channel, ) -> Result<()> { let mut hotkeys = Vec::new(); for shortcut in shortcuts { hotkeys.push((parse_shortcut(&shortcut)?, Some(shortcut))); } - global_shortcut.register_all_internal(hotkeys, ShortcutSource::Ipc { window, handler }) + global_shortcut.register_all_internal(hotkeys, ShortcutSource::Ipc(handler)) } #[tauri::command] @@ -303,19 +297,14 @@ impl Builder { ]) .setup(move |app, _api| { let shortcuts = - Arc::new(Mutex::new(HashMap::>::new())); + Arc::new(Mutex::new(HashMap::::new())); let shortcuts_ = shortcuts.clone(); GlobalHotKeyEvent::set_event_handler(Some(move |e: GlobalHotKeyEvent| { if let Some(shortcut) = shortcuts_.lock().unwrap().get(&e.id) { match &shortcut.source { - ShortcutSource::Ipc { window, handler } => { - let callback_string = tauri::api::ipc::format_callback( - *handler, - &shortcut.shortcut.1, - ) - .expect("unable to serialize shortcut string to json"); - let _ = window.eval(callback_string.as_str()); + ShortcutSource::Ipc(channel) => { + let _ = channel.send(&shortcut.shortcut.1); } ShortcutSource::Rust => { if let Some(handler) = &handler { diff --git a/plugins/http/CHANGELOG.md b/plugins/http/CHANGELOG.md index a70b10ec..0c643f00 100644 --- a/plugins/http/CHANGELOG.md +++ b/plugins/http/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`7d9df72`](https://github.com/tauri-apps/plugins-workspace/commit/7d9df7297a221a64d9de945ffc2cd8313d3104dc)([#428](https://github.com/tauri-apps/plugins-workspace/pull/428)) Multipart requests are now handled in JavaScript by the `Request` JavaScript class so you just need to use a `FormData` body and not set the content-type header to `multipart/form-data`. `application/x-www-form-urlencoded` requests must be done manually. +- [`7d9df72`](https://github.com/tauri-apps/plugins-workspace/commit/7d9df7297a221a64d9de945ffc2cd8313d3104dc)([#428](https://github.com/tauri-apps/plugins-workspace/pull/428)) The http plugin has been rewritten from scratch and now only exposes a `fetch` function in Javascript and Re-exports `reqwest` crate in Rust. The new `fetch` method tries to be as close and compliant to the `fetch` Web API as possible. +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/http/Cargo.toml b/plugins/http/Cargo.toml index 8dc315f7..7ff2ed57 100644 --- a/plugins/http/Cargo.toml +++ b/plugins/http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-http" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Access an HTTP client written in Rust." edition = { workspace = true } authors = { workspace = true } @@ -14,7 +14,7 @@ serde = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } thiserror = { workspace = true } -tauri-plugin-fs = { path = "../fs", version = "2.0.0-alpha.0" } +tauri-plugin-fs = { path = "../fs", version = "2.0.0-alpha.1" } glob = "0.3" http = "0.2" reqwest = { version = "0.11", default-features = false } @@ -22,22 +22,22 @@ url = "2.4" data-url = "0.3" [features] -multipart = ["reqwest/multipart"] -json = ["reqwest/json"] -stream = ["reqwest/stream"] -native-tls = ["reqwest/native-tls"] -native-tls-vendored = ["reqwest/native-tls-vendored"] -rustls-tls = ["reqwest/rustls-tls"] -default-tls = ["reqwest/default-tls"] -native-tls-alpn = ["reqwest/native-tls-alpn"] -rustls-tls-manual-roots = ["reqwest/rustls-tls-manual-roots"] -rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] -rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] -blocking = ["reqwest/blocking"] -cookies = ["reqwest/cookies"] -gzip = ["reqwest/gzip"] -brotli = ["reqwest/brotli"] -deflate = ["reqwest/deflate"] -trust-dns = ["reqwest/trust-dns"] -socks = ["reqwest/socks"] -http3 = ["reqwest/http3"] +multipart = [ "reqwest/multipart" ] +json = [ "reqwest/json" ] +stream = [ "reqwest/stream" ] +native-tls = [ "reqwest/native-tls" ] +native-tls-vendored = [ "reqwest/native-tls-vendored" ] +rustls-tls = [ "reqwest/rustls-tls" ] +default-tls = [ "reqwest/default-tls" ] +native-tls-alpn = [ "reqwest/native-tls-alpn" ] +rustls-tls-manual-roots = [ "reqwest/rustls-tls-manual-roots" ] +rustls-tls-webpki-roots = [ "reqwest/rustls-tls-webpki-roots" ] +rustls-tls-native-roots = [ "reqwest/rustls-tls-native-roots" ] +blocking = [ "reqwest/blocking" ] +cookies = [ "reqwest/cookies" ] +gzip = [ "reqwest/gzip" ] +brotli = [ "reqwest/brotli" ] +deflate = [ "reqwest/deflate" ] +trust-dns = [ "reqwest/trust-dns" ] +socks = [ "reqwest/socks" ] +http3 = [ "reqwest/http3" ] diff --git a/plugins/http/package.json b/plugins/http/package.json index 81d3bc40..4c7339c4 100644 --- a/plugins/http/package.json +++ b/plugins/http/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-http", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.5.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/http/src/commands.rs b/plugins/http/src/commands.rs index 833b4e7f..898b180e 100644 --- a/plugins/http/src/commands.rs +++ b/plugins/http/src/commands.rs @@ -163,16 +163,15 @@ pub async fn fetch_send( }) } -// TODO: change return value to tauri::ipc::Response on next alpha #[command] pub(crate) async fn fetch_read_body( app: AppHandle, rid: RequestId, -) -> crate::Result> { +) -> crate::Result { let mut response_table = app.http().responses.lock().await; let res = response_table .remove(&rid) .ok_or(Error::InvalidRequestId(rid))?; - Ok(res.bytes().await?.to_vec()) + Ok(tauri::ipc::Response::new(res.bytes().await?.to_vec())) } diff --git a/plugins/localhost/CHANGELOG.md b/plugins/localhost/CHANGELOG.md index a70b10ec..e4124e09 100644 --- a/plugins/localhost/CHANGELOG.md +++ b/plugins/localhost/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d5a7c77`](https://github.com/tauri-apps/plugins-workspace/commit/d5a7c77a8d0e7912a6b07b22ed329004edd6e80b)([#545](https://github.com/tauri-apps/plugins-workspace/pull/545)) Fixes docs.rs build by enabling the `tauri/dox` feature flag. +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/localhost/Cargo.toml b/plugins/localhost/Cargo.toml index bc91624a..62cf2d94 100644 --- a/plugins/localhost/Cargo.toml +++ b/plugins/localhost/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-localhost" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Expose your apps assets through a localhost server instead of the default custom protocol." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/log/CHANGELOG.md b/plugins/log/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/log/CHANGELOG.md +++ b/plugins/log/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index b6fa4547..a7eda25f 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-log" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Configurable logging for your Tauri app." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/log/package.json b/plugins/log/package.json index 4370fa1a..c9069857 100644 --- a/plugins/log/package.json +++ b/plugins/log/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-log", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Configurable logging for your Tauri app.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/log/src/api-iife.js b/plugins/log/src/api-iife.js index e733187f..ca318f25 100644 --- a/plugins/log/src/api-iife.js +++ b/plugins/log/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_LOG__=function(e){"use strict";var n=Object.defineProperty,t=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},r=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},a=(e,n,t)=>(r(e,n,"read from private field"),t?t.call(e):n.get(e)),i=(e,n,t,a)=>(r(e,n,"write to private field"),a?a.call(e,t):n.set(e,t),t);function o(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}t({},{Channel:()=>c,PluginListener:()=>s,addPluginListener:()=>u,convertFileSrc:()=>d,invoke:()=>_,transformCallback:()=>o});var l,c=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,l,(()=>{})),this.id=o((e=>{a(this,l).call(this,e)}))}set onmessage(e){i(this,l,e)}get onmessage(){return a(this,l)}toJSON(){return`__CHANNEL__:${this.id}`}};l=new WeakMap;var s=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return _(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function u(e,n,t){let r=new c;return r.onmessage=t,_(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new s(e,n,r.id)))}async function _(e,n={}){return new Promise(((t,r)=>{let a=o((e=>{t(e),Reflect.deleteProperty(window,`_${i}`)}),!0),i=o((e=>{r(e),Reflect.deleteProperty(window,`_${a}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:a,error:i,...n})}))}function d(e,n="asset"){let t=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${n}.localhost/${t}`:`${n}://localhost/${t}`}t({},{TauriEvent:()=>f,emit:()=>E,listen:()=>v,once:()=>h});var w,f=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(f||{});async function g(e,n){await _("plugin:event|unlisten",{event:e,eventId:n})}async function v(e,n,t){return _("plugin:event|listen",{event:e,windowLabel:t?.target,handler:o(n)}).then((n=>async()=>g(e,n)))}async function h(e,n,t){return v(e,(t=>{n(t),g(e,t.id).catch((()=>{}))}),t)}async function E(e,n,t){await _("plugin:event|emit",{event:e,windowLabel:t?.target,payload:n})}async function I(e,n,t){var r,a;const i=null===(r=(new Error).stack)||void 0===r?void 0:r.split("\n").map((e=>e.split("@"))),o=null==i?void 0:i.filter((([e,n])=>e.length>0&&"[native code]"!==n)),{file:l,line:c,keyValues:s}=null!=t?t:{};let u=null===(a=null==o?void 0:o[0])||void 0===a?void 0:a.filter((e=>e.length>0)).join("@");"Error"===u&&(u="webview::unknown"),await window.__TAURI_INVOKE__("plugin:log|log",{level:e,message:n,location:u,file:l,line:c,keyValues:s})}return function(e){e[e.Trace=1]="Trace",e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"}(w||(w={})),e.attachConsole=async function(){return await v("log://log",(e=>{const n=e.payload,t=n.message.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"");switch(n.level){case w.Trace:console.log(t);break;case w.Debug:console.debug(t);break;case w.Info:console.info(t);break;case w.Warn:console.warn(t);break;case w.Error:console.error(t);break;default:throw new Error(`unknown log level ${n.level}`)}}))},e.debug=async function(e,n){await I(w.Debug,e,n)},e.error=async function(e,n){await I(w.Error,e,n)},e.info=async function(e,n){await I(w.Info,e,n)},e.trace=async function(e,n){await I(w.Trace,e,n)},e.warn=async function(e,n){await I(w.Warn,e,n)},e}({});Object.defineProperty(window.__TAURI__,"log",{value:__TAURI_LOG__})} +if("__TAURI__"in window){var __TAURI_LOG__=function(e){"use strict";var n=Object.defineProperty,t=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},r=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},a=(e,n,t)=>(r(e,n,"read from private field"),t?t.call(e):n.get(e)),i=(e,n,t,a)=>(r(e,n,"write to private field"),a?a.call(e,t):n.set(e,t),t);function o(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}t({},{Channel:()=>c,PluginListener:()=>s,addPluginListener:()=>u,convertFileSrc:()=>d,invoke:()=>_,transformCallback:()=>o});var l,c=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,l,(()=>{})),this.id=o((e=>{a(this,l).call(this,e)}))}set onmessage(e){i(this,l,e)}get onmessage(){return a(this,l)}toJSON(){return`__CHANNEL__:${this.id}`}};l=new WeakMap;var s=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return _(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function u(e,n,t){let r=new c;return r.onmessage=t,_(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new s(e,n,r.id)))}async function _(e,n={},t){return new Promise(((r,a)=>{let i=o((e=>{r(e),Reflect.deleteProperty(window,`_${l}`)}),!0),l=o((e=>{a(e),Reflect.deleteProperty(window,`_${i}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:i,error:l,payload:n,options:t})}))}function d(e,n="asset"){return window.__TAURI__.convertFileSrc(e,n)}t({},{TauriEvent:()=>f,emit:()=>E,listen:()=>v,once:()=>h});var w,f=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(f||{});async function g(e,n){await _("plugin:event|unlisten",{event:e,eventId:n})}async function v(e,n,t){return _("plugin:event|listen",{event:e,windowLabel:t?.target,handler:o(n)}).then((n=>async()=>g(e,n)))}async function h(e,n,t){return v(e,(t=>{n(t),g(e,t.id).catch((()=>{}))}),t)}async function E(e,n,t){await _("plugin:event|emit",{event:e,windowLabel:t?.target,payload:n})}async function I(e,n,t){var r,a;const i=null===(r=(new Error).stack)||void 0===r?void 0:r.split("\n").map((e=>e.split("@"))),o=null==i?void 0:i.filter((([e,n])=>e.length>0&&"[native code]"!==n)),{file:l,line:c,keyValues:s}=null!=t?t:{};let u=null===(a=null==o?void 0:o[0])||void 0===a?void 0:a.filter((e=>e.length>0)).join("@");"Error"===u&&(u="webview::unknown"),await window.__TAURI_INVOKE__("plugin:log|log",{level:e,message:n,location:u,file:l,line:c,keyValues:s})}return function(e){e[e.Trace=1]="Trace",e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"}(w||(w={})),e.attachConsole=async function(){return await v("log://log",(e=>{const n=e.payload,t=n.message.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"");switch(n.level){case w.Trace:console.log(t);break;case w.Debug:console.debug(t);break;case w.Info:console.info(t);break;case w.Warn:console.warn(t);break;case w.Error:console.error(t);break;default:throw new Error(`unknown log level ${n.level}`)}}))},e.debug=async function(e,n){await I(w.Debug,e,n)},e.error=async function(e,n){await I(w.Error,e,n)},e.info=async function(e,n){await I(w.Info,e,n)},e.trace=async function(e,n){await I(w.Trace,e,n)},e.warn=async function(e,n){await I(w.Warn,e,n)},e}({});Object.defineProperty(window.__TAURI__,"log",{value:__TAURI_LOG__})} diff --git a/plugins/notification/CHANGELOG.md b/plugins/notification/CHANGELOG.md index 263a20f0..ca8d58f0 100644 --- a/plugins/notification/CHANGELOG.md +++ b/plugins/notification/CHANGELOG.md @@ -2,6 +2,20 @@ ## \[2.0.0-alpha.1] +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.1] + +- [`d8b4aca`](https://github.com/tauri-apps/plugins-workspace/commit/d8b4aca69f628b170804ecb982e2c319d026ef47)([#414](https://github.com/tauri-apps/plugins-workspace/pull/414)) Use `window.__TAURI_INVOKE__` instead of `window.__TAURI__` in init.js, fixes usage in apps without `withGlobalTauri` enabled. +- [`7d71ad4`](https://github.com/tauri-apps/plugins-workspace/commit/7d71ad4e587bcf47ea34645f5b226945e487b765) Play a default sound when showing a notification on Windows. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +ub.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.1] + - [`d8b4aca`](https://github.com/tauri-apps/plugins-workspace/commit/d8b4aca69f628b170804ecb982e2c319d026ef47)([#414](https://github.com/tauri-apps/plugins-workspace/pull/414)) Use `window.__TAURI_INVOKE__` instead of `window.__TAURI__` in init.js, fixes usage in apps without `withGlobalTauri` enabled. - [`7d71ad4`](https://github.com/tauri-apps/plugins-workspace/commit/7d71ad4e587bcf47ea34645f5b226945e487b765) Play a default sound when showing a notification on Windows. diff --git a/plugins/notification/Cargo.toml b/plugins/notification/Cargo.toml index ad284e9f..43de2c5b 100644 --- a/plugins/notification/Cargo.toml +++ b/plugins/notification/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-notification" -version = "2.0.0-alpha.1" +version = "2.0.0-alpha.2" description = "Send desktop and mobile notifications on your Tauri application." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/notification/package.json b/plugins/notification/package.json index cc74a676..1fdde204 100644 --- a/plugins/notification/package.json +++ b/plugins/notification/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-notification", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.4.1" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/notification/src/api-iife.js b/plugins/notification/src/api-iife.js index 4ef6d877..68ef23d3 100644 --- a/plugins/notification/src/api-iife.js +++ b/plugins/notification/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_NOTIFICATION__=function(n){"use strict";var e=Object.defineProperty,i=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)},t=(n,e,t)=>(i(n,e,"read from private field"),t?t.call(n):e.get(n)),o=(n,e,t,o)=>(i(n,e,"write to private field"),o?o.call(n,t):e.set(n,t),t);function r(n,e=!1){let i=window.crypto.getRandomValues(new Uint32Array(1))[0],t=`_${i}`;return Object.defineProperty(window,t,{value:i=>(e&&Reflect.deleteProperty(window,t),n?.(i)),writable:!1,configurable:!0}),i}((n,i)=>{for(var t in i)e(n,t,{get:i[t],enumerable:!0})})({},{Channel:()=>a,PluginListener:()=>f,addPluginListener:()=>d,convertFileSrc:()=>p,invoke:()=>_,transformCallback:()=>r});var c,a=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)})(this,c,(()=>{})),this.id=r((n=>{t(this,c).call(this,n)}))}set onmessage(n){o(this,c,n)}get onmessage(){return t(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var s,l,u,f=class{constructor(n,e,i){this.plugin=n,this.event=e,this.channelId=i}async unregister(){return _(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function d(n,e,i){let t=new a;return t.onmessage=i,_(`plugin:${n}|register_listener`,{event:e,handler:t}).then((()=>new f(n,e,t.id)))}async function _(n,e={}){return new Promise(((i,t)=>{let o=r((n=>{i(n),Reflect.deleteProperty(window,`_${c}`)}),!0),c=r((n=>{t(n),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:n,callback:o,error:c,...e})}))}function p(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}return function(n){n.Year="Year",n.Month="Month",n.TwoWeeks="TwoWeeks",n.Week="Week",n.Day="Day",n.Hour="Hour",n.Minute="Minute",n.Second="Second"}(s||(s={})),n.Importance=void 0,(l=n.Importance||(n.Importance={}))[l.None=0]="None",l[l.Min=1]="Min",l[l.Low=2]="Low",l[l.Default=3]="Default",l[l.High=4]="High",n.Visibility=void 0,(u=n.Visibility||(n.Visibility={}))[u.Secret=-1]="Secret",u[u.Private=0]="Private",u[u.Public=1]="Public",n.active=async function(){return _("plugin:notification|get_active")},n.cancel=async function(n){return _("plugin:notification|cancel",{notifications:n})},n.cancelAll=async function(){return _("plugin:notification|cancel")},n.channels=async function(){return _("plugin:notification|getActive")},n.createChannel=async function(n){return _("plugin:notification|create_channel",{...n})},n.isPermissionGranted=async function(){return"default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):_("plugin:notification|is_permission_granted")},n.onAction=async function(n){return d("notification","actionPerformed",n)},n.onNotificationReceived=async function(n){return d("notification","notification",n)},n.pending=async function(){return _("plugin:notification|get_pending")},n.registerActionTypes=async function(n){return _("plugin:notification|register_action_types",{types:n})},n.removeActive=async function(n){return _("plugin:notification|remove_active",{notifications:n})},n.removeAllActive=async function(){return _("plugin:notification|remove_active")},n.removeChannel=async function(n){return _("plugin:notification|delete_channel",{id:n})},n.requestPermission=async function(){return window.Notification.requestPermission()},n.sendNotification=function(n){"string"==typeof n?new window.Notification(n):new window.Notification(n.title,n)},n}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_NOTIFICATION__})} +if("__TAURI__"in window){var __TAURI_NOTIFICATION__=function(n){"use strict";var e=Object.defineProperty,i=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)},t=(n,e,t)=>(i(n,e,"read from private field"),t?t.call(n):e.get(n)),o=(n,e,t,o)=>(i(n,e,"write to private field"),o?o.call(n,t):e.set(n,t),t);function r(n,e=!1){let i=window.crypto.getRandomValues(new Uint32Array(1))[0],t=`_${i}`;return Object.defineProperty(window,t,{value:i=>(e&&Reflect.deleteProperty(window,t),n?.(i)),writable:!1,configurable:!0}),i}((n,i)=>{for(var t in i)e(n,t,{get:i[t],enumerable:!0})})({},{Channel:()=>a,PluginListener:()=>f,addPluginListener:()=>d,convertFileSrc:()=>w,invoke:()=>_,transformCallback:()=>r});var c,a=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)})(this,c,(()=>{})),this.id=r((n=>{t(this,c).call(this,n)}))}set onmessage(n){o(this,c,n)}get onmessage(){return t(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var s,l,u,f=class{constructor(n,e,i){this.plugin=n,this.event=e,this.channelId=i}async unregister(){return _(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function d(n,e,i){let t=new a;return t.onmessage=i,_(`plugin:${n}|register_listener`,{event:e,handler:t}).then((()=>new f(n,e,t.id)))}async function _(n,e={},i){return new Promise(((t,o)=>{let c=r((n=>{t(n),Reflect.deleteProperty(window,`_${a}`)}),!0),a=r((n=>{o(n),Reflect.deleteProperty(window,`_${c}`)}),!0);window.__TAURI_IPC__({cmd:n,callback:c,error:a,payload:e,options:i})}))}function w(n,e="asset"){return window.__TAURI__.convertFileSrc(n,e)}return function(n){n.Year="Year",n.Month="Month",n.TwoWeeks="TwoWeeks",n.Week="Week",n.Day="Day",n.Hour="Hour",n.Minute="Minute",n.Second="Second"}(s||(s={})),n.Importance=void 0,(l=n.Importance||(n.Importance={}))[l.None=0]="None",l[l.Min=1]="Min",l[l.Low=2]="Low",l[l.Default=3]="Default",l[l.High=4]="High",n.Visibility=void 0,(u=n.Visibility||(n.Visibility={}))[u.Secret=-1]="Secret",u[u.Private=0]="Private",u[u.Public=1]="Public",n.active=async function(){return _("plugin:notification|get_active")},n.cancel=async function(n){return _("plugin:notification|cancel",{notifications:n})},n.cancelAll=async function(){return _("plugin:notification|cancel")},n.channels=async function(){return _("plugin:notification|getActive")},n.createChannel=async function(n){return _("plugin:notification|create_channel",{...n})},n.isPermissionGranted=async function(){return"default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):_("plugin:notification|is_permission_granted")},n.onAction=async function(n){return d("notification","actionPerformed",n)},n.onNotificationReceived=async function(n){return d("notification","notification",n)},n.pending=async function(){return _("plugin:notification|get_pending")},n.registerActionTypes=async function(n){return _("plugin:notification|register_action_types",{types:n})},n.removeActive=async function(n){return _("plugin:notification|remove_active",{notifications:n})},n.removeAllActive=async function(){return _("plugin:notification|remove_active")},n.removeChannel=async function(n){return _("plugin:notification|delete_channel",{id:n})},n.requestPermission=async function(){return window.Notification.requestPermission()},n.sendNotification=function(n){"string"==typeof n?new window.Notification(n):new window.Notification(n.title,n)},n}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_NOTIFICATION__})} diff --git a/plugins/os/CHANGELOG.md b/plugins/os/CHANGELOG.md index a70b10ec..ca058b91 100644 --- a/plugins/os/CHANGELOG.md +++ b/plugins/os/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`1091d6d`](https://github.com/tauri-apps/plugins-workspace/commit/1091d6d6ac5081f2c7526b0f492ae4f34b306f1d)([#419](https://github.com/tauri-apps/plugins-workspace/pull/419)) The os plugin is recieving a few changes to improve consistency and add new features: + + - Renamed `Kind` enum to `OsType` and `kind()` function to `os_type()`. + - Added `family()`,`exe_extension()`, and `hostname()` functions and their equivalents for JS. + - Removed `tempdir()` function and its equivalent on JS, use `std::env::temp_dir` instead of `temp_dir` from `tauri::path::PathResolver::temp_dir` and `path.tempDir` on JS. + - Modified `platform()` implementation to return `windows` instead of `win32` and `macos` instead of `darwin` to align with Rust's `std::env::consts::OS` + - `EOL` const in JS has been modified into a function `eol()` fix import issues in frameworks like `next.js` +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/os/Cargo.toml b/plugins/os/Cargo.toml index d3e6abe5..cf973ade 100644 --- a/plugins/os/Cargo.toml +++ b/plugins/os/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-os" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Read information about the operating system." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/os/package.json b/plugins/os/package.json index 93a51096..00bbd7f8 100644 --- a/plugins/os/package.json +++ b/plugins/os/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-os", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/persisted-scope/CHANGELOG.md b/plugins/persisted-scope/CHANGELOG.md index fea6e6de..2822e43a 100644 --- a/plugins/persisted-scope/CHANGELOG.md +++ b/plugins/persisted-scope/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d5a7c77`](https://github.com/tauri-apps/plugins-workspace/commit/d5a7c77a8d0e7912a6b07b22ed329004edd6e80b)([#545](https://github.com/tauri-apps/plugins-workspace/pull/545)) Fixes docs.rs build by enabling the `tauri/dox` feature flag. +- [`aba07c2`](https://github.com/tauri-apps/plugins-workspace/commit/aba07c27b887c1cc54026024227cb3f74c91e21a)([#468](https://github.com/tauri-apps/plugins-workspace/pull/468)) Split up fs and asset scopes. **This will reset the asset protocol scope once!** +- [`aba07c2`](https://github.com/tauri-apps/plugins-workspace/commit/aba07c27b887c1cc54026024227cb3f74c91e21a)([#468](https://github.com/tauri-apps/plugins-workspace/pull/468)) Fix usage of directory patterns by removing glob asterisks at the end before allowing/forbidding them. This was causing them to be escaped, and so undesirable paths were allowed/forbidden while polluting the `.persisted-scope` file. +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +### Dependencies + +- Upgraded to `fs@2.0.0-alpha.1` + ## \[2.0.0-alpha.0] - [`ebb2eb2`](https://github.com/tauri-apps/plugins-workspace/commit/ebb2eb2fe2ebfbb70530d16a983d396aa5829aa1)([#274](https://github.com/tauri-apps/plugins-workspace/pull/274)) Recursively unescape saved patterns before allowing/forbidding them. This effectively prevents `.persisted-scope` files from blowing up, which caused Out-Of-Memory issues, while automatically fixing existing broken files seamlessly. diff --git a/plugins/persisted-scope/Cargo.toml b/plugins/persisted-scope/Cargo.toml index 8967960a..50f32234 100644 --- a/plugins/persisted-scope/Cargo.toml +++ b/plugins/persisted-scope/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-persisted-scope" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Save filesystem and asset scopes and restore them when the app is reopened." authors = { workspace = true } license = { workspace = true } @@ -18,7 +18,7 @@ log = { workspace = true } thiserror = { workspace = true } aho-corasick = "1.0" bincode = "1" -tauri-plugin-fs = { path = "../fs", version = "2.0.0-alpha.0" } +tauri-plugin-fs = { path = "../fs", version = "2.0.0-alpha.1" } [features] protocol-asset = [ "tauri/protocol-asset" ] diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index b4803dc9..a1e447ca 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -254,7 +254,7 @@ pub fn init() -> TauriPlugin { if let Some(fs_scope) = fs_scope { if fs_scope_state_path.exists() { - let scope: Scope = tauri::api::file::read_binary(&fs_scope_state_path) + let scope: Scope = std::fs::read(&fs_scope_state_path) .map_err(Error::from) .and_then(|scope| bincode::deserialize(&scope).map_err(Into::into)) .unwrap_or_default(); @@ -276,7 +276,7 @@ pub fn init() -> TauriPlugin { #[cfg(feature = "protocol-asset")] if asset_scope_state_path.exists() { - let scope: Scope = tauri::api::file::read_binary(&asset_scope_state_path) + let scope: Scope = std::fs::read(&asset_scope_state_path) .map_err(Error::from) .and_then(|scope| bincode::deserialize(&scope).map_err(Into::into)) .unwrap_or_default(); diff --git a/plugins/positioner/CHANGELOG.md b/plugins/positioner/CHANGELOG.md index f0814299..f3a52aa8 100644 --- a/plugins/positioner/CHANGELOG.md +++ b/plugins/positioner/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! @@ -59,3 +63,7 @@ - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 data on 2021-11-19 - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 +nberg/tauri-plugin-positioner/commit/119d9c47639e1df16f5520a08f039bdb6f39532b) update metadata on 2021-11-19 + - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 + data on 2021-11-19 + - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 diff --git a/plugins/positioner/Cargo.toml b/plugins/positioner/Cargo.toml index 25189be5..a85ab340 100644 --- a/plugins/positioner/Cargo.toml +++ b/plugins/positioner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-positioner" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Position your windows at well-known locations." authors = { workspace = true } license = { workspace = true } @@ -19,4 +19,4 @@ thiserror = { workspace = true } serde_repr = "0.1" [features] -system-tray = [ "tauri/system-tray" ] +tray-icon = [ "tauri/tray-icon" ] diff --git a/plugins/positioner/package.json b/plugins/positioner/package.json index 0593b4a0..b524f3d2 100644 --- a/plugins/positioner/package.json +++ b/plugins/positioner/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-positioner", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Position your windows at well-known locations.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/positioner/src/ext.rs b/plugins/positioner/src/ext.rs index 196209ad..11a725dc 100644 --- a/plugins/positioner/src/ext.rs +++ b/plugins/positioner/src/ext.rs @@ -3,10 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -#[cfg(feature = "system-tray")] +#[cfg(feature = "tray-icon")] use crate::Tray; use serde_repr::Deserialize_repr; -#[cfg(feature = "system-tray")] +#[cfg(feature = "tray-icon")] use tauri::Manager; use tauri::{PhysicalPosition, PhysicalSize, Result, Runtime, Window}; @@ -23,17 +23,17 @@ pub enum Position { LeftCenter, RightCenter, Center, - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayLeft, - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayBottomLeft, - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayRight, - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayBottomRight, - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayCenter, - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayBottomCenter, } @@ -59,7 +59,7 @@ impl WindowExt for Window { width: self.outer_size()?.width as i32, height: self.outer_size()?.height as i32, }; - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] let (tray_position, tray_size) = self .state::() .0 @@ -107,7 +107,7 @@ impl WindowExt for Window { x: screen_position.x + ((screen_size.width / 2) - (window_size.width / 2)), y: screen_position.y + (screen_size.height / 2) - (window_size.height / 2), }, - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayLeft => { if let Some((tray_x, tray_y)) = tray_position { PhysicalPosition { @@ -118,7 +118,7 @@ impl WindowExt for Window { panic!("tray position not set"); } } - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayBottomLeft => { if let Some((tray_x, tray_y)) = tray_position { PhysicalPosition { @@ -129,7 +129,7 @@ impl WindowExt for Window { panic!("Tray position not set"); } } - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayRight => { if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) { @@ -141,7 +141,7 @@ impl WindowExt for Window { panic!("Tray position not set"); } } - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayBottomRight => { if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) { @@ -153,7 +153,7 @@ impl WindowExt for Window { panic!("Tray position not set"); } } - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayCenter => { if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) { @@ -165,7 +165,7 @@ impl WindowExt for Window { panic!("Tray position not set"); } } - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] TrayBottomCenter => { if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) { diff --git a/plugins/positioner/src/lib.rs b/plugins/positioner/src/lib.rs index 0a412d9a..6c5b735e 100644 --- a/plugins/positioner/src/lib.rs +++ b/plugins/positioner/src/lib.rs @@ -9,7 +9,7 @@ //! //! # Cargo features //! -//! - **system-tray**: Enables system-tray-relative positions. +//! - **tray-icon**: Enables tray-icon-relative positions. //! //! Note: This requires attaching the Tauri plugin, *even* when using the trait extension only. @@ -27,38 +27,27 @@ use tauri::{ Result, Runtime, }; -#[cfg(feature = "system-tray")] -use tauri::{AppHandle, Manager, PhysicalPosition, PhysicalSize, SystemTrayEvent}; +#[cfg(feature = "tray-icon")] +use tauri::{tray::TrayIconEvent, AppHandle, Manager, PhysicalPosition, PhysicalSize}; -#[cfg(feature = "system-tray")] +#[cfg(feature = "tray-icon")] struct Tray(std::sync::Mutex, PhysicalSize)>>); -#[cfg(feature = "system-tray")] -pub fn on_tray_event(app: &AppHandle, event: &SystemTrayEvent) { - match event { - SystemTrayEvent::LeftClick { position, size, .. } => { - app.state::() - .0 - .lock() - .unwrap() - .replace((*position, *size)); - } - SystemTrayEvent::RightClick { position, size, .. } => { - app.state::() - .0 - .lock() - .unwrap() - .replace((*position, *size)); - } - SystemTrayEvent::DoubleClick { position, size, .. } => { - app.state::() - .0 - .lock() - .unwrap() - .replace((*position, *size)); - } - _ => (), - } +#[cfg(feature = "tray-icon")] +pub fn on_tray_event(app: &AppHandle, event: &TrayIconEvent) { + let position = PhysicalPosition { + x: event.x, + y: event.y, + }; + let size = PhysicalSize { + width: event.icon_rect.right - event.icon_rect.left, + height: event.icon_rect.bottom - event.icon_rect.top, + }; + app.state::() + .0 + .lock() + .unwrap() + .replace((position, size)); } #[tauri::command] @@ -72,7 +61,7 @@ pub fn init() -> TauriPlugin { .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![move_window]); - #[cfg(feature = "system-tray")] + #[cfg(feature = "tray-icon")] let plugin = plugin.setup(|app_handle, _api| { app_handle.manage(Tray(std::sync::Mutex::new(None))); Ok(()) diff --git a/plugins/process/CHANGELOG.md b/plugins/process/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/process/CHANGELOG.md +++ b/plugins/process/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/process/Cargo.toml b/plugins/process/Cargo.toml index c5e8036d..fa4fe680 100644 --- a/plugins/process/Cargo.toml +++ b/plugins/process/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-process" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Access the current process of your Tauri application." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/process/package.json b/plugins/process/package.json index 92490d55..48dc1f59 100644 --- a/plugins/process/package.json +++ b/plugins/process/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-process", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/shell/CHANGELOG.md b/plugins/shell/CHANGELOG.md index a70b10ec..648e7be7 100644 --- a/plugins/shell/CHANGELOG.md +++ b/plugins/shell/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +d `Command::arg`, `Command::env` and changed `Command::new` input type. +- [`52ef0ad`](https://github.com/tauri-apps/plugins-workspace/commit/52ef0addd84a1737a4e1a4b07113a30d3d496fa1)([#463](https://github.com/tauri-apps/plugins-workspace/pull/463)) Ensure the launched process is detached so it can out-live your tauri app and does not shutdown with it. +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/shell/Cargo.toml b/plugins/shell/Cargo.toml index 5ab6d87e..a89a9a1b 100644 --- a/plugins/shell/Cargo.toml +++ b/plugins/shell/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-shell" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/shell/guest-js/index.ts b/plugins/shell/guest-js/index.ts index 6c567c21..0496849b 100644 --- a/plugins/shell/guest-js/index.ts +++ b/plugins/shell/guest-js/index.ts @@ -62,14 +62,7 @@ * @module */ -declare global { - interface Window { - __TAURI_INVOKE__: (cmd: string, args?: unknown) => Promise; - __TAURI__: { - transformCallback: (cb: (payload: T) => void) => number; - }; - } -} +import { invoke, Channel } from "@tauri-apps/api/tauri"; /** * @since 2.0.0 @@ -111,7 +104,7 @@ interface ChildProcess { * * @ignore * @param program The name of the scoped command. - * @param onEvent Event handler. + * @param onEventHandler Event handler. * @param args Program arguments. * @param options Configuration for the process spawn. * @returns A promise resolving to the process id. @@ -119,7 +112,7 @@ interface ChildProcess { * @since 2.0.0 */ async function execute( - onEvent: (event: CommandEvent) => void, + onEventHandler: (event: CommandEvent) => void, program: string, args: string | string[] = [], options?: InternalSpawnOptions, @@ -128,11 +121,14 @@ async function execute( Object.freeze(args); } - return window.__TAURI_INVOKE__("plugin:shell|execute", { + const onEvent = new Channel>(); + onEvent.onmessage = onEventHandler; + + return invoke("plugin:shell|execute", { program, args, options, - onEventFn: window.__TAURI__.transformCallback(onEvent), + onEvent, }); } @@ -358,7 +354,7 @@ class Child { * @since 2.0.0 */ async write(data: IOPayload): Promise { - return window.__TAURI_INVOKE__("plugin:shell|stdin_write", { + return invoke("plugin:shell|stdin_write", { pid: this.pid, // correctly serialize Uint8Arrays buffer: typeof data === "string" ? data : Array.from(data), @@ -373,7 +369,7 @@ class Child { * @since 2.0.0 */ async kill(): Promise { - return window.__TAURI_INVOKE__("plugin:shell|kill", { + return invoke("plugin:shell|kill", { cmd: "killChild", pid: this.pid, }); @@ -648,7 +644,7 @@ type CommandEvent = * @since 2.0.0 */ async function open(path: string, openWith?: string): Promise { - return window.__TAURI_INVOKE__("plugin:shell|open", { + return invoke("plugin:shell|open", { path, with: openWith, }); diff --git a/plugins/shell/package.json b/plugins/shell/package.json index 5b2cae09..9e61207f 100644 --- a/plugins/shell/package.json +++ b/plugins/shell/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-shell", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.4.1" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/shell/src/api-iife.js b/plugins/shell/src/api-iife.js index cb6b28ac..8125c2e1 100644 --- a/plugins/shell/src/api-iife.js +++ b/plugins/shell/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_SHELL__=function(e){"use strict";class t{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const s=n=>{this.removeListener(e,s),t(n)};return this.addListener(e,s)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const s=this.eventListeners[e];for(const e of s)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const s=n=>{this.removeListener(e,s),t(n)};return this.prependListener(e,s)}}class s{constructor(e){this.pid=e}async write(e){return window.__TAURI_INVOKE__("plugin:shell|stdin_write",{pid:this.pid,buffer:"string"==typeof e?e:Array.from(e)})}async kill(){return window.__TAURI_INVOKE__("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class n extends t{constructor(e,s=[],n){super(),this.stdout=new t,this.stderr=new t,this.program=e,this.args="string"==typeof s?[s]:s,this.options=null!=n?n:{}}static create(e,t=[],s){return new n(e,t,s)}static sidecar(e,t=[],s){const r=new n(e,t,s);return r.options.sidecar=!0,r}async spawn(){return async function(e,t,s=[],n){return"object"==typeof s&&Object.freeze(s),window.__TAURI_INVOKE__("plugin:shell|execute",{program:t,args:s,options:n,onEventFn:window.__TAURI__.transformCallback(e)})}((e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}}),this.program,this.args,this.options).then((e=>new s(e)))}async execute(){return new Promise(((e,t)=>{this.on("error",t);const s=[],n=[];this.stdout.on("data",(e=>{s.push(e)})),this.stderr.on("data",(e=>{n.push(e)})),this.on("close",(t=>{e({code:t.code,signal:t.signal,stdout:this.collectOutput(s),stderr:this.collectOutput(n)})})),this.spawn().catch(t)}))}collectOutput(e){return"raw"===this.options.encoding?e.reduce(((e,t)=>new Uint8Array([...e,...t,10])),new Uint8Array):e.join("\n")}}return e.Child=s,e.Command=n,e.EventEmitter=t,e.open=async function(e,t){return window.__TAURI_INVOKE__("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_SHELL__})} +if("__TAURI__"in window){var __TAURI_SHELL__=function(e){"use strict";var t=Object.defineProperty,n=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},r=(e,t,r)=>(n(e,t,"read from private field"),r?r.call(e):t.get(e)),s=(e,t,r,s)=>(n(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);function i(e,t=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${n}`;return Object.defineProperty(window,r,{value:n=>(t&&Reflect.deleteProperty(window,r),e?.(n)),writable:!1,configurable:!0}),n}((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})({},{Channel:()=>a,PluginListener:()=>c,addPluginListener:()=>l,convertFileSrc:()=>u,invoke:()=>h,transformCallback:()=>i});var o,a=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,o,(()=>{})),this.id=i((e=>{r(this,o).call(this,e)}))}set onmessage(e){s(this,o,e)}get onmessage(){return r(this,o)}toJSON(){return`__CHANNEL__:${this.id}`}};o=new WeakMap;var c=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return h(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l(e,t,n){let r=new a;return r.onmessage=n,h(`plugin:${e}|register_listener`,{event:t,handler:r}).then((()=>new c(e,t,r.id)))}async function h(e,t={},n){return new Promise(((r,s)=>{let o=i((e=>{r(e),Reflect.deleteProperty(window,`_${a}`)}),!0),a=i((e=>{s(e),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,payload:t,options:n})}))}function u(e,t="asset"){return window.__TAURI__.convertFileSrc(e,t)}class d{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const n=r=>{this.removeListener(e,n),t(r)};return this.addListener(e,n)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const n=this.eventListeners[e];for(const e of n)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const n=r=>{this.removeListener(e,n),t(r)};return this.prependListener(e,n)}}class p{constructor(e){this.pid=e}async write(e){return h("plugin:shell|stdin_write",{pid:this.pid,buffer:"string"==typeof e?e:Array.from(e)})}async kill(){return h("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class w extends d{constructor(e,t=[],n){super(),this.stdout=new d,this.stderr=new d,this.program=e,this.args="string"==typeof t?[t]:t,this.options=null!=n?n:{}}static create(e,t=[],n){return new w(e,t,n)}static sidecar(e,t=[],n){const r=new w(e,t,n);return r.options.sidecar=!0,r}async spawn(){return async function(e,t,n=[],r){"object"==typeof n&&Object.freeze(n);const s=new a;return s.onmessage=e,h("plugin:shell|execute",{program:t,args:n,options:r,onEvent:s})}((e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}}),this.program,this.args,this.options).then((e=>new p(e)))}async execute(){return new Promise(((e,t)=>{this.on("error",t);const n=[],r=[];this.stdout.on("data",(e=>{n.push(e)})),this.stderr.on("data",(e=>{r.push(e)})),this.on("close",(t=>{e({code:t.code,signal:t.signal,stdout:this.collectOutput(n),stderr:this.collectOutput(r)})})),this.spawn().catch(t)}))}collectOutput(e){return"raw"===this.options.encoding?e.reduce(((e,t)=>new Uint8Array([...e,...t,10])),new Uint8Array):e.join("\n")}}return e.Child=p,e.Command=w,e.EventEmitter=d,e.open=async function(e,t){return h("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_SHELL__})} diff --git a/plugins/shell/src/commands.rs b/plugins/shell/src/commands.rs index e4b63e24..fd1e5058 100644 --- a/plugins/shell/src/commands.rs +++ b/plugins/shell/src/commands.rs @@ -6,7 +6,7 @@ use std::{collections::HashMap, path::PathBuf, string::FromUtf8Error}; use encoding_rs::Encoding; use serde::{Deserialize, Serialize}; -use tauri::{api::ipc::CallbackFn, Manager, Runtime, State, Window}; +use tauri::{ipc::Channel, Manager, Runtime, State, Window}; use crate::{ open::Program, @@ -97,7 +97,7 @@ pub fn execute( shell: State<'_, Shell>, program: String, args: ExecuteArgs, - on_event_fn: CallbackFn, + on_event: Channel, options: CommandOptions, ) -> crate::Result { let mut command = if options.sidecar { @@ -166,10 +166,7 @@ pub fn execute( children.lock().unwrap().remove(&pid); }; let js_event = JSCommandEvent::new(event, encoding); - let js = tauri::api::ipc::format_callback(on_event_fn, &js_event) - .expect("unable to serialize CommandEvent"); - - let _ = window.eval(js.as_str()); + let _ = on_event.send(&js_event); } }); diff --git a/plugins/shell/src/process/mod.rs b/plugins/shell/src/process/mod.rs index 11a3154e..8065de40 100644 --- a/plugins/shell/src/process/mod.rs +++ b/plugins/shell/src/process/mod.rs @@ -206,7 +206,7 @@ impl Command { /// use tauri_plugin_shell::{process::CommandEvent, ShellExt}; /// tauri::Builder::default() /// .setup(|app| { - /// let handle = app.handle(); + /// let handle = app.handle().clone(); /// tauri::async_runtime::spawn(async move { /// let (mut rx, mut child) = handle.shell().command("cargo") /// .args(["tauri", "dev"]) @@ -242,8 +242,6 @@ impl Command { let child_ = child.clone(); let guard = Arc::new(RwLock::new(())); - //TODO commands().lock().unwrap().insert(child.id(), child.clone()); - let (tx, rx) = channel(1); spawn_pipe_reader( @@ -263,7 +261,6 @@ impl Command { let _ = match child_.wait() { Ok(status) => { let _l = guard.write().unwrap(); - //TODO commands().lock().unwrap().remove(&child_.id()); block_on_task(async move { tx.send(CommandEvent::Terminated(TerminatedPayload { code: status.code(), diff --git a/plugins/single-instance/CHANGELOG.md b/plugins/single-instance/CHANGELOG.md index a70b10ec..e4124e09 100644 --- a/plugins/single-instance/CHANGELOG.md +++ b/plugins/single-instance/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d5a7c77`](https://github.com/tauri-apps/plugins-workspace/commit/d5a7c77a8d0e7912a6b07b22ed329004edd6e80b)([#545](https://github.com/tauri-apps/plugins-workspace/pull/545)) Fixes docs.rs build by enabling the `tauri/dox` feature flag. +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/single-instance/Cargo.toml b/plugins/single-instance/Cargo.toml index 109f8c3f..e4a4f3ad 100644 --- a/plugins/single-instance/Cargo.toml +++ b/plugins/single-instance/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-single-instance" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Ensure a single instance of your tauri app is running." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/single-instance/examples/vanilla/package.json b/plugins/single-instance/examples/vanilla/package.json index f3d8f88e..1578d03e 100644 --- a/plugins/single-instance/examples/vanilla/package.json +++ b/plugins/single-instance/examples/vanilla/package.json @@ -9,6 +9,6 @@ "author": "", "license": "MIT", "devDependencies": { - "@tauri-apps/cli": "2.0.0-alpha.10" + "@tauri-apps/cli": "2.0.0-alpha.11" } } diff --git a/plugins/sql/CHANGELOG.md b/plugins/sql/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/sql/CHANGELOG.md +++ b/plugins/sql/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/sql/Cargo.toml b/plugins/sql/Cargo.toml index 4fc170a9..f723fce1 100644 --- a/plugins/sql/Cargo.toml +++ b/plugins/sql/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-sql" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Interface with SQL databases." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/sql/package.json b/plugins/sql/package.json index 28ad04e8..95debcf8 100644 --- a/plugins/sql/package.json +++ b/plugins/sql/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-sql", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Interface with SQL databases", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/store/CHANGELOG.md b/plugins/store/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/store/CHANGELOG.md +++ b/plugins/store/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/store/Cargo.toml b/plugins/store/Cargo.toml index fee875ef..ae04b589 100644 --- a/plugins/store/Cargo.toml +++ b/plugins/store/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-store" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Simple, persistent key-value store." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/store/package.json b/plugins/store/package.json index 63f61ac2..1737be27 100644 --- a/plugins/store/package.json +++ b/plugins/store/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-store", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Simple, persistent key-value store.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/store/src/api-iife.js b/plugins/store/src/api-iife.js index 9e7f497b..3f074050 100644 --- a/plugins/store/src/api-iife.js +++ b/plugins/store/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_STORE__=function(e){"use strict";var t=Object.defineProperty,a=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},n=(e,t,a)=>{if(!t.has(e))throw TypeError("Cannot "+a)},r=(e,t,a)=>(n(e,t,"read from private field"),a?a.call(e):t.get(e)),i=(e,t,a,r)=>(n(e,t,"write to private field"),r?r.call(e,a):t.set(e,a),a);function s(e,t=!1){let a=window.crypto.getRandomValues(new Uint32Array(1))[0],n=`_${a}`;return Object.defineProperty(window,n,{value:a=>(t&&Reflect.deleteProperty(window,n),e?.(a)),writable:!1,configurable:!0}),a}a({},{Channel:()=>o,PluginListener:()=>l,addPluginListener:()=>u,convertFileSrc:()=>c,invoke:()=>h,transformCallback:()=>s});var _,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,a)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,a)})(this,_,(()=>{})),this.id=s((e=>{r(this,_).call(this,e)}))}set onmessage(e){i(this,_,e)}get onmessage(){return r(this,_)}toJSON(){return`__CHANNEL__:${this.id}`}};_=new WeakMap;var l=class{constructor(e,t,a){this.plugin=e,this.event=t,this.channelId=a}async unregister(){return h(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function u(e,t,a){let n=new o;return n.onmessage=a,h(`plugin:${e}|register_listener`,{event:t,handler:n}).then((()=>new l(e,t,n.id)))}async function h(e,t={}){return new Promise(((a,n)=>{let r=s((e=>{a(e),Reflect.deleteProperty(window,`_${i}`)}),!0),i=s((e=>{n(e),Reflect.deleteProperty(window,`_${r}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:r,error:i,...t})}))}function c(e,t="asset"){let a=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${a}`:`${t}://localhost/${a}`}a({},{TauriEvent:()=>d,emit:()=>y,listen:()=>w,once:()=>I});var d=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(d||{});async function p(e,t){await h("plugin:event|unlisten",{event:e,eventId:t})}async function w(e,t,a){return h("plugin:event|listen",{event:e,windowLabel:a?.target,handler:s(t)}).then((t=>async()=>p(e,t)))}async function I(e,t,a){return w(e,(a=>{t(a),p(e,a.id).catch((()=>{}))}),a)}async function y(e,t,a){await h("plugin:event|emit",{event:e,windowLabel:a?.target,payload:t})}return e.Store=class{constructor(e){this.path=e}async set(e,t){return await window.__TAURI_INVOKE__("plugin:store|set",{path:this.path,key:e,value:t})}async get(e){return await window.__TAURI_INVOKE__("plugin:store|get",{path:this.path,key:e})}async has(e){return await window.__TAURI_INVOKE__("plugin:store|has",{path:this.path,key:e})}async delete(e){return await window.__TAURI_INVOKE__("plugin:store|delete",{path:this.path,key:e})}async clear(){return await window.__TAURI_INVOKE__("plugin:store|clear",{path:this.path})}async reset(){return await window.__TAURI_INVOKE__("plugin:store|reset",{path:this.path})}async keys(){return await window.__TAURI_INVOKE__("plugin:store|keys",{path:this.path})}async values(){return await window.__TAURI_INVOKE__("plugin:store|values",{path:this.path})}async entries(){return await window.__TAURI_INVOKE__("plugin:store|entries",{path:this.path})}async length(){return await window.__TAURI_INVOKE__("plugin:store|length",{path:this.path})}async load(){return await window.__TAURI_INVOKE__("plugin:store|load",{path:this.path})}async save(){return await window.__TAURI_INVOKE__("plugin:store|save",{path:this.path})}async onKeyChange(e,t){return await w("store://change",(a=>{a.payload.path===this.path&&a.payload.key===e&&t(a.payload.value)}))}async onChange(e){return await w("store://change",(t=>{t.payload.path===this.path&&e(t.payload.key,t.payload.value)}))}},e}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_STORE__})} +if("__TAURI__"in window){var __TAURI_STORE__=function(e){"use strict";var t=Object.defineProperty,a=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},n=(e,t,a)=>{if(!t.has(e))throw TypeError("Cannot "+a)},r=(e,t,a)=>(n(e,t,"read from private field"),a?a.call(e):t.get(e)),i=(e,t,a,r)=>(n(e,t,"write to private field"),r?r.call(e,a):t.set(e,a),a);function s(e,t=!1){let a=window.crypto.getRandomValues(new Uint32Array(1))[0],n=`_${a}`;return Object.defineProperty(window,n,{value:a=>(t&&Reflect.deleteProperty(window,n),e?.(a)),writable:!1,configurable:!0}),a}a({},{Channel:()=>o,PluginListener:()=>l,addPluginListener:()=>u,convertFileSrc:()=>c,invoke:()=>h,transformCallback:()=>s});var _,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,a)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,a)})(this,_,(()=>{})),this.id=s((e=>{r(this,_).call(this,e)}))}set onmessage(e){i(this,_,e)}get onmessage(){return r(this,_)}toJSON(){return`__CHANNEL__:${this.id}`}};_=new WeakMap;var l=class{constructor(e,t,a){this.plugin=e,this.event=t,this.channelId=a}async unregister(){return h(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function u(e,t,a){let n=new o;return n.onmessage=a,h(`plugin:${e}|register_listener`,{event:t,handler:n}).then((()=>new l(e,t,n.id)))}async function h(e,t={},a){return new Promise(((n,r)=>{let i=s((e=>{n(e),Reflect.deleteProperty(window,`_${_}`)}),!0),_=s((e=>{r(e),Reflect.deleteProperty(window,`_${i}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:i,error:_,payload:t,options:a})}))}function c(e,t="asset"){return window.__TAURI__.convertFileSrc(e,t)}a({},{TauriEvent:()=>p,emit:()=>y,listen:()=>d,once:()=>I});var p=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(p||{});async function w(e,t){await h("plugin:event|unlisten",{event:e,eventId:t})}async function d(e,t,a){return h("plugin:event|listen",{event:e,windowLabel:a?.target,handler:s(t)}).then((t=>async()=>w(e,t)))}async function I(e,t,a){return d(e,(a=>{t(a),w(e,a.id).catch((()=>{}))}),a)}async function y(e,t,a){await h("plugin:event|emit",{event:e,windowLabel:a?.target,payload:t})}return e.Store=class{constructor(e){this.path=e}async set(e,t){return await window.__TAURI_INVOKE__("plugin:store|set",{path:this.path,key:e,value:t})}async get(e){return await window.__TAURI_INVOKE__("plugin:store|get",{path:this.path,key:e})}async has(e){return await window.__TAURI_INVOKE__("plugin:store|has",{path:this.path,key:e})}async delete(e){return await window.__TAURI_INVOKE__("plugin:store|delete",{path:this.path,key:e})}async clear(){return await window.__TAURI_INVOKE__("plugin:store|clear",{path:this.path})}async reset(){return await window.__TAURI_INVOKE__("plugin:store|reset",{path:this.path})}async keys(){return await window.__TAURI_INVOKE__("plugin:store|keys",{path:this.path})}async values(){return await window.__TAURI_INVOKE__("plugin:store|values",{path:this.path})}async entries(){return await window.__TAURI_INVOKE__("plugin:store|entries",{path:this.path})}async length(){return await window.__TAURI_INVOKE__("plugin:store|length",{path:this.path})}async load(){return await window.__TAURI_INVOKE__("plugin:store|load",{path:this.path})}async save(){return await window.__TAURI_INVOKE__("plugin:store|save",{path:this.path})}async onKeyChange(e,t){return await d("store://change",(a=>{a.payload.path===this.path&&a.payload.key===e&&t(a.payload.value)}))}async onChange(e){return await d("store://change",(t=>{t.payload.path===this.path&&e(t.payload.key,t.payload.value)}))}},e}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_STORE__})} diff --git a/plugins/store/src/lib.rs b/plugins/store/src/lib.rs index 3569f273..45a0c826 100644 --- a/plugins/store/src/lib.rs +++ b/plugins/store/src/lib.rs @@ -218,7 +218,7 @@ impl Builder { /// /// tauri::Builder::default() /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle()); + /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); /// let builder = Builder::default().store(store); /// Ok(()) /// }); @@ -237,7 +237,7 @@ impl Builder { /// /// tauri::Builder::default() /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle()); + /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); /// let builder = Builder::default().stores([store]); /// Ok(()) /// }); @@ -261,7 +261,7 @@ impl Builder { /// /// tauri::Builder::default() /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle()); + /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); /// app.handle().plugin(Builder::default().freeze().build()); /// Ok(()) /// }); @@ -280,7 +280,7 @@ impl Builder { /// /// tauri::Builder::default() /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle()); + /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); /// app.handle().plugin(Builder::default().build()); /// Ok(()) /// }); diff --git a/plugins/store/src/store.rs b/plugins/store/src/store.rs index 41e9ff54..cea0eb17 100644 --- a/plugins/store/src/store.rs +++ b/plugins/store/src/store.rs @@ -144,7 +144,7 @@ impl StoreBuilder { /// ``` /// tauri::Builder::default() /// .setup(|app| { - /// let store = tauri_plugin_store::StoreBuilder::new("store.json").build(app.handle()); + /// let store = tauri_plugin_store::StoreBuilder::new("store.json").build(app.handle().clone()); /// Ok(()) /// }); /// ``` diff --git a/plugins/stronghold/CHANGELOG.md b/plugins/stronghold/CHANGELOG.md index ae13dabe..1d2fbdb6 100644 --- a/plugins/stronghold/CHANGELOG.md +++ b/plugins/stronghold/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## \[2.0.0-alpha.2] + +- [`aba07c2`](https://github.com/tauri-apps/plugins-workspace/commit/aba07c27b887c1cc54026024227cb3f74c91e21a)([#468](https://github.com/tauri-apps/plugins-workspace/pull/468)) Change the argument name of the `Stronghold.remove` from `location` to `recordPath` to match the Stronghold command argument +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + ## \[2.0.0-alpha.1] - [`b3d7d11`](https://github.com/tauri-apps/plugins-workspace/commit/b3d7d11ae32e0970184f53be26e2c5530f78cdf0)([#416](https://github.com/tauri-apps/plugins-workspace/pull/416)) Added `Stronghold.load` and removed its constructor. diff --git a/plugins/stronghold/Cargo.toml b/plugins/stronghold/Cargo.toml index d425f395..69e8fc98 100644 --- a/plugins/stronghold/Cargo.toml +++ b/plugins/stronghold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-stronghold" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Store secrets and keys using the IOTA Stronghold encrypted database." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/stronghold/package.json b/plugins/stronghold/package.json index 8d3ed06b..2be6601f 100644 --- a/plugins/stronghold/package.json +++ b/plugins/stronghold/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-stronghold", - "version": "2.0.0-alpha.1", + "version": "2.0.0-alpha.2", "description": "Store secrets and keys using the IOTA Stronghold encrypted database.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/updater/CHANGELOG.md b/plugins/updater/CHANGELOG.md index a70b10ec..eeab0f3b 100644 --- a/plugins/updater/CHANGELOG.md +++ b/plugins/updater/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. +- [`4ab90f0`](https://github.com/tauri-apps/plugins-workspace/commit/4ab90f048eab2918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +ater. +- [`1cb8311`](https://github.com/tauri-apps/plugins-workspace/commit/1cb831183c63ba5bd3f72d8a482992f6467d950d)([#405](https://github.com/tauri-apps/plugins-workspace/pull/405)) Implement passive mode on NSIS and automatically restart after NSIS update. +- [`4ab90f0`](https://github.com/tauri-apps/plugins-workspace/commit/4ab90f048eab2918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/updater/Cargo.toml b/plugins/updater/Cargo.toml index 76573fc6..47c92a7a 100644 --- a/plugins/updater/Cargo.toml +++ b/plugins/updater/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-updater" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "In-app updates for Tauri applications." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/updater/package.json b/plugins/updater/package.json index ef19ccab..bb4f24ab 100644 --- a/plugins/updater/package.json +++ b/plugins/updater/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-updater", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.5.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/updater/src/api-iife.js b/plugins/updater/src/api-iife.js index 4574b7dd..287417b6 100644 --- a/plugins/updater/src/api-iife.js +++ b/plugins/updater/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_UPDATER__=function(e){"use strict";var n=Object.defineProperty,t=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},r=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),i=(e,n,r,i)=>(t(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r);function a(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})({},{Channel:()=>o,PluginListener:()=>l,addPluginListener:()=>c,convertFileSrc:()=>u,invoke:()=>d,transformCallback:()=>a});var s,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,s,(()=>{})),this.id=a((e=>{r(this,s).call(this,e)}))}set onmessage(e){i(this,s,e)}get onmessage(){return r(this,s)}toJSON(){return`__CHANNEL__:${this.id}`}};s=new WeakMap;var l=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return d(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function c(e,n,t){let r=new o;return r.onmessage=t,d(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new l(e,n,r.id)))}async function d(e,n={}){return new Promise(((t,r)=>{let i=a((e=>{t(e),Reflect.deleteProperty(window,`_${s}`)}),!0),s=a((e=>{r(e),Reflect.deleteProperty(window,`_${i}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:i,error:s,...n})}))}function u(e,n="asset"){let t=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${n}.localhost/${t}`:`${n}://localhost/${t}`}class _{constructor(e){this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body}async downloadAndInstall(e){const n=new o;return null!=e&&(n.onmessage=e),d("plugin:updater|download_and_install",{onEvent:n})}}return e.Update=_,e.check=async function(e){return(null==e?void 0:e.headers)&&(e.headers=Array.from(new Headers(e.headers).entries())),d("plugin:updater|check",{...e}).then((e=>e.available?new _(e):null))},e}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_UPDATER__})} +if("__TAURI__"in window){var __TAURI_UPDATER__=function(e){"use strict";var n=Object.defineProperty,t=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},r=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),i=(e,n,r,i)=>(t(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r);function a(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})({},{Channel:()=>o,PluginListener:()=>l,addPluginListener:()=>d,convertFileSrc:()=>_,invoke:()=>c,transformCallback:()=>a});var s,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,s,(()=>{})),this.id=a((e=>{r(this,s).call(this,e)}))}set onmessage(e){i(this,s,e)}get onmessage(){return r(this,s)}toJSON(){return`__CHANNEL__:${this.id}`}};s=new WeakMap;var l=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return c(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function d(e,n,t){let r=new o;return r.onmessage=t,c(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new l(e,n,r.id)))}async function c(e,n={},t){return new Promise(((r,i)=>{let s=a((e=>{r(e),Reflect.deleteProperty(window,`_${o}`)}),!0),o=a((e=>{i(e),Reflect.deleteProperty(window,`_${s}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:s,error:o,payload:n,options:t})}))}function _(e,n="asset"){return window.__TAURI__.convertFileSrc(e,n)}class u{constructor(e){this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body}async downloadAndInstall(e){const n=new o;return null!=e&&(n.onmessage=e),c("plugin:updater|download_and_install",{onEvent:n})}}return e.Update=u,e.check=async function(e){return(null==e?void 0:e.headers)&&(e.headers=Array.from(new Headers(e.headers).entries())),c("plugin:updater|check",{...e}).then((e=>e.available?new u(e):null))},e}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_UPDATER__})} diff --git a/plugins/updater/src/commands.rs b/plugins/updater/src/commands.rs index cd621dc9..4e8fcdc8 100644 --- a/plugins/updater/src/commands.rs +++ b/plugins/updater/src/commands.rs @@ -5,7 +5,7 @@ use crate::{PendingUpdate, Result, UpdaterExt}; use serde::Serialize; -use tauri::{api::ipc::Channel, AppHandle, Runtime, State}; +use tauri::{ipc::Channel, AppHandle, Runtime, State}; use std::{ sync::atomic::{AtomicBool, Ordering}, @@ -76,7 +76,7 @@ pub(crate) async fn check( pub(crate) async fn download_and_install( _app: AppHandle, pending: State<'_, PendingUpdate>, - on_event: Channel, + on_event: Channel, ) -> Result<()> { if let Some(pending) = &*pending.0.lock().await { let first_chunk = AtomicBool::new(false); @@ -86,11 +86,11 @@ pub(crate) async fn download_and_install( move |chunk_length, content_length| { if first_chunk.swap(false, Ordering::Acquire) { on_event - .send(&DownloadEvent::Started { content_length }) + .send(DownloadEvent::Started { content_length }) .unwrap(); } on_event - .send(&DownloadEvent::Progress { chunk_length }) + .send(DownloadEvent::Progress { chunk_length }) .unwrap(); }, move || { diff --git a/plugins/updater/src/lib.rs b/plugins/updater/src/lib.rs index cb239102..0475620d 100644 --- a/plugins/updater/src/lib.rs +++ b/plugins/updater/src/lib.rs @@ -41,7 +41,7 @@ pub trait UpdaterExt { /// use tauri_plugin_updater::UpdaterExt; /// tauri::Builder::default() /// .setup(|app| { - /// let handle = app.handle(); + /// let handle = app.handle().clone(); /// tauri::async_runtime::spawn(async move { /// let response = handle.updater_builder().build().unwrap().check().await; /// }); @@ -58,7 +58,7 @@ pub trait UpdaterExt { /// use tauri_plugin_updater::UpdaterExt; /// tauri::Builder::default() /// .setup(|app| { - /// let handle = app.handle(); + /// let handle = app.handle().clone(); /// tauri::async_runtime::spawn(async move { /// let response = handle.updater().unwrap().check().await; /// }); diff --git a/plugins/updater/tests/app-updater/src/main.rs b/plugins/updater/tests/app-updater/src/main.rs index b16926cf..ad145c49 100644 --- a/plugins/updater/tests/app-updater/src/main.rs +++ b/plugins/updater/tests/app-updater/src/main.rs @@ -13,7 +13,7 @@ fn main() { tauri::Builder::default() .plugin(tauri_plugin_updater::Builder::new().build()) .setup(|app| { - let handle = app.handle(); + let handle = app.handle().clone(); tauri::async_runtime::spawn(async move { let mut builder = handle.updater_builder(); if std::env::var("TARGET").unwrap_or_default() == "nsis" { diff --git a/plugins/upload/CHANGELOG.md b/plugins/upload/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/upload/CHANGELOG.md +++ b/plugins/upload/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/upload/Cargo.toml b/plugins/upload/Cargo.toml index c7178ecf..e30a8efe 100644 --- a/plugins/upload/Cargo.toml +++ b/plugins/upload/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-upload" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Upload files from disk to a remote server over HTTP." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/upload/package.json b/plugins/upload/package.json index db31acf1..fce3a920 100644 --- a/plugins/upload/package.json +++ b/plugins/upload/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-upload", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Upload files from disk to a remote server over HTTP.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/upload/src/api-iife.js b/plugins/upload/src/api-iife.js index 210ee0d9..567fe0db 100644 --- a/plugins/upload/src/api-iife.js +++ b/plugins/upload/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_UPLOAD__=function(e){"use strict";var n=Object.defineProperty,t=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},r=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),o=(e,n,r,o)=>(t(e,n,"write to private field"),o?o.call(e,r):n.set(e,r),r);function a(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})({},{Channel:()=>s,PluginListener:()=>l,addPluginListener:()=>d,convertFileSrc:()=>u,invoke:()=>c,transformCallback:()=>a});var i,s=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,i,(()=>{})),this.id=a((e=>{r(this,i).call(this,e)}))}set onmessage(e){o(this,i,e)}get onmessage(){return r(this,i)}toJSON(){return`__CHANNEL__:${this.id}`}};i=new WeakMap;var l=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return c(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function d(e,n,t){let r=new s;return r.onmessage=t,c(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new l(e,n,r.id)))}async function c(e,n={}){return new Promise(((t,r)=>{let o=a((e=>{t(e),Reflect.deleteProperty(window,`_${i}`)}),!0),i=a((e=>{r(e),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:o,error:i,...n})}))}function u(e,n="asset"){let t=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${n}.localhost/${t}`:`${n}://localhost/${t}`}return e.download=async function(e,n,t,r){const o=new Uint32Array(1);window.crypto.getRandomValues(o);const a=o[0],i=new s;null!=t&&(i.onmessage=t),await c("plugin:upload|download",{id:a,url:e,filePath:n,headers:null!=r?r:{},onProgress:i})},e.upload=async function(e,n,t,r){const o=new Uint32Array(1);window.crypto.getRandomValues(o);const a=o[0],i=new s;null!=t&&(i.onmessage=t),await c("plugin:upload|upload",{id:a,url:e,filePath:n,headers:null!=r?r:{},onProgress:i})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_UPLOAD__})} +if("__TAURI__"in window){var __TAURI_UPLOAD__=function(e){"use strict";var n=Object.defineProperty,t=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},r=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),i=(e,n,r,i)=>(t(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r);function o(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})({},{Channel:()=>l,PluginListener:()=>s,addPluginListener:()=>d,convertFileSrc:()=>u,invoke:()=>c,transformCallback:()=>o});var a,l=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,a,(()=>{})),this.id=o((e=>{r(this,a).call(this,e)}))}set onmessage(e){i(this,a,e)}get onmessage(){return r(this,a)}toJSON(){return`__CHANNEL__:${this.id}`}};a=new WeakMap;var s=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return c(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function d(e,n,t){let r=new l;return r.onmessage=t,c(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new s(e,n,r.id)))}async function c(e,n={},t){return new Promise(((r,i)=>{let a=o((e=>{r(e),Reflect.deleteProperty(window,`_${l}`)}),!0),l=o((e=>{i(e),Reflect.deleteProperty(window,`_${a}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:a,error:l,payload:n,options:t})}))}function u(e,n="asset"){return window.__TAURI__.convertFileSrc(e,n)}return e.download=async function(e,n,t,r){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const o=i[0],a=new l;null!=t&&(a.onmessage=t),await c("plugin:upload|download",{id:o,url:e,filePath:n,headers:null!=r?r:{},onProgress:a})},e.upload=async function(e,n,t,r){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const o=i[0],a=new l;null!=t&&(a.onmessage=t),await c("plugin:upload|upload",{id:o,url:e,filePath:n,headers:null!=r?r:{},onProgress:a})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_UPLOAD__})} diff --git a/plugins/upload/src/lib.rs b/plugins/upload/src/lib.rs index fb139a3e..83f2d479 100644 --- a/plugins/upload/src/lib.rs +++ b/plugins/upload/src/lib.rs @@ -16,8 +16,8 @@ use futures_util::TryStreamExt; use serde::{ser::Serializer, Serialize}; use tauri::{ - api::ipc::Channel, command, + ipc::Channel, plugin::{Builder as PluginBuilder, TauriPlugin}, Runtime, }; @@ -56,11 +56,11 @@ struct ProgressPayload { } #[command] -async fn download( +async fn download( url: &str, file_path: &str, headers: HashMap, - on_progress: Channel, + on_progress: Channel, ) -> Result<()> { let client = reqwest::Client::new(); @@ -89,11 +89,11 @@ async fn download( } #[command] -async fn upload( +async fn upload( url: &str, file_path: &str, headers: HashMap, - on_progress: Channel, + on_progress: Channel, ) -> Result { // Read the file let file = File::open(file_path).await?; @@ -113,13 +113,13 @@ async fn upload( response.json().await.map_err(Into::into) } -fn file_to_body(channel: Channel, file: File) -> reqwest::Body { +fn file_to_body(channel: Channel, file: File) -> reqwest::Body { let stream = FramedRead::new(file, BytesCodec::new()).map_ok(|r| r.freeze()); reqwest::Body::wrap_stream(ReadProgressStream::new( stream, Box::new(move |progress, total| { - let _ = channel.send(&ProgressPayload { progress, total }); + let _ = channel.send(ProgressPayload { progress, total }); }), )) } diff --git a/plugins/websocket/CHANGELOG.md b/plugins/websocket/CHANGELOG.md index a70b10ec..ff1bcea9 100644 --- a/plugins/websocket/CHANGELOG.md +++ b/plugins/websocket/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. + +## \[2.0.0-alpha.0] + +- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +te to alpha.11. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/websocket/Cargo.toml b/plugins/websocket/Cargo.toml index 439d71c2..15359cd6 100644 --- a/plugins/websocket/Cargo.toml +++ b/plugins/websocket/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-websocket" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Expose a WebSocket server to your Tauri frontend." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/websocket/examples/svelte-app/package.json b/plugins/websocket/examples/svelte-app/package.json index 98b52669..8e13e403 100644 --- a/plugins/websocket/examples/svelte-app/package.json +++ b/plugins/websocket/examples/svelte-app/package.json @@ -13,7 +13,7 @@ "devDependencies": { "@sveltejs/adapter-auto": "2.1.0", "@sveltejs/kit": "1.22.3", - "@tauri-apps/cli": "2.0.0-alpha.10", + "@tauri-apps/cli": "2.0.0-alpha.11", "svelte": "4.0.5", "svelte-check": "3.4.6", "tslib": "2.6.0", diff --git a/plugins/websocket/guest-js/index.ts b/plugins/websocket/guest-js/index.ts index bd6ca752..c72fd776 100644 --- a/plugins/websocket/guest-js/index.ts +++ b/plugins/websocket/guest-js/index.ts @@ -2,14 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -declare global { - interface Window { - __TAURI_INVOKE__: (cmd: string, args?: unknown) => Promise; - __TAURI__: { - transformCallback: (cb: (payload: T) => void) => number; - }; - } -} +import { invoke, Channel } from "@tauri-apps/api/tauri"; export interface MessageKind { type: T; @@ -39,17 +32,17 @@ export default class WebSocket { static async connect(url: string, options?: unknown): Promise { const listeners: Array<(arg: Message) => void> = []; - const handler = (message: Message): void => { + + const onMessage = new Channel(); + onMessage.onmessage = (message: Message): void => { listeners.forEach((l) => l(message)); }; - return await window - .__TAURI_INVOKE__("plugin:websocket|connect", { - url, - callbackFunction: window.__TAURI__.transformCallback(handler), - options, - }) - .then((id) => new WebSocket(id, listeners)); + return await invoke("plugin:websocket|connect", { + url, + onMessage, + options, + }).then((id) => new WebSocket(id, listeners)); } addListener(cb: (arg: Message) => void): void { @@ -69,7 +62,7 @@ export default class WebSocket { "invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array", ); } - return await window.__TAURI_INVOKE__("plugin:websocket|send", { + return await invoke("plugin:websocket|send", { id: this.id, message: m, }); diff --git a/plugins/websocket/package.json b/plugins/websocket/package.json index 0ae8849b..d2d6c437 100644 --- a/plugins/websocket/package.json +++ b/plugins/websocket/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-websocket", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/websocket/src/api-iife.js b/plugins/websocket/src/api-iife.js index cea3c830..7774527e 100644 --- a/plugins/websocket/src/api-iife.js +++ b/plugins/websocket/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_WEBSOCKET__=function(){"use strict";class e{constructor(e,t){this.id=e,this.listeners=t}static async connect(t,n){const i=[];return await window.__TAURI_INVOKE__("plugin:websocket|connect",{url:t,callbackFunction:window.__TAURI__.transformCallback((e=>{i.forEach((t=>t(e)))})),options:n}).then((t=>new e(t,i)))}addListener(e){this.listeners.push(e)}async send(e){let t;if("string"==typeof e)t={type:"Text",data:e};else if("object"==typeof e&&"type"in e)t=e;else{if(!Array.isArray(e))throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array");t={type:"Binary",data:e}}return await window.__TAURI_INVOKE__("plugin:websocket|send",{id:this.id,message:t})}async disconnect(){return await this.send({type:"Close",data:{code:1e3,reason:"Disconnected by client"}})}}return e}();Object.defineProperty(window.__TAURI__,"websocket",{value:__TAURI_WEBSOCKET__})} +if("__TAURI__"in window){var __TAURI_WEBSOCKET__=function(){"use strict";var e=Object.defineProperty,t=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},n=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),r=(e,n,r,i)=>(t(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r);function i(e,t=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${n}`;return Object.defineProperty(window,r,{value:n=>(t&&Reflect.deleteProperty(window,r),e?.(n)),writable:!1,configurable:!0}),n}((t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})})({},{Channel:()=>a,PluginListener:()=>o,addPluginListener:()=>c,convertFileSrc:()=>d,invoke:()=>l,transformCallback:()=>i});var s,a=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,s,(()=>{})),this.id=i((e=>{n(this,s).call(this,e)}))}set onmessage(e){r(this,s,e)}get onmessage(){return n(this,s)}toJSON(){return`__CHANNEL__:${this.id}`}};s=new WeakMap;var o=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return l(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function c(e,t,n){let r=new a;return r.onmessage=n,l(`plugin:${e}|register_listener`,{event:t,handler:r}).then((()=>new o(e,t,r.id)))}async function l(e,t={},n){return new Promise(((r,s)=>{let a=i((e=>{r(e),Reflect.deleteProperty(window,`_${o}`)}),!0),o=i((e=>{s(e),Reflect.deleteProperty(window,`_${a}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:a,error:o,payload:t,options:n})}))}function d(e,t="asset"){return window.__TAURI__.convertFileSrc(e,t)}class _{constructor(e,t){this.id=e,this.listeners=t}static async connect(e,t){const n=[],r=new a;return r.onmessage=e=>{n.forEach((t=>t(e)))},await l("plugin:websocket|connect",{url:e,onMessage:r,options:t}).then((e=>new _(e,n)))}addListener(e){this.listeners.push(e)}async send(e){let t;if("string"==typeof e)t={type:"Text",data:e};else if("object"==typeof e&&"type"in e)t=e;else{if(!Array.isArray(e))throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array");t={type:"Binary",data:e}}return await l("plugin:websocket|send",{id:this.id,message:t})}async disconnect(){return await this.send({type:"Close",data:{code:1e3,reason:"Disconnected by client"}})}}return _}();Object.defineProperty(window.__TAURI__,"websocket",{value:__TAURI_WEBSOCKET__})} diff --git a/plugins/websocket/src/lib.rs b/plugins/websocket/src/lib.rs index 31d744c3..164a0a09 100644 --- a/plugins/websocket/src/lib.rs +++ b/plugins/websocket/src/lib.rs @@ -14,7 +14,7 @@ use futures_util::{stream::SplitSink, SinkExt, StreamExt}; use serde::{ser::Serializer, Deserialize, Serialize}; use tauri::{ - api::ipc::{format_callback, CallbackFn}, + ipc::Channel, plugin::{Builder as PluginBuilder, TauriPlugin}, Manager, Runtime, State, Window, }; @@ -95,7 +95,7 @@ enum WebSocketMessage { async fn connect( window: Window, url: String, - callback_function: CallbackFn, + on_message: Channel, config: Option, ) -> Result { let id = rand::random(); @@ -107,6 +107,7 @@ async fn connect( manager.0.lock().await.insert(id, write); read.for_each(move |message| { let window_ = window.clone(); + let on_message_ = on_message.clone(); async move { if let Ok(Message::Close(_)) = message { let manager = window_.state::(); @@ -136,9 +137,8 @@ async fn connect( Ok(Message::Frame(_)) => serde_json::Value::Null, // This value can't be recieved. Err(e) => serde_json::to_value(Error::from(e)).unwrap(), }; - let js = format_callback(callback_function, &response) - .expect("unable to serialize websocket message"); - let _ = window_.eval(js.as_str()); + + let _ = on_message_.send(response); } }) .await; diff --git a/plugins/window-state/CHANGELOG.md b/plugins/window-state/CHANGELOG.md index a70b10ec..71cca910 100644 --- a/plugins/window-state/CHANGELOG.md +++ b/plugins/window-state/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. +- [`84b3612`](https://github.com/tauri-apps/plugins-workspace/commit/84b3612393e3d0d4faeebe1e61cb7d7973556503)([#436](https://github.com/tauri-apps/plugins-workspace/pull/436)) Correctly propagate the promise inside `saveWindowState`, `restoreState` and `restoreStateCurrent` so callers can choose to `await` them. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +lugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/window-state/Cargo.toml b/plugins/window-state/Cargo.toml index 52759d75..0bcdb1b1 100644 --- a/plugins/window-state/Cargo.toml +++ b/plugins/window-state/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-window-state" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Save window positions and sizes and restore them when the app is reopened." authors = { workspace = true } license = { workspace = true } diff --git a/plugins/window-state/package.json b/plugins/window-state/package.json index ad169f17..f59709a0 100644 --- a/plugins/window-state/package.json +++ b/plugins/window-state/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-window-state", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "description": "Save window positions and sizes and restore them when the app is reopened.", "license": "MIT or APACHE-2.0", "authors": [ @@ -28,6 +28,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index 98d58a9f..0bd79a89 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -317,8 +317,8 @@ impl Builder { let state_path = app_dir.join(STATE_FILENAME); if state_path.exists() { Arc::new(Mutex::new( - tauri::api::file::read_binary(state_path) - .map_err(Error::TauriApi) + std::fs::read(state_path) + .map_err(Error::from) .and_then(|state| bincode::deserialize(&state).map_err(Into::into)) .unwrap_or_default(), )) diff --git a/plugins/window/CHANGELOG.md b/plugins/window/CHANGELOG.md index a70b10ec..21fd21b0 100644 --- a/plugins/window/CHANGELOG.md +++ b/plugins/window/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## \[2.0.0-alpha.1] + +- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. +- [`2fc420b`](https://github.com/tauri-apps/plugins-workspace/commit/2fc420ba375de924f236f5b32d26667f742fcd6b)([#418](https://github.com/tauri-apps/plugins-workspace/pull/418)) Add `incognito` window configuration option +- [`84133b5`](https://github.com/tauri-apps/plugins-workspace/commit/84133b57b8c443007c728dd8dbe32b08804009f9)([#426](https://github.com/tauri-apps/plugins-workspace/pull/426)) The window plugin is recieving a few changes to improve consistency and add new features: + + - Removed `appWindow` variable from JS module, use `getCurrent` or `Window.getCurrent`. + - Removed `WindowManager`, `WebviewWindow` and `WebviewHandle` types and merged them into one `Window` type that matches the name of the rust window type. + - Added `Window.getCurrent` and `Window.getAll` which is a convenient method for `getCurrent` and `getAll` functions. +- [`c8c3191`](https://github.com/tauri-apps/plugins-workspace/commit/c8c3191565aef518037f9f4519886ca98329fe47)([#392](https://github.com/tauri-apps/plugins-workspace/pull/392)) Added the `setEffects` and `clearEffects` API. + +### feat + +- [`a79d6d9`](https://github.com/tauri-apps/plugins-workspace/commit/a79d6d94bdbf6d1919adff8e65f79240c31d4a14)([#406](https://github.com/tauri-apps/plugins-workspace/pull/406)) Added the `maximizable`, `minimizable` and `closable` fields on `WindowOptions`. +- [`a79d6d9`](https://github.com/tauri-apps/plugins-workspace/commit/a79d6d94bdbf6d1919adff8e65f79240c31d4a14)([#406](https://github.com/tauri-apps/plugins-workspace/pull/406)) Added the `setMaximizable`, `setMinimizable`, `setClosable`, `isMaximizable`, `isMinimizable` and `isClosable` methods. +- [`83abea3`](https://github.com/tauri-apps/plugins-workspace/commit/83abea3cae8408ce262f3815c1a6cc506e73c486)([#407](https://github.com/tauri-apps/plugins-workspace/pull/407)) Add `WebviewWindow.is_focused` and `WebviewWindow.getFocusedWindow` getters. + ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/window/Cargo.toml b/plugins/window/Cargo.toml index 229bbc3b..feb24558 100644 --- a/plugins/window/Cargo.toml +++ b/plugins/window/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-window" -version = "2.0.0-alpha.0" +version = "2.0.0-alpha.1" description = "Interact with the Tauri window." edition = { workspace = true } authors = { workspace = true } diff --git a/plugins/window/package.json b/plugins/window/package.json index 2efeb0e8..c7641200 100644 --- a/plugins/window/package.json +++ b/plugins/window/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/plugin-window", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" @@ -27,6 +27,6 @@ "tslib": "^2.5.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } } diff --git a/plugins/window/src/api-iife.js b/plugins/window/src/api-iife.js index 0582f280..fdd7ba30 100644 --- a/plugins/window/src/api-iife.js +++ b/plugins/window/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_WINDOW__=function(e){"use strict";var i=Object.defineProperty,t=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},n=(e,i,t)=>{if(!i.has(e))throw TypeError("Cannot "+t)},l=(e,i,t)=>(n(e,i,"read from private field"),t?t.call(e):i.get(e)),a=(e,i,t,l)=>(n(e,i,"write to private field"),l?l.call(e,t):i.set(e,t),t);function s(e,i=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],n=`_${t}`;return Object.defineProperty(window,n,{value:t=>(i&&Reflect.deleteProperty(window,n),e?.(t)),writable:!1,configurable:!0}),t}t({},{Channel:()=>o,PluginListener:()=>_,addPluginListener:()=>w,convertFileSrc:()=>c,invoke:()=>u,transformCallback:()=>s});var r,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,i,t)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,t)})(this,r,(()=>{})),this.id=s((e=>{l(this,r).call(this,e)}))}set onmessage(e){a(this,r,e)}get onmessage(){return l(this,r)}toJSON(){return`__CHANNEL__:${this.id}`}};r=new WeakMap;var _=class{constructor(e,i,t){this.plugin=e,this.event=i,this.channelId=t}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function w(e,i,t){let n=new o;return n.onmessage=t,u(`plugin:${e}|register_listener`,{event:i,handler:n}).then((()=>new _(e,i,n.id)))}async function u(e,i={}){return new Promise(((t,n)=>{let l=s((e=>{t(e),Reflect.deleteProperty(window,`_${a}`)}),!0),a=s((e=>{n(e),Reflect.deleteProperty(window,`_${l}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:l,error:a,...i})}))}function c(e,i="asset"){let t=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${i}.localhost/${t}`:`${i}://localhost/${t}`}t({},{TauriEvent:()=>h,emit:()=>b,listen:()=>y,once:()=>I});var d,h=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(h||{});async function p(e,i){await u("plugin:event|unlisten",{event:e,eventId:i})}async function y(e,i,t){return u("plugin:event|listen",{event:e,windowLabel:t?.target,handler:s(i)}).then((i=>async()=>p(e,i)))}async function I(e,i,t){return y(e,(t=>{i(t),p(e,t.id).catch((()=>{}))}),t)}async function b(e,i,t){await u("plugin:event|emit",{event:e,windowLabel:t?.target,payload:i})}class g{constructor(e,i){this.type="Logical",this.width=e,this.height=i}}class E{constructor(e,i){this.type="Physical",this.width=e,this.height=i}toLogical(e){return new g(this.width/e,this.height/e)}}class O{constructor(e,i){this.type="Logical",this.x=e,this.y=i}}class A{constructor(e,i){this.type="Physical",this.x=e,this.y=i}toLogical(e){return new O(this.x/e,this.y/e)}}e.UserAttentionType=void 0,(d=e.UserAttentionType||(e.UserAttentionType={}))[d.Critical=1]="Critical",d[d.Informational=2]="Informational";class m{constructor(e){this._preventDefault=!1,this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function R(){return new T(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function N(){return window.__TAURI_METADATA__.__windows.map((e=>new T(e.label,{skip:!0})))}const v=["tauri://created","tauri://error"];class T{constructor(e,i={}){this.label=e,this.listeners=Object.create(null),(null==i?void 0:i.skip)||window.__TAURI_INVOKE__("plugin:window|create",{options:{...i,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return N().some((i=>i.label===e))?new T(e,{skip:!0}):null}static getCurrent(){return R()}static getAll(){return N()}static async getFocusedWindow(){for(const e of N())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?Promise.resolve((()=>{const t=this.listeners[e];t.splice(t.indexOf(i),1)})):y(e,i,{target:this.label})}async once(e,i){return this._handleTauriEvent(e,i)?Promise.resolve((()=>{const t=this.listeners[e];t.splice(t.indexOf(i),1)})):I(e,i,{target:this.label})}async emit(e,i){if(v.includes(e)){for(const t of this.listeners[e]||[])t({event:e,id:-1,windowLabel:this.label,payload:i});return Promise.resolve()}return b(e,i,{target:this.label})}_handleTauriEvent(e,i){return!!v.includes(e)&&(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0)}async scaleFactor(){return window.__TAURI_INVOKE__("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return window.__TAURI_INVOKE__("plugin:window|inner_position",{label:this.label}).then((({x:e,y:i})=>new A(e,i)))}async outerPosition(){return window.__TAURI_INVOKE__("plugin:window|outer_position",{label:this.label}).then((({x:e,y:i})=>new A(e,i)))}async innerSize(){return window.__TAURI_INVOKE__("plugin:window|inner_size",{label:this.label}).then((({width:e,height:i})=>new E(e,i)))}async outerSize(){return window.__TAURI_INVOKE__("plugin:window|outer_size",{label:this.label}).then((({width:e,height:i})=>new E(e,i)))}async isFullscreen(){return window.__TAURI_INVOKE__("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return window.__TAURI_INVOKE__("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return window.__TAURI_INVOKE__("plugin:window|is_maximized",{label:this.label})}async isFocused(){return window.__TAURI_INVOKE__("plugin:window|is_focused",{label:this.label})}async isDecorated(){return window.__TAURI_INVOKE__("plugin:window|is_decorated",{label:this.label})}async isResizable(){return window.__TAURI_INVOKE__("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return window.__TAURI_INVOKE__("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return window.__TAURI_INVOKE__("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return window.__TAURI_INVOKE__("plugin:window|is_closable",{label:this.label})}async isVisible(){return window.__TAURI_INVOKE__("plugin:window|is_visible",{label:this.label})}async title(){return window.__TAURI_INVOKE__("plugin:window|title",{label:this.label})}async theme(){return window.__TAURI_INVOKE__("plugin:window|theme",{label:this.label})}async center(){return window.__TAURI_INVOKE__("plugin:window|center",{label:this.label})}async requestUserAttention(i){let t=null;return i&&(t=i===e.UserAttentionType.Critical?{type:"Critical"}:{type:"Informational"}),window.__TAURI_INVOKE__("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return window.__TAURI_INVOKE__("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return window.__TAURI_INVOKE__("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return window.__TAURI_INVOKE__("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return window.__TAURI_INVOKE__("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return window.__TAURI_INVOKE__("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return window.__TAURI_INVOKE__("plugin:window|maximize",{label:this.label})}async unmaximize(){return window.__TAURI_INVOKE__("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return window.__TAURI_INVOKE__("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return window.__TAURI_INVOKE__("plugin:window|minimize",{label:this.label})}async unminimize(){return window.__TAURI_INVOKE__("plugin:window|unminimize",{label:this.label})}async show(){return window.__TAURI_INVOKE__("plugin:window|show",{label:this.label})}async hide(){return window.__TAURI_INVOKE__("plugin:window|hide",{label:this.label})}async close(){return window.__TAURI_INVOKE__("plugin:window|close",{label:this.label})}async setDecorations(e){return window.__TAURI_INVOKE__("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return window.__TAURI_INVOKE__("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return window.__TAURI_INVOKE__("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return window.__TAURI_INVOKE__("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return window.__TAURI_INVOKE__("plugin:window|set_always_on_top",{label:this.label,value:e})}async setContentProtected(e){return window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return window.__TAURI_INVOKE__("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return window.__TAURI_INVOKE__("plugin:window|set_focus",{label:this.label})}async setIcon(e){return window.__TAURI_INVOKE__("plugin:window|set_icon",{label:this.label,value:"string"==typeof e?e:Array.from(e)})}async setSkipTaskbar(e){return window.__TAURI_INVOKE__("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return window.__TAURI_INVOKE__("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return window.__TAURI_INVOKE__("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return window.__TAURI_INVOKE__("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return window.__TAURI_INVOKE__("plugin:window|start_dragging",{label:this.label})}async onResized(e){return this.listen(h.WINDOW_RESIZED,(i=>{i.payload=D(i.payload),e(i)}))}async onMoved(e){return this.listen(h.WINDOW_MOVED,(i=>{i.payload=W(i.payload),e(i)}))}async onCloseRequested(e){return this.listen(h.WINDOW_CLOSE_REQUESTED,(i=>{const t=new m(i);Promise.resolve(e(t)).then((()=>{if(!t.isPreventDefault())return this.close()}))}))}async onFocusChanged(e){const i=await this.listen(h.WINDOW_FOCUS,(i=>{e({...i,payload:!0})})),t=await this.listen(h.WINDOW_BLUR,(i=>{e({...i,payload:!1})}));return()=>{i(),t()}}async onScaleChanged(e){return this.listen(h.WINDOW_SCALE_FACTOR_CHANGED,e)}async onMenuClicked(e){return this.listen(h.MENU,e)}async onFileDropEvent(e){const i=await this.listen(h.WINDOW_FILE_DROP,(i=>{e({...i,payload:{type:"drop",paths:i.payload.paths,position:W(i.payload.position)}})})),t=await this.listen(h.WINDOW_FILE_DROP_HOVER,(i=>{e({...i,payload:{type:"hover",paths:i.payload.paths,position:W(i.payload.position)}})})),n=await this.listen(h.WINDOW_FILE_DROP_CANCELLED,(i=>{e({...i,payload:{type:"cancel"}})}));return()=>{i(),t(),n()}}async onThemeChanged(e){return this.listen(h.WINDOW_THEME_CHANGED,e)}}var f,U;function V(e){return null===e?null:{name:e.name,scaleFactor:e.scaleFactor,position:W(e.position),size:D(e.size)}}function W(e){return new A(e.x,e.y)}function D(e){return new E(e.width,e.height)}return e.Effect=void 0,(f=e.Effect||(e.Effect={})).AppearanceBased="appearanceBased",f.Light="light",f.Dark="dark",f.MediumLight="mediumLight",f.UltraDark="ultraDark",f.Titlebar="titlebar",f.Selection="selection",f.Menu="menu",f.Popover="popover",f.Sidebar="sidebar",f.HeaderView="headerView",f.Sheet="sheet",f.WindowBackground="windowBackground",f.HudWindow="hudWindow",f.FullScreenUI="fullScreenUI",f.Tooltip="tooltip",f.ContentBackground="contentBackground",f.UnderWindowBackground="underWindowBackground",f.UnderPageBackground="underPageBackground",f.Mica="mica",f.Blur="blur",f.Acrylic="acrylic",e.EffectState=void 0,(U=e.EffectState||(e.EffectState={})).FollowsWindowActiveState="followsWindowActiveState",U.Active="active",U.Inactive="inactive",e.CloseRequestedEvent=m,e.LogicalPosition=O,e.LogicalSize=g,e.PhysicalPosition=A,e.PhysicalSize=E,e.Window=T,e.availableMonitors=async function(){return window.__TAURI_INVOKE__("plugin:window|available_monitors").then((e=>e.map(V)))},e.currentMonitor=async function(){return window.__TAURI_INVOKE__("plugin:window|current_monitor").then(V)},e.getAll=N,e.getCurrent=R,e.primaryMonitor=async function(){return window.__TAURI_INVOKE__("plugin:window|primary_monitor").then(V)},e}({});Object.defineProperty(window.__TAURI__,"window",{value:__TAURI_WINDOW__})} +if("__TAURI__"in window){var __TAURI_WINDOW__=function(e){"use strict";var i=Object.defineProperty,n=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0})},t=(e,i,n)=>{if(!i.has(e))throw TypeError("Cannot "+n)},l=(e,i,n)=>(t(e,i,"read from private field"),n?n.call(e):i.get(e)),a=(e,i,n,l)=>(t(e,i,"write to private field"),l?l.call(e,n):i.set(e,n),n);function s(e,i=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],t=`_${n}`;return Object.defineProperty(window,t,{value:n=>(i&&Reflect.deleteProperty(window,t),e?.(n)),writable:!1,configurable:!0}),n}n({},{Channel:()=>o,PluginListener:()=>_,addPluginListener:()=>w,convertFileSrc:()=>c,invoke:()=>u,transformCallback:()=>s});var r,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,i,n)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,n)})(this,r,(()=>{})),this.id=s((e=>{l(this,r).call(this,e)}))}set onmessage(e){a(this,r,e)}get onmessage(){return l(this,r)}toJSON(){return`__CHANNEL__:${this.id}`}};r=new WeakMap;var _=class{constructor(e,i,n){this.plugin=e,this.event=i,this.channelId=n}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function w(e,i,n){let t=new o;return t.onmessage=n,u(`plugin:${e}|register_listener`,{event:i,handler:t}).then((()=>new _(e,i,t.id)))}async function u(e,i={},n){return new Promise(((t,l)=>{let a=s((e=>{t(e),Reflect.deleteProperty(window,`_${r}`)}),!0),r=s((e=>{l(e),Reflect.deleteProperty(window,`_${a}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:a,error:r,payload:i,options:n})}))}function c(e,i="asset"){return window.__TAURI__.convertFileSrc(e,i)}n({},{TauriEvent:()=>h,emit:()=>b,listen:()=>y,once:()=>I});var d,h=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(h||{});async function p(e,i){await u("plugin:event|unlisten",{event:e,eventId:i})}async function y(e,i,n){return u("plugin:event|listen",{event:e,windowLabel:n?.target,handler:s(i)}).then((i=>async()=>p(e,i)))}async function I(e,i,n){return y(e,(n=>{i(n),p(e,n.id).catch((()=>{}))}),n)}async function b(e,i,n){await u("plugin:event|emit",{event:e,windowLabel:n?.target,payload:i})}class g{constructor(e,i){this.type="Logical",this.width=e,this.height=i}}class E{constructor(e,i){this.type="Physical",this.width=e,this.height=i}toLogical(e){return new g(this.width/e,this.height/e)}}class O{constructor(e,i){this.type="Logical",this.x=e,this.y=i}}class A{constructor(e,i){this.type="Physical",this.x=e,this.y=i}toLogical(e){return new O(this.x/e,this.y/e)}}e.UserAttentionType=void 0,(d=e.UserAttentionType||(e.UserAttentionType={}))[d.Critical=1]="Critical",d[d.Informational=2]="Informational";class m{constructor(e){this._preventDefault=!1,this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function R(){return new v(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function N(){return window.__TAURI_METADATA__.__windows.map((e=>new v(e.label,{skip:!0})))}const T=["tauri://created","tauri://error"];class v{constructor(e,i={}){this.label=e,this.listeners=Object.create(null),(null==i?void 0:i.skip)||window.__TAURI_INVOKE__("plugin:window|create",{options:{...i,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return N().some((i=>i.label===e))?new v(e,{skip:!0}):null}static getCurrent(){return R()}static getAll(){return N()}static async getFocusedWindow(){for(const e of N())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)})):y(e,i,{target:this.label})}async once(e,i){return this._handleTauriEvent(e,i)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)})):I(e,i,{target:this.label})}async emit(e,i){if(T.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:i});return Promise.resolve()}return b(e,i,{target:this.label})}_handleTauriEvent(e,i){return!!T.includes(e)&&(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0)}async scaleFactor(){return window.__TAURI_INVOKE__("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return window.__TAURI_INVOKE__("plugin:window|inner_position",{label:this.label}).then((({x:e,y:i})=>new A(e,i)))}async outerPosition(){return window.__TAURI_INVOKE__("plugin:window|outer_position",{label:this.label}).then((({x:e,y:i})=>new A(e,i)))}async innerSize(){return window.__TAURI_INVOKE__("plugin:window|inner_size",{label:this.label}).then((({width:e,height:i})=>new E(e,i)))}async outerSize(){return window.__TAURI_INVOKE__("plugin:window|outer_size",{label:this.label}).then((({width:e,height:i})=>new E(e,i)))}async isFullscreen(){return window.__TAURI_INVOKE__("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return window.__TAURI_INVOKE__("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return window.__TAURI_INVOKE__("plugin:window|is_maximized",{label:this.label})}async isFocused(){return window.__TAURI_INVOKE__("plugin:window|is_focused",{label:this.label})}async isDecorated(){return window.__TAURI_INVOKE__("plugin:window|is_decorated",{label:this.label})}async isResizable(){return window.__TAURI_INVOKE__("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return window.__TAURI_INVOKE__("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return window.__TAURI_INVOKE__("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return window.__TAURI_INVOKE__("plugin:window|is_closable",{label:this.label})}async isVisible(){return window.__TAURI_INVOKE__("plugin:window|is_visible",{label:this.label})}async title(){return window.__TAURI_INVOKE__("plugin:window|title",{label:this.label})}async theme(){return window.__TAURI_INVOKE__("plugin:window|theme",{label:this.label})}async center(){return window.__TAURI_INVOKE__("plugin:window|center",{label:this.label})}async requestUserAttention(i){let n=null;return i&&(n=i===e.UserAttentionType.Critical?{type:"Critical"}:{type:"Informational"}),window.__TAURI_INVOKE__("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return window.__TAURI_INVOKE__("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return window.__TAURI_INVOKE__("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return window.__TAURI_INVOKE__("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return window.__TAURI_INVOKE__("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return window.__TAURI_INVOKE__("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return window.__TAURI_INVOKE__("plugin:window|maximize",{label:this.label})}async unmaximize(){return window.__TAURI_INVOKE__("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return window.__TAURI_INVOKE__("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return window.__TAURI_INVOKE__("plugin:window|minimize",{label:this.label})}async unminimize(){return window.__TAURI_INVOKE__("plugin:window|unminimize",{label:this.label})}async show(){return window.__TAURI_INVOKE__("plugin:window|show",{label:this.label})}async hide(){return window.__TAURI_INVOKE__("plugin:window|hide",{label:this.label})}async close(){return window.__TAURI_INVOKE__("plugin:window|close",{label:this.label})}async setDecorations(e){return window.__TAURI_INVOKE__("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return window.__TAURI_INVOKE__("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return window.__TAURI_INVOKE__("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return window.__TAURI_INVOKE__("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return window.__TAURI_INVOKE__("plugin:window|set_always_on_top",{label:this.label,value:e})}async setContentProtected(e){return window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return window.__TAURI_INVOKE__("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return window.__TAURI_INVOKE__("plugin:window|set_focus",{label:this.label})}async setIcon(e){return window.__TAURI_INVOKE__("plugin:window|set_icon",{label:this.label,value:"string"==typeof e?e:Array.from(e)})}async setSkipTaskbar(e){return window.__TAURI_INVOKE__("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return window.__TAURI_INVOKE__("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return window.__TAURI_INVOKE__("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return window.__TAURI_INVOKE__("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 window.__TAURI_INVOKE__("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return window.__TAURI_INVOKE__("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return window.__TAURI_INVOKE__("plugin:window|start_dragging",{label:this.label})}async onResized(e){return this.listen(h.WINDOW_RESIZED,(i=>{i.payload=W(i.payload),e(i)}))}async onMoved(e){return this.listen(h.WINDOW_MOVED,(i=>{i.payload=D(i.payload),e(i)}))}async onCloseRequested(e){return this.listen(h.WINDOW_CLOSE_REQUESTED,(i=>{const n=new m(i);Promise.resolve(e(n)).then((()=>{if(!n.isPreventDefault())return this.close()}))}))}async onFocusChanged(e){const i=await this.listen(h.WINDOW_FOCUS,(i=>{e({...i,payload:!0})})),n=await this.listen(h.WINDOW_BLUR,(i=>{e({...i,payload:!1})}));return()=>{i(),n()}}async onScaleChanged(e){return this.listen(h.WINDOW_SCALE_FACTOR_CHANGED,e)}async onMenuClicked(e){return this.listen(h.MENU,e)}async onFileDropEvent(e){const i=await this.listen(h.WINDOW_FILE_DROP,(i=>{e({...i,payload:{type:"drop",paths:i.payload.paths,position:D(i.payload.position)}})})),n=await this.listen(h.WINDOW_FILE_DROP_HOVER,(i=>{e({...i,payload:{type:"hover",paths:i.payload.paths,position:D(i.payload.position)}})})),t=await this.listen(h.WINDOW_FILE_DROP_CANCELLED,(i=>{e({...i,payload:{type:"cancel"}})}));return()=>{i(),n(),t()}}async onThemeChanged(e){return this.listen(h.WINDOW_THEME_CHANGED,e)}}var f,U;function V(e){return null===e?null:{name:e.name,scaleFactor:e.scaleFactor,position:D(e.position),size:W(e.size)}}function D(e){return new A(e.x,e.y)}function W(e){return new E(e.width,e.height)}return e.Effect=void 0,(f=e.Effect||(e.Effect={})).AppearanceBased="appearanceBased",f.Light="light",f.Dark="dark",f.MediumLight="mediumLight",f.UltraDark="ultraDark",f.Titlebar="titlebar",f.Selection="selection",f.Menu="menu",f.Popover="popover",f.Sidebar="sidebar",f.HeaderView="headerView",f.Sheet="sheet",f.WindowBackground="windowBackground",f.HudWindow="hudWindow",f.FullScreenUI="fullScreenUI",f.Tooltip="tooltip",f.ContentBackground="contentBackground",f.UnderWindowBackground="underWindowBackground",f.UnderPageBackground="underPageBackground",f.Mica="mica",f.Blur="blur",f.Acrylic="acrylic",e.EffectState=void 0,(U=e.EffectState||(e.EffectState={})).FollowsWindowActiveState="followsWindowActiveState",U.Active="active",U.Inactive="inactive",e.CloseRequestedEvent=m,e.LogicalPosition=O,e.LogicalSize=g,e.PhysicalPosition=A,e.PhysicalSize=E,e.Window=v,e.availableMonitors=async function(){return window.__TAURI_INVOKE__("plugin:window|available_monitors").then((e=>e.map(V)))},e.currentMonitor=async function(){return window.__TAURI_INVOKE__("plugin:window|current_monitor").then(V)},e.getAll=N,e.getCurrent=R,e.primaryMonitor=async function(){return window.__TAURI_INVOKE__("plugin:window|primary_monitor").then(V)},e}({});Object.defineProperty(window.__TAURI__,"window",{value:__TAURI_WINDOW__})} diff --git a/plugins/window/src/lib.rs b/plugins/window/src/lib.rs index be545b88..90dbd710 100644 --- a/plugins/window/src/lib.rs +++ b/plugins/window/src/lib.rs @@ -37,7 +37,7 @@ pub fn init() -> TauriPlugin { .invoke_handler(|invoke| { #[cfg(desktop)] { - let handler: Box) -> bool> = + let handler: Box) -> bool> = Box::new(tauri::generate_handler![ desktop_commands::create, // getters diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 062ad1ad..37315ec4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,46 +64,46 @@ importers: examples/api: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 '@tauri-apps/plugin-app': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/app '@tauri-apps/plugin-cli': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/cli '@tauri-apps/plugin-clipboard-manager': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/clipboard-manager '@tauri-apps/plugin-dialog': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/dialog '@tauri-apps/plugin-fs': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/fs '@tauri-apps/plugin-global-shortcut': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/global-shortcut '@tauri-apps/plugin-http': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/http '@tauri-apps/plugin-notification': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/notification '@tauri-apps/plugin-os': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/os '@tauri-apps/plugin-process': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/process '@tauri-apps/plugin-shell': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/shell '@tauri-apps/plugin-updater': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/updater '@tauri-apps/plugin-window': - specifier: 2.0.0-alpha.0 + specifier: 2.0.0-alpha.1 version: link:../../plugins/window '@zerodevx/svelte-json-view': specifier: 1.0.5 @@ -119,8 +119,8 @@ importers: specifier: ^2.4.1 version: 2.4.1(svelte@3.59.1)(vite@4.4.4) '@tauri-apps/cli': - specifier: 2.0.0-alpha.10 - version: 2.0.0-alpha.10 + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11 '@unocss/extractor-svelte': specifier: ^0.53.1 version: 0.53.1 @@ -140,8 +140,8 @@ importers: plugins/app: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.5.0 @@ -150,8 +150,8 @@ importers: plugins/authenticator: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -160,8 +160,8 @@ importers: plugins/autostart: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -170,8 +170,8 @@ importers: plugins/cli: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.4.1 @@ -180,8 +180,8 @@ importers: plugins/clipboard-manager: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.4.1 @@ -190,8 +190,8 @@ importers: plugins/dialog: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.4.1 @@ -200,8 +200,8 @@ importers: plugins/fs: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.4.1 @@ -210,8 +210,8 @@ importers: plugins/global-shortcut: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.4.1 @@ -220,8 +220,8 @@ importers: plugins/http: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.5.0 @@ -230,8 +230,8 @@ importers: plugins/log: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -240,8 +240,8 @@ importers: plugins/notification: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.4.1 @@ -250,8 +250,8 @@ importers: plugins/os: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -260,8 +260,8 @@ importers: plugins/positioner: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -270,8 +270,8 @@ importers: plugins/process: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -280,8 +280,8 @@ importers: plugins/shell: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.4.1 @@ -290,14 +290,14 @@ importers: plugins/single-instance/examples/vanilla: devDependencies: '@tauri-apps/cli': - specifier: 2.0.0-alpha.10 - version: 2.0.0-alpha.10 + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11 plugins/sql: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -306,8 +306,8 @@ importers: plugins/store: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -316,8 +316,8 @@ importers: plugins/stronghold: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -326,8 +326,8 @@ importers: plugins/updater: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.5.0 @@ -336,8 +336,8 @@ importers: plugins/upload: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -346,8 +346,8 @@ importers: plugins/websocket: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -366,8 +366,8 @@ importers: specifier: 1.22.3 version: 1.22.3(svelte@4.0.5)(vite@4.4.4) '@tauri-apps/cli': - specifier: 2.0.0-alpha.10 - version: 2.0.0-alpha.10 + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11 svelte: specifier: 4.0.5 version: 4.0.5 @@ -387,8 +387,8 @@ importers: plugins/window: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: ^2.5.0 @@ -397,8 +397,8 @@ importers: plugins/window-state: dependencies: '@tauri-apps/api': - specifier: 2.0.0-alpha.5 - version: 2.0.0-alpha.5 + specifier: 2.0.0-alpha.6 + version: 2.0.0-alpha.6 devDependencies: tslib: specifier: 2.6.0 @@ -1106,13 +1106,13 @@ packages: - supports-color dev: true - /@tauri-apps/api@2.0.0-alpha.5: - resolution: {integrity: sha512-OqysC4c819itGxic50RoDMrmd+ofX+MMNkXKeRS0BV2rkKqrnuV17o3TrQXFI1xs/kXRmmPC+3Y42P9Y5uNvRg==} + /@tauri-apps/api@2.0.0-alpha.6: + resolution: {integrity: sha512-ZMOc3eu9amwvkC6M69h3hWt4/EsFaAXmtkiw4xd2LN59/lTb4ZQiVfq2QKlRcu1rj3n/Tcr7U30ZopvHwXBGIg==} engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'} dev: false - /@tauri-apps/cli-darwin-arm64@2.0.0-alpha.10: - resolution: {integrity: sha512-z6DoKRUm1Yygu2Tpatu7Fej0eZejZQcsDKsHWc3b5yoIsrodxvKbko2SvYczUx4ecXWplJBTIfTZNo6ciIRRmw==} + /@tauri-apps/cli-darwin-arm64@2.0.0-alpha.11: + resolution: {integrity: sha512-SXm5vCO/Rt5JoY9se35jA4zz8iqgA0bgbcM/qVOrTnd1DUFWUP9Tss0g+UExhqEcvUxo/QPfuwk8qVYDH3A7gg==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1120,8 +1120,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-darwin-x64@2.0.0-alpha.10: - resolution: {integrity: sha512-xqPUC5uI6zo5+1IXSwZLj1uyRWCeZgQgpyaExGDOYBjcC8HUc2NRdFGsGVtGhFWE+HftppD9p8elJLQM90B02w==} + /@tauri-apps/cli-darwin-x64@2.0.0-alpha.11: + resolution: {integrity: sha512-usboHzRGITRcT4YM6CC7M11EpgO1pormVhOb2OzhkUmt7m0HTwKDswZL7YER5Kx82RaMqXmt8MKF5q14HZqzkg==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1129,8 +1129,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-alpha.10: - resolution: {integrity: sha512-UpjG9qpF/7fkfrBoM6N+Lo08HRAKR9k7LENAFU+zd81JestxOCs0hxuX2/lGkVydtOuSXfVvMn1W5YpGKkgp3A==} + /@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-alpha.11: + resolution: {integrity: sha512-yAcJOpTnijxSmvxwkbRmHNBmFGo0UyA9qunboDaSppQQqlEozGMwQe6yASUpBdjzRaECbygoiiNez9dHOnQfOg==} engines: {node: '>= 10'} cpu: [arm] os: [linux] @@ -1138,8 +1138,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-arm64-gnu@2.0.0-alpha.10: - resolution: {integrity: sha512-Pc8seZINcbHDgOC0ThZ5EPUqOYbL94wEUecKkiaKn7gCl3/ZyIlRte5gizBeLwmnG4fkSLZc0UMvRilu4hGK3g==} + /@tauri-apps/cli-linux-arm64-gnu@2.0.0-alpha.11: + resolution: {integrity: sha512-tPYRhxZjAKaBcpN5WerHO39PEru9Uql8milTgp+rD+uu5C0cqUTR524YoffuIox38zB4skq7y8sQCT+oivDLkQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1147,8 +1147,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-arm64-musl@2.0.0-alpha.10: - resolution: {integrity: sha512-ZlaBbJq5yXP6VmNOrUGgSDnM1JcDsYf7XfVOm/kLVVrZ3iEzYA18v4SZH2kR18bU7h5+YVCPwwnfD+B8ROGidA==} + /@tauri-apps/cli-linux-arm64-musl@2.0.0-alpha.11: + resolution: {integrity: sha512-E+FJ9nnaYcsmm88u8GZOmmiHG/3qG4guF/k7r7Y3v5N9I1NFyiEr8hg5WeHBNBZoepHSrtBRQ0Ov2Bq58hqOzg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1156,8 +1156,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-x64-gnu@2.0.0-alpha.10: - resolution: {integrity: sha512-7fo0u56URSFZwJpwPMeNiYypbgYcT8i5KPMe1CQgWW19sJLHBMK1Kd0L8SeAZDlCPpY2coNifAdEm3C7Ca7xMQ==} + /@tauri-apps/cli-linux-x64-gnu@2.0.0-alpha.11: + resolution: {integrity: sha512-Rvy/r0HI2RmE+D+0EUAs5xlIa4zMxQ421PTrOY0WmyTHrjxx/M4TX3D4oJnZsKrLjQ3L8OFvV6A632BJnxpAuA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1165,8 +1165,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-x64-musl@2.0.0-alpha.10: - resolution: {integrity: sha512-9lY7YJmsm7SndlIxKzj/faX/bYX1q0dib88kpxT2xW4qNt9RihTI6PST1PDce5DmEoheLU9Xp9ere8SfoHgE2A==} + /@tauri-apps/cli-linux-x64-musl@2.0.0-alpha.11: + resolution: {integrity: sha512-QT1TH+QieJKDT8YOyUKRIdcnMZgeH/vGdkzkmXbKaGURcYEjsh8qHelYzE+2oyWt8VBIJJXV7DcbNX6g4Q+fMA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1174,8 +1174,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-win32-arm64-msvc@2.0.0-alpha.10: - resolution: {integrity: sha512-tJOHIy13vjYRkfw7++aRDQEb5CVzVQKDiJ35Zg4I8YcaPExgj6LKCpDo8N8AD4RXy4SnYKzqYTt8K9xcyIonzA==} + /@tauri-apps/cli-win32-arm64-msvc@2.0.0-alpha.11: + resolution: {integrity: sha512-ggGRBzdND1lEYlZ31ujeYvVAKZh/vHjnx7Q5Gsi4Bu3e9pSt3sId0G5G2OXH7WyxftaDUzfsLfKknE3cQwX9rA==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1183,8 +1183,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-win32-ia32-msvc@2.0.0-alpha.10: - resolution: {integrity: sha512-DN4TlOU8e6cRRVXAnldHhfDDr0ER000fojJ/Vb33fgGvaXury3jBtNyKQuoscvg6T8fLUBc72O6+4tDnXlIBwQ==} + /@tauri-apps/cli-win32-ia32-msvc@2.0.0-alpha.11: + resolution: {integrity: sha512-P32D6CvyzVB+5pPDxcKSoIClGB0el5rzaDne8jVS/VR+IidYp1oCP5wAsF9h+ldEsdesAbsbtWaMKS36kxgA2g==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1192,8 +1192,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-win32-x64-msvc@2.0.0-alpha.10: - resolution: {integrity: sha512-H5Y+L7H24n9EVB/Dw5HHGo+wQZHTLVgWrkOwsxqssDhTPiM5CbEuyjEf/B1y8uqp4YoIlw5t7Db+GBg12KejAA==} + /@tauri-apps/cli-win32-x64-msvc@2.0.0-alpha.11: + resolution: {integrity: sha512-a3geg/sWR7+qfTuoQGFK13YlHlip47XYnMXtoaC+SAXJ7Pur+/m48PZgxYy5mwvI2ApNUTgkMO5ZwdeeK2sh5g==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -1201,21 +1201,21 @@ packages: dev: true optional: true - /@tauri-apps/cli@2.0.0-alpha.10: - resolution: {integrity: sha512-8SkTAxg5J06f7BWgJjNt1NEBPRsffmj4X+PckHX3ZguZd8xqpGtACufUg0zVqaFZPmd+9OCvoEJSP5veO4utDQ==} + /@tauri-apps/cli@2.0.0-alpha.11: + resolution: {integrity: sha512-akkxK6lkPyo27F7+GHJuZTEUWwaX5yKRXrDhir+DAzEH4Gt/EZ+GsPFPgSV1EBQzDZGdMGpRovuftIky7m0TZw==} engines: {node: '>= 10'} hasBin: true optionalDependencies: - '@tauri-apps/cli-darwin-arm64': 2.0.0-alpha.10 - '@tauri-apps/cli-darwin-x64': 2.0.0-alpha.10 - '@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-alpha.10 - '@tauri-apps/cli-linux-arm64-gnu': 2.0.0-alpha.10 - '@tauri-apps/cli-linux-arm64-musl': 2.0.0-alpha.10 - '@tauri-apps/cli-linux-x64-gnu': 2.0.0-alpha.10 - '@tauri-apps/cli-linux-x64-musl': 2.0.0-alpha.10 - '@tauri-apps/cli-win32-arm64-msvc': 2.0.0-alpha.10 - '@tauri-apps/cli-win32-ia32-msvc': 2.0.0-alpha.10 - '@tauri-apps/cli-win32-x64-msvc': 2.0.0-alpha.10 + '@tauri-apps/cli-darwin-arm64': 2.0.0-alpha.11 + '@tauri-apps/cli-darwin-x64': 2.0.0-alpha.11 + '@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-alpha.11 + '@tauri-apps/cli-linux-arm64-gnu': 2.0.0-alpha.11 + '@tauri-apps/cli-linux-arm64-musl': 2.0.0-alpha.11 + '@tauri-apps/cli-linux-x64-gnu': 2.0.0-alpha.11 + '@tauri-apps/cli-linux-x64-musl': 2.0.0-alpha.11 + '@tauri-apps/cli-win32-arm64-msvc': 2.0.0-alpha.11 + '@tauri-apps/cli-win32-ia32-msvc': 2.0.0-alpha.11 + '@tauri-apps/cli-win32-x64-msvc': 2.0.0-alpha.11 dev: true /@tauri-apps/toml@2.2.4: diff --git a/shared/template/package.json b/shared/template/package.json index 58309e19..ae154257 100644 --- a/shared/template/package.json +++ b/shared/template/package.json @@ -27,6 +27,6 @@ "tslib": "2.6.0" }, "dependencies": { - "@tauri-apps/api": "2.0.0-alpha.5" + "@tauri-apps/api": "2.0.0-alpha.6" } }