From ef67ab362962c91cf6dbf7c282a592d704aef5c6 Mon Sep 17 00:00:00 2001 From: stan44 Date: Mon, 2 Mar 2026 18:45:49 -0600 Subject: [PATCH] node_modulesbs --- node_modules/.package-lock.json | 26 - node_modules/.sdt-deps.sha256 | 1 - node_modules/@tauri-apps/api/CHANGELOG.md | 1041 --------- .../@tauri-apps/api/LICENSE_APACHE-2.0 | 177 -- node_modules/@tauri-apps/api/LICENSE_MIT | 21 - node_modules/@tauri-apps/api/README.md | 52 - node_modules/@tauri-apps/api/app.cjs | 235 -- node_modules/@tauri-apps/api/app.d.ts | 220 -- node_modules/@tauri-apps/api/app.js | 221 -- node_modules/@tauri-apps/api/core.cjs | 295 --- node_modules/@tauri-apps/api/core.d.ts | 193 -- node_modules/@tauri-apps/api/core.js | 283 --- node_modules/@tauri-apps/api/dpi.cjs | 347 --- node_modules/@tauri-apps/api/dpi.d.ts | 289 --- node_modules/@tauri-apps/api/dpi.js | 340 --- node_modules/@tauri-apps/api/event.cjs | 163 -- node_modules/@tauri-apps/api/event.d.ts | 145 -- node_modules/@tauri-apps/api/event.js | 158 -- .../api/external/tslib/tslib.es6.cjs | 39 - .../api/external/tslib/tslib.es6.js | 36 - node_modules/@tauri-apps/api/image.cjs | 88 - node_modules/@tauri-apps/api/image.d.ts | 57 - node_modules/@tauri-apps/api/image.js | 85 - node_modules/@tauri-apps/api/index.cjs | 29 - node_modules/@tauri-apps/api/index.d.ts | 33 - node_modules/@tauri-apps/api/index.js | 24 - node_modules/@tauri-apps/api/menu.cjs | 30 - node_modules/@tauri-apps/api/menu.d.ts | 12 - node_modules/@tauri-apps/api/menu.js | 16 - node_modules/@tauri-apps/api/menu/base.cjs | 100 - node_modules/@tauri-apps/api/menu/base.d.ts | 18 - node_modules/@tauri-apps/api/menu/base.js | 97 - .../@tauri-apps/api/menu/checkMenuItem.cjs | 68 - .../@tauri-apps/api/menu/checkMenuItem.d.ts | 32 - .../@tauri-apps/api/menu/checkMenuItem.js | 66 - .../@tauri-apps/api/menu/iconMenuItem.cjs | 187 -- .../@tauri-apps/api/menu/iconMenuItem.d.ts | 160 -- .../@tauri-apps/api/menu/iconMenuItem.js | 185 -- node_modules/@tauri-apps/api/menu/menu.cjs | 148 -- node_modules/@tauri-apps/api/menu/menu.d.ts | 86 - node_modules/@tauri-apps/api/menu/menu.js | 146 -- .../@tauri-apps/api/menu/menuItem.cjs | 53 - .../@tauri-apps/api/menu/menuItem.d.ts | 31 - node_modules/@tauri-apps/api/menu/menuItem.js | 51 - .../api/menu/predefinedMenuItem.cjs | 33 - .../api/menu/predefinedMenuItem.d.ts | 95 - .../api/menu/predefinedMenuItem.js | 31 - node_modules/@tauri-apps/api/menu/submenu.cjs | 203 -- .../@tauri-apps/api/menu/submenu.d.ts | 97 - node_modules/@tauri-apps/api/menu/submenu.js | 200 -- node_modules/@tauri-apps/api/mocks.cjs | 297 --- node_modules/@tauri-apps/api/mocks.d.ts | 177 -- node_modules/@tauri-apps/api/mocks.js | 292 --- node_modules/@tauri-apps/api/package.json | 63 - node_modules/@tauri-apps/api/path.cjs | 753 ------ node_modules/@tauri-apps/api/path.d.ts | 589 ----- node_modules/@tauri-apps/api/path.js | 719 ------ node_modules/@tauri-apps/api/tray.cjs | 188 -- node_modules/@tauri-apps/api/tray.d.ts | 219 -- node_modules/@tauri-apps/api/tray.js | 186 -- node_modules/@tauri-apps/api/webview.cjs | 594 ----- node_modules/@tauri-apps/api/webview.d.ts | 612 ----- node_modules/@tauri-apps/api/webview.js | 590 ----- .../@tauri-apps/api/webviewWindow.cjs | 211 -- .../@tauri-apps/api/webviewWindow.d.ts | 123 - node_modules/@tauri-apps/api/webviewWindow.js | 207 -- node_modules/@tauri-apps/api/window.cjs | 2051 ----------------- node_modules/@tauri-apps/api/window.d.ts | 1803 --------------- node_modules/@tauri-apps/api/window.js | 2038 ---------------- .../tauri-plugin-mic-recorder-api/LICENSE | 21 - .../tauri-plugin-mic-recorder-api/README.md | 95 - .../dist-js/index.cjs | 43 - .../dist-js/index.d.ts | 31 - .../dist-js/index.js | 39 - .../package.json | 48 - 75 files changed, 18732 deletions(-) delete mode 100644 node_modules/.package-lock.json delete mode 100644 node_modules/.sdt-deps.sha256 delete mode 100644 node_modules/@tauri-apps/api/CHANGELOG.md delete mode 100644 node_modules/@tauri-apps/api/LICENSE_APACHE-2.0 delete mode 100644 node_modules/@tauri-apps/api/LICENSE_MIT delete mode 100644 node_modules/@tauri-apps/api/README.md delete mode 100644 node_modules/@tauri-apps/api/app.cjs delete mode 100644 node_modules/@tauri-apps/api/app.d.ts delete mode 100644 node_modules/@tauri-apps/api/app.js delete mode 100644 node_modules/@tauri-apps/api/core.cjs delete mode 100644 node_modules/@tauri-apps/api/core.d.ts delete mode 100644 node_modules/@tauri-apps/api/core.js delete mode 100644 node_modules/@tauri-apps/api/dpi.cjs delete mode 100644 node_modules/@tauri-apps/api/dpi.d.ts delete mode 100644 node_modules/@tauri-apps/api/dpi.js delete mode 100644 node_modules/@tauri-apps/api/event.cjs delete mode 100644 node_modules/@tauri-apps/api/event.d.ts delete mode 100644 node_modules/@tauri-apps/api/event.js delete mode 100644 node_modules/@tauri-apps/api/external/tslib/tslib.es6.cjs delete mode 100644 node_modules/@tauri-apps/api/external/tslib/tslib.es6.js delete mode 100644 node_modules/@tauri-apps/api/image.cjs delete mode 100644 node_modules/@tauri-apps/api/image.d.ts delete mode 100644 node_modules/@tauri-apps/api/image.js delete mode 100644 node_modules/@tauri-apps/api/index.cjs delete mode 100644 node_modules/@tauri-apps/api/index.d.ts delete mode 100644 node_modules/@tauri-apps/api/index.js delete mode 100644 node_modules/@tauri-apps/api/menu.cjs delete mode 100644 node_modules/@tauri-apps/api/menu.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu.js delete mode 100644 node_modules/@tauri-apps/api/menu/base.cjs delete mode 100644 node_modules/@tauri-apps/api/menu/base.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu/base.js delete mode 100644 node_modules/@tauri-apps/api/menu/checkMenuItem.cjs delete mode 100644 node_modules/@tauri-apps/api/menu/checkMenuItem.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu/checkMenuItem.js delete mode 100644 node_modules/@tauri-apps/api/menu/iconMenuItem.cjs delete mode 100644 node_modules/@tauri-apps/api/menu/iconMenuItem.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu/iconMenuItem.js delete mode 100644 node_modules/@tauri-apps/api/menu/menu.cjs delete mode 100644 node_modules/@tauri-apps/api/menu/menu.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu/menu.js delete mode 100644 node_modules/@tauri-apps/api/menu/menuItem.cjs delete mode 100644 node_modules/@tauri-apps/api/menu/menuItem.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu/menuItem.js delete mode 100644 node_modules/@tauri-apps/api/menu/predefinedMenuItem.cjs delete mode 100644 node_modules/@tauri-apps/api/menu/predefinedMenuItem.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu/predefinedMenuItem.js delete mode 100644 node_modules/@tauri-apps/api/menu/submenu.cjs delete mode 100644 node_modules/@tauri-apps/api/menu/submenu.d.ts delete mode 100644 node_modules/@tauri-apps/api/menu/submenu.js delete mode 100644 node_modules/@tauri-apps/api/mocks.cjs delete mode 100644 node_modules/@tauri-apps/api/mocks.d.ts delete mode 100644 node_modules/@tauri-apps/api/mocks.js delete mode 100644 node_modules/@tauri-apps/api/package.json delete mode 100644 node_modules/@tauri-apps/api/path.cjs delete mode 100644 node_modules/@tauri-apps/api/path.d.ts delete mode 100644 node_modules/@tauri-apps/api/path.js delete mode 100644 node_modules/@tauri-apps/api/tray.cjs delete mode 100644 node_modules/@tauri-apps/api/tray.d.ts delete mode 100644 node_modules/@tauri-apps/api/tray.js delete mode 100644 node_modules/@tauri-apps/api/webview.cjs delete mode 100644 node_modules/@tauri-apps/api/webview.d.ts delete mode 100644 node_modules/@tauri-apps/api/webview.js delete mode 100644 node_modules/@tauri-apps/api/webviewWindow.cjs delete mode 100644 node_modules/@tauri-apps/api/webviewWindow.d.ts delete mode 100644 node_modules/@tauri-apps/api/webviewWindow.js delete mode 100644 node_modules/@tauri-apps/api/window.cjs delete mode 100644 node_modules/@tauri-apps/api/window.d.ts delete mode 100644 node_modules/@tauri-apps/api/window.js delete mode 100644 node_modules/tauri-plugin-mic-recorder-api/LICENSE delete mode 100644 node_modules/tauri-plugin-mic-recorder-api/README.md delete mode 100644 node_modules/tauri-plugin-mic-recorder-api/dist-js/index.cjs delete mode 100644 node_modules/tauri-plugin-mic-recorder-api/dist-js/index.d.ts delete mode 100644 node_modules/tauri-plugin-mic-recorder-api/dist-js/index.js delete mode 100644 node_modules/tauri-plugin-mic-recorder-api/package.json diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json deleted file mode 100644 index 4304b8a..0000000 --- a/node_modules/.package-lock.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "DevTool-master", - "lockfileVersion": 3, - "requires": true, - "packages": { - "node_modules/@tauri-apps/api": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.10.1.tgz", - "integrity": "sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==", - "license": "Apache-2.0 OR MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/tauri" - } - }, - "node_modules/tauri-plugin-mic-recorder-api": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tauri-plugin-mic-recorder-api/-/tauri-plugin-mic-recorder-api-2.0.0.tgz", - "integrity": "sha512-04wqYCX4WIlYd6KUY7aS3+W4B5RtnSoVczaQCBSXKpQkEx9XdaaBN05XCee2unxGva0btSXBItFqQSdosnS4jQ==", - "license": "MIT", - "dependencies": { - "@tauri-apps/api": ">=2.0.0-beta.6" - } - } - } -} diff --git a/node_modules/.sdt-deps.sha256 b/node_modules/.sdt-deps.sha256 deleted file mode 100644 index ed053a1..0000000 --- a/node_modules/.sdt-deps.sha256 +++ /dev/null @@ -1 +0,0 @@ -9241cd740a6b6aa9ccbad93df22cafe05a801f777e6113df8118981c3a438e58 \ No newline at end of file diff --git a/node_modules/@tauri-apps/api/CHANGELOG.md b/node_modules/@tauri-apps/api/CHANGELOG.md deleted file mode 100644 index 5af6867..0000000 --- a/node_modules/@tauri-apps/api/CHANGELOG.md +++ /dev/null @@ -1,1041 +0,0 @@ -# Changelog - -## \[2.10.1] - -### Bug Fixes - -- Re-release of `2.10.0` with working assets. - -## \[2.10.0] - -### Dependencies - -- [`517b81e97`](https://www.github.com/tauri-apps/tauri/commit/517b81e97005d087ca5fc4538d954982fce0f4ac) ([#14876](https://www.github.com/tauri-apps/tauri/pull/14876)) Upgraded to `tauri@2.10` - -## \[2.9.1] - -### Bug Fixes - -- [`ad1dec2e2`](https://www.github.com/tauri-apps/tauri/commit/ad1dec2e2488fe5c0a004b69f1bd290dfc593bf8) ([#14464](https://www.github.com/tauri-apps/tauri/pull/14464) by [@funnydino](https://www.github.com/tauri-apps/tauri/../../funnydino)) Fix `addPluginListener` fallback added in https://github.com/tauri-apps/tauri/pull/14132 didn't work properly - -## \[2.9.0] - -### New Features - -- [`f5851ee00`](https://www.github.com/tauri-apps/tauri/commit/f5851ee00d6d1f4d560a220ca5a728fedd525092) ([#14089](https://www.github.com/tauri-apps/tauri/pull/14089)) Adds the `scrollBarStyle` option to the Webview and WebviewBuilder constructors. -- [`3397fd9bf`](https://www.github.com/tauri-apps/tauri/commit/3397fd9bfe5f6b1337110149f6c34731b8a44bb3) ([#14133](https://www.github.com/tauri-apps/tauri/pull/14133)) Added `app > onBackButtonPress` for Android back button handling. - -### Enhancements - -- [`59089723f`](https://www.github.com/tauri-apps/tauri/commit/59089723fc20d66f3f305f2008adeb279bf87462) ([#14091](https://www.github.com/tauri-apps/tauri/pull/14091)) Added a config to set a data_directory relative to the app-specific data dir in JavaScript and `tauri.conf.json`. - -### Bug Fixes - -- [`08bda64c2`](https://www.github.com/tauri-apps/tauri/commit/08bda64c25008bd45c5b58d06ff14649081a2f5d) ([#14132](https://www.github.com/tauri-apps/tauri/pull/14132)) Fix `core > addPluginListener` failing on command permission check. - -## \[2.8.0] - -### New Features - -- [`68874c68c`](https://www.github.com/tauri-apps/tauri/commit/68874c68c566638b4c21a3aa67844d1bdaeb6dab) ([#13564](https://www.github.com/tauri-apps/tauri/pull/13564) by [@robertrpf](https://www.github.com/tauri-apps/tauri/../../robertrpf)) Add window focusable attribute and set_focusable API. -- [`5110a762e`](https://www.github.com/tauri-apps/tauri/commit/5110a762e9db978a28a15400bf76e3c864da2a86) ([#13830](https://www.github.com/tauri-apps/tauri/pull/13830) by [@Sky-walkerX](https://www.github.com/tauri-apps/tauri/../../Sky-walkerX)) Added `Window::setSimpleFullscreen`. - -### Enhancements - -- [`5ba1c3faa`](https://www.github.com/tauri-apps/tauri/commit/5ba1c3faa468073512bdb5035a01f7f99720fcf0) ([#13722](https://www.github.com/tauri-apps/tauri/pull/13722) by [@s00d](https://www.github.com/tauri-apps/tauri/../../s00d)) Added icon (icon and nativeIcon) support for Submenu: - - - In the Rust API (`tauri`), you can now set an icon for submenus via the builder and dedicated methods. - - In the JS/TS API (`@tauri-apps/api`), `SubmenuOptions` now has an `icon` field, and the `Submenu` class provides `setIcon` and `setNativeIcon` methods. - - Usage examples are added to the documentation and demo app. - - This is a backwards-compatible feature. Submenus can now display icons just like regular menu items. - -## \[2.7.0] - -### New Features - -- [`232265c70`](https://www.github.com/tauri-apps/tauri/commit/232265c70e1c213bbb3f84b5541ddc07d330fce1) ([#13209](https://www.github.com/tauri-apps/tauri/pull/13209) by [@kandrelczyk](https://www.github.com/tauri-apps/tauri/../../kandrelczyk)) Added `getBundleType` to the app module. - -### Enhancements - -- [`96391467e`](https://www.github.com/tauri-apps/tauri/commit/96391467e967c1e3c6475ce75166c58a326116a3) ([#13783](https://www.github.com/tauri-apps/tauri/pull/13783) by [@JosephBrooksbank](https://www.github.com/tauri-apps/tauri/../../JosephBrooksbank)) Allow events emitted with `emit` to be handled correctly by `listen` callbacks when in a mocked environment - -### Bug Fixes - -- [`152d971bc`](https://www.github.com/tauri-apps/tauri/commit/152d971bcd6c1fdc5716f7d5417dd4df5ce7479f) ([#13744](https://www.github.com/tauri-apps/tauri/pull/13744) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Expose `unregisterCallback`, `runCallback`, `callbacks` in `mockIPC` -- [`b821796ad`](https://www.github.com/tauri-apps/tauri/commit/b821796add33cca4de72f48882684af487936d02) ([#13810](https://www.github.com/tauri-apps/tauri/pull/13810) by [@asdolo](https://www.github.com/tauri-apps/tauri/../../asdolo)) Add missing `trafficLightPosition` TypeScript type definition - -## \[2.6.0] - -### New Features - -- [`50ebddaa2`](https://www.github.com/tauri-apps/tauri/commit/50ebddaa2d83033a393a176ba07ef28352b98210) ([#13319](https://www.github.com/tauri-apps/tauri/pull/13319) by [@kingsword09](https://www.github.com/tauri-apps/tauri/../../kingsword09)) Expose the `setAutoResize` API for webviews in `@tauri-apps/api`. -- [`267368fd4`](https://www.github.com/tauri-apps/tauri/commit/267368fd4f83e0a71dfb1b72a66d56592a2066bc) ([#13276](https://www.github.com/tauri-apps/tauri/pull/13276) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `Monitor.workArea` field. - -### Bug Fixes - -- [`23b9da75b`](https://www.github.com/tauri-apps/tauri/commit/23b9da75b91379cca9520bc53b10fdf39ebae241) ([#13324](https://www.github.com/tauri-apps/tauri/pull/13324) by [@kingsword09](https://www.github.com/tauri-apps/tauri/../../kingsword09)) Fixed path joining behavior where `path.join('', 'a')` incorrectly returns "/a" instead of "a". -- [`b985eaf0a`](https://www.github.com/tauri-apps/tauri/commit/b985eaf0a231ea570e36d686c665cddbc76ab4f6) ([#13306](https://www.github.com/tauri-apps/tauri/pull/13306) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Immediately unregister event listener when the unlisten function is called. - -### What's Changed - -- [`b5c549d18`](https://www.github.com/tauri-apps/tauri/commit/b5c549d1898ecdb712822c02dc665cc6771fbd07) ([#13325](https://www.github.com/tauri-apps/tauri/pull/13325) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) `transformCallback` now registers the callbacks inside `window.__TAURI_INTERNALS__.callbacks` instead of directly on `window['_{id}']` - -## \[2.5.0] - -### New Features - -- [`66e6325f4`](https://www.github.com/tauri-apps/tauri/commit/66e6325f43efa49ec2165c45afec911a1a14ecfb) ([#13136](https://www.github.com/tauri-apps/tauri/pull/13136)) Allow passing the callback as the parameter of constructor of `Channel` so you can use it like this `new Channel((message) => console.log(message))` -- [`ea36294cb`](https://www.github.com/tauri-apps/tauri/commit/ea36294cbca98f7725c91d1464fd92e77c89698a) ([#13208](https://www.github.com/tauri-apps/tauri/pull/13208)) Added `disableInputAccessoryView: bool` config for iOS. -- [`c1cd0a2dd`](https://www.github.com/tauri-apps/tauri/commit/c1cd0a2ddb5bc3e99451cbe399b5fc9f0035f571) ([#13090](https://www.github.com/tauri-apps/tauri/pull/13090)) macOS/iOS: add option to disable or enable link previews when building a webview (the webkit api has it enabled by default) - - - `WindowOptions::allowLinkPreview` - - `WebviewOptions::allowLinkPreview` -- [`b072e2b29`](https://www.github.com/tauri-apps/tauri/commit/b072e2b2967640ae4fa1af466ae878c156551edd) ([#9687](https://www.github.com/tauri-apps/tauri/pull/9687)) Add `preventOverflow` config option to prevent the window from overflowing the monitor size on creation -- [`dd4f13ce4`](https://www.github.com/tauri-apps/tauri/commit/dd4f13ce4b3cd89cde2fa3f18a063c272f215621) ([#13185](https://www.github.com/tauri-apps/tauri/pull/13185)) Added `app.setDockVisibility` for macOS. - -### Enhancements - -- [`b8f86669a`](https://www.github.com/tauri-apps/tauri/commit/b8f86669ab05f7dbdd15839a20999e63dc43bda6) ([#13145](https://www.github.com/tauri-apps/tauri/pull/13145)) `core.isTauri` now leverages `globalThis` instead of `window` in order to be used in unit tests. - -### Bug Fixes - -- [`66e6325f4`](https://www.github.com/tauri-apps/tauri/commit/66e6325f43efa49ec2165c45afec911a1a14ecfb) ([#13136](https://www.github.com/tauri-apps/tauri/pull/13136)) Fix `Channel`'s callback attached to `window` never cleaned up - -## \[2.4.1] - -### Enhancements - -- [`dd1372833`](https://www.github.com/tauri-apps/tauri/commit/dd137283341ce0e6aabfd158d07d77c6feeb920e) ([#13066](https://www.github.com/tauri-apps/tauri/pull/13066) by [@ahaoboy](https://www.github.com/tauri-apps/tauri/../../ahaoboy)) Add a generic to `emit` and `emitTo` functions for the `payload` instead of the previously used type (`unknown`). - -## \[2.4.0] - -### New Features - -- [`d8059bad3`](https://www.github.com/tauri-apps/tauri/commit/d8059bad3cc922dc369c39ca1cfa49aaec31322e) ([#12900](https://www.github.com/tauri-apps/tauri/pull/12900) by [@Simon-Laux](https://www.github.com/tauri-apps/tauri/../../Simon-Laux)) add `AppHandle.fetch_data_store_identifiers` and `AppHandle.remove_data_store` (macOS and iOS only) -- [`20c190691`](https://www.github.com/tauri-apps/tauri/commit/20c19069125c89b2d45a2127278c9ffc2df35fc2) ([#12821](https://www.github.com/tauri-apps/tauri/pull/12821) by [@Simon-Laux](https://www.github.com/tauri-apps/tauri/../../Simon-Laux)) Added `WindowOptions::javascriptDisabled` and `WebviewOptions::javascriptDisabled`. -- [`060de5bbd`](https://www.github.com/tauri-apps/tauri/commit/060de5bbdddca384e3965a8938d89840f27c581d) ([#12837](https://www.github.com/tauri-apps/tauri/pull/12837) by [@niladrix719](https://www.github.com/tauri-apps/tauri/../../niladrix719)) Added `getIdentifier()` function to get the application identifier configured in tauri.conf.json -- [`be2e6b85f`](https://www.github.com/tauri-apps/tauri/commit/be2e6b85fed226732b4a98f68cc5d72b4f8f5a13) ([#12944](https://www.github.com/tauri-apps/tauri/pull/12944) by [@Simon-Laux](https://www.github.com/tauri-apps/tauri/../../Simon-Laux)) Added `Window#isAlwaysOnTop` and `WebviewWindow#isAlwaysOnTop` methods. -- [`bcdd51025`](https://www.github.com/tauri-apps/tauri/commit/bcdd510254ebe37827e22a5ffeb944321361e97c) ([#13012](https://www.github.com/tauri-apps/tauri/pull/13012) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) The `path` basename and extname APIs now accept Android content URIs, such as the paths returned by the dialog plugin. - -### Bug Fixes - -- [`3a74dc8f3`](https://www.github.com/tauri-apps/tauri/commit/3a74dc8f3421112b1d0a32b6a432606b1f33cc25) ([#12935](https://www.github.com/tauri-apps/tauri/pull/12935) by [@tk103331](https://www.github.com/tauri-apps/tauri/../../tk103331)) Fix `Webview.close` always fail with command not found - -## \[2.3.0] - -### Enhancements - -- [`a2d36b8c3`](https://www.github.com/tauri-apps/tauri/commit/a2d36b8c34a8dcfc6736797ca5cd4665faf75e7e) ([#12181](https://www.github.com/tauri-apps/tauri/pull/12181) by [@bastiankistner](https://www.github.com/tauri-apps/tauri/../../bastiankistner)) Add an option to change the default background throttling policy (currently for WebKit only). - -## \[2.2.0] - -### New Features - -- [`020ea0556`](https://www.github.com/tauri-apps/tauri/commit/020ea05561348dcd6d2a7df358f8a5190f661ba2) ([#11661](https://www.github.com/tauri-apps/tauri/pull/11661) by [@ahqsoftwares](https://www.github.com/tauri-apps/tauri/../../ahqsoftwares)) Add badging APIs: - - - `Window/WebviewWindow::set_badge_count` for Linux, macOS and IOS. - - `Window/WebviewWindow::set_overlay_icon` for Windows Only. - - `Window/WebviewWindow::set_badge_label`for macOS Only. -- [`fc30b20be`](https://www.github.com/tauri-apps/tauri/commit/fc30b20bea125f647db00ca824663f8e1da4d61f) ([#11726](https://www.github.com/tauri-apps/tauri/pull/11726) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `TrayIcon.setShowMenuOnLeftClick` method and deprecate `TrayIcon.setMenuOnLeftClick` to match the Rust API. -- [`fc30b20be`](https://www.github.com/tauri-apps/tauri/commit/fc30b20bea125f647db00ca824663f8e1da4d61f) ([#11726](https://www.github.com/tauri-apps/tauri/pull/11726) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `TrayIconOptions.showMenuOnLeftClick` field and deprecate `TrayIconOptions.menuOnLeftClick` to match the Rust API. - -### Enhancements - -- [`fc30b20be`](https://www.github.com/tauri-apps/tauri/commit/fc30b20bea125f647db00ca824663f8e1da4d61f) ([#11726](https://www.github.com/tauri-apps/tauri/pull/11726) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add support for `TrayIconOptions.menuOnLeftClick` option and `TrayIcon.setMenuOnLeftClick` on Windows. - -### Bug Fixes - -- [`a16796a55`](https://www.github.com/tauri-apps/tauri/commit/a16796a55592cf5be80043edfbb630dd2e32efab) ([#12069](https://www.github.com/tauri-apps/tauri/pull/12069) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Fix `Channel` never calls `onmessage` in some cases -- [`12a48d1e2`](https://www.github.com/tauri-apps/tauri/commit/12a48d1e26a83c3915eaa0687b196fbc8f2d457a) ([#11741](https://www.github.com/tauri-apps/tauri/pull/11741) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Fix error when calling `PredefinedMenuItem.new` to create an `About` menu item that uses an `Image` instance for the about icon. -- [`12a48d1e2`](https://www.github.com/tauri-apps/tauri/commit/12a48d1e26a83c3915eaa0687b196fbc8f2d457a) ([#11741](https://www.github.com/tauri-apps/tauri/pull/11741) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Fix error when calling `IconMenuItem.new` using an `Image` instance for the icon. -- [`b63262cd4`](https://www.github.com/tauri-apps/tauri/commit/b63262cd4d6a3667ca1664607a0a5444ad79fe0e) ([#11724](https://www.github.com/tauri-apps/tauri/pull/11724) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Removed the generic in the type of the callback function argument in `mockIPC` which prevented its proper use in tests using TypeScript. -- [`a6e84f7d2`](https://www.github.com/tauri-apps/tauri/commit/a6e84f7d2c1d5fdc65901fce683502be3f47833f) ([#11835](https://www.github.com/tauri-apps/tauri/pull/11835) by [@ilittlebig](https://www.github.com/tauri-apps/tauri/../../ilittlebig)) Fix error where using `isAbsolute` would return `Command not found`. - -## \[2.1.1] - -### Bug Fixes - -- [`7f81f0523`](https://www.github.com/tauri-apps/tauri/commit/7f81f052365675721312aafba297a7b67fb872d2) Fix regression in `toLogical` and `toPhysical` for position types in `dpi` module returning incorrect `y` value. -- [`e8a50f6d7`](https://www.github.com/tauri-apps/tauri/commit/e8a50f6d760fad4529e7abb400302a1b487f11dd) ([#11645](https://www.github.com/tauri-apps/tauri/pull/11645)) Fix integer values of `BasDirectory.Home` and `BaseDirectory.Font` regression which broke path APIs in JS. - -## \[2.1.0] - -### New Features - -- [`5c4b83084`](https://www.github.com/tauri-apps/tauri/commit/5c4b830843ab085f8ff9db9e08d832223b027e4e) ([#11191](https://www.github.com/tauri-apps/tauri/pull/11191) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Improved support for `dpi` module types to allow these types to be used without manual conversions with `invoke`: - - - Added `SERIALIZE_TO_IPC_FN` const in `core` module which can be used to implement custom IPC serialization for types passed to `invoke`. - - Added `Size` and `Position` classes in `dpi` module. - - Implementd `SERIALIZE_TO_IPC_FN` method on `PhysicalSize`, `PhysicalPosition`, `LogicalSize` and `LogicalPosition` to convert it into a valid IPC-compatible value that can be deserialized correctly on the Rust side into its equivalent struct. -- [`4d545ab3c`](https://www.github.com/tauri-apps/tauri/commit/4d545ab3ca228c8a21b966b709f84a0da2864479) ([#11486](https://www.github.com/tauri-apps/tauri/pull/11486) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Added `Webview::setBackgroundColor`, `WebviewWindow::setBackgroundColor` APIs to set the window background color dynamically - and a `backgroundColor` window option to set the background color on window creation. -- [`cbc095ec5`](https://www.github.com/tauri-apps/tauri/commit/cbc095ec5fe7de29b5c9265576d4e071ec159c1c) ([#11451](https://www.github.com/tauri-apps/tauri/pull/11451) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `app > windows > devtools` config option and when creating the webview from JS, to enable or disable devtools for a specific webview. -- [`2a75c64b5`](https://www.github.com/tauri-apps/tauri/commit/2a75c64b5431284e7340e8743d4ea56a62c75466) ([#11469](https://www.github.com/tauri-apps/tauri/pull/11469) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Added `windowClassname` option, when constructing a `Webview` or `WebviewWindow`, to specify the name of the window class on Windows. - -### Bug Fixes - -- [`54cbf59b5`](https://www.github.com/tauri-apps/tauri/commit/54cbf59b5a572570a47237a3b5e6505f2a9e5d5d) ([#11441](https://www.github.com/tauri-apps/tauri/pull/11441) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Fix submenu created as a menu item instead of a submenu when created by using an object in the `items` field in the options object passed to `Menu.new` or `Submenu.new`. - -## \[2.0.3] - -### Bug Fixes - -- [`fbb45c674`](https://www.github.com/tauri-apps/tauri/commit/fbb45c674ca92fbbe04f1a8360e5f2e477dd4297) ([#11423](https://www.github.com/tauri-apps/tauri/pull/11423) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fixes `addPluginListener` not working. - -### What's Changed - -- [`2e88633ba`](https://www.github.com/tauri-apps/tauri/commit/2e88633ba4da8fc289c6d8a29c36f3327f9b576e) ([#11369](https://www.github.com/tauri-apps/tauri/pull/11369) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Remove references to no longer used `__TAURI_INTERNALS__.metadata.windows` and `__TAURI_INTERNALS__.metadata.webviews`. - -## \[2.0.2] - -### What's Changed - -- [`e968b3d25`](https://www.github.com/tauri-apps/tauri/commit/e968b3d2527b8edf7653e6cf7284dc4a8889b5fe) ([#11219](https://www.github.com/tauri-apps/tauri/pull/11219) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Actually publish package with the latest tag. - -## \[2.0.1] - -### What's Changed - -- [`be683e2ac`](https://www.github.com/tauri-apps/tauri/commit/be683e2ac36df9c51a5c050d9d500247bd019090) ([#11199](https://www.github.com/tauri-apps/tauri/pull/11199) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Publish package with the latest NPM tag. - -## \[2.0.0] - -### What's Changed - -- [`637285790`](https://www.github.com/tauri-apps/tauri/commit/6372857905ae9c0aedb7f482ddf6cf9f9836c9f2) Promote to v2 stable! - -## \[2.0.0-rc.6] - -### New Features - -- [`9014a3f17`](https://www.github.com/tauri-apps/tauri/commit/9014a3f1765ca406ea5c3e5224267a79c52cd53d) ([#11066](https://www.github.com/tauri-apps/tauri/pull/11066) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `WebviewWindow.clearAllBrowsingData` and `Webview.clearAllBrowsingData` to clear the webview browsing data. -- [`95df53a2e`](https://www.github.com/tauri-apps/tauri/commit/95df53a2ed96873cd35a4b14a5e312d07e4e3004) ([#11143](https://www.github.com/tauri-apps/tauri/pull/11143) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Add the ability to set theme dynamically using `Window.setTheme` or `setTheme` function from the `app` module -- [`d9d2502b4`](https://www.github.com/tauri-apps/tauri/commit/d9d2502b41e39efde679e30c8955006e2ba9ea64) ([#11140](https://www.github.com/tauri-apps/tauri/pull/11140) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `Webview.hide` and `Webview.show` methods. -- [`de7414aab`](https://www.github.com/tauri-apps/tauri/commit/de7414aab935e45540594ea930eb60bae4dbc979) ([#11154](https://www.github.com/tauri-apps/tauri/pull/11154) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `Window::setEnabled` and `Window::isEnabled` methods - -### Bug Fixes - -- [`948772a65`](https://www.github.com/tauri-apps/tauri/commit/948772a657eb3caf20843628abac9109e3b67d41) ([#11114](https://www.github.com/tauri-apps/tauri/pull/11114) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Change the `button_state` tray event field to camelCase `buttonState`. - -### Breaking Changes - -- [`0b4495996`](https://www.github.com/tauri-apps/tauri/commit/0b4495996d3131a5ee80fbb2c71a28203e491ee7) ([#11121](https://www.github.com/tauri-apps/tauri/pull/11121) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Simplified emitted tray event JS value and updated `TrayIconEvent` type definition to match it. - -## \[2.0.0-rc.5] - -### New Features - -- [`ddf69157b`](https://www.github.com/tauri-apps/tauri/commit/ddf69157b54249f3321ca72db6703812019f1ab9) ([#11031](https://www.github.com/tauri-apps/tauri/pull/11031) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `toPhysical` method on `LogicalPositon` and `LogicalSize` classes. - -## \[2.0.0-rc.4] - -### Enhancements - -- [`f81929e25`](https://www.github.com/tauri-apps/tauri/commit/f81929e25104aa1091e464bd012c80649dedf9e5) ([#10799](https://www.github.com/tauri-apps/tauri/pull/10799) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Added `PermissionState`, `checkPermissions` and `requestPermissions` base APIs to the core module, designed for plugin authors to extend. - -### Bug Fixes - -- [`fbe76a955`](https://www.github.com/tauri-apps/tauri/commit/fbe76a955a63af9fb33f66d5f747caf858cf179b) ([#10797](https://www.github.com/tauri-apps/tauri/pull/10797) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Uint8Arrays and ArrayBuffers are now properly serialized as an array of numbers. - -## \[2.0.0-rc.3] - -### What's Changed - -- [`f4d5241b3`](https://www.github.com/tauri-apps/tauri/commit/f4d5241b377d0f7a1b58100ee19f7843384634ac) ([#10731](https://www.github.com/tauri-apps/tauri/pull/10731) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Update documentation icon path. - -## \[2.0.0-rc.2] - -### Bug Fixes - -- [`c689521a7`](https://www.github.com/tauri-apps/tauri/commit/c689521a7674b6562b5dfd4f5cacd12138d99d85) ([#10681](https://www.github.com/tauri-apps/tauri/pull/10681) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix tslib path in dist. - -## \[2.0.0-rc.1] - -### Breaking Changes - -- [`b6dca99ff`](https://www.github.com/tauri-apps/tauri/commit/b6dca99fff73816a39380b288c299b47b493cfdb) ([#10630](https://www.github.com/tauri-apps/tauri/pull/10630) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Changed `WebviewWindow.getAll`, `WebviewWindow.getByLabel`, `getAllWebviewWindows`, - `Window.getAll`, `Window.getByLabel`, `getAllWindows`, - `Webview.getAll`, `Webview.getByLabel`, `getAllWebviews` - to be async so their return value are synchronized with the state from the Rust side, - meaning new and destroyed windows are reflected. - -## \[2.0.0-rc.0] - -### Changes - -- Promoted to RC! - -## \[2.0.0-beta.16] - -### New Features - -- [`da25f7353`](https://www.github.com/tauri-apps/tauri/commit/da25f7353070477ba969851e974379d7666d6806) ([#10242](https://www.github.com/tauri-apps/tauri/pull/10242) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add APIs to enable setting window size constraints separately: - - - Added `WindowSizeConstraints` interface in `window` and `webviewWindow` modules. - - Added `Window.setSizeConstraints` and `WebviewWindow.setSizeConstraints` - -### Bug Fixes - -- [`3c17fb64f`](https://www.github.com/tauri-apps/tauri/commit/3c17fb64fd822597d5cc16ee7e7b3f9e1023637b) ([#10277](https://www.github.com/tauri-apps/tauri/pull/10277) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Fix `Webview.reparent` pointing to `set_webview_focus` instead of `reparent` Rust API -- [`da25f7353`](https://www.github.com/tauri-apps/tauri/commit/da25f7353070477ba969851e974379d7666d6806) ([#10242](https://www.github.com/tauri-apps/tauri/pull/10242) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Apply `minWidth`, `minHieght`, `maxWidth` and `maxHeight` constraints separately, which fixes a long standing bug where these constraints were never applied unless width and height were constrained together. - -## \[2.0.0-beta.15] - -### New Features - -- [`7bc6a2a1d`](https://www.github.com/tauri-apps/tauri/commit/7bc6a2a1d6d2c5406d91cac94d33bce76443c28f) ([#9788](https://www.github.com/tauri-apps/tauri/pull/9788) by [@pewsheen](https://www.github.com/tauri-apps/tauri/../../pewsheen)) Add a new method to set title bar style dynamically on macOS. - -### Enhancements - -- [`080b6e127`](https://www.github.com/tauri-apps/tauri/commit/080b6e12720b89d839c686d7067cc94d276ed7e4) ([#10246](https://www.github.com/tauri-apps/tauri/pull/10246) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Use `EventName` on `Window`, `Webview` and `WebviewWindow`'s `once` so you can get auto complete for tauri's built-in events - -### Bug Fixes - -- [`080b6e127`](https://www.github.com/tauri-apps/tauri/commit/080b6e12720b89d839c686d7067cc94d276ed7e4) ([#10246](https://www.github.com/tauri-apps/tauri/pull/10246) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Fix `once` doesn't detached after one callback if event handler throws - -### Breaking Changes - -- [`261c9f942`](https://www.github.com/tauri-apps/tauri/commit/261c9f942de9a598b5c6cc504de6bddd1306113b) ([#10170](https://www.github.com/tauri-apps/tauri/pull/10170) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Renamed drag and drop events in `TauriEvent` enum to better convey when they are triggered: - - - `TauriEvent.DRAG` -> `TauriEvent.DRAG_ENTER` - - `TauriEvent.DROP_OVER` -> `TauriEvent.DRAG_OVER` - - `TauriEvent.DROP` -> `TauriEvent.DRAG_DROP` - - `TauriEvent.DROP_CANCELLED` -> `TauriEvent::DRAG_LEAVE` - - Also the `type` field values in `Window/Webview/WebviewWindow.onDropEvent` and `DragDropEvent` have changed: - - - `dragged` -> `enter` - - `dragOver` -> `over` - - `dropped` -> `drop` - - `cancelled` -> `leave` -- [`2b1ceb40d`](https://www.github.com/tauri-apps/tauri/commit/2b1ceb40d345aef42dd79438fa69ca7989ee0194) ([#10229](https://www.github.com/tauri-apps/tauri/pull/10229) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Renamed the JS `getCurrent` and `getAll` functions to a clearer name to avoid ambiguity: - - - `getCurrent` in `window` module has been renamed to `getCurrentWindow` - - `getCurrent` in `webview` module has been renamed to `getCurrentWebview` - - `getCurrent` in `webviewWindow` module has been renamed to `getCurrentWebviewWindow` - - `getAll` in `window` module has been renamed to `getAllWindows` - - `getAll` in `webview` module has been renamed to `getAllWebviews` - - `getAll` in `webviewWindow` module has been renamed to `getAllWebviewWindows` - -## \[2.0.0-beta.14] - -### New Features - -- [`148f04887`](https://www.github.com/tauri-apps/tauri/commit/148f048871caee21498b236c058b8890f2b66cc7) ([#9979](https://www.github.com/tauri-apps/tauri/pull/9979)) Add `defaultWindowIcon` to the JS `app` module to retrieve the default window icon in JS. - -### Bug Fixes - -- [`c98f385cb`](https://www.github.com/tauri-apps/tauri/commit/c98f385cb5da4d72968df24b1fc0b58212d59653) ([#10044](https://www.github.com/tauri-apps/tauri/pull/10044)) Export `mocks` module in `@tauri-apps/api` npm package. - -## \[2.0.0-beta.13] - -### Breaking Changes - -- [`c4410daa8`](https://www.github.com/tauri-apps/tauri/commit/c4410daa85616340e911c8243fdaa69e6906fd49)([#9777](https://www.github.com/tauri-apps/tauri/pull/9777)) This release contains breaking changes to the tray event structure because of newly added events: - - - Changed `TrayIconEvent` to be an enum instead of a struct. - - Added `MouseButtonState` and `MouseButton` enums. - - Removed `ClickType` enum and replaced it with `MouseButton` enum. - - Added `MouseButtonState` enum. - -## \[2.0.0-beta.12] - -### New Features - -- [`ec0e092ec`](https://www.github.com/tauri-apps/tauri/commit/ec0e092ecd23b547c756c7476f23a0d95be6db80)([#9770](https://www.github.com/tauri-apps/tauri/pull/9770)) Add `monitorFromPoint` function in `window` module to get the monitor from a given point. - -## \[2.0.0-beta.11] - -### Bug Fixes - -- [`aa080696e`](https://www.github.com/tauri-apps/tauri/commit/aa080696e0952abff416dd9088d519eaf2587a3a)([#9618](https://www.github.com/tauri-apps/tauri/pull/9618)) Fix `isTauri` incorrect return type. - -## \[2.0.0-beta.10] - -### New Features - -- [`477bb8cd4`](https://www.github.com/tauri-apps/tauri/commit/477bb8cd4ea88ade3f6c1f268ad1701a68150161)([#9297](https://www.github.com/tauri-apps/tauri/pull/9297)) Add `cursorPosition` function in `window` module to get the current cursor position. - -## \[2.0.0-beta.9] - -### New Features - -- [`70c51371e`](https://www.github.com/tauri-apps/tauri/commit/70c51371e01184223312de3dba8030394a5a9406)([#9539](https://www.github.com/tauri-apps/tauri/pull/9539)) Add `isTauri` function in `core` module to check whether running inside tauri or not. - -### Bug Fixes - -- [`be7eab209`](https://www.github.com/tauri-apps/tauri/commit/be7eab209c60c45e140f7bcb4bab1037d62d4c03)([#9486](https://www.github.com/tauri-apps/tauri/pull/9486)) Set the `exports > types` package.json field. -- [`cf615e8e4`](https://www.github.com/tauri-apps/tauri/commit/cf615e8e4d5008ee1ac3f77e530ba26fb91e8977)([#9463](https://www.github.com/tauri-apps/tauri/pull/9463)) Fixes a bug when processing channel messages out of order. -- [`35b25f7e5`](https://www.github.com/tauri-apps/tauri/commit/35b25f7e5c0fe03af4ed3582e22a626863f035f0)([#9530](https://www.github.com/tauri-apps/tauri/pull/9530)) Do not use JS optional chaining to prevent script errors on older webviews such as macOS 10.14. - -## \[2.0.0-beta.8] - -### New Features - -- [`58a7a552d`](https://www.github.com/tauri-apps/tauri/commit/58a7a552d739b77b71d61af11c53f7f2dc7a6e7e)([#9378](https://www.github.com/tauri-apps/tauri/pull/9378)) Added the `set_zoom` function to the webview API. -- [`58a7a552d`](https://www.github.com/tauri-apps/tauri/commit/58a7a552d739b77b71d61af11c53f7f2dc7a6e7e)([#9378](https://www.github.com/tauri-apps/tauri/pull/9378)) Add `zoom_hotkeys_enabled` to enable browser native zoom controls on creating webviews. - -### Bug Fixes - -- [`48a7a78f8`](https://www.github.com/tauri-apps/tauri/commit/48a7a78f8094d08e5e403e88050391642d29151b)([#9376](https://www.github.com/tauri-apps/tauri/pull/9376)) Fix `Window/Webview/WebviewWindow.setSize`, `Window/Webview/WebviewWindow.setPostion`, `Window/WebviewWindow.setMinSize`, `Window/WebviewWindow.setMaxSize`, `Window/WebviewWindow.setCursorPosition` and `Menu/Submenu.popup` methods failing with invalid args. - -## \[2.0.0-beta.7] - -### Bug Fixes - -- [`c33f6e6cf`](https://www.github.com/tauri-apps/tauri/commit/c33f6e6cf35a0d34b5598875a2e5b642a01c8b38)([#9211](https://www.github.com/tauri-apps/tauri/pull/9211)) Re-added the `TauriEvent.WINDOW_CREATED` (`tauri://window-created`) event. - -### Breaking Changes - -- [`06833f4fa`](https://www.github.com/tauri-apps/tauri/commit/06833f4fa8e63ecc55fe3fc874a9e397e77a5709)([#9100](https://www.github.com/tauri-apps/tauri/pull/9100)) Rename `FileDrop` to `DragDrop` on structs, enums and enum variants. Also renamed `file_drop` to `drag_drop` on fields and function names. - -## \[2.0.0-beta.6] - -### New Features - -- [`acdd76833`](https://www.github.com/tauri-apps/tauri/commit/acdd76833db6d81f4012418133d0042220de100b)([#9155](https://www.github.com/tauri-apps/tauri/pull/9155)) Add `TrayIcon.getById` and `TrayIcon.removeById` static methods. - -### Enhancements - -- [`ea0242db4`](https://www.github.com/tauri-apps/tauri/commit/ea0242db4aa6c127d2bb4a2e275000ba47c9e68c)([#9179](https://www.github.com/tauri-apps/tauri/pull/9179)) The `Image` constructor is now public (for internal use only). - -### Bug Fixes - -- [`379cc2b35`](https://www.github.com/tauri-apps/tauri/commit/379cc2b3547395474d4b66b4222679cf4538428d)([#9165](https://www.github.com/tauri-apps/tauri/pull/9165)) Fix `basename(path, 'ext')` JS API when removing all occurances of `ext` where it should only remove the last one. - -### Breaking Changes - -- [`ea0242db4`](https://www.github.com/tauri-apps/tauri/commit/ea0242db4aa6c127d2bb4a2e275000ba47c9e68c)([#9179](https://www.github.com/tauri-apps/tauri/pull/9179)) `Image::rgba()` now returns `Promise`. -- [`ea0242db4`](https://www.github.com/tauri-apps/tauri/commit/ea0242db4aa6c127d2bb4a2e275000ba47c9e68c)([#9179](https://www.github.com/tauri-apps/tauri/pull/9179)) Removed `width` and `height` methods on the JS `Image` class, use `size` instead. - -## \[2.0.0-beta.5] - -### Breaking Changes - -- [`db0a24a97`](https://www.github.com/tauri-apps/tauri/commit/db0a24a973191752aeecfbd556faa254b0f17e79)([#9132](https://www.github.com/tauri-apps/tauri/pull/9132)) Remove the `Image.fromPngBytes` and `Image.fromIcoBytes` APIs. Use `Image.fromBytes` instead. - -## \[2.0.0-beta.4] - -### New Features - -- [`d1e77acd8`](https://www.github.com/tauri-apps/tauri/commit/d1e77acd8dfdf554b90b542513a58a2de1ef2360)([#9011](https://www.github.com/tauri-apps/tauri/pull/9011)) Add a new `Image` type in Rust and JS. - -### Enhancements - -- [`e62ca4ee9`](https://www.github.com/tauri-apps/tauri/commit/e62ca4ee95f4308a6ad128d0f100c85634e28223)([#9070](https://www.github.com/tauri-apps/tauri/pull/9070)) Added a mechanism to preserve channel message order. - -## \[2.0.0-beta.3] - -### New Features - -- [`fdcaf935`](https://www.github.com/tauri-apps/tauri/commit/fdcaf935fa75ecfa2806939c4faad4fe9e880386)([#8939](https://www.github.com/tauri-apps/tauri/pull/8939)) Added the `reparent` function to the webview API. - -## \[2.0.0-beta.2] - -### Breaking Changes - -- [`361ec37f`](https://www.github.com/tauri-apps/tauri/commit/361ec37fd4a5caa5b6630b9563ef079f53c6c336)([#8932](https://www.github.com/tauri-apps/tauri/pull/8932)) Removed the `unityUri` option from the progress bar state, no longer required. - -## \[2.0.0-beta.1] - -### New Features - -- [`16e550ec`](https://www.github.com/tauri-apps/tauri/commit/16e550ec1503765158cdc3bb2a20e70ec710e981)([#8844](https://www.github.com/tauri-apps/tauri/pull/8844)) Add a new `webviewWindow` module that exports `WebviewWindow` class and related methods such as `getCurrent` and `getAll`. -- [`16e550ec`](https://www.github.com/tauri-apps/tauri/commit/16e550ec1503765158cdc3bb2a20e70ec710e981)([#8844](https://www.github.com/tauri-apps/tauri/pull/8844)) Add `Window.onFileDropEvent` method. - -### Breaking Changes - -- [`16e550ec`](https://www.github.com/tauri-apps/tauri/commit/16e550ec1503765158cdc3bb2a20e70ec710e981)([#8844](https://www.github.com/tauri-apps/tauri/pull/8844)) Renamed the following enum variants of `TauriEvent` enum: - - - `TauriEvent.WEBVIEW_FILE_DROP` -> `TauriEvent.FILE_DROP` - - `TauriEvent.WEBVIEW_FILE_DROP_HOVER` -> `TauriEvent.FILE_DROP_HOVER` - - `TauriEvent.WEBVIEW_FILE_DROP_CANCELLED` -> `TauriEvent.FILE_DROP_CANCELLED` -- [`16e550ec`](https://www.github.com/tauri-apps/tauri/commit/16e550ec1503765158cdc3bb2a20e70ec710e981)([#8844](https://www.github.com/tauri-apps/tauri/pull/8844)) Move `WebviewWindow` class from `webview` module to a new `webviewWindow` module. - -## \[2.0.0-beta.0] - -### New Features - -- [`74a2a603`](https://www.github.com/tauri-apps/tauri/commit/74a2a6036a5e57462f161d728cbd8a6f121028ca)([#8661](https://www.github.com/tauri-apps/tauri/pull/8661)) Implement access control list for IPC usage. -- [`a093682d`](https://www.github.com/tauri-apps/tauri/commit/a093682d2df7169b024bb4f736c7f1fd2ea8b327)([#8621](https://www.github.com/tauri-apps/tauri/pull/8621)) Added `emitTo` api to `event` module which is equivalent to the rust `emit_to` method. Also added `emitTo` method on `Window`, `Webivew` and `WebviewWindow` classes. -- [`a2fc3a63`](https://www.github.com/tauri-apps/tauri/commit/a2fc3a63579ca739646d696870cbecbb3a169d33)([#8657](https://www.github.com/tauri-apps/tauri/pull/8657)) Add `visibleOnAllWorkspaces` option when creating the window in JS and `Window.setVisibleOnAllWorkspaces` method. -- [`7f033f6d`](https://www.github.com/tauri-apps/tauri/commit/7f033f6dcd54c69a4193765a5c1584755ba92c61)([#8537](https://www.github.com/tauri-apps/tauri/pull/8537)) Add `Window.startResizeDragging`. -- [`9eaeb5a8`](https://www.github.com/tauri-apps/tauri/commit/9eaeb5a8cd95ae24b5e66205bdc2763cb7f965ce)([#8622](https://www.github.com/tauri-apps/tauri/pull/8622)) Add `parent` option when creating a window. -- [`af610232`](https://www.github.com/tauri-apps/tauri/commit/af6102327376884364b2075b468bdf08ee0d02aa)([#8710](https://www.github.com/tauri-apps/tauri/pull/8710)) Added `Window::destroy` to force close a window. -- [`c77b4032`](https://www.github.com/tauri-apps/tauri/commit/c77b40324ea9bf580871fc11aed69ba0c9b6b8cf)([#8280](https://www.github.com/tauri-apps/tauri/pull/8280)) Added support to multiwebview via the new `window` and `webview` modules. - -### Breaking Changes - -- [`c77b4032`](https://www.github.com/tauri-apps/tauri/commit/c77b40324ea9bf580871fc11aed69ba0c9b6b8cf)([#8280](https://www.github.com/tauri-apps/tauri/pull/8280)) Removed event callback's `windowLabel`. -- [`c77b4032`](https://www.github.com/tauri-apps/tauri/commit/c77b40324ea9bf580871fc11aed69ba0c9b6b8cf)([#8280](https://www.github.com/tauri-apps/tauri/pull/8280)) The event target is now an object so you can target either a window or a webview. -- [`c77b4032`](https://www.github.com/tauri-apps/tauri/commit/c77b40324ea9bf580871fc11aed69ba0c9b6b8cf)([#8280](https://www.github.com/tauri-apps/tauri/pull/8280)) Moved webview-specific APIs from the `Window` class to the `Webview` class. -- [`c77b4032`](https://www.github.com/tauri-apps/tauri/commit/c77b40324ea9bf580871fc11aed69ba0c9b6b8cf)([#8280](https://www.github.com/tauri-apps/tauri/pull/8280)) Renamed `TauriEvent.WINDOW_FILE_DROP` to `TauriEvent.WEBVIEW_FILE_DROP`, `TauriEvent.WINDOW_FILE_DROP_HOVER` to `TauriEvent.WEBVIEW_FILE_DROP_HOVER` and `TauriEvent.WINDOW_FILE_DROP_CANCELLED` to `TauriEvent.WEBVIEW_FILE_DROP_CANCELLED`. -- [`c77b4032`](https://www.github.com/tauri-apps/tauri/commit/c77b40324ea9bf580871fc11aed69ba0c9b6b8cf)([#8280](https://www.github.com/tauri-apps/tauri/pull/8280)) Added back the `WebviewWindow` API that exposes functionality of a window that hosts a single webview. The dedicated `Window` and `Webview` types are exposed for multiwebview features. -- [`af610232`](https://www.github.com/tauri-apps/tauri/commit/af6102327376884364b2075b468bdf08ee0d02aa)([#8710](https://www.github.com/tauri-apps/tauri/pull/8710)) `Window::close` now triggers a close requested event instead of forcing the window to be closed. - -## \[2.0.0-alpha.14] - -- [`97e33412`](https://www.github.com/tauri-apps/tauri/commit/97e334129956159bbd60e1c531b6acd3bc6139a6)([#8534](https://www.github.com/tauri-apps/tauri/pull/8534)) `mockIPC` and `mockWindows` no longer crash if `window.__TAURI_INTERNALS__` is undefined. - -## \[2.0.0-alpha.13] - -### New Features - -- [`428ea652`](https://www.github.com/tauri-apps/tauri/commit/428ea6524c70545be33aac96d7c22b21f25caa4c)([#8370](https://www.github.com/tauri-apps/tauri/pull/8370)) Exposed `Resource` class which should be extended for Rust-backed resources created through `tauri::Manager::resources_table`. - -### Bug Fixes - -- [`ef21b681`](https://www.github.com/tauri-apps/tauri/commit/ef21b681e237a80592c9118b9c023c1d57231bac)([#8391](https://www.github.com/tauri-apps/tauri/pull/8391)) Fix a regression where typescript could not find types when using `"moduleResolution": "node"` -- [`46451aee`](https://www.github.com/tauri-apps/tauri/commit/46451aee1318f63a6cd861a12b63929b38c64eb6)([#8268](https://www.github.com/tauri-apps/tauri/pull/8268)) Add top-level `main`, `module` and `types` fields in `package.json` to be compliant with typescripts's `"moduleResolution": "node"` - -### Breaking Changes - -- [`c2ad4d28`](https://www.github.com/tauri-apps/tauri/commit/c2ad4d28c481b2d7ed643458db56210cd44a2e0c)([#8273](https://www.github.com/tauri-apps/tauri/pull/8273)) Changed former `tauri` module from `primitives` to `core`. - -## \[2.0.0-alpha.12] - -### New Features - -- [`f93148ea`](https://www.github.com/tauri-apps/tauri/commit/f93148eac05a1428e038bd9351a8149b2464ff4c)([#7709](https://www.github.com/tauri-apps/tauri/pull/7709)) Add `tray` and `menu` modules to create and manage tray icons and menus from Javascript. - -### Enhancements - -- [`b7add750`](https://www.github.com/tauri-apps/tauri/commit/b7add750ef9f32d959de613ab35063ff240281c2)([#8204](https://www.github.com/tauri-apps/tauri/pull/8204)) Added `position` field to the `FileDropEvent` payload. - -## \[2.0.0-alpha.11] - -### Bug Fixes - -- [`822bf15d`](https://www.github.com/tauri-apps/tauri/commit/822bf15d6b258556b689ca55ac2ac224897e913a)([#8130](https://www.github.com/tauri-apps/tauri/pull/8130)) Fix tslib missing in the distributed api package. - -## \[2.0.0-alpha.10] - -### Enhancements - -- [`c6c59cf2`](https://www.github.com/tauri-apps/tauri/commit/c6c59cf2373258b626b00a26f4de4331765dd487) Pull changes from Tauri 1.5 release. - -### Bug Fixes - -- [`287066b2`](https://www.github.com/tauri-apps/tauri/commit/287066b279f503dd09bfd43d5da37d1f471451fb)([#8071](https://www.github.com/tauri-apps/tauri/pull/8071)) No longer crashing in tests without mocks when `clearMocks` is defined in `afterEach` hook. - -## \[2.0.0-alpha.9] - -### New Features - -- [`c1ec0f15`](https://www.github.com/tauri-apps/tauri/commit/c1ec0f155118527361dd5645d920becbc8afd569)([#7933](https://www.github.com/tauri-apps/tauri/pull/7933)) Added `setAlwaysOnBottom` function on `Window` and the `alwaysOnBottom` option when creating a window. -- [`fb10b879`](https://www.github.com/tauri-apps/tauri/commit/fb10b87970a43320ef4d14564f45e7579b774eaf)([#8039](https://www.github.com/tauri-apps/tauri/pull/8039)) Add the `app` module back. -- [`ed32257d`](https://www.github.com/tauri-apps/tauri/commit/ed32257d044f90b5eb15053efd1667125def2d2b)([#7794](https://www.github.com/tauri-apps/tauri/pull/7794)) On Windows, add `Effect.Tabbed`,`Effect.TabbedDark` and `Effect.TabbedLight` effects. -- [`c9a9246c`](https://www.github.com/tauri-apps/tauri/commit/c9a9246c37bdf190661355c8ee406dac6c427344)([#8007](https://www.github.com/tauri-apps/tauri/pull/8007)) Add the `window` module back. -- [`c085adda`](https://www.github.com/tauri-apps/tauri/commit/c085addab58ba851398373c6fd13f9cb026d71e8)([#8009](https://www.github.com/tauri-apps/tauri/pull/8009)) Added the `setProgressBar` API on the `Window` class. - -### What's Changed - -- [`5c0eeb40`](https://www.github.com/tauri-apps/tauri/commit/5c0eeb40c1003583290ff3aebfa02e2b5f5b9c41)([#7638](https://www.github.com/tauri-apps/tauri/pull/7638)) Updated minimum Node.js version to 18. - -### Breaking Changes - -- [`a63e71f9`](https://www.github.com/tauri-apps/tauri/commit/a63e71f9799e9bbc82521d2f17b5238fbf690e89)([#7942](https://www.github.com/tauri-apps/tauri/pull/7942)) Changed `tauri` module to `primitives` and removed the undocumented `invoke` export from the root module. - -## \[2.0.0-alpha.8] - -### Breaking Changes - -- [`d5074af5`](https://www.github.com/tauri-apps/tauri/commit/d5074af562b2b5cb6c5711442097c4058af32db6)([#7801](https://www.github.com/tauri-apps/tauri/pull/7801)) The custom protocol on Android now uses the `http` scheme instead of `https`. - -## \[2.0.0-alpha.7] - -### Breaking Changes - -- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`. - -## \[2.0.0-alpha.6] - -### New Features - -- [`4af5c5a8`](https://www.github.com/tauri-apps/tauri/commit/4af5c5a8293263c16f8a65e8d232f2de52f41701)([#7170](https://www.github.com/tauri-apps/tauri/pull/7170)) Change the IPC call to align with the new format for the custom protocol based API. - -## \[2.0.0-alpha.5] - -### New Features - -- [`e0f0dce2`](https://www.github.com/tauri-apps/tauri/commit/e0f0dce220730e2822fc202463aedf0166145de7)([#6442](https://www.github.com/tauri-apps/tauri/pull/6442)) Added the `windowEffects` option when creating a window and `setWindowEffects` method to change it at runtime. - -### Enhancements - -- [`9e3a18e0`](https://www.github.com/tauri-apps/tauri/commit/9e3a18e04672edad15d0ec654bd8632544871967)([#7132](https://www.github.com/tauri-apps/tauri/pull/7132)) Expose the window target option on event APIs. -- [`6d3f3138`](https://www.github.com/tauri-apps/tauri/commit/6d3f3138b9e2f41cda712c7d9caba0f0e65dfd3c)([#7160](https://www.github.com/tauri-apps/tauri/pull/7160)) Changed `sep` and `delimiter` from `path` module into functions to fix import in frameworks like `next.js` -- [`4652c446`](https://www.github.com/tauri-apps/tauri/commit/4652c446b361a801252bcf45e9da39813bf85482)([#7144](https://www.github.com/tauri-apps/tauri/pull/7144)) Add `tempDir` function to `path` module - -## \[2.0.0-alpha.4] - -- [`0ab5f40d`](https://www.github.com/tauri-apps/tauri/commit/0ab5f40d3a4207f20e4440587b41c4e78f91d233)([#6813](https://www.github.com/tauri-apps/tauri/pull/6813)) Add channel API for sending data across the IPC. -- [`3245d14b`](https://www.github.com/tauri-apps/tauri/commit/3245d14b9eb256a5c5675c7030bac7082855df47)([#6895](https://www.github.com/tauri-apps/tauri/pull/6895)) Moved the `app` feature to its own plugin in the plugins-workspace repository. -- [`09376af5`](https://www.github.com/tauri-apps/tauri/commit/09376af59424cc27803fa2820d2ac0d4cdc90a6d)([#6704](https://www.github.com/tauri-apps/tauri/pull/6704)) Moved the `cli` feature to its own plugin in the plugins-workspace repository. -- [`2d5378bf`](https://www.github.com/tauri-apps/tauri/commit/2d5378bfc1ba817ee2f331b41738a90e5997e5e8)([#6717](https://www.github.com/tauri-apps/tauri/pull/6717)) Moved the dialog APIs to its own plugin in the plugins-workspace repository. -- [`39f1b04f`](https://www.github.com/tauri-apps/tauri/commit/39f1b04f7be4966488484829cd54c8ce72a04200)([#6943](https://www.github.com/tauri-apps/tauri/pull/6943)) Moved the `event` JS APIs to a plugin. -- [`fc4d687e`](https://www.github.com/tauri-apps/tauri/commit/fc4d687ef0ef2ea069ed73c40916da733b5dcb8f)([#6716](https://www.github.com/tauri-apps/tauri/pull/6716)) Moved the file system APIs to its own plugin in the plugins-workspace repository. -- [`f78a3783`](https://www.github.com/tauri-apps/tauri/commit/f78a378344bbec48533641661d865920a8f46f8f)([#6742](https://www.github.com/tauri-apps/tauri/pull/6742)) Moved the `http` feature to its own plugin in the plugins-workspace repository. -- [`29ce9ce2`](https://www.github.com/tauri-apps/tauri/commit/29ce9ce2ce7dfb260d556d5cffd075e8fe06660c)([#6902](https://www.github.com/tauri-apps/tauri/pull/6902)) Moved the `os` feature to its own plugin in the plugins-workspace repository. -- [`60cf9ed2`](https://www.github.com/tauri-apps/tauri/commit/60cf9ed2fcd7be4df41e86cf18735efe9b6cb254)([#6905](https://www.github.com/tauri-apps/tauri/pull/6905)) Moved the `process` feature to its own plugin in the plugins-workspace repository. -- [`96639ca2`](https://www.github.com/tauri-apps/tauri/commit/96639ca239c9e4f75142fc07868ac46822111cff)([#6749](https://www.github.com/tauri-apps/tauri/pull/6749)) Moved the `shell` functionality to its own plugin in the plugins-workspace repository. -- [`b072daa3`](https://www.github.com/tauri-apps/tauri/commit/b072daa3bd3e38b808466666619ddb885052c5b2)([#6919](https://www.github.com/tauri-apps/tauri/pull/6919)) Moved the `updater` feature to its own plugin in the plugins-workspace repository. -- [`cebd7526`](https://www.github.com/tauri-apps/tauri/commit/cebd75261ac71b98976314a450cb292eeeec1515)([#6728](https://www.github.com/tauri-apps/tauri/pull/6728)) Moved the `clipboard` feature to its own plugin in the plugins-workspace repository. -- [`3f17ee82`](https://www.github.com/tauri-apps/tauri/commit/3f17ee82f6ff21108806edb7b00500b8512b8dc7)([#6737](https://www.github.com/tauri-apps/tauri/pull/6737)) Moved the `global-shortcut` feature to its own plugin in the plugins-workspace repository. -- [`9a79dc08`](https://www.github.com/tauri-apps/tauri/commit/9a79dc085870e0c1a5df13481ff271b8c6cc3b78)([#6947](https://www.github.com/tauri-apps/tauri/pull/6947)) Moved the `window` JS APIs to its own plugin in the plugins-workspace repository. - -## \[2.0.0-alpha.3] - -- Overload the dialog `open` function to have better TS result types. - - [1eacd51d](https://www.github.com/tauri-apps/tauri/commit/1eacd51d185ba69a3c3cb2cc93c792e2d5929843) overloaded the open function for convenient type inference ([#5619](https://www.github.com/tauri-apps/tauri/pull/5619)) on 2023-04-07 - -## \[2.0.0-alpha.2] - -- Added `raw` encoding option to read stdout and stderr raw bytes. - - [f992e7f5](https://www.github.com/tauri-apps/tauri/commit/f992e7f58bf975c654a3daf36780b31a32bac064) chore(changes): readd change file on 2023-04-03 -- Removed shell's `Command` constructor and added the `Command.create` static function instead. - - [509d4678](https://www.github.com/tauri-apps/tauri/commit/509d4678b12816c1dd08a9a5efa71ba556d91c27) Support sending raw byte data to the "data" event for child command's stdout and stderr ([#5789](https://www.github.com/tauri-apps/tauri/pull/5789)) on 2023-03-31 - -## \[2.0.0-alpha.1] - -- Added the `shadow` option when creating a window and `setShadow` function. - - [a81750d7](https://www.github.com/tauri-apps/tauri/commit/a81750d779bc72f0fdb7de90b7fbddfd8049b328) feat(core): add shadow APIs ([#6206](https://www.github.com/tauri-apps/tauri/pull/6206)) on 2023-02-08 - -## \[2.0.0-alpha.0] - -- First mobile alpha release! - - [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08 - -## \[1.5.3] - -### Bug Fixes - -- [`1c582a94`](https://www.github.com/tauri-apps/tauri/commit/1c582a942e345a066b65620e4db9f688ec142bb9)([#8392](https://www.github.com/tauri-apps/tauri/pull/8392)) Fix a regression where typescript could not find types when using `"moduleResolution": "node"` - -## \[1.5.2] - -### Bug Fixes - -- [`50462702`](https://www.github.com/tauri-apps/tauri/commit/504627027303ef5a0e855aab2abea64c6964223b)([#8267](https://www.github.com/tauri-apps/tauri/pull/8267)) Add top-level `main`, `module` and `types` fields in `package.json` to be compliant with typescripts's `"moduleResolution": "node"` -- [`14544e4b`](https://www.github.com/tauri-apps/tauri/commit/14544e4b87269c06c89fed3647d80f492e0a1d34)([#8219](https://www.github.com/tauri-apps/tauri/pull/8219)) Avoid crashing in `clearMocks` - -## \[1.5.1] - -### New Features - -- [`2b0212af`](https://www.github.com/tauri-apps/tauri/commit/2b0212af49c386e52bb2357381813d6d435ec4af)([#7961](https://www.github.com/tauri-apps/tauri/pull/7961)) Add `mockConvertFileSrc` in `mocks` module, to mock `convertFileSrc` function. - -## \[1.5.0] - -### New Features - -- [`6c408b73`](https://www.github.com/tauri-apps/tauri/commit/6c408b736c7aa2a0a91f0a40d45a2b7a7dedfe78)([#7269](https://www.github.com/tauri-apps/tauri/pull/7269)) Add option to specify notification sound. - -### Enhancements - -- [`58d6b899`](https://www.github.com/tauri-apps/tauri/commit/58d6b899e21d37bb42810890d289deb57f2273bd)([#7636](https://www.github.com/tauri-apps/tauri/pull/7636)) Add `append` option to `FsOptions` in the `fs` JS module, used in `writeTextFile` and `writeBinaryFile`, to be able to append to existing files instead of overwriting it. - -### Bug Fixes - -- [`2eab1505`](https://www.github.com/tauri-apps/tauri/commit/2eab1505632ff71431d4c31c49b5afc78fa5b9dd)([#7394](https://www.github.com/tauri-apps/tauri/pull/7394)) Fix `Body.form` static not reading and sending entries of type `Blob` (including subclasses such as `File`) - -## \[1.4.0] - -### New Features - -- [`359058ce`](https://www.github.com/tauri-apps/tauri/commit/359058cecca44a9c30b65140c44a8bb3a6dd3be8)([#5939](https://www.github.com/tauri-apps/tauri/pull/5939)) Add `locale` function in the `os` module to get the system locale. -- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` fields on `WindowOptions`. -- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `setMaximizable`, `setMinimizable`, `setClosable`, `isMaximizable`, `isMinimizable` and `isClosable` methods. -- [`000104bc`](https://www.github.com/tauri-apps/tauri/commit/000104bc3bc0c9ff3d20558ab9cf2080f126e9e0)([#6472](https://www.github.com/tauri-apps/tauri/pull/6472)) Add `WebviewWindow.is_focused` and `WebviewWindow.getFocusedWindow` getters. - -## \[1.3.0] - -- Return correct type for `event.payload` in `onResized` and `onMoved` window event handlers. - - [0b46637e](https://www.github.com/tauri-apps/tauri/commit/0b46637ebaba54403afa32a1cb466f09df2db999) fix(api): construct correct object for onResized and onMoved, closes [#6507](https://www.github.com/tauri-apps/tauri/pull/6507) ([#6509](https://www.github.com/tauri-apps/tauri/pull/6509)) on 2023-04-03 -- Added the `WindowOptions::contentProtected` option and `WebviewWindow#setContentProtected` to change it at runtime. - - [4ab5545b](https://www.github.com/tauri-apps/tauri/commit/4ab5545b7a831c549f3c65e74de487ede3ab7ce5) feat: add content protection api, closes [#5132](https://www.github.com/tauri-apps/tauri/pull/5132) ([#5513](https://www.github.com/tauri-apps/tauri/pull/5513)) on 2022-12-13 -- Allow setting the text of the dialog buttons. - - [00e1efaa](https://www.github.com/tauri-apps/tauri/commit/00e1efaa9b33876d41dd360624b69971e70d3856) feat: customize button texts of message dialog ([#4383](https://www.github.com/tauri-apps/tauri/pull/4383)) on 2022-12-28 -- Add `is_minimized()` window method. - - [62144ef3](https://www.github.com/tauri-apps/tauri/commit/62144ef3be63b237869e511826edfb938e2c7174) feat: add is_minimized (fix [#3878](https://www.github.com/tauri-apps/tauri/pull/3878)) ([#5618](https://www.github.com/tauri-apps/tauri/pull/5618)) on 2022-12-13 -- Add `title` getter on window. - - [233e43b0](https://www.github.com/tauri-apps/tauri/commit/233e43b0c34fada1ca025378533a0b76931a6540) feat: add `title` getter on window, closes [#5023](https://www.github.com/tauri-apps/tauri/pull/5023) ([#5515](https://www.github.com/tauri-apps/tauri/pull/5515)) on 2022-12-13 - -## \[1.2.0] - -- Added the `acceptFirstMouse` window option. - - [95f467ad](https://www.github.com/tauri-apps/tauri/commit/95f467add51448319983c54e2f382c7c09fb72d6) feat(core): add window `accept_first_mouse` option, closes [#5347](https://www.github.com/tauri-apps/tauri/pull/5347) ([#5374](https://www.github.com/tauri-apps/tauri/pull/5374)) on 2022-10-17 -- Fix incorrect return type on `fs/exists` - - [ca3cd8b3](https://www.github.com/tauri-apps/tauri/commit/ca3cd8b3d11beb9b6102da40b7d27f6dbe6cd2d0) fix(api): fs/exists return type previously set to void when it should be boolean ([#5252](https://www.github.com/tauri-apps/tauri/pull/5252)) on 2022-09-29 -- Initialize `Monitor` instances with the correct classes for `position` and `size` fields instead of plain object. - - [6f41a271](https://www.github.com/tauri-apps/tauri/commit/6f41a2712445ac41a5ed84bbcd40af3b76c8b1d8) fix(api.js): fix `Monitor` initialization, closes [#4672](https://www.github.com/tauri-apps/tauri/pull/4672) ([#5314](https://www.github.com/tauri-apps/tauri/pull/5314)) on 2022-09-30 -- **Breaking change:** Node.js v12 is no longer supported. - - [1129f4f5](https://www.github.com/tauri-apps/tauri/commit/1129f4f575dd02f746abe8e66472c88c8f9fe63d) refactor: simplify api.js bundling ([#4277](https://www.github.com/tauri-apps/tauri/pull/4277)) on 2022-10-04 -- Add new app-specific `BaseDirectory` enum variants `AppConfig`, `AppData`, `AppLocalData`, `AppCache` and `AppLog` along with equivalent functions in `path` module and deprecated ambiguous variants `Log` and `App` along with their equivalent functions in `path` module. - - [5d89905e](https://www.github.com/tauri-apps/tauri/commit/5d89905e39ce0e6eaaec50a693679335449edb32) feat(api): add app-specific directory APIs, closes [#5263](https://www.github.com/tauri-apps/tauri/pull/5263) ([#5272](https://www.github.com/tauri-apps/tauri/pull/5272)) on 2022-09-28 -- Fix `dialog.save` return type - - [8357ce5b](https://www.github.com/tauri-apps/tauri/commit/8357ce5b2efdd6f92c7944822542e48ba0e303ce) Fix dialog.save return type ([#5373](https://www.github.com/tauri-apps/tauri/pull/5373)) on 2022-10-08 -- Added support to `FormData` on the `Body.form` function. - - [aa119f28](https://www.github.com/tauri-apps/tauri/commit/aa119f28364f8ffbc64c6bcdfc77483613076a20) feat(api): add FormData support on Body.form, closes [#5545](https://www.github.com/tauri-apps/tauri/pull/5545) ([#5546](https://www.github.com/tauri-apps/tauri/pull/5546)) on 2022-11-04 -- Added `show` and `hide` methods on the `app` module. - - [39bf895b](https://www.github.com/tauri-apps/tauri/commit/39bf895b73ec6b53f5758815396ba85dda6b9c67) feat(macOS): Add application `show` and `hide` methods ([#3689](https://www.github.com/tauri-apps/tauri/pull/3689)) on 2022-10-03 -- Added `tabbingIdentifier` window option for macOS. - - [4137ab44](https://www.github.com/tauri-apps/tauri/commit/4137ab44a81d739556cbc7583485887e78952bf1) feat(macos): add `tabbing_identifier` option, closes [#2804](https://www.github.com/tauri-apps/tauri/pull/2804), [#3912](https://www.github.com/tauri-apps/tauri/pull/3912) ([#5399](https://www.github.com/tauri-apps/tauri/pull/5399)) on 2022-10-19 -- Added `tabbing_identifier` to the window builder on macOS. - - [4137ab44](https://www.github.com/tauri-apps/tauri/commit/4137ab44a81d739556cbc7583485887e78952bf1) feat(macos): add `tabbing_identifier` option, closes [#2804](https://www.github.com/tauri-apps/tauri/pull/2804), [#3912](https://www.github.com/tauri-apps/tauri/pull/3912) ([#5399](https://www.github.com/tauri-apps/tauri/pull/5399)) on 2022-10-19 -- Added the `user_agent` option when creating a window. - - [a6c94119](https://www.github.com/tauri-apps/tauri/commit/a6c94119d8545d509723b147c273ca5edfe3729f) feat(core): expose user_agent to window config ([#5317](https://www.github.com/tauri-apps/tauri/pull/5317)) on 2022-10-02 - -## \[1.1.0] - -- Update `mockIPC()` handler signature to allow async handler functions. - - [4fa968dc](https://www.github.com/tauri-apps/tauri/commit/4fa968dc0e74b5206bfcd54e704d180c16b67b08) fix(api): add async `mockIPC()` handler signature ([#5056](https://www.github.com/tauri-apps/tauri/pull/5056)) on 2022-08-26 -- Improve shell's `Command`, `Command.stdout` and `Command.stderr` events with new `once`, `off`, `listenerCount`, `prependListener`, `prependOnceListener` and `removeAllListeners` functions. - - [aa9f1243](https://www.github.com/tauri-apps/tauri/commit/aa9f1243e6c1629972a82e469f20c8399741740e) Improved EventEmitter for tauri api shell ([#4697](https://www.github.com/tauri-apps/tauri/pull/4697)) on 2022-07-26 -- Added the `encoding` option to the `Command` options. - - [d8cf9f9f](https://www.github.com/tauri-apps/tauri/commit/d8cf9f9fcd617ac24fa418952fd4a32c08804f5c) Command support for specified character encoding, closes [#4644](https://www.github.com/tauri-apps/tauri/pull/4644) ([#4772](https://www.github.com/tauri-apps/tauri/pull/4772)) on 2022-07-28 -- Add `exists` function to the fs module. - - [3c62dbc9](https://www.github.com/tauri-apps/tauri/commit/3c62dbc902c904d35a7472ce72a969084c95fbbe) feat(api): Add `exists` function to the fs module. ([#5060](https://www.github.com/tauri-apps/tauri/pull/5060)) on 2022-09-15 - -## \[1.0.2] - -- Added helper functions to listen to updater and window events. - - [b02fc90f](https://www.github.com/tauri-apps/tauri/commit/b02fc90f450ff9e9d8a35ee55dc1beced4957869) feat(api): add abstractions to updater and window event listeners ([#4569](https://www.github.com/tauri-apps/tauri/pull/4569)) on 2022-07-05 -- Add support to `ArrayBuffer` in `Body.bytes` and `writeBinaryFile`. - - [92aca55a](https://www.github.com/tauri-apps/tauri/commit/92aca55a6f1f899d5c0c3a6aae9ac9cb0a7e9a86) feat(api): add support to ArrayBuffer ([#4579](https://www.github.com/tauri-apps/tauri/pull/4579)) on 2022-07-05 -- Use `toString()` on message/confirm/ask dialogs title and message values. - - [b8cd2a79](https://www.github.com/tauri-apps/tauri/commit/b8cd2a7993cd2aa5b71b30c545b3307245d254bf) feat(api): call `toString()` on dialog title and message, closes [#4583](https://www.github.com/tauri-apps/tauri/pull/4583) ([#4588](https://www.github.com/tauri-apps/tauri/pull/4588)) on 2022-07-04 -- Remove the `type-fest` dependency, changing the OS types to the specific enum instead of allowing any string. - - [d5e910eb](https://www.github.com/tauri-apps/tauri/commit/d5e910ebcc6c8d7f055ab0691286722b140ffcd4) chore(api): remove `type-fest` ([#4605](https://www.github.com/tauri-apps/tauri/pull/4605)) on 2022-07-06 - -## \[1.0.1] - -- Fixes the `writeBinaryFile` sending an empty file contents when only the first argument is passed. - - [ea43cf52](https://www.github.com/tauri-apps/tauri/commit/ea43cf52db8541d20a6397ef3ecd40f0f2bd6113) fix(api): `writeBinaryFile` sends an empty contents with only one arg ([#4368](https://www.github.com/tauri-apps/tauri/pull/4368)) on 2022-06-16 - -## \[1.0.0] - -- Allow choosing multiple folders in `dialog.open`. - - [4e51dce6](https://www.github.com/tauri-apps/tauri/commit/4e51dce6ca21c7664de779bc78a04be1051371f7) fix: dialog open supports multiple dirs, fixes [#4091](https://www.github.com/tauri-apps/tauri/pull/4091) ([#4354](https://www.github.com/tauri-apps/tauri/pull/4354)) on 2022-06-15 -- Upgrade to `stable`! - - [f4bb30cc](https://www.github.com/tauri-apps/tauri/commit/f4bb30cc73d6ba9b9ef19ef004dc5e8e6bb901d3) feat(covector): prepare for v1 ([#4351](https://www.github.com/tauri-apps/tauri/pull/4351)) on 2022-06-15 - -## \[1.0.0-rc.7] - -- Fix `FilePart` usage in `http.Body.form` by renaming the `value` property to `file`. - - [55f89d5f](https://www.github.com/tauri-apps/tauri/commit/55f89d5f9d429252ad3fd557b1d6233b256495e0) fix(api): Rename FormPart `value` to `file` to match docs and endpoint ([#4307](https://www.github.com/tauri-apps/tauri/pull/4307)) on 2022-06-09 -- Fixes a memory leak in the command system. - - [f72cace3](https://www.github.com/tauri-apps/tauri/commit/f72cace36821dc675a6d25268ae85a21bdbd6296) fix: never remove ipc callback & mem never be released ([#4274](https://www.github.com/tauri-apps/tauri/pull/4274)) on 2022-06-05 -- The notification's `isPermissionGranted` function now returns `boolean` instead of `boolean | null`. The response is never `null` because we won't check the permission for now, always returning `true` instead. - - [f482b094](https://www.github.com/tauri-apps/tauri/commit/f482b0942276e9402ab3725957535039bacb4fef) fix: remove notification permission prompt ([#4302](https://www.github.com/tauri-apps/tauri/pull/4302)) on 2022-06-09 -- Added the `resolveResource` API to the path module. - - [7bba8db8](https://www.github.com/tauri-apps/tauri/commit/7bba8db83ead92e9bd9c4be7863742e71ac47513) feat(api): add `resolveResource` API to the path module ([#4234](https://www.github.com/tauri-apps/tauri/pull/4234)) on 2022-05-29 -- Renamed `writeFile` to `writeTextFile` but kept the original function for backwards compatibility. - - [3f998ca2](https://www.github.com/tauri-apps/tauri/commit/3f998ca29445a349489078a74dd068e157a4d68e) feat(api): add `writeTextFile` and `(path, contents, options)` overload ([#4228](https://www.github.com/tauri-apps/tauri/pull/4228)) on 2022-05-29 -- Added `(path, contents[, options])` overload to the `writeTextFile` and `writeBinaryFile` APIs. - - [3f998ca2](https://www.github.com/tauri-apps/tauri/commit/3f998ca29445a349489078a74dd068e157a4d68e) feat(api): add `writeTextFile` and `(path, contents, options)` overload ([#4228](https://www.github.com/tauri-apps/tauri/pull/4228)) on 2022-05-29 - -## \[1.0.0-rc.6] - -- Expose option to set the dialog type. - - [f46175d5](https://www.github.com/tauri-apps/tauri/commit/f46175d5d46fa3eae66ad2415a0eb1efb7d31da2) feat(core): expose option to set dialog type, closes [#4183](https://www.github.com/tauri-apps/tauri/pull/4183) ([#4187](https://www.github.com/tauri-apps/tauri/pull/4187)) on 2022-05-21 -- Expose `title` option in the message dialog API. - - [ae99f991](https://www.github.com/tauri-apps/tauri/commit/ae99f991674d77c322a2240d10ed4b78ed2f4d4b) feat(core): expose message dialog's title option, ref [#4183](https://www.github.com/tauri-apps/tauri/pull/4183) ([#4186](https://www.github.com/tauri-apps/tauri/pull/4186)) on 2022-05-21 - -## \[1.0.0-rc.5] - -- Fixes the type of `http > connectTimeout`. - - [f3c5ca89](https://www.github.com/tauri-apps/tauri/commit/f3c5ca89e79d429183c4e15a9e7cebada2b493a0) fix(core): http api `connect_timeout` deserialization, closes [#4004](https://www.github.com/tauri-apps/tauri/pull/4004) ([#4006](https://www.github.com/tauri-apps/tauri/pull/4006)) on 2022-04-29 - -## \[1.0.0-rc.4] - -- Encode the file path in the `convertFileSrc` function. - - [42e8d9cf](https://www.github.com/tauri-apps/tauri/commit/42e8d9cf925089e9ad591198ee04b0cc0a0eed48) fix(api): encode file path in `convertFileSrc` function, closes [#3841](https://www.github.com/tauri-apps/tauri/pull/3841) ([#3846](https://www.github.com/tauri-apps/tauri/pull/3846)) on 2022-04-02 -- Added `theme` getter to `WebviewWindow`. - - [4cebcf6d](https://www.github.com/tauri-apps/tauri/commit/4cebcf6da7cad1953e0f01b426afac3b5ef1f81e) feat: expose theme APIs, closes [#3903](https://www.github.com/tauri-apps/tauri/pull/3903) ([#3937](https://www.github.com/tauri-apps/tauri/pull/3937)) on 2022-04-21 -- Added `theme` field to `WindowOptions`. - - [4cebcf6d](https://www.github.com/tauri-apps/tauri/commit/4cebcf6da7cad1953e0f01b426afac3b5ef1f81e) feat: expose theme APIs, closes [#3903](https://www.github.com/tauri-apps/tauri/pull/3903) ([#3937](https://www.github.com/tauri-apps/tauri/pull/3937)) on 2022-04-21 -- Added the `setCursorGrab`, `setCursorVisible`, `setCursorIcon` and `setCursorPosition` methods to the `WebviewWindow` class. - - [c54ddfe9](https://www.github.com/tauri-apps/tauri/commit/c54ddfe9338e7eb90b4d5b02dfde687d432d5bc1) feat: expose window cursor APIs, closes [#3888](https://www.github.com/tauri-apps/tauri/pull/3888) [#3890](https://www.github.com/tauri-apps/tauri/pull/3890) ([#3935](https://www.github.com/tauri-apps/tauri/pull/3935)) on 2022-04-21 -- **Breaking change:** The process Command API stdio lines now includes the trailing `\r`. - - [b5622882](https://www.github.com/tauri-apps/tauri/commit/b5622882cf3748e1e5a90915f415c0cd922aaaf8) fix(cli): exit on non-compilation Cargo errors, closes [#3930](https://www.github.com/tauri-apps/tauri/pull/3930) ([#3942](https://www.github.com/tauri-apps/tauri/pull/3942)) on 2022-04-22 -- Added the `tauri://theme-changed` event. - - [4cebcf6d](https://www.github.com/tauri-apps/tauri/commit/4cebcf6da7cad1953e0f01b426afac3b5ef1f81e) feat: expose theme APIs, closes [#3903](https://www.github.com/tauri-apps/tauri/pull/3903) ([#3937](https://www.github.com/tauri-apps/tauri/pull/3937)) on 2022-04-21 - -## \[1.0.0-rc.3] - -- Properly define the `appWindow` type. - - [1deeb03e](https://www.github.com/tauri-apps/tauri/commit/1deeb03ef6c7cbea8cf585864424a3d66f184a02) fix(api.js): appWindow shown as type `any`, fixes [#3747](https://www.github.com/tauri-apps/tauri/pull/3747) ([#3772](https://www.github.com/tauri-apps/tauri/pull/3772)) on 2022-03-24 -- Added `Temp` to the `BaseDirectory` enum. - - [266156a0](https://www.github.com/tauri-apps/tauri/commit/266156a0b08150b21140dd552c8bc252fe413cdd) feat(core): add `BaseDirectory::Temp` and `$TEMP` variable ([#3763](https://www.github.com/tauri-apps/tauri/pull/3763)) on 2022-03-24 - -## \[1.0.0-rc.2] - -- Do not crash if `__TAURI_METADATA__` is not set, log an error instead. - - [9cb1059a](https://www.github.com/tauri-apps/tauri/commit/9cb1059aa3f81521ccc6da655243acfe0327cd98) fix(api): do not throw an exception if **TAURI_METADATA** is not set, fixes [#3554](https://www.github.com/tauri-apps/tauri/pull/3554) ([#3572](https://www.github.com/tauri-apps/tauri/pull/3572)) on 2022-03-03 -- Reimplement endpoint to read file as string for performance. - - [834ccc51](https://www.github.com/tauri-apps/tauri/commit/834ccc51539401d36a7dfa1c0982623c9c446a4c) feat(core): reimplement `readTextFile` for performance ([#3631](https://www.github.com/tauri-apps/tauri/pull/3631)) on 2022-03-07 -- Fixes a regression on the `unlisten` command. - - [76c791bd](https://www.github.com/tauri-apps/tauri/commit/76c791bd2b836d2055410e37e71716172a3f81ef) fix(core): regression on the unlisten function ([#3623](https://www.github.com/tauri-apps/tauri/pull/3623)) on 2022-03-06 - -## \[1.0.0-rc.1] - -- Provide functions to mock IPC calls during testing and static site generation. - - [7e04c072](https://www.github.com/tauri-apps/tauri/commit/7e04c072c4ee2278c648f44575c6c4710ac047f3) feat: add mock functions for testing and SSG ([#3437](https://www.github.com/tauri-apps/tauri/pull/3437)) on 2022-02-14 - - [6f5ed2e6](https://www.github.com/tauri-apps/tauri/commit/6f5ed2e69cb7ffa0d5c8eb5a744fbf94ed6010d4) fix: change file on 2022-02-14 - -## \[1.0.0-rc.0] - -- Add `fileDropEnabled` property to `WindowOptions` so you can now disable it when creating windows from js. - - - [1bfc32a3](https://www.github.com/tauri-apps/tauri/commit/1bfc32a3b2f31b962ce8a5c611b60cb008360923) fix(api.js): add `fileDropEnabled` to `WindowOptions`, closes [#2968](https://www.github.com/tauri-apps/tauri/pull/2968) ([#2989](https://www.github.com/tauri-apps/tauri/pull/2989)) on 2021-12-09 - -- Add `logDir` function to the `path` module to access the suggested log directory. - Add `BaseDirectory.Log` to the `fs` module. - - - [acbb3ae7](https://www.github.com/tauri-apps/tauri/commit/acbb3ae7bb0165846b9456aea103269f027fc548) feat: add Log directory ([#2736](https://www.github.com/tauri-apps/tauri/pull/2736)) on 2021-10-16 - - [62c7a8ad](https://www.github.com/tauri-apps/tauri/commit/62c7a8ad30fd3031b8679960590e5ef3eef8e4da) chore(covector): prepare for `rc` release ([#3376](https://www.github.com/tauri-apps/tauri/pull/3376)) on 2022-02-10 - -- Expose `ask`, `message` and `confirm` APIs on the dialog module. - - - [e98c1af4](https://www.github.com/tauri-apps/tauri/commit/e98c1af44279a5ff6c8a6f0a506ecc219c9f77af) feat(core): expose message dialog APIs, fix window.confirm, implement HasRawWindowHandle for Window, closes [#2535](https://www.github.com/tauri-apps/tauri/pull/2535) ([#2700](https://www.github.com/tauri-apps/tauri/pull/2700)) on 2021-10-02 - -- Event `emit` now automatically serialize non-string types. - - - [06000996](https://www.github.com/tauri-apps/tauri/commit/060009969627890fa9018e2f1105bad13299394c) feat(api): support unknown types for event emit payload, closes [#2929](https://www.github.com/tauri-apps/tauri/pull/2929) ([#2964](https://www.github.com/tauri-apps/tauri/pull/2964)) on 2022-01-07 - -- Fix `http.fetch` throwing error if the response is successful but the body is empty. - - - [50c63900](https://www.github.com/tauri-apps/tauri/commit/50c63900c7313064037e2ceb798a6432fcd1bcda) fix(api.js): fix `http.fetch` throwing error if response body is empty, closes [#2831](https://www.github.com/tauri-apps/tauri/pull/2831) ([#3008](https://www.github.com/tauri-apps/tauri/pull/3008)) on 2021-12-09 - -- Add `title` option to file open/save dialogs. - - - [e1d6a6e6](https://www.github.com/tauri-apps/tauri/commit/e1d6a6e6445637723e2331ca799a662e720e15a8) Create api-file-dialog-title.md ([#3235](https://www.github.com/tauri-apps/tauri/pull/3235)) on 2022-01-16 - - [62c7a8ad](https://www.github.com/tauri-apps/tauri/commit/62c7a8ad30fd3031b8679960590e5ef3eef8e4da) chore(covector): prepare for `rc` release ([#3376](https://www.github.com/tauri-apps/tauri/pull/3376)) on 2022-02-10 - -- Fix `os.platform` returning `macos` and `windows` instead of `darwin` and `win32`. - - - [3924c3d8](https://www.github.com/tauri-apps/tauri/commit/3924c3d85365df30b376a1ec6c2d933460d66af0) fix(api.js): fix `os.platform` return on macos and windows, closes [#2698](https://www.github.com/tauri-apps/tauri/pull/2698) ([#2699](https://www.github.com/tauri-apps/tauri/pull/2699)) on 2021-10-02 - -- The `formatCallback` helper function now returns a number instead of a string. - - - [a48b8b18](https://www.github.com/tauri-apps/tauri/commit/a48b8b18d428bcc404d489daa690bbefe1f57311) feat(core): validate callbacks and event names \[TRI-038] \[TRI-020] ([#21](https://www.github.com/tauri-apps/tauri/pull/21)) on 2022-01-09 - -- Added `rawHeaders` to `http > Response`. - - - [b7a2345b](https://www.github.com/tauri-apps/tauri/commit/b7a2345b06ca0306988b4ba3d3deadd449e65af9) feat(core): add raw headers to HTTP API, closes [#2695](https://www.github.com/tauri-apps/tauri/pull/2695) ([#3053](https://www.github.com/tauri-apps/tauri/pull/3053)) on 2022-01-07 - -- Removed the `currentDir` API from the `path` module. - - - [a08509c6](https://www.github.com/tauri-apps/tauri/commit/a08509c641f43695e25944a2dd47697b18cd83e2) fix(api): remove `currentDir` API from the `path` module on 2022-02-04 - -- Remove `.ts` files on the published package. - - - [0f321ac0](https://www.github.com/tauri-apps/tauri/commit/0f321ac08d56412edd5bc9d166201fbc95d887d8) fix(api): do not ship TS files, closes [#2598](https://www.github.com/tauri-apps/tauri/pull/2598) ([#2645](https://www.github.com/tauri-apps/tauri/pull/2645)) on 2021-09-23 - -- **Breaking change:** Replaces all usages of `number[]` with `Uint8Array` to be closer aligned with the wider JS ecosystem. - - - [9b19a805](https://www.github.com/tauri-apps/tauri/commit/9b19a805aa8efa64b22f2dfef193a144b8e0cee3) fix(api.js) Replace `number[]`with `Uint8Array`. fixes [#3306](https://www.github.com/tauri-apps/tauri/pull/3306) ([#3305](https://www.github.com/tauri-apps/tauri/pull/3305)) on 2022-02-05 - -- `WindowManager` methods `innerPosition` `outerPosition` now correctly return instance of `PhysicalPosition`. - `WindowManager` methods `innerSize` `outerSize` now correctly return instance of `PhysicalSize`. - - - [cc8b1468](https://www.github.com/tauri-apps/tauri/commit/cc8b1468c821df53ceb771061c919409a9c80978) Fix(api): Window size and position returning wrong class (fix: [#2599](https://www.github.com/tauri-apps/tauri/pull/2599)) ([#2621](https://www.github.com/tauri-apps/tauri/pull/2621)) on 2021-09-22 - -- Change the `event` field of the `Event` interface to type `EventName` instead of `string`. - - - [b5d9bcb4](https://www.github.com/tauri-apps/tauri/commit/b5d9bcb402380abc86ae1fa1a77c629af2275f9d) Consistent event name usage ([#3228](https://www.github.com/tauri-apps/tauri/pull/3228)) on 2022-01-15 - - [62c7a8ad](https://www.github.com/tauri-apps/tauri/commit/62c7a8ad30fd3031b8679960590e5ef3eef8e4da) chore(covector): prepare for `rc` release ([#3376](https://www.github.com/tauri-apps/tauri/pull/3376)) on 2022-02-10 - -- Now `resolve()`, `join()` and `normalize()` from the `path` module, won't throw errors if the path doesn't exist, which matches NodeJS behavior. - - - [fe381a0b](https://www.github.com/tauri-apps/tauri/commit/fe381a0bde86ebf4014007f6e21af4c1a9e58cef) fix: `join` no longer cares if path doesn't exist, closes [#2499](https://www.github.com/tauri-apps/tauri/pull/2499) ([#2548](https://www.github.com/tauri-apps/tauri/pull/2548)) on 2021-09-21 - -- Fixes the dialog `defaultPath` usage on Linux. - - - [2212bd5d](https://www.github.com/tauri-apps/tauri/commit/2212bd5d75146f5a2df27cc2157a057642f626da) fix: dialog default path on Linux, closes [#3091](https://www.github.com/tauri-apps/tauri/pull/3091) ([#3123](https://www.github.com/tauri-apps/tauri/pull/3123)) on 2021-12-27 - -- Fixes `window.label` property returning null instead of the actual label. - - - [f5109e0c](https://www.github.com/tauri-apps/tauri/commit/f5109e0c962e3d25404995194968bade1be33b16) fix(api): window label null instead of actual value, closes [#3295](https://www.github.com/tauri-apps/tauri/pull/3295) ([#3332](https://www.github.com/tauri-apps/tauri/pull/3332)) on 2022-02-04 - -- Remove the `BaseDirectory::Current` enum variant for security reasons. - - - [696dca58](https://www.github.com/tauri-apps/tauri/commit/696dca58a9f8ee127a1cf857eb848e09f5845d18) refactor(core): remove `BaseDirectory::Current` variant on 2022-01-26 - -- Change `WindowLabel` type to `string`. - - - [f68603ae](https://www.github.com/tauri-apps/tauri/commit/f68603aee4e16500dff9e385b217f5dd8b1b39e8) chore(docs): simplify event system documentation on 2021-09-27 - -- When building Universal macOS Binaries through the virtual target `universal-apple-darwin`: - -- Expect a universal binary to be created by the user - -- Ensure that binary is bundled and accessed correctly at runtime - -- [3035e458](https://www.github.com/tauri-apps/tauri/commit/3035e4581c161ec7f0bd6d9b42e9015cf1dd1d77) Remove target triple from sidecar bin paths, closes [#3355](https://www.github.com/tauri-apps/tauri/pull/3355) ([#3356](https://www.github.com/tauri-apps/tauri/pull/3356)) on 2022-02-07 - -## \[1.0.0-beta.8] - -- Revert target back to ES5. - - [657c7dac](https://www.github.com/tauri-apps/tauri/commit/657c7dac734661956b87d021ff531ba530dd92a3) fix(api): revert ES2021 target on 2021-08-23 - -## \[1.0.0-beta.7] - -- Fix missing asset protocol path.Now the protocol is `https://asset.localhost/path/to/file` on Windows. Linux and macOS - is still `asset://path/to/file`. - - [994b5325](https://www.github.com/tauri-apps/tauri/commit/994b5325dd385f564b37fe1530c5d798dc925fff) fix: missing asset protocol path ([#2484](https://www.github.com/tauri-apps/tauri/pull/2484)) on 2021-08-23 - -## \[1.0.0-beta.6] - -- `bundle` now exports `clipboard` module so you can `import { clipboard } from "@tauri-apps/api"`. - - [4f88c3fb](https://www.github.com/tauri-apps/tauri/commit/4f88c3fb94286f3daafb906e3513c9210ecfa76b) fix(api.js): `bundle` now exports `clipboard` mod, closes [#2243](https://www.github.com/tauri-apps/tauri/pull/2243) ([#2244](https://www.github.com/tauri-apps/tauri/pull/2244)) on 2021-07-19 -- Fix double window creation - - [9fbcc024](https://www.github.com/tauri-apps/tauri/commit/9fbcc024542d87f71afd364acdcf2302cf82912c) fix(api.js): fix double window creation, closes [#2284](https://www.github.com/tauri-apps/tauri/pull/2284) ([#2285](https://www.github.com/tauri-apps/tauri/pull/2285)) on 2021-07-23 -- Add `os` module which exports `EOL`, `platform()`, `version()`, `type()`, `arch()`, `tempdir()` - - [05e679a6](https://www.github.com/tauri-apps/tauri/commit/05e679a6d2aca5642c780052bcf1384c49a462de) feat(api.js): add `os` module ([#2299](https://www.github.com/tauri-apps/tauri/pull/2299)) on 2021-07-28 -- - Add new nodejs-inspired functions which are `join`, `resolve`, `normalize`, `dirname`, `basename` and `extname`. -- Add `sep` and `delimiter` constants. -- Removed `resolvePath` API, use `resolve` instead. -- [05b9d81e](https://www.github.com/tauri-apps/tauri/commit/05b9d81ee6bcc920defca76cff00178b301fffe8) feat(api.js): add nodejs-inspired functions in `path` module ([#2310](https://www.github.com/tauri-apps/tauri/pull/2310)) on 2021-08-02 -- Change target to ES2021. - - [97bc52ee](https://www.github.com/tauri-apps/tauri/commit/97bc52ee03dec0b67cc1cced23305a4c53e9eb62) Tooling: \[API] Changed target in tsconfig to es6 ([#2362](https://www.github.com/tauri-apps/tauri/pull/2362)) on 2021-08-09 -- Add `toggleMaximize()` function to the `WebviewWindow` class. - - [1a510066](https://www.github.com/tauri-apps/tauri/commit/1a510066732d5f61c88c0ceed1c5f5cc559faf7d) fix(core): `data-tauri-drag-region` didn't respect resizable, closes [#2314](https://www.github.com/tauri-apps/tauri/pull/2314) ([#2316](https://www.github.com/tauri-apps/tauri/pull/2316)) on 2021-08-02 -- Fix `@ts-expect` error usage - - [dd52e738](https://www.github.com/tauri-apps/tauri/commit/dd52e738f1fd323bd8d185d6e650f412eb031200) fix(api.js): fix `@ts-expect-error` usage, closes [#2249](https://www.github.com/tauri-apps/tauri/pull/2249) ([#2250](https://www.github.com/tauri-apps/tauri/pull/2250)) on 2021-07-20 -- Fixes file drop events being swapped (`file-drop-hover` on drop and `file-drop` on hover). - - [c2b0fe1c](https://www.github.com/tauri-apps/tauri/commit/c2b0fe1ce58e54dbcfdb63162ad17d7e6d8774d9) fix(core): fix wrong file drop events ([#2300](https://www.github.com/tauri-apps/tauri/pull/2300)) on 2021-07-31 -- Fixes the global bundle UMD code. - - [268450b1](https://www.github.com/tauri-apps/tauri/commit/268450b1329a4b55f2043890c565a8563f890c3a) fix(api): global bundle broken code, closes [#2289](https://www.github.com/tauri-apps/tauri/pull/2289) ([#2297](https://www.github.com/tauri-apps/tauri/pull/2297)) on 2021-07-26 -- - Fixes monitor api not working. -- Fixes window.print() not working on macOS. -- [0f63f5e7](https://www.github.com/tauri-apps/tauri/commit/0f63f5e757873f1787a1ae07ca531340d0d45ec3) fix(api): Fix monitor functions, closes [#2294](https://www.github.com/tauri-apps/tauri/pull/2294) ([#2301](https://www.github.com/tauri-apps/tauri/pull/2301)) on 2021-07-29 -- Improve `EventName` type using `type-fest`'s `LiteralUnion`. - - [8e480297](https://www.github.com/tauri-apps/tauri/commit/8e48029790857b38988da4d291aa7458f51bb265) feat(api): improve `EventName` type definition ([#2379](https://www.github.com/tauri-apps/tauri/pull/2379)) on 2021-08-10 -- Update protocol url path with wry 0.12.1 on Windows. - - [88382fe1](https://www.github.com/tauri-apps/tauri/commit/88382fe147ebcb3f59308cc529e5562a04970876) chore(api): update protocol url path with wry 0.12.1 on Windows ([#2409](https://www.github.com/tauri-apps/tauri/pull/2409)) on 2021-08-13 - -## \[1.0.0-beta.5] - -- Adds `convertFileSrc` helper to the `tauri` module, simplifying the process of using file paths as webview source (`img`, `video`, etc). - - [51a5cfe4](https://www.github.com/tauri-apps/tauri/commit/51a5cfe4b5e9890fb6f639c9c929657fd747a595) feat(api): add `convertFileSrc` helper ([#2138](https://www.github.com/tauri-apps/tauri/pull/2138)) on 2021-07-02 -- You can now use `emit`, `listen` and `once` using the `appWindow` exported by the window module. - - [5d7626f8](https://www.github.com/tauri-apps/tauri/commit/5d7626f89781a6ebccceb9ab3b2e8335aa7a0392) feat(api): WindowManager extends WebviewWindowHandle, add events docs ([#2146](https://www.github.com/tauri-apps/tauri/pull/2146)) on 2021-07-03 -- Allow manipulating a spawned window directly using `WebviewWindow`, which now extends `WindowManager`. - - [d69b1cf6](https://www.github.com/tauri-apps/tauri/commit/d69b1cf6d7c13297073073d753e30fe1a22a09cb) feat(api): allow managing windows created on JS ([#2154](https://www.github.com/tauri-apps/tauri/pull/2154)) on 2021-07-05 - -## \[1.0.0-beta.4] - -- Add asset custom protocol to access local file system. - - [ee60e424](https://www.github.com/tauri-apps/tauri/commit/ee60e424221559d3d725716b0003c5566ef2b5cd) feat: asset custom protocol to access local file system ([#2104](https://www.github.com/tauri-apps/tauri/pull/2104)) on 2021-06-28 - -## \[1.0.0-beta.3] - -- Export `Response` and `ResponseType` as value instead of type. - - [394b6e05](https://www.github.com/tauri-apps/tauri/commit/394b6e0572e7a0a92e103e462a7f603f7d569319) fix(api): http `ResponseType` export type error ([#2065](https://www.github.com/tauri-apps/tauri/pull/2065)) on 2021-06-24 - -## \[1.0.0-beta.2] - -- Export `BaseDirectory` in `path` module - - [277f5ca5](https://www.github.com/tauri-apps/tauri/commit/277f5ca5a8ae227bbdccee1ad52bdd88b4a5b11b) feat(api): export `BaseDirectory` in `path` module ([#1885](https://www.github.com/tauri-apps/tauri/pull/1885)) on 2021-05-30 -- Use `export type` to export TS types, enums and interfaces. - - [9a662d26](https://www.github.com/tauri-apps/tauri/commit/9a662d2601b01d712c6bd205f8db1b674f56dfa7) fix: Monitor if --isolatedModules is enabled ([#1825](https://www.github.com/tauri-apps/tauri/pull/1825)) on 2021-05-13 - - [612cd8ec](https://www.github.com/tauri-apps/tauri/commit/612cd8ecb8e02954f3696b9e138cbc7d2c228fad) feat(api): finalize `export type` usage ([#1847](https://www.github.com/tauri-apps/tauri/pull/1847)) on 2021-05-17 -- Adds `focus?: boolean` to the WindowOptions interface. - - [5f351622](https://www.github.com/tauri-apps/tauri/commit/5f351622c7812ad1bb56ddb37364ccaa4124c24b) feat(core): add focus API to the WindowBuilder and WindowOptions, [#1737](https://www.github.com/tauri-apps/tauri/pull/1737) on 2021-05-30 -- Adds `isDecorated` getter on the window API. - - [f58a2114](https://www.github.com/tauri-apps/tauri/commit/f58a2114fbfd5307c349f05c88f2e08fd8baa8aa) feat(core): add `is_decorated` Window getter on 2021-05-30 -- Adds `isResizable` getter on the window API. - - [1e8af280](https://www.github.com/tauri-apps/tauri/commit/1e8af280c27f381828d6209722b10e889082fa00) feat(core): add `is_resizable` Window getter on 2021-05-30 -- Adds `isVisible` getter on the window API. - - [36506c96](https://www.github.com/tauri-apps/tauri/commit/36506c967de82bc7ff453d11e6104ecf66d7a588) feat(core): add `is_visible` API on 2021-05-30 -- Adds `requestUserAttention` API to the `window` module. - - [7dcca6e9](https://www.github.com/tauri-apps/tauri/commit/7dcca6e9281182b11ad3d4a79871f09b30b9b419) feat(core): add `request_user_attention` API, closes [#2023](https://www.github.com/tauri-apps/tauri/pull/2023) ([#2026](https://www.github.com/tauri-apps/tauri/pull/2026)) on 2021-06-20 -- Adds `setFocus` to the window API. - - [bb6992f8](https://www.github.com/tauri-apps/tauri/commit/bb6992f888196ca7c87bb2fe74ad2bd8bf393e05) feat(core): add `set_focus` window API, fixes [#1737](https://www.github.com/tauri-apps/tauri/pull/1737) on 2021-05-30 -- Adds `setSkipTaskbar` to the window API. - - [e06aa277](https://www.github.com/tauri-apps/tauri/commit/e06aa277384450cfef617c0e57b0d5d403bb1e7f) feat(core): add `set_skip_taskbar` API on 2021-05-30 -- Adds `skipTaskbar?: boolean` to the WindowOptions interface. - - [5525b03a](https://www.github.com/tauri-apps/tauri/commit/5525b03a78a2232c650043fbd9894ce1553cad41) feat(core): add `skip_taskbar` API to the WindowBuilder/WindowOptions on 2021-05-30 -- Adds `center?: boolean` to `WindowOptions` and `center()` API to the `appWindow`. - - [5cba6eb4](https://www.github.com/tauri-apps/tauri/commit/5cba6eb4d28d53f06855d60d4d0eae6b95233ccf) feat(core): add window `center` API, closes [#1822](https://www.github.com/tauri-apps/tauri/pull/1822) ([#1954](https://www.github.com/tauri-apps/tauri/pull/1954)) on 2021-06-05 -- Adds `clipboard` APIs (write and read text). - - [285bf64b](https://www.github.com/tauri-apps/tauri/commit/285bf64bf9569efb2df904c69c6df405ff0d62e2) feat(core): add clipboard writeText and readText APIs ([#2035](https://www.github.com/tauri-apps/tauri/pull/2035)) on 2021-06-21 - - [dee71ad5](https://www.github.com/tauri-apps/tauri/commit/dee71ad58349f699995cc9077b79032bacc6afcb) fix(workflows): update docs workflow syntax ([#2054](https://www.github.com/tauri-apps/tauri/pull/2054)) on 2021-06-23 -- The `http` APIs now resolve the returned promise when the API call finishes with an error status code. - - [47f75584](https://www.github.com/tauri-apps/tauri/commit/47f7558417cc654bdb1d018127e8900bc4eac622) fix(core): resolve HTTP API on non-ok status code, fix binary response, closes [#2046](https://www.github.com/tauri-apps/tauri/pull/2046) ([#2053](https://www.github.com/tauri-apps/tauri/pull/2053)) on 2021-06-23 -- Improve RPC security by requiring a numeric code to invoke commands. The codes are generated by the Rust side and injected into the app's code using a closure, so external scripts can't access the backend. This change doesn't protect `withGlobalTauri` (`window.__TAURI__`) usage. - - [160fb052](https://www.github.com/tauri-apps/tauri/commit/160fb0529fd31d755574ae30fbdf01fa221a2acb) feat(core): improve RPC security, closes [#814](https://www.github.com/tauri-apps/tauri/pull/814) ([#2047](https://www.github.com/tauri-apps/tauri/pull/2047)) on 2021-06-22 -- Mark the `WebviewWindow` constructor as public. - - [4aeb936e](https://www.github.com/tauri-apps/tauri/commit/4aeb936e9b60b895d383597dc698ee5d638436f9) fix(api): `WebviewWindow` constructor is public ([#1888](https://www.github.com/tauri-apps/tauri/pull/1888)) on 2021-05-21 -- Validate arguments on the window `setLocation`, `setSize`, `setMinSize` and `setMaxSize` API. - - [7616e6cc](https://www.github.com/tauri-apps/tauri/commit/7616e6cc7bcd49f688b0d00fdc33c94b7b93713d) feat(api): validate window API `size` and `location` arguments ([#1846](https://www.github.com/tauri-apps/tauri/pull/1846)) on 2021-05-17 - -## \[1.0.0-beta.1] - -- Adds `package.json` to the `exports` object. - - [ab1ea96](https://www.github.com/tauri-apps/tauri/commit/ab1ea964786e1781c922582b059c555b6072f1a0) chore(api): add `package.json` to the `exports` field ([#1807](https://www.github.com/tauri-apps/tauri/pull/1807)) on 2021-05-12 - -## \[1.0.0-beta.0] - -- CommonJS chunks are now properly exported with `.cjs` extension - - [ddcd923](https://www.github.com/tauri-apps/tauri/commit/ddcd9233bd6f499aa7f22484d6c151b01778bc1b) fix(api): export commonjs chunks with `.cjs` extension, fix [#1625](https://www.github.com/tauri-apps/tauri/pull/1625) ([#1627](https://www.github.com/tauri-apps/tauri/pull/1627)) on 2021-04-26 -- Adds `transparent?: boolean` to the `WindowOptions` interface. - - [08c1c5c](https://www.github.com/tauri-apps/tauri/commit/08c1c5ca5c0ebe17ea98689a5fe3b7e47a98e955) fix(api): missing `transparent` flag on `WindowOptions` ([#1764](https://www.github.com/tauri-apps/tauri/pull/1764)) on 2021-05-10 -- Adds `options` argument to the shell command API (`env` and `cwd` configuration). - - [721e98f](https://www.github.com/tauri-apps/tauri/commit/721e98f175567b360c86f30565ab1b9d08e7cf85) feat(core): add env, cwd to the command API, closes [#1634](https://www.github.com/tauri-apps/tauri/pull/1634) ([#1635](https://www.github.com/tauri-apps/tauri/pull/1635)) on 2021-04-28 -- Adds `startDragging` API on the window module. - - [c31f097](https://www.github.com/tauri-apps/tauri/commit/c31f0978c535f794fffb75a121e69a323e70b06e) refactor: update to wry 0.9 ([#1630](https://www.github.com/tauri-apps/tauri/pull/1630)) on 2021-04-28 -- Move `exit` and `relaunch` APIs from `app` to `process` module. - - [b0bb796](https://www.github.com/tauri-apps/tauri/commit/b0bb796a42e2560233aea47ce6ced54ac238eb53) refactor: rename `command` mod to `process`, move restart_application ([#1667](https://www.github.com/tauri-apps/tauri/pull/1667)) on 2021-04-30 -- The window management API was refactored: removed `setX`, `setY`, `setWidth`, `setHeight` APIs, renamed `resize` to `setSize` and the size and position APIs now allow defining both logical and physical values. - - [6bfac86](https://www.github.com/tauri-apps/tauri/commit/6bfac866a703f1499a64237fb29b2625703f4e22) refactor(core): add window getters, physical & logical sizes/positions ([#1723](https://www.github.com/tauri-apps/tauri/pull/1723)) on 2021-05-05 -- Adds window getters. - - [6bfac86](https://www.github.com/tauri-apps/tauri/commit/6bfac866a703f1499a64237fb29b2625703f4e22) refactor(core): add window getters, physical & logical sizes/positions ([#1723](https://www.github.com/tauri-apps/tauri/pull/1723)) on 2021-05-05 - -## \[1.0.0-beta-rc.3] - -- Fixes distribution of the `@tauri-apps/api` package for older bundlers. - - [7f998d0](https://www.github.com/tauri-apps/tauri/commit/7f998d08e3ab8823c99190fa283bdfa2c4f2749b) fix(api): distribution ([#1582](https://www.github.com/tauri-apps/tauri/pull/1582)) on 2021-04-22 -- Update minimum Node.js version to v12.13.0 - - [1f089fb](https://www.github.com/tauri-apps/tauri/commit/1f089fb4f964c673dcab5784bdf1da2833487a7c) chore: update minimum nodejs version to 12.13.0 ([#1562](https://www.github.com/tauri-apps/tauri/pull/1562)) on 2021-04-21 - -## \[1.0.0-beta-rc.2] - -- TS was wrongly re-exporting the module. - - [fcb3b48](https://www.github.com/tauri-apps/tauri/commit/fcb3b4857efa17d2a3717f32457e88b24520cc9b) fix: [#1512](https://www.github.com/tauri-apps/tauri/pull/1512) ([#1517](https://www.github.com/tauri-apps/tauri/pull/1517)) on 2021-04-19 - - [ae14a3f](https://www.github.com/tauri-apps/tauri/commit/ae14a3ff51a742b6ab6f76bbfc21f385310f1dc6) fix: [#1517](https://www.github.com/tauri-apps/tauri/pull/1517) had the wrong package reference in the changefile ([#1538](https://www.github.com/tauri-apps/tauri/pull/1538)) on 2021-04-19 - -## \[1.0.0-beta-rc.1] - -- Missing the `files` property in the package.json which mean that the `dist` directory was not published and used. - - [b2569a7](https://www.github.com/tauri-apps/tauri/commit/b2569a729a3caa88bdba62abc31f0665e1323aaa) fix(js-api): dist ([#1498](https://www.github.com/tauri-apps/tauri/pull/1498)) on 2021-04-15 - -## \[1.0.0-beta-rc.0] - -- Add current working directory to the path api module. - - [52c2baf](https://www.github.com/tauri-apps/tauri/commit/52c2baf940773cf7c51647fb6f20d0f7df126115) feat: add current working directory to path api module ([#1375](https://www.github.com/tauri-apps/tauri/pull/1375)) on 2021-03-23 - - [a6def70](https://www.github.com/tauri-apps/tauri/commit/a6def7066eec19c889b0f14cc1e475bf209a332e) Refactor(tauri): move tauri-api and tauri-updater to tauri ([#1455](https://www.github.com/tauri-apps/tauri/pull/1455)) on 2021-04-11 -- The shell process spawning API was rewritten and now includes stream access. - - [3713066](https://www.github.com/tauri-apps/tauri/commit/3713066e451bd30d0cc6f57bb437f08276f4c4ad) refactor(core): rewrite shell execute API, closes [#1229](https://www.github.com/tauri-apps/tauri/pull/1229) ([#1408](https://www.github.com/tauri-apps/tauri/pull/1408)) on 2021-03-31 -- The file dialog API now uses [rfd](https://github.com/PolyMeilex/rfd). The filter option is now an array of `{ name: string, extensions: string[] }`. - - [2326bcd](https://www.github.com/tauri-apps/tauri/commit/2326bcd399411f7f0eabdb7ade910be473adadae) refactor(core): use `nfd` for file dialogs, closes [#1251](https://www.github.com/tauri-apps/tauri/pull/1251) ([#1257](https://www.github.com/tauri-apps/tauri/pull/1257)) on 2021-02-18 - - [a6def70](https://www.github.com/tauri-apps/tauri/commit/a6def7066eec19c889b0f14cc1e475bf209a332e) Refactor(tauri): move tauri-api and tauri-updater to tauri ([#1455](https://www.github.com/tauri-apps/tauri/pull/1455)) on 2021-04-11 -- The HTTP API was improved with client caching and better payload and response types. - - [a7bc472](https://www.github.com/tauri-apps/tauri/commit/a7bc472e994730071f960d09a12ac85296a080ae) refactor(core): improve HTTP API, closes [#1098](https://www.github.com/tauri-apps/tauri/pull/1098) ([#1237](https://www.github.com/tauri-apps/tauri/pull/1237)) on 2021-02-15 - - [a6def70](https://www.github.com/tauri-apps/tauri/commit/a6def7066eec19c889b0f14cc1e475bf209a332e) Refactor(tauri): move tauri-api and tauri-updater to tauri ([#1455](https://www.github.com/tauri-apps/tauri/pull/1455)) on 2021-04-11 -- Update all code files to have our license header. - - [bf82136](https://www.github.com/tauri-apps/tauri/commit/bf8213646689175f8a158b956911f3a43e360690) feat(license): SPDX Headers ([#1449](https://www.github.com/tauri-apps/tauri/pull/1449)) on 2021-04-11 - - [a6def70](https://www.github.com/tauri-apps/tauri/commit/a6def7066eec19c889b0f14cc1e475bf209a332e) Refactor(tauri): move tauri-api and tauri-updater to tauri ([#1455](https://www.github.com/tauri-apps/tauri/pull/1455)) on 2021-04-11 - - [aea6145](https://www.github.com/tauri-apps/tauri/commit/aea614587bddab930d552512b54e18624fbf573e) refactor(repo): add /tooling folder ([#1457](https://www.github.com/tauri-apps/tauri/pull/1457)) on 2021-04-12 -- Use secure RNG on callback function names. - - [c8992bb](https://www.github.com/tauri-apps/tauri/commit/c8992bb0bfb8eaeae8ebed444719f9c9372d39d4) refactor(api): use secure RNG, closes [#1356](https://www.github.com/tauri-apps/tauri/pull/1356) ([#1398](https://www.github.com/tauri-apps/tauri/pull/1398)) on 2021-03-30 -- The invoke function can now be called with the cmd as the first parameter and the args as the second. - - [427d170](https://www.github.com/tauri-apps/tauri/commit/427d170930ab711fd0ca82f7a73b524d6fdc222f) feat(api/invoke): separate cmd arg ([#1321](https://www.github.com/tauri-apps/tauri/pull/1321)) on 2021-03-04 -- Adds a global shortcut API. - - [855effa](https://www.github.com/tauri-apps/tauri/commit/855effadd9ebfb6bc1a3555ac7fc733f6f766b7a) feat(core): globalShortcut API ([#1232](https://www.github.com/tauri-apps/tauri/pull/1232)) on 2021-02-14 - - [a6def70](https://www.github.com/tauri-apps/tauri/commit/a6def7066eec19c889b0f14cc1e475bf209a332e) Refactor(tauri): move tauri-api and tauri-updater to tauri ([#1455](https://www.github.com/tauri-apps/tauri/pull/1455)) on 2021-04-11 -- Added window management and window creation APIs. - - [a3d6dff](https://www.github.com/tauri-apps/tauri/commit/a3d6dff2163c7a45842253edd81dbc62248dc65d) feat(core): window API ([#1225](https://www.github.com/tauri-apps/tauri/pull/1225)) on 2021-02-13 - - [641374b](https://www.github.com/tauri-apps/tauri/commit/641374b15343518cd835bd5ada811941c65dcf2e) feat(core): window creation at runtime ([#1249](https://www.github.com/tauri-apps/tauri/pull/1249)) on 2021-02-17 diff --git a/node_modules/@tauri-apps/api/LICENSE_APACHE-2.0 b/node_modules/@tauri-apps/api/LICENSE_APACHE-2.0 deleted file mode 100644 index f433b1a..0000000 --- a/node_modules/@tauri-apps/api/LICENSE_APACHE-2.0 +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/node_modules/@tauri-apps/api/LICENSE_MIT b/node_modules/@tauri-apps/api/LICENSE_MIT deleted file mode 100644 index b08530d..0000000 --- a/node_modules/@tauri-apps/api/LICENSE_MIT +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 - Present Tauri Apps Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@tauri-apps/api/README.md b/node_modules/@tauri-apps/api/README.md deleted file mode 100644 index d74ab83..0000000 --- a/node_modules/@tauri-apps/api/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# @tauri-apps/api - - - -[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev) -[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri) -[![lint js](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/lint-js.yml?label=lint%20js&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/lint-js.yml) -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield) -[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S) -[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app) -[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation) -[![support](https://img.shields.io/badge/sponsor-Open%20Collective-blue.svg)](https://opencollective.com/tauri) - -| Component | Version | -| --------------- | ----------------------------------------------------- | -| @tauri-apps/api | ![](https://img.shields.io/npm/v/@tauri-apps/api.svg) | - -## About Tauri - -Tauri is a polyglot and generic system that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily. - -Tauri apps can have custom menus and have tray-type interfaces. They can be updated, and are managed by the user's operating system as expected. They are very small, because they use the system's webview. They do not ship a runtime, since the final binary is compiled from rust. This makes the reversing of Tauri apps not a trivial task. - -## This module - -This is a typescript library that creates `cjs` and `esm` JavaScript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure typescript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts. - -To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document. - -## Installation - -The preferred method is to install this module locally as a dependency: - -``` -$ pnpm add @tauri-apps/api -$ yarn add @tauri-apps/api -$ npm add @tauri-apps/api -``` - -## Semver - -**tauri** is following [Semantic Versioning 2.0](https://semver.org/). - -## Licenses - -Code: (c) 2019 - 2021 - The Tauri Programme within The Commons Conservancy. - -MIT or MIT/Apache 2.0 where applicable. - -Logo: CC-BY-NC-ND - -- Original Tauri Logo Designs by [Daniel Thompson-Yvetot](https://github.com/nothingismagick) and [Guillaume Chau](https://github.com/akryum) diff --git a/node_modules/@tauri-apps/api/app.cjs b/node_modules/@tauri-apps/api/app.cjs deleted file mode 100644 index 12df98f..0000000 --- a/node_modules/@tauri-apps/api/app.cjs +++ /dev/null @@ -1,235 +0,0 @@ -'use strict'; - -var core = require('./core.cjs'); -var image = require('./image.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Bundle type of the current application. - */ -exports.BundleType = void 0; -(function (BundleType) { - /** Windows NSIS */ - BundleType["Nsis"] = "nsis"; - /** Windows MSI */ - BundleType["Msi"] = "msi"; - /** Linux Debian package */ - BundleType["Deb"] = "deb"; - /** Linux RPM */ - BundleType["Rpm"] = "rpm"; - /** Linux AppImage */ - BundleType["AppImage"] = "appimage"; - /** macOS app bundle */ - BundleType["App"] = "app"; -})(exports.BundleType || (exports.BundleType = {})); -/** - * Application metadata and related APIs. - * - * @module - */ -/** - * Gets the application version. - * @example - * ```typescript - * import { getVersion } from '@tauri-apps/api/app'; - * const appVersion = await getVersion(); - * ``` - * - * @since 1.0.0 - */ -async function getVersion() { - return core.invoke('plugin:app|version'); -} -/** - * Gets the application name. - * @example - * ```typescript - * import { getName } from '@tauri-apps/api/app'; - * const appName = await getName(); - * ``` - * - * @since 1.0.0 - */ -async function getName() { - return core.invoke('plugin:app|name'); -} -/** - * Gets the Tauri framework version used by this application. - * - * @example - * ```typescript - * import { getTauriVersion } from '@tauri-apps/api/app'; - * const tauriVersion = await getTauriVersion(); - * ``` - * - * @since 1.0.0 - */ -async function getTauriVersion() { - return core.invoke('plugin:app|tauri_version'); -} -/** - * Gets the application identifier. - * @example - * ```typescript - * import { getIdentifier } from '@tauri-apps/api/app'; - * const identifier = await getIdentifier(); - * ``` - * - * @returns The application identifier as configured in `tauri.conf.json`. - * - * @since 2.4.0 - */ -async function getIdentifier() { - return core.invoke('plugin:app|identifier'); -} -/** - * Shows the application on macOS. This function does not automatically - * focus any specific app window. - * - * @example - * ```typescript - * import { show } from '@tauri-apps/api/app'; - * await show(); - * ``` - * - * @since 1.2.0 - */ -async function show() { - return core.invoke('plugin:app|app_show'); -} -/** - * Hides the application on macOS. - * - * @example - * ```typescript - * import { hide } from '@tauri-apps/api/app'; - * await hide(); - * ``` - * - * @since 1.2.0 - */ -async function hide() { - return core.invoke('plugin:app|app_hide'); -} -/** - * Fetches the data store identifiers on macOS and iOS. - * - * See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information. - * - * @example - * ```typescript - * import { fetchDataStoreIdentifiers } from '@tauri-apps/api/app'; - * const ids = await fetchDataStoreIdentifiers(); - * ``` - * - * @since 2.4.0 - */ -async function fetchDataStoreIdentifiers() { - return core.invoke('plugin:app|fetch_data_store_identifiers'); -} -/** - * Removes the data store with the given identifier. - * - * Note that any webview using this data store should be closed before running this API. - * - * See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information. - * - * @example - * ```typescript - * import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app'; - * for (const id of (await fetchDataStoreIdentifiers())) { - * await removeDataStore(id); - * } - * ``` - * - * @since 2.4.0 - */ -async function removeDataStore(uuid) { - return core.invoke('plugin:app|remove_data_store', { uuid }); -} -/** - * Gets the default window icon. - * - * @example - * ```typescript - * import { defaultWindowIcon } from '@tauri-apps/api/app'; - * const icon = await defaultWindowIcon(); - * ``` - * - * @since 2.0.0 - */ -async function defaultWindowIcon() { - return core.invoke('plugin:app|default_window_icon').then((rid) => rid ? new image.Image(rid) : null); -} -/** - * Sets the application's theme. Pass in `null` or `undefined` to follow - * the system theme. - * - * @example - * ```typescript - * import { setTheme } from '@tauri-apps/api/app'; - * await setTheme('dark'); - * ``` - * - * #### Platform-specific - * - * - **iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ -async function setTheme(theme) { - return core.invoke('plugin:app|set_app_theme', { theme }); -} -/** - * Sets the dock visibility for the application on macOS. - * - * @param visible - Whether the dock should be visible or not. - * - * @example - * ```typescript - * import { setDockVisibility } from '@tauri-apps/api/app'; - * await setDockVisibility(false); - * ``` - * - * @since 2.5.0 - */ -async function setDockVisibility(visible) { - return core.invoke('plugin:app|set_dock_visibility', { visible }); -} -/** - * Gets the application bundle type. - * - * @example - * ```typescript - * import { getBundleType } from '@tauri-apps/api/app'; - * const type = await getBundleType(); - * ``` - * - * @since 2.5.0 - */ -async function getBundleType() { - return core.invoke('plugin:app|bundle_type'); -} -/** - * Listens to the backButton event on Android. - * @param handler - */ -async function onBackButtonPress(handler) { - return core.addPluginListener('app', 'back-button', handler); -} - -exports.defaultWindowIcon = defaultWindowIcon; -exports.fetchDataStoreIdentifiers = fetchDataStoreIdentifiers; -exports.getBundleType = getBundleType; -exports.getIdentifier = getIdentifier; -exports.getName = getName; -exports.getTauriVersion = getTauriVersion; -exports.getVersion = getVersion; -exports.hide = hide; -exports.onBackButtonPress = onBackButtonPress; -exports.removeDataStore = removeDataStore; -exports.setDockVisibility = setDockVisibility; -exports.setTheme = setTheme; -exports.show = show; diff --git a/node_modules/@tauri-apps/api/app.d.ts b/node_modules/@tauri-apps/api/app.d.ts deleted file mode 100644 index d535727..0000000 --- a/node_modules/@tauri-apps/api/app.d.ts +++ /dev/null @@ -1,220 +0,0 @@ -import { PluginListener } from './core'; -import { Image } from './image'; -import { Theme } from './window'; -/** - * Identifier type used for data stores on macOS and iOS. - * - * Represents a 128-bit identifier, commonly expressed as a 16-byte UUID. - */ -export type DataStoreIdentifier = [ - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number -]; -/** - * Bundle type of the current application. - */ -export declare enum BundleType { - /** Windows NSIS */ - Nsis = "nsis", - /** Windows MSI */ - Msi = "msi", - /** Linux Debian package */ - Deb = "deb", - /** Linux RPM */ - Rpm = "rpm", - /** Linux AppImage */ - AppImage = "appimage", - /** macOS app bundle */ - App = "app" -} -/** - * Application metadata and related APIs. - * - * @module - */ -/** - * Gets the application version. - * @example - * ```typescript - * import { getVersion } from '@tauri-apps/api/app'; - * const appVersion = await getVersion(); - * ``` - * - * @since 1.0.0 - */ -declare function getVersion(): Promise; -/** - * Gets the application name. - * @example - * ```typescript - * import { getName } from '@tauri-apps/api/app'; - * const appName = await getName(); - * ``` - * - * @since 1.0.0 - */ -declare function getName(): Promise; -/** - * Gets the Tauri framework version used by this application. - * - * @example - * ```typescript - * import { getTauriVersion } from '@tauri-apps/api/app'; - * const tauriVersion = await getTauriVersion(); - * ``` - * - * @since 1.0.0 - */ -declare function getTauriVersion(): Promise; -/** - * Gets the application identifier. - * @example - * ```typescript - * import { getIdentifier } from '@tauri-apps/api/app'; - * const identifier = await getIdentifier(); - * ``` - * - * @returns The application identifier as configured in `tauri.conf.json`. - * - * @since 2.4.0 - */ -declare function getIdentifier(): Promise; -/** - * Shows the application on macOS. This function does not automatically - * focus any specific app window. - * - * @example - * ```typescript - * import { show } from '@tauri-apps/api/app'; - * await show(); - * ``` - * - * @since 1.2.0 - */ -declare function show(): Promise; -/** - * Hides the application on macOS. - * - * @example - * ```typescript - * import { hide } from '@tauri-apps/api/app'; - * await hide(); - * ``` - * - * @since 1.2.0 - */ -declare function hide(): Promise; -/** - * Fetches the data store identifiers on macOS and iOS. - * - * See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information. - * - * @example - * ```typescript - * import { fetchDataStoreIdentifiers } from '@tauri-apps/api/app'; - * const ids = await fetchDataStoreIdentifiers(); - * ``` - * - * @since 2.4.0 - */ -declare function fetchDataStoreIdentifiers(): Promise; -/** - * Removes the data store with the given identifier. - * - * Note that any webview using this data store should be closed before running this API. - * - * See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information. - * - * @example - * ```typescript - * import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app'; - * for (const id of (await fetchDataStoreIdentifiers())) { - * await removeDataStore(id); - * } - * ``` - * - * @since 2.4.0 - */ -declare function removeDataStore(uuid: DataStoreIdentifier): Promise; -/** - * Gets the default window icon. - * - * @example - * ```typescript - * import { defaultWindowIcon } from '@tauri-apps/api/app'; - * const icon = await defaultWindowIcon(); - * ``` - * - * @since 2.0.0 - */ -declare function defaultWindowIcon(): Promise; -/** - * Sets the application's theme. Pass in `null` or `undefined` to follow - * the system theme. - * - * @example - * ```typescript - * import { setTheme } from '@tauri-apps/api/app'; - * await setTheme('dark'); - * ``` - * - * #### Platform-specific - * - * - **iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ -declare function setTheme(theme?: Theme | null): Promise; -/** - * Sets the dock visibility for the application on macOS. - * - * @param visible - Whether the dock should be visible or not. - * - * @example - * ```typescript - * import { setDockVisibility } from '@tauri-apps/api/app'; - * await setDockVisibility(false); - * ``` - * - * @since 2.5.0 - */ -declare function setDockVisibility(visible: boolean): Promise; -/** - * Gets the application bundle type. - * - * @example - * ```typescript - * import { getBundleType } from '@tauri-apps/api/app'; - * const type = await getBundleType(); - * ``` - * - * @since 2.5.0 - */ -declare function getBundleType(): Promise; -/** - * Payload for the onBackButtonPress event. - */ -type OnBackButtonPressPayload = { - /** Whether the webview canGoBack property is true. */ - canGoBack: boolean; -}; -/** - * Listens to the backButton event on Android. - * @param handler - */ -declare function onBackButtonPress(handler: (payload: OnBackButtonPressPayload) => void): Promise; -export { getName, getVersion, getTauriVersion, getIdentifier, show, hide, defaultWindowIcon, setTheme, fetchDataStoreIdentifiers, removeDataStore, setDockVisibility, getBundleType, type OnBackButtonPressPayload, onBackButtonPress }; diff --git a/node_modules/@tauri-apps/api/app.js b/node_modules/@tauri-apps/api/app.js deleted file mode 100644 index c1f2228..0000000 --- a/node_modules/@tauri-apps/api/app.js +++ /dev/null @@ -1,221 +0,0 @@ -import { invoke, addPluginListener } from './core.js'; -import { Image } from './image.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Bundle type of the current application. - */ -var BundleType; -(function (BundleType) { - /** Windows NSIS */ - BundleType["Nsis"] = "nsis"; - /** Windows MSI */ - BundleType["Msi"] = "msi"; - /** Linux Debian package */ - BundleType["Deb"] = "deb"; - /** Linux RPM */ - BundleType["Rpm"] = "rpm"; - /** Linux AppImage */ - BundleType["AppImage"] = "appimage"; - /** macOS app bundle */ - BundleType["App"] = "app"; -})(BundleType || (BundleType = {})); -/** - * Application metadata and related APIs. - * - * @module - */ -/** - * Gets the application version. - * @example - * ```typescript - * import { getVersion } from '@tauri-apps/api/app'; - * const appVersion = await getVersion(); - * ``` - * - * @since 1.0.0 - */ -async function getVersion() { - return invoke('plugin:app|version'); -} -/** - * Gets the application name. - * @example - * ```typescript - * import { getName } from '@tauri-apps/api/app'; - * const appName = await getName(); - * ``` - * - * @since 1.0.0 - */ -async function getName() { - return invoke('plugin:app|name'); -} -/** - * Gets the Tauri framework version used by this application. - * - * @example - * ```typescript - * import { getTauriVersion } from '@tauri-apps/api/app'; - * const tauriVersion = await getTauriVersion(); - * ``` - * - * @since 1.0.0 - */ -async function getTauriVersion() { - return invoke('plugin:app|tauri_version'); -} -/** - * Gets the application identifier. - * @example - * ```typescript - * import { getIdentifier } from '@tauri-apps/api/app'; - * const identifier = await getIdentifier(); - * ``` - * - * @returns The application identifier as configured in `tauri.conf.json`. - * - * @since 2.4.0 - */ -async function getIdentifier() { - return invoke('plugin:app|identifier'); -} -/** - * Shows the application on macOS. This function does not automatically - * focus any specific app window. - * - * @example - * ```typescript - * import { show } from '@tauri-apps/api/app'; - * await show(); - * ``` - * - * @since 1.2.0 - */ -async function show() { - return invoke('plugin:app|app_show'); -} -/** - * Hides the application on macOS. - * - * @example - * ```typescript - * import { hide } from '@tauri-apps/api/app'; - * await hide(); - * ``` - * - * @since 1.2.0 - */ -async function hide() { - return invoke('plugin:app|app_hide'); -} -/** - * Fetches the data store identifiers on macOS and iOS. - * - * See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information. - * - * @example - * ```typescript - * import { fetchDataStoreIdentifiers } from '@tauri-apps/api/app'; - * const ids = await fetchDataStoreIdentifiers(); - * ``` - * - * @since 2.4.0 - */ -async function fetchDataStoreIdentifiers() { - return invoke('plugin:app|fetch_data_store_identifiers'); -} -/** - * Removes the data store with the given identifier. - * - * Note that any webview using this data store should be closed before running this API. - * - * See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information. - * - * @example - * ```typescript - * import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app'; - * for (const id of (await fetchDataStoreIdentifiers())) { - * await removeDataStore(id); - * } - * ``` - * - * @since 2.4.0 - */ -async function removeDataStore(uuid) { - return invoke('plugin:app|remove_data_store', { uuid }); -} -/** - * Gets the default window icon. - * - * @example - * ```typescript - * import { defaultWindowIcon } from '@tauri-apps/api/app'; - * const icon = await defaultWindowIcon(); - * ``` - * - * @since 2.0.0 - */ -async function defaultWindowIcon() { - return invoke('plugin:app|default_window_icon').then((rid) => rid ? new Image(rid) : null); -} -/** - * Sets the application's theme. Pass in `null` or `undefined` to follow - * the system theme. - * - * @example - * ```typescript - * import { setTheme } from '@tauri-apps/api/app'; - * await setTheme('dark'); - * ``` - * - * #### Platform-specific - * - * - **iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ -async function setTheme(theme) { - return invoke('plugin:app|set_app_theme', { theme }); -} -/** - * Sets the dock visibility for the application on macOS. - * - * @param visible - Whether the dock should be visible or not. - * - * @example - * ```typescript - * import { setDockVisibility } from '@tauri-apps/api/app'; - * await setDockVisibility(false); - * ``` - * - * @since 2.5.0 - */ -async function setDockVisibility(visible) { - return invoke('plugin:app|set_dock_visibility', { visible }); -} -/** - * Gets the application bundle type. - * - * @example - * ```typescript - * import { getBundleType } from '@tauri-apps/api/app'; - * const type = await getBundleType(); - * ``` - * - * @since 2.5.0 - */ -async function getBundleType() { - return invoke('plugin:app|bundle_type'); -} -/** - * Listens to the backButton event on Android. - * @param handler - */ -async function onBackButtonPress(handler) { - return addPluginListener('app', 'back-button', handler); -} - -export { BundleType, defaultWindowIcon, fetchDataStoreIdentifiers, getBundleType, getIdentifier, getName, getTauriVersion, getVersion, hide, onBackButtonPress, removeDataStore, setDockVisibility, setTheme, show }; diff --git a/node_modules/@tauri-apps/api/core.cjs b/node_modules/@tauri-apps/api/core.cjs deleted file mode 100644 index 8046d4e..0000000 --- a/node_modules/@tauri-apps/api/core.cjs +++ /dev/null @@ -1,295 +0,0 @@ -'use strict'; - -var tslib_es6 = require('./external/tslib/tslib.es6.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -var _Channel_onmessage, _Channel_nextMessageIndex, _Channel_pendingMessages, _Channel_messageEndIndex, _Resource_rid; -/** - * Invoke your custom commands. - * - * This package is also accessible with `window.__TAURI__.core` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ -/** - * A key to be used to implement a special function - * on your types that define how your type should be serialized - * when passing across the IPC. - * @example - * Given a type in Rust that looks like this - * ```rs - * #[derive(serde::Serialize, serde::Deserialize) - * enum UserId { - * String(String), - * Number(u32), - * } - * ``` - * `UserId::String("id")` would be serialized into `{ String: "id" }` - * and so we need to pass the same structure back to Rust - * ```ts - * import { SERIALIZE_TO_IPC_FN } from "@tauri-apps/api/core" - * - * class UserIdString { - * id - * constructor(id) { - * this.id = id - * } - * - * [SERIALIZE_TO_IPC_FN]() { - * return { String: this.id } - * } - * } - * - * class UserIdNumber { - * id - * constructor(id) { - * this.id = id - * } - * - * [SERIALIZE_TO_IPC_FN]() { - * return { Number: this.id } - * } - * } - * - * type UserId = UserIdString | UserIdNumber - * ``` - * - */ -// if this value changes, make sure to update it in: -// 1. ipc.js -// 2. process-ipc-message-fn.js -const SERIALIZE_TO_IPC_FN = '__TAURI_TO_IPC_KEY__'; -/** - * Stores the callback in a known location, and returns an identifier that can be passed to the backend. - * The backend uses the identifier to `eval()` the callback. - * - * @return An unique identifier associated with the callback function. - * - * @since 1.0.0 - */ -function transformCallback( -// TODO: Make this not optional in v3 -callback, once = false) { - return window.__TAURI_INTERNALS__.transformCallback(callback, once); -} -class Channel { - constructor(onmessage) { - _Channel_onmessage.set(this, void 0); - // the index is used as a mechanism to preserve message order - _Channel_nextMessageIndex.set(this, 0); - _Channel_pendingMessages.set(this, []); - _Channel_messageEndIndex.set(this, void 0); - tslib_es6.__classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => { }), "f"); - this.id = transformCallback((rawMessage) => { - const index = rawMessage.index; - if ('end' in rawMessage) { - if (index == tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) { - this.cleanupCallback(); - } - else { - tslib_es6.__classPrivateFieldSet(this, _Channel_messageEndIndex, index, "f"); - } - return; - } - const message = rawMessage.message; - // Process the message if we're at the right order - if (index == tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) { - tslib_es6.__classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message); - tslib_es6.__classPrivateFieldSet(this, _Channel_nextMessageIndex, tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f"); - // process pending messages - while (tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") in tslib_es6.__classPrivateFieldGet(this, _Channel_pendingMessages, "f")) { - const message = tslib_es6.__classPrivateFieldGet(this, _Channel_pendingMessages, "f")[tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")]; - tslib_es6.__classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message); - // eslint-disable-next-line @typescript-eslint/no-array-delete - delete tslib_es6.__classPrivateFieldGet(this, _Channel_pendingMessages, "f")[tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")]; - tslib_es6.__classPrivateFieldSet(this, _Channel_nextMessageIndex, tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f"); - } - if (tslib_es6.__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") === tslib_es6.__classPrivateFieldGet(this, _Channel_messageEndIndex, "f")) { - this.cleanupCallback(); - } - } - // Queue the message if we're not - else { - // eslint-disable-next-line security/detect-object-injection - tslib_es6.__classPrivateFieldGet(this, _Channel_pendingMessages, "f")[index] = message; - } - }); - } - cleanupCallback() { - window.__TAURI_INTERNALS__.unregisterCallback(this.id); - } - set onmessage(handler) { - tslib_es6.__classPrivateFieldSet(this, _Channel_onmessage, handler, "f"); - } - get onmessage() { - return tslib_es6.__classPrivateFieldGet(this, _Channel_onmessage, "f"); - } - [(_Channel_onmessage = new WeakMap(), _Channel_nextMessageIndex = new WeakMap(), _Channel_pendingMessages = new WeakMap(), _Channel_messageEndIndex = new WeakMap(), SERIALIZE_TO_IPC_FN)]() { - return `__CHANNEL__:${this.id}`; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} -class PluginListener { - constructor(plugin, event, channelId) { - this.plugin = plugin; - this.event = event; - this.channelId = channelId; - } - async unregister() { - return invoke(`plugin:${this.plugin}|remove_listener`, { - event: this.event, - channelId: this.channelId - }); - } -} -/** - * Adds a listener to a plugin event. - * - * @returns The listener object to stop listening to the events. - * - * @since 2.0.0 - */ -async function addPluginListener(plugin, event, cb) { - const handler = new Channel(cb); - try { - await invoke(`plugin:${plugin}|register_listener`, { - event, - handler - }); - return new PluginListener(plugin, event, handler.id); - } - catch { - // TODO(v3): remove this fallback - // note: we must try with camelCase here for backwards compatibility - await invoke(`plugin:${plugin}|registerListener`, { event, handler }); - return new PluginListener(plugin, event, handler.id); - } -} -/** - * Get permission state for a plugin. - * - * This should be used by plugin authors to wrap their actual implementation. - */ -async function checkPermissions(plugin) { - return invoke(`plugin:${plugin}|check_permissions`); -} -/** - * Request permissions. - * - * This should be used by plugin authors to wrap their actual implementation. - */ -async function requestPermissions(plugin) { - return invoke(`plugin:${plugin}|request_permissions`); -} -/** - * Sends a message to the backend. - * @example - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' }); - * ``` - * - * @param cmd The command name. - * @param args The optional arguments to pass to the command. - * @param options The request options. - * @return A promise resolving or rejecting to the backend response. - * - * @since 1.0.0 - */ -async function invoke(cmd, args = {}, options) { - return window.__TAURI_INTERNALS__.invoke(cmd, args, options); -} -/** - * Convert a device file path to an URL that can be loaded by the webview. - * Note that `asset:` and `http://asset.localhost` must be added to [`app.security.csp`](https://v2.tauri.app/reference/config/#csp-1) in `tauri.conf.json`. - * Example CSP value: `"csp": "default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost"` to use the asset protocol on image sources. - * - * Additionally, `"enable" : "true"` must be added to [`app.security.assetProtocol`](https://v2.tauri.app/reference/config/#assetprotocolconfig) - * in `tauri.conf.json` and its access scope must be defined on the `scope` array on the same `assetProtocol` object. - * - * @param filePath The file path. - * @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol. - * @example - * ```typescript - * import { appDataDir, join } from '@tauri-apps/api/path'; - * import { convertFileSrc } from '@tauri-apps/api/core'; - * const appDataDirPath = await appDataDir(); - * const filePath = await join(appDataDirPath, 'assets/video.mp4'); - * const assetUrl = convertFileSrc(filePath); - * - * const video = document.getElementById('my-video'); - * const source = document.createElement('source'); - * source.type = 'video/mp4'; - * source.src = assetUrl; - * video.appendChild(source); - * video.load(); - * ``` - * - * @return the URL that can be used as source on the webview. - * - * @since 1.0.0 - */ -function convertFileSrc(filePath, protocol = 'asset') { - return window.__TAURI_INTERNALS__.convertFileSrc(filePath, protocol); -} -/** - * A rust-backed resource stored through `tauri::Manager::resources_table` API. - * - * The resource lives in the main process and does not exist - * in the Javascript world, and thus will not be cleaned up automatically - * except on application exit. If you want to clean it up early, call {@linkcode Resource.close} - * - * @example - * ```typescript - * import { Resource, invoke } from '@tauri-apps/api/core'; - * export class DatabaseHandle extends Resource { - * static async open(path: string): Promise { - * const rid: number = await invoke('open_db', { path }); - * return new DatabaseHandle(rid); - * } - * - * async execute(sql: string): Promise { - * await invoke('execute_sql', { rid: this.rid, sql }); - * } - * } - * ``` - */ -class Resource { - get rid() { - return tslib_es6.__classPrivateFieldGet(this, _Resource_rid, "f"); - } - constructor(rid) { - _Resource_rid.set(this, void 0); - tslib_es6.__classPrivateFieldSet(this, _Resource_rid, rid, "f"); - } - /** - * Destroys and cleans up this resource from memory. - * **You should not call any method on this object anymore and should drop any reference to it.** - */ - async close() { - return invoke('plugin:resources|close', { - rid: this.rid - }); - } -} -_Resource_rid = new WeakMap(); -function isTauri() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access - return !!(globalThis || window).isTauri; -} - -exports.Channel = Channel; -exports.PluginListener = PluginListener; -exports.Resource = Resource; -exports.SERIALIZE_TO_IPC_FN = SERIALIZE_TO_IPC_FN; -exports.addPluginListener = addPluginListener; -exports.checkPermissions = checkPermissions; -exports.convertFileSrc = convertFileSrc; -exports.invoke = invoke; -exports.isTauri = isTauri; -exports.requestPermissions = requestPermissions; -exports.transformCallback = transformCallback; diff --git a/node_modules/@tauri-apps/api/core.d.ts b/node_modules/@tauri-apps/api/core.d.ts deleted file mode 100644 index 7e126b9..0000000 --- a/node_modules/@tauri-apps/api/core.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Invoke your custom commands. - * - * This package is also accessible with `window.__TAURI__.core` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ -/** - * A key to be used to implement a special function - * on your types that define how your type should be serialized - * when passing across the IPC. - * @example - * Given a type in Rust that looks like this - * ```rs - * #[derive(serde::Serialize, serde::Deserialize) - * enum UserId { - * String(String), - * Number(u32), - * } - * ``` - * `UserId::String("id")` would be serialized into `{ String: "id" }` - * and so we need to pass the same structure back to Rust - * ```ts - * import { SERIALIZE_TO_IPC_FN } from "@tauri-apps/api/core" - * - * class UserIdString { - * id - * constructor(id) { - * this.id = id - * } - * - * [SERIALIZE_TO_IPC_FN]() { - * return { String: this.id } - * } - * } - * - * class UserIdNumber { - * id - * constructor(id) { - * this.id = id - * } - * - * [SERIALIZE_TO_IPC_FN]() { - * return { Number: this.id } - * } - * } - * - * type UserId = UserIdString | UserIdNumber - * ``` - * - */ -export declare const SERIALIZE_TO_IPC_FN = "__TAURI_TO_IPC_KEY__"; -/** - * Stores the callback in a known location, and returns an identifier that can be passed to the backend. - * The backend uses the identifier to `eval()` the callback. - * - * @return An unique identifier associated with the callback function. - * - * @since 1.0.0 - */ -declare function transformCallback(callback?: (response: T) => void, once?: boolean): number; -declare class Channel { - #private; - /** The callback id returned from {@linkcode transformCallback} */ - id: number; - constructor(onmessage?: (response: T) => void); - private cleanupCallback; - set onmessage(handler: (response: T) => void); - get onmessage(): (response: T) => void; - [SERIALIZE_TO_IPC_FN](): string; - toJSON(): string; -} -declare class PluginListener { - plugin: string; - event: string; - channelId: number; - constructor(plugin: string, event: string, channelId: number); - unregister(): Promise; -} -/** - * Adds a listener to a plugin event. - * - * @returns The listener object to stop listening to the events. - * - * @since 2.0.0 - */ -declare function addPluginListener(plugin: string, event: string, cb: (payload: T) => void): Promise; -type PermissionState = 'granted' | 'denied' | 'prompt' | 'prompt-with-rationale'; -/** - * Get permission state for a plugin. - * - * This should be used by plugin authors to wrap their actual implementation. - */ -declare function checkPermissions(plugin: string): Promise; -/** - * Request permissions. - * - * This should be used by plugin authors to wrap their actual implementation. - */ -declare function requestPermissions(plugin: string): Promise; -/** - * Command arguments. - * - * @since 1.0.0 - */ -type InvokeArgs = Record | number[] | ArrayBuffer | Uint8Array; -/** - * @since 2.0.0 - */ -interface InvokeOptions { - headers: HeadersInit; -} -/** - * Sends a message to the backend. - * @example - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' }); - * ``` - * - * @param cmd The command name. - * @param args The optional arguments to pass to the command. - * @param options The request options. - * @return A promise resolving or rejecting to the backend response. - * - * @since 1.0.0 - */ -declare function invoke(cmd: string, args?: InvokeArgs, options?: InvokeOptions): Promise; -/** - * Convert a device file path to an URL that can be loaded by the webview. - * Note that `asset:` and `http://asset.localhost` must be added to [`app.security.csp`](https://v2.tauri.app/reference/config/#csp-1) in `tauri.conf.json`. - * Example CSP value: `"csp": "default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost"` to use the asset protocol on image sources. - * - * Additionally, `"enable" : "true"` must be added to [`app.security.assetProtocol`](https://v2.tauri.app/reference/config/#assetprotocolconfig) - * in `tauri.conf.json` and its access scope must be defined on the `scope` array on the same `assetProtocol` object. - * - * @param filePath The file path. - * @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol. - * @example - * ```typescript - * import { appDataDir, join } from '@tauri-apps/api/path'; - * import { convertFileSrc } from '@tauri-apps/api/core'; - * const appDataDirPath = await appDataDir(); - * const filePath = await join(appDataDirPath, 'assets/video.mp4'); - * const assetUrl = convertFileSrc(filePath); - * - * const video = document.getElementById('my-video'); - * const source = document.createElement('source'); - * source.type = 'video/mp4'; - * source.src = assetUrl; - * video.appendChild(source); - * video.load(); - * ``` - * - * @return the URL that can be used as source on the webview. - * - * @since 1.0.0 - */ -declare function convertFileSrc(filePath: string, protocol?: string): string; -/** - * A rust-backed resource stored through `tauri::Manager::resources_table` API. - * - * The resource lives in the main process and does not exist - * in the Javascript world, and thus will not be cleaned up automatically - * except on application exit. If you want to clean it up early, call {@linkcode Resource.close} - * - * @example - * ```typescript - * import { Resource, invoke } from '@tauri-apps/api/core'; - * export class DatabaseHandle extends Resource { - * static async open(path: string): Promise { - * const rid: number = await invoke('open_db', { path }); - * return new DatabaseHandle(rid); - * } - * - * async execute(sql: string): Promise { - * await invoke('execute_sql', { rid: this.rid, sql }); - * } - * } - * ``` - */ -export declare class Resource { - #private; - get rid(): number; - constructor(rid: number); - /** - * Destroys and cleans up this resource from memory. - * **You should not call any method on this object anymore and should drop any reference to it.** - */ - close(): Promise; -} -declare function isTauri(): boolean; -export type { InvokeArgs, InvokeOptions }; -export { transformCallback, Channel, PluginListener, addPluginListener, PermissionState, checkPermissions, requestPermissions, invoke, convertFileSrc, isTauri }; diff --git a/node_modules/@tauri-apps/api/core.js b/node_modules/@tauri-apps/api/core.js deleted file mode 100644 index ad03e61..0000000 --- a/node_modules/@tauri-apps/api/core.js +++ /dev/null @@ -1,283 +0,0 @@ -import { __classPrivateFieldSet, __classPrivateFieldGet } from './external/tslib/tslib.es6.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -var _Channel_onmessage, _Channel_nextMessageIndex, _Channel_pendingMessages, _Channel_messageEndIndex, _Resource_rid; -/** - * Invoke your custom commands. - * - * This package is also accessible with `window.__TAURI__.core` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ -/** - * A key to be used to implement a special function - * on your types that define how your type should be serialized - * when passing across the IPC. - * @example - * Given a type in Rust that looks like this - * ```rs - * #[derive(serde::Serialize, serde::Deserialize) - * enum UserId { - * String(String), - * Number(u32), - * } - * ``` - * `UserId::String("id")` would be serialized into `{ String: "id" }` - * and so we need to pass the same structure back to Rust - * ```ts - * import { SERIALIZE_TO_IPC_FN } from "@tauri-apps/api/core" - * - * class UserIdString { - * id - * constructor(id) { - * this.id = id - * } - * - * [SERIALIZE_TO_IPC_FN]() { - * return { String: this.id } - * } - * } - * - * class UserIdNumber { - * id - * constructor(id) { - * this.id = id - * } - * - * [SERIALIZE_TO_IPC_FN]() { - * return { Number: this.id } - * } - * } - * - * type UserId = UserIdString | UserIdNumber - * ``` - * - */ -// if this value changes, make sure to update it in: -// 1. ipc.js -// 2. process-ipc-message-fn.js -const SERIALIZE_TO_IPC_FN = '__TAURI_TO_IPC_KEY__'; -/** - * Stores the callback in a known location, and returns an identifier that can be passed to the backend. - * The backend uses the identifier to `eval()` the callback. - * - * @return An unique identifier associated with the callback function. - * - * @since 1.0.0 - */ -function transformCallback( -// TODO: Make this not optional in v3 -callback, once = false) { - return window.__TAURI_INTERNALS__.transformCallback(callback, once); -} -class Channel { - constructor(onmessage) { - _Channel_onmessage.set(this, void 0); - // the index is used as a mechanism to preserve message order - _Channel_nextMessageIndex.set(this, 0); - _Channel_pendingMessages.set(this, []); - _Channel_messageEndIndex.set(this, void 0); - __classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => { }), "f"); - this.id = transformCallback((rawMessage) => { - const index = rawMessage.index; - if ('end' in rawMessage) { - if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) { - this.cleanupCallback(); - } - else { - __classPrivateFieldSet(this, _Channel_messageEndIndex, index, "f"); - } - return; - } - const message = rawMessage.message; - // Process the message if we're at the right order - if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) { - __classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message); - __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f"); - // process pending messages - while (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") in __classPrivateFieldGet(this, _Channel_pendingMessages, "f")) { - const message = __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")]; - __classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message); - // eslint-disable-next-line @typescript-eslint/no-array-delete - delete __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")]; - __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f"); - } - if (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") === __classPrivateFieldGet(this, _Channel_messageEndIndex, "f")) { - this.cleanupCallback(); - } - } - // Queue the message if we're not - else { - // eslint-disable-next-line security/detect-object-injection - __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[index] = message; - } - }); - } - cleanupCallback() { - window.__TAURI_INTERNALS__.unregisterCallback(this.id); - } - set onmessage(handler) { - __classPrivateFieldSet(this, _Channel_onmessage, handler, "f"); - } - get onmessage() { - return __classPrivateFieldGet(this, _Channel_onmessage, "f"); - } - [(_Channel_onmessage = new WeakMap(), _Channel_nextMessageIndex = new WeakMap(), _Channel_pendingMessages = new WeakMap(), _Channel_messageEndIndex = new WeakMap(), SERIALIZE_TO_IPC_FN)]() { - return `__CHANNEL__:${this.id}`; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} -class PluginListener { - constructor(plugin, event, channelId) { - this.plugin = plugin; - this.event = event; - this.channelId = channelId; - } - async unregister() { - return invoke(`plugin:${this.plugin}|remove_listener`, { - event: this.event, - channelId: this.channelId - }); - } -} -/** - * Adds a listener to a plugin event. - * - * @returns The listener object to stop listening to the events. - * - * @since 2.0.0 - */ -async function addPluginListener(plugin, event, cb) { - const handler = new Channel(cb); - try { - await invoke(`plugin:${plugin}|register_listener`, { - event, - handler - }); - return new PluginListener(plugin, event, handler.id); - } - catch { - // TODO(v3): remove this fallback - // note: we must try with camelCase here for backwards compatibility - await invoke(`plugin:${plugin}|registerListener`, { event, handler }); - return new PluginListener(plugin, event, handler.id); - } -} -/** - * Get permission state for a plugin. - * - * This should be used by plugin authors to wrap their actual implementation. - */ -async function checkPermissions(plugin) { - return invoke(`plugin:${plugin}|check_permissions`); -} -/** - * Request permissions. - * - * This should be used by plugin authors to wrap their actual implementation. - */ -async function requestPermissions(plugin) { - return invoke(`plugin:${plugin}|request_permissions`); -} -/** - * Sends a message to the backend. - * @example - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' }); - * ``` - * - * @param cmd The command name. - * @param args The optional arguments to pass to the command. - * @param options The request options. - * @return A promise resolving or rejecting to the backend response. - * - * @since 1.0.0 - */ -async function invoke(cmd, args = {}, options) { - return window.__TAURI_INTERNALS__.invoke(cmd, args, options); -} -/** - * Convert a device file path to an URL that can be loaded by the webview. - * Note that `asset:` and `http://asset.localhost` must be added to [`app.security.csp`](https://v2.tauri.app/reference/config/#csp-1) in `tauri.conf.json`. - * Example CSP value: `"csp": "default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost"` to use the asset protocol on image sources. - * - * Additionally, `"enable" : "true"` must be added to [`app.security.assetProtocol`](https://v2.tauri.app/reference/config/#assetprotocolconfig) - * in `tauri.conf.json` and its access scope must be defined on the `scope` array on the same `assetProtocol` object. - * - * @param filePath The file path. - * @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol. - * @example - * ```typescript - * import { appDataDir, join } from '@tauri-apps/api/path'; - * import { convertFileSrc } from '@tauri-apps/api/core'; - * const appDataDirPath = await appDataDir(); - * const filePath = await join(appDataDirPath, 'assets/video.mp4'); - * const assetUrl = convertFileSrc(filePath); - * - * const video = document.getElementById('my-video'); - * const source = document.createElement('source'); - * source.type = 'video/mp4'; - * source.src = assetUrl; - * video.appendChild(source); - * video.load(); - * ``` - * - * @return the URL that can be used as source on the webview. - * - * @since 1.0.0 - */ -function convertFileSrc(filePath, protocol = 'asset') { - return window.__TAURI_INTERNALS__.convertFileSrc(filePath, protocol); -} -/** - * A rust-backed resource stored through `tauri::Manager::resources_table` API. - * - * The resource lives in the main process and does not exist - * in the Javascript world, and thus will not be cleaned up automatically - * except on application exit. If you want to clean it up early, call {@linkcode Resource.close} - * - * @example - * ```typescript - * import { Resource, invoke } from '@tauri-apps/api/core'; - * export class DatabaseHandle extends Resource { - * static async open(path: string): Promise { - * const rid: number = await invoke('open_db', { path }); - * return new DatabaseHandle(rid); - * } - * - * async execute(sql: string): Promise { - * await invoke('execute_sql', { rid: this.rid, sql }); - * } - * } - * ``` - */ -class Resource { - get rid() { - return __classPrivateFieldGet(this, _Resource_rid, "f"); - } - constructor(rid) { - _Resource_rid.set(this, void 0); - __classPrivateFieldSet(this, _Resource_rid, rid, "f"); - } - /** - * Destroys and cleans up this resource from memory. - * **You should not call any method on this object anymore and should drop any reference to it.** - */ - async close() { - return invoke('plugin:resources|close', { - rid: this.rid - }); - } -} -_Resource_rid = new WeakMap(); -function isTauri() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access - return !!(globalThis || window).isTauri; -} - -export { Channel, PluginListener, Resource, SERIALIZE_TO_IPC_FN, addPluginListener, checkPermissions, convertFileSrc, invoke, isTauri, requestPermissions, transformCallback }; diff --git a/node_modules/@tauri-apps/api/dpi.cjs b/node_modules/@tauri-apps/api/dpi.cjs deleted file mode 100644 index 972617f..0000000 --- a/node_modules/@tauri-apps/api/dpi.cjs +++ /dev/null @@ -1,347 +0,0 @@ -'use strict'; - -var core = require('./core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * A size represented in logical pixels. - * Logical pixels are scaled according to the window's DPI scale. - * Most browser APIs (i.e. `MouseEvent`'s `clientX`) will return logical pixels. - * - * For logical-pixel-based position, see {@linkcode LogicalPosition}. - * - * @since 2.0.0 - */ -class LogicalSize { - constructor(...args) { - this.type = 'Logical'; - if (args.length === 1) { - if ('Logical' in args[0]) { - this.width = args[0].Logical.width; - this.height = args[0].Logical.height; - } - else { - this.width = args[0].width; - this.height = args[0].height; - } - } - else { - this.width = args[0]; - this.height = args[1]; - } - } - /** - * Converts the logical size to a physical one. - * @example - * ```typescript - * import { LogicalSize } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const size = new LogicalSize(400, 500); - * const physical = size.toPhysical(factor); - * ``` - * - * @since 2.0.0 - */ - toPhysical(scaleFactor) { - return new PhysicalSize(this.width * scaleFactor, this.height * scaleFactor); - } - [core.SERIALIZE_TO_IPC_FN]() { - return { - width: this.width, - height: this.height - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[core.SERIALIZE_TO_IPC_FN](); - } -} -/** - * A size represented in physical pixels. - * - * Physical pixels represent actual screen pixels, and are DPI-independent. - * For high-DPI windows, this means that any point in the window on the screen - * will have a different position in logical pixels {@linkcode LogicalSize}. - * - * For physical-pixel-based position, see {@linkcode PhysicalPosition}. - * - * @since 2.0.0 - */ -class PhysicalSize { - constructor(...args) { - this.type = 'Physical'; - if (args.length === 1) { - if ('Physical' in args[0]) { - this.width = args[0].Physical.width; - this.height = args[0].Physical.height; - } - else { - this.width = args[0].width; - this.height = args[0].height; - } - } - else { - this.width = args[0]; - this.height = args[1]; - } - } - /** - * Converts the physical size to a logical one. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const size = await appWindow.innerSize(); // PhysicalSize - * const logical = size.toLogical(factor); - * ``` - */ - toLogical(scaleFactor) { - return new LogicalSize(this.width / scaleFactor, this.height / scaleFactor); - } - [core.SERIALIZE_TO_IPC_FN]() { - return { - width: this.width, - height: this.height - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[core.SERIALIZE_TO_IPC_FN](); - } -} -/** - * A size represented either in physical or in logical pixels. - * - * This type is basically a union type of {@linkcode LogicalSize} and {@linkcode PhysicalSize} - * but comes in handy when using `tauri::Size` in Rust as an argument to a command, as this class - * automatically serializes into a valid format so it can be deserialized correctly into `tauri::Size` - * - * So instead of - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalSize, PhysicalSize } from '@tauri-apps/api/dpi'; - * - * const size: LogicalSize | PhysicalSize = someFunction(); // where someFunction returns either LogicalSize or PhysicalSize - * const validSize = size instanceof LogicalSize - * ? { Logical: { width: size.width, height: size.height } } - * : { Physical: { width: size.width, height: size.height } } - * await invoke("do_something_with_size", { size: validSize }); - * ``` - * - * You can just use {@linkcode Size} - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalSize, PhysicalSize, Size } from '@tauri-apps/api/dpi'; - * - * const size: LogicalSize | PhysicalSize = someFunction(); // where someFunction returns either LogicalSize or PhysicalSize - * const validSize = new Size(size); - * await invoke("do_something_with_size", { size: validSize }); - * ``` - * - * @since 2.1.0 - */ -class Size { - constructor(size) { - this.size = size; - } - toLogical(scaleFactor) { - return this.size instanceof LogicalSize - ? this.size - : this.size.toLogical(scaleFactor); - } - toPhysical(scaleFactor) { - return this.size instanceof PhysicalSize - ? this.size - : this.size.toPhysical(scaleFactor); - } - [core.SERIALIZE_TO_IPC_FN]() { - return { - [`${this.size.type}`]: { - width: this.size.width, - height: this.size.height - } - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[core.SERIALIZE_TO_IPC_FN](); - } -} -/** - * A position represented in logical pixels. - * For an explanation of what logical pixels are, see description of {@linkcode LogicalSize}. - * - * @since 2.0.0 - */ -class LogicalPosition { - constructor(...args) { - this.type = 'Logical'; - if (args.length === 1) { - if ('Logical' in args[0]) { - this.x = args[0].Logical.x; - this.y = args[0].Logical.y; - } - else { - this.x = args[0].x; - this.y = args[0].y; - } - } - else { - this.x = args[0]; - this.y = args[1]; - } - } - /** - * Converts the logical position to a physical one. - * @example - * ```typescript - * import { LogicalPosition } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const position = new LogicalPosition(400, 500); - * const physical = position.toPhysical(factor); - * ``` - * - * @since 2.0.0 - */ - toPhysical(scaleFactor) { - return new PhysicalPosition(this.x * scaleFactor, this.y * scaleFactor); - } - [core.SERIALIZE_TO_IPC_FN]() { - return { - x: this.x, - y: this.y - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[core.SERIALIZE_TO_IPC_FN](); - } -} -/** - * A position represented in physical pixels. - * - * For an explanation of what physical pixels are, see description of {@linkcode PhysicalSize}. - * - * @since 2.0.0 - */ -class PhysicalPosition { - constructor(...args) { - this.type = 'Physical'; - if (args.length === 1) { - if ('Physical' in args[0]) { - this.x = args[0].Physical.x; - this.y = args[0].Physical.y; - } - else { - this.x = args[0].x; - this.y = args[0].y; - } - } - else { - this.x = args[0]; - this.y = args[1]; - } - } - /** - * Converts the physical position to a logical one. - * @example - * ```typescript - * import { PhysicalPosition } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const position = new PhysicalPosition(400, 500); - * const physical = position.toLogical(factor); - * ``` - * - * @since 2.0.0 - */ - toLogical(scaleFactor) { - return new LogicalPosition(this.x / scaleFactor, this.y / scaleFactor); - } - [core.SERIALIZE_TO_IPC_FN]() { - return { - x: this.x, - y: this.y - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[core.SERIALIZE_TO_IPC_FN](); - } -} -/** - * A position represented either in physical or in logical pixels. - * - * This type is basically a union type of {@linkcode LogicalSize} and {@linkcode PhysicalSize} - * but comes in handy when using `tauri::Position` in Rust as an argument to a command, as this class - * automatically serializes into a valid format so it can be deserialized correctly into `tauri::Position` - * - * So instead of - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalPosition, PhysicalPosition } from '@tauri-apps/api/dpi'; - * - * const position: LogicalPosition | PhysicalPosition = someFunction(); // where someFunction returns either LogicalPosition or PhysicalPosition - * const validPosition = position instanceof LogicalPosition - * ? { Logical: { x: position.x, y: position.y } } - * : { Physical: { x: position.x, y: position.y } } - * await invoke("do_something_with_position", { position: validPosition }); - * ``` - * - * You can just use {@linkcode Position} - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalPosition, PhysicalPosition, Position } from '@tauri-apps/api/dpi'; - * - * const position: LogicalPosition | PhysicalPosition = someFunction(); // where someFunction returns either LogicalPosition or PhysicalPosition - * const validPosition = new Position(position); - * await invoke("do_something_with_position", { position: validPosition }); - * ``` - * - * @since 2.1.0 - */ -class Position { - constructor(position) { - this.position = position; - } - toLogical(scaleFactor) { - return this.position instanceof LogicalPosition - ? this.position - : this.position.toLogical(scaleFactor); - } - toPhysical(scaleFactor) { - return this.position instanceof PhysicalPosition - ? this.position - : this.position.toPhysical(scaleFactor); - } - [core.SERIALIZE_TO_IPC_FN]() { - return { - [`${this.position.type}`]: { - x: this.position.x, - y: this.position.y - } - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[core.SERIALIZE_TO_IPC_FN](); - } -} - -exports.LogicalPosition = LogicalPosition; -exports.LogicalSize = LogicalSize; -exports.PhysicalPosition = PhysicalPosition; -exports.PhysicalSize = PhysicalSize; -exports.Position = Position; -exports.Size = Size; diff --git a/node_modules/@tauri-apps/api/dpi.d.ts b/node_modules/@tauri-apps/api/dpi.d.ts deleted file mode 100644 index 7e6c1da..0000000 --- a/node_modules/@tauri-apps/api/dpi.d.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { SERIALIZE_TO_IPC_FN } from './core'; -/** - * A size represented in logical pixels. - * Logical pixels are scaled according to the window's DPI scale. - * Most browser APIs (i.e. `MouseEvent`'s `clientX`) will return logical pixels. - * - * For logical-pixel-based position, see {@linkcode LogicalPosition}. - * - * @since 2.0.0 - */ -declare class LogicalSize { - readonly type = "Logical"; - width: number; - height: number; - constructor(width: number, height: number); - constructor(object: { - Logical: { - width: number; - height: number; - }; - }); - constructor(object: { - width: number; - height: number; - }); - /** - * Converts the logical size to a physical one. - * @example - * ```typescript - * import { LogicalSize } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const size = new LogicalSize(400, 500); - * const physical = size.toPhysical(factor); - * ``` - * - * @since 2.0.0 - */ - toPhysical(scaleFactor: number): PhysicalSize; - [SERIALIZE_TO_IPC_FN](): { - width: number; - height: number; - }; - toJSON(): { - width: number; - height: number; - }; -} -/** - * A size represented in physical pixels. - * - * Physical pixels represent actual screen pixels, and are DPI-independent. - * For high-DPI windows, this means that any point in the window on the screen - * will have a different position in logical pixels {@linkcode LogicalSize}. - * - * For physical-pixel-based position, see {@linkcode PhysicalPosition}. - * - * @since 2.0.0 - */ -declare class PhysicalSize { - readonly type = "Physical"; - width: number; - height: number; - constructor(width: number, height: number); - constructor(object: { - Physical: { - width: number; - height: number; - }; - }); - constructor(object: { - width: number; - height: number; - }); - /** - * Converts the physical size to a logical one. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const size = await appWindow.innerSize(); // PhysicalSize - * const logical = size.toLogical(factor); - * ``` - */ - toLogical(scaleFactor: number): LogicalSize; - [SERIALIZE_TO_IPC_FN](): { - width: number; - height: number; - }; - toJSON(): { - width: number; - height: number; - }; -} -/** - * A size represented either in physical or in logical pixels. - * - * This type is basically a union type of {@linkcode LogicalSize} and {@linkcode PhysicalSize} - * but comes in handy when using `tauri::Size` in Rust as an argument to a command, as this class - * automatically serializes into a valid format so it can be deserialized correctly into `tauri::Size` - * - * So instead of - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalSize, PhysicalSize } from '@tauri-apps/api/dpi'; - * - * const size: LogicalSize | PhysicalSize = someFunction(); // where someFunction returns either LogicalSize or PhysicalSize - * const validSize = size instanceof LogicalSize - * ? { Logical: { width: size.width, height: size.height } } - * : { Physical: { width: size.width, height: size.height } } - * await invoke("do_something_with_size", { size: validSize }); - * ``` - * - * You can just use {@linkcode Size} - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalSize, PhysicalSize, Size } from '@tauri-apps/api/dpi'; - * - * const size: LogicalSize | PhysicalSize = someFunction(); // where someFunction returns either LogicalSize or PhysicalSize - * const validSize = new Size(size); - * await invoke("do_something_with_size", { size: validSize }); - * ``` - * - * @since 2.1.0 - */ -declare class Size { - size: LogicalSize | PhysicalSize; - constructor(size: LogicalSize | PhysicalSize); - toLogical(scaleFactor: number): LogicalSize; - toPhysical(scaleFactor: number): PhysicalSize; - [SERIALIZE_TO_IPC_FN](): { - [x: string]: { - width: number; - height: number; - }; - }; - toJSON(): { - [x: string]: { - width: number; - height: number; - }; - }; -} -/** - * A position represented in logical pixels. - * For an explanation of what logical pixels are, see description of {@linkcode LogicalSize}. - * - * @since 2.0.0 - */ -declare class LogicalPosition { - readonly type = "Logical"; - x: number; - y: number; - constructor(x: number, y: number); - constructor(object: { - Logical: { - x: number; - y: number; - }; - }); - constructor(object: { - x: number; - y: number; - }); - /** - * Converts the logical position to a physical one. - * @example - * ```typescript - * import { LogicalPosition } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const position = new LogicalPosition(400, 500); - * const physical = position.toPhysical(factor); - * ``` - * - * @since 2.0.0 - */ - toPhysical(scaleFactor: number): PhysicalPosition; - [SERIALIZE_TO_IPC_FN](): { - x: number; - y: number; - }; - toJSON(): { - x: number; - y: number; - }; -} -/** - * A position represented in physical pixels. - * - * For an explanation of what physical pixels are, see description of {@linkcode PhysicalSize}. - * - * @since 2.0.0 - */ -declare class PhysicalPosition { - readonly type = "Physical"; - x: number; - y: number; - constructor(x: number, y: number); - constructor(object: { - Physical: { - x: number; - y: number; - }; - }); - constructor(object: { - x: number; - y: number; - }); - /** - * Converts the physical position to a logical one. - * @example - * ```typescript - * import { PhysicalPosition } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const position = new PhysicalPosition(400, 500); - * const physical = position.toLogical(factor); - * ``` - * - * @since 2.0.0 - */ - toLogical(scaleFactor: number): LogicalPosition; - [SERIALIZE_TO_IPC_FN](): { - x: number; - y: number; - }; - toJSON(): { - x: number; - y: number; - }; -} -/** - * A position represented either in physical or in logical pixels. - * - * This type is basically a union type of {@linkcode LogicalSize} and {@linkcode PhysicalSize} - * but comes in handy when using `tauri::Position` in Rust as an argument to a command, as this class - * automatically serializes into a valid format so it can be deserialized correctly into `tauri::Position` - * - * So instead of - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalPosition, PhysicalPosition } from '@tauri-apps/api/dpi'; - * - * const position: LogicalPosition | PhysicalPosition = someFunction(); // where someFunction returns either LogicalPosition or PhysicalPosition - * const validPosition = position instanceof LogicalPosition - * ? { Logical: { x: position.x, y: position.y } } - * : { Physical: { x: position.x, y: position.y } } - * await invoke("do_something_with_position", { position: validPosition }); - * ``` - * - * You can just use {@linkcode Position} - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalPosition, PhysicalPosition, Position } from '@tauri-apps/api/dpi'; - * - * const position: LogicalPosition | PhysicalPosition = someFunction(); // where someFunction returns either LogicalPosition or PhysicalPosition - * const validPosition = new Position(position); - * await invoke("do_something_with_position", { position: validPosition }); - * ``` - * - * @since 2.1.0 - */ -declare class Position { - position: LogicalPosition | PhysicalPosition; - constructor(position: LogicalPosition | PhysicalPosition); - toLogical(scaleFactor: number): LogicalPosition; - toPhysical(scaleFactor: number): PhysicalPosition; - [SERIALIZE_TO_IPC_FN](): { - [x: string]: { - x: number; - y: number; - }; - }; - toJSON(): { - [x: string]: { - x: number; - y: number; - }; - }; -} -export { LogicalPosition, LogicalSize, Size, PhysicalPosition, PhysicalSize, Position }; diff --git a/node_modules/@tauri-apps/api/dpi.js b/node_modules/@tauri-apps/api/dpi.js deleted file mode 100644 index f7fb485..0000000 --- a/node_modules/@tauri-apps/api/dpi.js +++ /dev/null @@ -1,340 +0,0 @@ -import { SERIALIZE_TO_IPC_FN } from './core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * A size represented in logical pixels. - * Logical pixels are scaled according to the window's DPI scale. - * Most browser APIs (i.e. `MouseEvent`'s `clientX`) will return logical pixels. - * - * For logical-pixel-based position, see {@linkcode LogicalPosition}. - * - * @since 2.0.0 - */ -class LogicalSize { - constructor(...args) { - this.type = 'Logical'; - if (args.length === 1) { - if ('Logical' in args[0]) { - this.width = args[0].Logical.width; - this.height = args[0].Logical.height; - } - else { - this.width = args[0].width; - this.height = args[0].height; - } - } - else { - this.width = args[0]; - this.height = args[1]; - } - } - /** - * Converts the logical size to a physical one. - * @example - * ```typescript - * import { LogicalSize } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const size = new LogicalSize(400, 500); - * const physical = size.toPhysical(factor); - * ``` - * - * @since 2.0.0 - */ - toPhysical(scaleFactor) { - return new PhysicalSize(this.width * scaleFactor, this.height * scaleFactor); - } - [SERIALIZE_TO_IPC_FN]() { - return { - width: this.width, - height: this.height - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} -/** - * A size represented in physical pixels. - * - * Physical pixels represent actual screen pixels, and are DPI-independent. - * For high-DPI windows, this means that any point in the window on the screen - * will have a different position in logical pixels {@linkcode LogicalSize}. - * - * For physical-pixel-based position, see {@linkcode PhysicalPosition}. - * - * @since 2.0.0 - */ -class PhysicalSize { - constructor(...args) { - this.type = 'Physical'; - if (args.length === 1) { - if ('Physical' in args[0]) { - this.width = args[0].Physical.width; - this.height = args[0].Physical.height; - } - else { - this.width = args[0].width; - this.height = args[0].height; - } - } - else { - this.width = args[0]; - this.height = args[1]; - } - } - /** - * Converts the physical size to a logical one. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const size = await appWindow.innerSize(); // PhysicalSize - * const logical = size.toLogical(factor); - * ``` - */ - toLogical(scaleFactor) { - return new LogicalSize(this.width / scaleFactor, this.height / scaleFactor); - } - [SERIALIZE_TO_IPC_FN]() { - return { - width: this.width, - height: this.height - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} -/** - * A size represented either in physical or in logical pixels. - * - * This type is basically a union type of {@linkcode LogicalSize} and {@linkcode PhysicalSize} - * but comes in handy when using `tauri::Size` in Rust as an argument to a command, as this class - * automatically serializes into a valid format so it can be deserialized correctly into `tauri::Size` - * - * So instead of - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalSize, PhysicalSize } from '@tauri-apps/api/dpi'; - * - * const size: LogicalSize | PhysicalSize = someFunction(); // where someFunction returns either LogicalSize or PhysicalSize - * const validSize = size instanceof LogicalSize - * ? { Logical: { width: size.width, height: size.height } } - * : { Physical: { width: size.width, height: size.height } } - * await invoke("do_something_with_size", { size: validSize }); - * ``` - * - * You can just use {@linkcode Size} - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalSize, PhysicalSize, Size } from '@tauri-apps/api/dpi'; - * - * const size: LogicalSize | PhysicalSize = someFunction(); // where someFunction returns either LogicalSize or PhysicalSize - * const validSize = new Size(size); - * await invoke("do_something_with_size", { size: validSize }); - * ``` - * - * @since 2.1.0 - */ -class Size { - constructor(size) { - this.size = size; - } - toLogical(scaleFactor) { - return this.size instanceof LogicalSize - ? this.size - : this.size.toLogical(scaleFactor); - } - toPhysical(scaleFactor) { - return this.size instanceof PhysicalSize - ? this.size - : this.size.toPhysical(scaleFactor); - } - [SERIALIZE_TO_IPC_FN]() { - return { - [`${this.size.type}`]: { - width: this.size.width, - height: this.size.height - } - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} -/** - * A position represented in logical pixels. - * For an explanation of what logical pixels are, see description of {@linkcode LogicalSize}. - * - * @since 2.0.0 - */ -class LogicalPosition { - constructor(...args) { - this.type = 'Logical'; - if (args.length === 1) { - if ('Logical' in args[0]) { - this.x = args[0].Logical.x; - this.y = args[0].Logical.y; - } - else { - this.x = args[0].x; - this.y = args[0].y; - } - } - else { - this.x = args[0]; - this.y = args[1]; - } - } - /** - * Converts the logical position to a physical one. - * @example - * ```typescript - * import { LogicalPosition } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const position = new LogicalPosition(400, 500); - * const physical = position.toPhysical(factor); - * ``` - * - * @since 2.0.0 - */ - toPhysical(scaleFactor) { - return new PhysicalPosition(this.x * scaleFactor, this.y * scaleFactor); - } - [SERIALIZE_TO_IPC_FN]() { - return { - x: this.x, - y: this.y - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} -/** - * A position represented in physical pixels. - * - * For an explanation of what physical pixels are, see description of {@linkcode PhysicalSize}. - * - * @since 2.0.0 - */ -class PhysicalPosition { - constructor(...args) { - this.type = 'Physical'; - if (args.length === 1) { - if ('Physical' in args[0]) { - this.x = args[0].Physical.x; - this.y = args[0].Physical.y; - } - else { - this.x = args[0].x; - this.y = args[0].y; - } - } - else { - this.x = args[0]; - this.y = args[1]; - } - } - /** - * Converts the physical position to a logical one. - * @example - * ```typescript - * import { PhysicalPosition } from '@tauri-apps/api/dpi'; - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * - * const appWindow = getCurrentWindow(); - * const factor = await appWindow.scaleFactor(); - * const position = new PhysicalPosition(400, 500); - * const physical = position.toLogical(factor); - * ``` - * - * @since 2.0.0 - */ - toLogical(scaleFactor) { - return new LogicalPosition(this.x / scaleFactor, this.y / scaleFactor); - } - [SERIALIZE_TO_IPC_FN]() { - return { - x: this.x, - y: this.y - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} -/** - * A position represented either in physical or in logical pixels. - * - * This type is basically a union type of {@linkcode LogicalSize} and {@linkcode PhysicalSize} - * but comes in handy when using `tauri::Position` in Rust as an argument to a command, as this class - * automatically serializes into a valid format so it can be deserialized correctly into `tauri::Position` - * - * So instead of - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalPosition, PhysicalPosition } from '@tauri-apps/api/dpi'; - * - * const position: LogicalPosition | PhysicalPosition = someFunction(); // where someFunction returns either LogicalPosition or PhysicalPosition - * const validPosition = position instanceof LogicalPosition - * ? { Logical: { x: position.x, y: position.y } } - * : { Physical: { x: position.x, y: position.y } } - * await invoke("do_something_with_position", { position: validPosition }); - * ``` - * - * You can just use {@linkcode Position} - * ```typescript - * import { invoke } from '@tauri-apps/api/core'; - * import { LogicalPosition, PhysicalPosition, Position } from '@tauri-apps/api/dpi'; - * - * const position: LogicalPosition | PhysicalPosition = someFunction(); // where someFunction returns either LogicalPosition or PhysicalPosition - * const validPosition = new Position(position); - * await invoke("do_something_with_position", { position: validPosition }); - * ``` - * - * @since 2.1.0 - */ -class Position { - constructor(position) { - this.position = position; - } - toLogical(scaleFactor) { - return this.position instanceof LogicalPosition - ? this.position - : this.position.toLogical(scaleFactor); - } - toPhysical(scaleFactor) { - return this.position instanceof PhysicalPosition - ? this.position - : this.position.toPhysical(scaleFactor); - } - [SERIALIZE_TO_IPC_FN]() { - return { - [`${this.position.type}`]: { - x: this.position.x, - y: this.position.y - } - }; - } - toJSON() { - // eslint-disable-next-line security/detect-object-injection - return this[SERIALIZE_TO_IPC_FN](); - } -} - -export { LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size }; diff --git a/node_modules/@tauri-apps/api/event.cjs b/node_modules/@tauri-apps/api/event.cjs deleted file mode 100644 index 33ee012..0000000 --- a/node_modules/@tauri-apps/api/event.cjs +++ /dev/null @@ -1,163 +0,0 @@ -'use strict'; - -var core = require('./core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * The event system allows you to emit events to the backend and listen to events from it. - * - * This package is also accessible with `window.__TAURI__.event` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ -/** - * @since 1.1.0 - */ -exports.TauriEvent = void 0; -(function (TauriEvent) { - TauriEvent["WINDOW_RESIZED"] = "tauri://resize"; - TauriEvent["WINDOW_MOVED"] = "tauri://move"; - TauriEvent["WINDOW_CLOSE_REQUESTED"] = "tauri://close-requested"; - TauriEvent["WINDOW_DESTROYED"] = "tauri://destroyed"; - TauriEvent["WINDOW_FOCUS"] = "tauri://focus"; - TauriEvent["WINDOW_BLUR"] = "tauri://blur"; - TauriEvent["WINDOW_SCALE_FACTOR_CHANGED"] = "tauri://scale-change"; - TauriEvent["WINDOW_THEME_CHANGED"] = "tauri://theme-changed"; - TauriEvent["WINDOW_CREATED"] = "tauri://window-created"; - TauriEvent["WEBVIEW_CREATED"] = "tauri://webview-created"; - TauriEvent["DRAG_ENTER"] = "tauri://drag-enter"; - TauriEvent["DRAG_OVER"] = "tauri://drag-over"; - TauriEvent["DRAG_DROP"] = "tauri://drag-drop"; - TauriEvent["DRAG_LEAVE"] = "tauri://drag-leave"; -})(exports.TauriEvent || (exports.TauriEvent = {})); -/** - * Unregister the event listener associated with the given name and id. - * - * @ignore - * @param event The event name - * @param eventId Event identifier - * @returns - */ -async function _unlisten(event, eventId) { - window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(event, eventId); - await core.invoke('plugin:event|unlisten', { - event, - eventId - }); -} -/** - * Listen to an emitted event to any {@link EventTarget|target}. - * - * @example - * ```typescript - * import { listen } from '@tauri-apps/api/event'; - * const unlisten = await listen('error', (event) => { - * console.log(`Got error, payload: ${event.payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler callback. - * @param options Event listening options. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - * - * @since 1.0.0 - */ -async function listen(event, handler, options) { - var _a; - const target = typeof (options === null || options === void 0 ? void 0 : options.target) === 'string' - ? { kind: 'AnyLabel', label: options.target } - : ((_a = options === null || options === void 0 ? void 0 : options.target) !== null && _a !== void 0 ? _a : { kind: 'Any' }); - return core.invoke('plugin:event|listen', { - event, - target, - handler: core.transformCallback(handler) - }).then((eventId) => { - return async () => _unlisten(event, eventId); - }); -} -/** - * Listens once to an emitted event to any {@link EventTarget|target}. - * - * @example - * ```typescript - * import { once } from '@tauri-apps/api/event'; - * interface LoadedPayload { - * loggedIn: boolean, - * token: string - * } - * const unlisten = await once('loaded', (event) => { - * console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler callback. - * @param options Event listening options. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - * - * @since 1.0.0 - */ -async function once(event, handler, options) { - return listen(event, (eventData) => { - void _unlisten(event, eventData.id); - handler(eventData); - }, options); -} -/** - * Emits an event to all {@link EventTarget|targets}. - * - * @example - * ```typescript - * import { emit } from '@tauri-apps/api/event'; - * await emit('frontend-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - * - * @since 1.0.0 - */ -async function emit(event, payload) { - await core.invoke('plugin:event|emit', { - event, - payload - }); -} -/** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { emitTo } from '@tauri-apps/api/event'; - * await emitTo('main', 'frontend-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - * - * @since 2.0.0 - */ -async function emitTo(target, event, payload) { - const eventTarget = typeof target === 'string' ? { kind: 'AnyLabel', label: target } : target; - await core.invoke('plugin:event|emit_to', { - target: eventTarget, - event, - payload - }); -} - -exports.emit = emit; -exports.emitTo = emitTo; -exports.listen = listen; -exports.once = once; diff --git a/node_modules/@tauri-apps/api/event.d.ts b/node_modules/@tauri-apps/api/event.d.ts deleted file mode 100644 index c110f7b..0000000 --- a/node_modules/@tauri-apps/api/event.d.ts +++ /dev/null @@ -1,145 +0,0 @@ -declare global { - interface Window { - __TAURI_EVENT_PLUGIN_INTERNALS__: { - unregisterListener: (event: string, eventId: number) => void; - }; - } -} -type EventTarget = { - kind: 'Any'; -} | { - kind: 'AnyLabel'; - label: string; -} | { - kind: 'App'; -} | { - kind: 'Window'; - label: string; -} | { - kind: 'Webview'; - label: string; -} | { - kind: 'WebviewWindow'; - label: string; -}; -interface Event { - /** Event name */ - event: EventName; - /** Event identifier used to unlisten */ - id: number; - /** Event payload */ - payload: T; -} -type EventCallback = (event: Event) => void; -type UnlistenFn = () => void; -type EventName = `${TauriEvent}` | (string & Record); -interface Options { - /** - * The event target to listen to, defaults to `{ kind: 'Any' }`, see {@link EventTarget}. - * - * If a string is provided, {@link EventTarget.AnyLabel} is used. - */ - target?: string | EventTarget; -} -/** - * @since 1.1.0 - */ -declare enum TauriEvent { - WINDOW_RESIZED = "tauri://resize", - WINDOW_MOVED = "tauri://move", - WINDOW_CLOSE_REQUESTED = "tauri://close-requested", - WINDOW_DESTROYED = "tauri://destroyed", - WINDOW_FOCUS = "tauri://focus", - WINDOW_BLUR = "tauri://blur", - WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", - WINDOW_THEME_CHANGED = "tauri://theme-changed", - WINDOW_CREATED = "tauri://window-created", - WEBVIEW_CREATED = "tauri://webview-created", - DRAG_ENTER = "tauri://drag-enter", - DRAG_OVER = "tauri://drag-over", - DRAG_DROP = "tauri://drag-drop", - DRAG_LEAVE = "tauri://drag-leave" -} -/** - * Listen to an emitted event to any {@link EventTarget|target}. - * - * @example - * ```typescript - * import { listen } from '@tauri-apps/api/event'; - * const unlisten = await listen('error', (event) => { - * console.log(`Got error, payload: ${event.payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler callback. - * @param options Event listening options. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - * - * @since 1.0.0 - */ -declare function listen(event: EventName, handler: EventCallback, options?: Options): Promise; -/** - * Listens once to an emitted event to any {@link EventTarget|target}. - * - * @example - * ```typescript - * import { once } from '@tauri-apps/api/event'; - * interface LoadedPayload { - * loggedIn: boolean, - * token: string - * } - * const unlisten = await once('loaded', (event) => { - * console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler callback. - * @param options Event listening options. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - * - * @since 1.0.0 - */ -declare function once(event: EventName, handler: EventCallback, options?: Options): Promise; -/** - * Emits an event to all {@link EventTarget|targets}. - * - * @example - * ```typescript - * import { emit } from '@tauri-apps/api/event'; - * await emit('frontend-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - * - * @since 1.0.0 - */ -declare function emit(event: string, payload?: T): Promise; -/** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { emitTo } from '@tauri-apps/api/event'; - * await emitTo('main', 'frontend-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - * - * @since 2.0.0 - */ -declare function emitTo(target: EventTarget | string, event: string, payload?: T): Promise; -export type { Event, EventTarget, EventCallback, UnlistenFn, EventName, Options }; -export { listen, once, emit, emitTo, TauriEvent }; diff --git a/node_modules/@tauri-apps/api/event.js b/node_modules/@tauri-apps/api/event.js deleted file mode 100644 index 5ef61bc..0000000 --- a/node_modules/@tauri-apps/api/event.js +++ /dev/null @@ -1,158 +0,0 @@ -import { invoke, transformCallback } from './core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * The event system allows you to emit events to the backend and listen to events from it. - * - * This package is also accessible with `window.__TAURI__.event` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ -/** - * @since 1.1.0 - */ -var TauriEvent; -(function (TauriEvent) { - TauriEvent["WINDOW_RESIZED"] = "tauri://resize"; - TauriEvent["WINDOW_MOVED"] = "tauri://move"; - TauriEvent["WINDOW_CLOSE_REQUESTED"] = "tauri://close-requested"; - TauriEvent["WINDOW_DESTROYED"] = "tauri://destroyed"; - TauriEvent["WINDOW_FOCUS"] = "tauri://focus"; - TauriEvent["WINDOW_BLUR"] = "tauri://blur"; - TauriEvent["WINDOW_SCALE_FACTOR_CHANGED"] = "tauri://scale-change"; - TauriEvent["WINDOW_THEME_CHANGED"] = "tauri://theme-changed"; - TauriEvent["WINDOW_CREATED"] = "tauri://window-created"; - TauriEvent["WEBVIEW_CREATED"] = "tauri://webview-created"; - TauriEvent["DRAG_ENTER"] = "tauri://drag-enter"; - TauriEvent["DRAG_OVER"] = "tauri://drag-over"; - TauriEvent["DRAG_DROP"] = "tauri://drag-drop"; - TauriEvent["DRAG_LEAVE"] = "tauri://drag-leave"; -})(TauriEvent || (TauriEvent = {})); -/** - * Unregister the event listener associated with the given name and id. - * - * @ignore - * @param event The event name - * @param eventId Event identifier - * @returns - */ -async function _unlisten(event, eventId) { - window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(event, eventId); - await invoke('plugin:event|unlisten', { - event, - eventId - }); -} -/** - * Listen to an emitted event to any {@link EventTarget|target}. - * - * @example - * ```typescript - * import { listen } from '@tauri-apps/api/event'; - * const unlisten = await listen('error', (event) => { - * console.log(`Got error, payload: ${event.payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler callback. - * @param options Event listening options. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - * - * @since 1.0.0 - */ -async function listen(event, handler, options) { - var _a; - const target = typeof (options === null || options === void 0 ? void 0 : options.target) === 'string' - ? { kind: 'AnyLabel', label: options.target } - : ((_a = options === null || options === void 0 ? void 0 : options.target) !== null && _a !== void 0 ? _a : { kind: 'Any' }); - return invoke('plugin:event|listen', { - event, - target, - handler: transformCallback(handler) - }).then((eventId) => { - return async () => _unlisten(event, eventId); - }); -} -/** - * Listens once to an emitted event to any {@link EventTarget|target}. - * - * @example - * ```typescript - * import { once } from '@tauri-apps/api/event'; - * interface LoadedPayload { - * loggedIn: boolean, - * token: string - * } - * const unlisten = await once('loaded', (event) => { - * console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler callback. - * @param options Event listening options. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - * - * @since 1.0.0 - */ -async function once(event, handler, options) { - return listen(event, (eventData) => { - void _unlisten(event, eventData.id); - handler(eventData); - }, options); -} -/** - * Emits an event to all {@link EventTarget|targets}. - * - * @example - * ```typescript - * import { emit } from '@tauri-apps/api/event'; - * await emit('frontend-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - * - * @since 1.0.0 - */ -async function emit(event, payload) { - await invoke('plugin:event|emit', { - event, - payload - }); -} -/** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { emitTo } from '@tauri-apps/api/event'; - * await emitTo('main', 'frontend-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - * - * @since 2.0.0 - */ -async function emitTo(target, event, payload) { - const eventTarget = typeof target === 'string' ? { kind: 'AnyLabel', label: target } : target; - await invoke('plugin:event|emit_to', { - target: eventTarget, - event, - payload - }); -} - -export { TauriEvent, emit, emitTo, listen, once }; diff --git a/node_modules/@tauri-apps/api/external/tslib/tslib.es6.cjs b/node_modules/@tauri-apps/api/external/tslib/tslib.es6.cjs deleted file mode 100644 index a15899d..0000000 --- a/node_modules/@tauri-apps/api/external/tslib/tslib.es6.cjs +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ - - -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -} - -typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; - -exports.__classPrivateFieldGet = __classPrivateFieldGet; -exports.__classPrivateFieldSet = __classPrivateFieldSet; diff --git a/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js b/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js deleted file mode 100644 index e42559f..0000000 --- a/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js +++ /dev/null @@ -1,36 +0,0 @@ -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ - - -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -} - -typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; - -export { __classPrivateFieldGet, __classPrivateFieldSet }; diff --git a/node_modules/@tauri-apps/api/image.cjs b/node_modules/@tauri-apps/api/image.cjs deleted file mode 100644 index 160bfc1..0000000 --- a/node_modules/@tauri-apps/api/image.cjs +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -var core = require('./core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** An RGBA Image in row-major order from top to bottom. */ -class Image extends core.Resource { - /** - * Creates an Image from a resource ID. For internal use only. - * - * @ignore - */ - constructor(rid) { - super(rid); - } - /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */ - static async new(rgba, width, height) { - return core.invoke('plugin:image|new', { - rgba: transformImage(rgba), - width, - height - }).then((rid) => new Image(rid)); - } - /** - * Creates a new image using the provided bytes by inferring the file format. - * If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes]. - * - * Only `ico` and `png` are supported (based on activated feature flag). - * - * Note that you need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - static async fromBytes(bytes) { - return core.invoke('plugin:image|from_bytes', { - bytes: transformImage(bytes) - }).then((rid) => new Image(rid)); - } - /** - * Creates a new image using the provided path. - * - * Only `ico` and `png` are supported (based on activated feature flag). - * - * Note that you need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - static async fromPath(path) { - return core.invoke('plugin:image|from_path', { path }).then((rid) => new Image(rid)); - } - /** Returns the RGBA data for this image, in row-major order from top to bottom. */ - async rgba() { - return core.invoke('plugin:image|rgba', { - rid: this.rid - }).then((buffer) => new Uint8Array(buffer)); - } - /** Returns the size of this image. */ - async size() { - return core.invoke('plugin:image|size', { rid: this.rid }); - } -} -/** - * Transforms image from various types into a type acceptable by Rust. - * - * See [tauri::image::JsImage](https://docs.rs/tauri/2/tauri/image/enum.JsImage.html) for more information. - * Note the API signature is not stable and might change. - */ -function transformImage(image) { - const ret = image == null - ? null - : typeof image === 'string' - ? image - : image instanceof Image - ? image.rid - : image; - return ret; -} - -exports.Image = Image; -exports.transformImage = transformImage; diff --git a/node_modules/@tauri-apps/api/image.d.ts b/node_modules/@tauri-apps/api/image.d.ts deleted file mode 100644 index 82f31c4..0000000 --- a/node_modules/@tauri-apps/api/image.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Resource } from './core'; -import { NativeIcon } from './menu/iconMenuItem'; -export interface ImageSize { - width: number; - height: number; -} -/** A type that represents an icon that can be used in menu items. */ -export type MenuIcon = NativeIcon | string | Image | Uint8Array | ArrayBuffer | number[]; -/** An RGBA Image in row-major order from top to bottom. */ -export declare class Image extends Resource { - /** - * Creates an Image from a resource ID. For internal use only. - * - * @ignore - */ - constructor(rid: number); - /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */ - static new(rgba: number[] | Uint8Array | ArrayBuffer, width: number, height: number): Promise; - /** - * Creates a new image using the provided bytes by inferring the file format. - * If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes]. - * - * Only `ico` and `png` are supported (based on activated feature flag). - * - * Note that you need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - static fromBytes(bytes: number[] | Uint8Array | ArrayBuffer): Promise; - /** - * Creates a new image using the provided path. - * - * Only `ico` and `png` are supported (based on activated feature flag). - * - * Note that you need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - static fromPath(path: string): Promise; - /** Returns the RGBA data for this image, in row-major order from top to bottom. */ - rgba(): Promise; - /** Returns the size of this image. */ - size(): Promise; -} -/** - * Transforms image from various types into a type acceptable by Rust. - * - * See [tauri::image::JsImage](https://docs.rs/tauri/2/tauri/image/enum.JsImage.html) for more information. - * Note the API signature is not stable and might change. - */ -export declare function transformImage(image: string | Image | Uint8Array | ArrayBuffer | number[] | null): T; diff --git a/node_modules/@tauri-apps/api/image.js b/node_modules/@tauri-apps/api/image.js deleted file mode 100644 index 66e7e84..0000000 --- a/node_modules/@tauri-apps/api/image.js +++ /dev/null @@ -1,85 +0,0 @@ -import { Resource, invoke } from './core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** An RGBA Image in row-major order from top to bottom. */ -class Image extends Resource { - /** - * Creates an Image from a resource ID. For internal use only. - * - * @ignore - */ - constructor(rid) { - super(rid); - } - /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */ - static async new(rgba, width, height) { - return invoke('plugin:image|new', { - rgba: transformImage(rgba), - width, - height - }).then((rid) => new Image(rid)); - } - /** - * Creates a new image using the provided bytes by inferring the file format. - * If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes]. - * - * Only `ico` and `png` are supported (based on activated feature flag). - * - * Note that you need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - static async fromBytes(bytes) { - return invoke('plugin:image|from_bytes', { - bytes: transformImage(bytes) - }).then((rid) => new Image(rid)); - } - /** - * Creates a new image using the provided path. - * - * Only `ico` and `png` are supported (based on activated feature flag). - * - * Note that you need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - static async fromPath(path) { - return invoke('plugin:image|from_path', { path }).then((rid) => new Image(rid)); - } - /** Returns the RGBA data for this image, in row-major order from top to bottom. */ - async rgba() { - return invoke('plugin:image|rgba', { - rid: this.rid - }).then((buffer) => new Uint8Array(buffer)); - } - /** Returns the size of this image. */ - async size() { - return invoke('plugin:image|size', { rid: this.rid }); - } -} -/** - * Transforms image from various types into a type acceptable by Rust. - * - * See [tauri::image::JsImage](https://docs.rs/tauri/2/tauri/image/enum.JsImage.html) for more information. - * Note the API signature is not stable and might change. - */ -function transformImage(image) { - const ret = image == null - ? null - : typeof image === 'string' - ? image - : image instanceof Image - ? image.rid - : image; - return ret; -} - -export { Image, transformImage }; diff --git a/node_modules/@tauri-apps/api/index.cjs b/node_modules/@tauri-apps/api/index.cjs deleted file mode 100644 index 05c2266..0000000 --- a/node_modules/@tauri-apps/api/index.cjs +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var app = require('./app.cjs'); -var core = require('./core.cjs'); -var dpi = require('./dpi.cjs'); -var event = require('./event.cjs'); -var image = require('./image.cjs'); -var menu = require('./menu.cjs'); -var mocks = require('./mocks.cjs'); -var path = require('./path.cjs'); -var tray = require('./tray.cjs'); -var webview = require('./webview.cjs'); -var webviewWindow = require('./webviewWindow.cjs'); -var window = require('./window.cjs'); - - - -exports.app = app; -exports.core = core; -exports.dpi = dpi; -exports.event = event; -exports.image = image; -exports.menu = menu; -exports.mocks = mocks; -exports.path = path; -exports.tray = tray; -exports.webview = webview; -exports.webviewWindow = webviewWindow; -exports.window = window; diff --git a/node_modules/@tauri-apps/api/index.d.ts b/node_modules/@tauri-apps/api/index.d.ts deleted file mode 100644 index 6111f0e..0000000 --- a/node_modules/@tauri-apps/api/index.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * The Tauri API allows you to interface with the backend layer. - * - * This module exposes all other modules as an object where the key is the module name, and the value is the module exports. - * @example - * ```typescript - * import { event, window, path } from '@tauri-apps/api' - * ``` - * - * ### Vanilla JS API - * - * The above import syntax is for JavaScript/TypeScript with a bundler. If you're using vanilla JavaScript, you can use the global `window.__TAURI__` object instead. It requires `app.withGlobalTauri` configuration option enabled. - * - * @example - * ```js - * const { event, window: tauriWindow, path } = window.__TAURI__; - * ``` - * - * @module - */ -import * as app from './app'; -import * as core from './core'; -import * as dpi from './dpi'; -import * as event from './event'; -import * as image from './image'; -import * as menu from './menu'; -import * as mocks from './mocks'; -import * as path from './path'; -import * as tray from './tray'; -import * as webview from './webview'; -import * as webviewWindow from './webviewWindow'; -import * as window from './window'; -export { app, core, dpi, event, image, menu, mocks, path, tray, webview, webviewWindow, window }; diff --git a/node_modules/@tauri-apps/api/index.js b/node_modules/@tauri-apps/api/index.js deleted file mode 100644 index 8518a55..0000000 --- a/node_modules/@tauri-apps/api/index.js +++ /dev/null @@ -1,24 +0,0 @@ -import * as app from './app.js'; -export { app }; -import * as core from './core.js'; -export { core }; -import * as dpi from './dpi.js'; -export { dpi }; -import * as event from './event.js'; -export { event }; -import * as image from './image.js'; -export { image }; -import * as menu from './menu.js'; -export { menu }; -import * as mocks from './mocks.js'; -export { mocks }; -import * as path from './path.js'; -export { path }; -import * as tray from './tray.js'; -export { tray }; -import * as webview from './webview.js'; -export { webview }; -import * as webviewWindow from './webviewWindow.js'; -export { webviewWindow }; -import * as window from './window.js'; -export { window }; diff --git a/node_modules/@tauri-apps/api/menu.cjs b/node_modules/@tauri-apps/api/menu.cjs deleted file mode 100644 index 13ae499..0000000 --- a/node_modules/@tauri-apps/api/menu.cjs +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -var submenu = require('./menu/submenu.cjs'); -var menuItem = require('./menu/menuItem.cjs'); -var menu = require('./menu/menu.cjs'); -var checkMenuItem = require('./menu/checkMenuItem.cjs'); -var iconMenuItem = require('./menu/iconMenuItem.cjs'); -var predefinedMenuItem = require('./menu/predefinedMenuItem.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Menu types and utilities. - * - * This package is also accessible with `window.__TAURI__.menu` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ - -exports.Submenu = submenu.Submenu; -exports.itemFromKind = submenu.itemFromKind; -exports.MenuItem = menuItem.MenuItem; -exports.Menu = menu.Menu; -exports.CheckMenuItem = checkMenuItem.CheckMenuItem; -exports.IconMenuItem = iconMenuItem.IconMenuItem; -Object.defineProperty(exports, "NativeIcon", { - enumerable: true, - get: function () { return iconMenuItem.NativeIcon; } -}); -exports.PredefinedMenuItem = predefinedMenuItem.PredefinedMenuItem; diff --git a/node_modules/@tauri-apps/api/menu.d.ts b/node_modules/@tauri-apps/api/menu.d.ts deleted file mode 100644 index 0aacba4..0000000 --- a/node_modules/@tauri-apps/api/menu.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export * from './menu/submenu'; -export * from './menu/menuItem'; -export * from './menu/menu'; -export * from './menu/checkMenuItem'; -export * from './menu/iconMenuItem'; -export * from './menu/predefinedMenuItem'; -/** - * Menu types and utilities. - * - * This package is also accessible with `window.__TAURI__.menu` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ diff --git a/node_modules/@tauri-apps/api/menu.js b/node_modules/@tauri-apps/api/menu.js deleted file mode 100644 index 8d1248c..0000000 --- a/node_modules/@tauri-apps/api/menu.js +++ /dev/null @@ -1,16 +0,0 @@ -export { Submenu, itemFromKind } from './menu/submenu.js'; -export { MenuItem } from './menu/menuItem.js'; -export { Menu } from './menu/menu.js'; -export { CheckMenuItem } from './menu/checkMenuItem.js'; -export { IconMenuItem, NativeIcon } from './menu/iconMenuItem.js'; -export { PredefinedMenuItem } from './menu/predefinedMenuItem.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Menu types and utilities. - * - * This package is also accessible with `window.__TAURI__.menu` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ diff --git a/node_modules/@tauri-apps/api/menu/base.cjs b/node_modules/@tauri-apps/api/menu/base.cjs deleted file mode 100644 index 17608e3..0000000 --- a/node_modules/@tauri-apps/api/menu/base.cjs +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -var tslib_es6 = require('../external/tslib/tslib.es6.cjs'); -var core = require('../core.cjs'); -var image = require('../image.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -var _MenuItemBase_id, _MenuItemBase_kind; -function injectChannel(i) { - var _a; - if ('items' in i) { - i.items = (_a = i.items) === null || _a === void 0 ? void 0 : _a.map((item) => 'rid' in item ? item : injectChannel(item)); - } - else if ('action' in i && i.action) { - const handler = new core.Channel(); - handler.onmessage = i.action; - delete i.action; - return { ...i, handler }; - } - return i; -} -async function newMenu(kind, opts) { - const handler = new core.Channel(); - if (opts && typeof opts === 'object') { - if ('action' in opts && opts.action) { - handler.onmessage = opts.action; - delete opts.action; - } - // about predefined menu item icon - if ('item' in opts - && opts.item - && typeof opts.item === 'object' - && 'About' in opts.item - && opts.item.About - && typeof opts.item.About === 'object' - && 'icon' in opts.item.About - && opts.item.About.icon) { - opts.item.About.icon = image.transformImage(opts.item.About.icon); - } - // icon menu item icon - if ('icon' in opts && opts.icon) { - opts.icon = image.transformImage(opts.icon); - } - // submenu items - if ('items' in opts && opts.items) { - function prepareItem(i) { - var _a; - if ('rid' in i) { - return [i.rid, i.kind]; - } - if ('item' in i && typeof i.item === 'object' && ((_a = i.item.About) === null || _a === void 0 ? void 0 : _a.icon)) { - i.item.About.icon = image.transformImage(i.item.About.icon); - } - if ('icon' in i && i.icon) { - i.icon = image.transformImage(i.icon); - } - if ('items' in i && i.items) { - // @ts-expect-error the `prepareItem` return doesn't exactly match - // this is fine, because the difference is in `[number, string]` variant - i.items = i.items.map(prepareItem); - } - return injectChannel(i); - } - // @ts-expect-error the `prepareItem` return doesn't exactly match - // this is fine, because the difference is in `[number, string]` variant - opts.items = opts.items.map(prepareItem); - } - } - return core.invoke('plugin:menu|new', { - kind, - options: opts, - handler - }); -} -class MenuItemBase extends core.Resource { - /** The id of this item. */ - get id() { - return tslib_es6.__classPrivateFieldGet(this, _MenuItemBase_id, "f"); - } - /** @ignore */ - get kind() { - return tslib_es6.__classPrivateFieldGet(this, _MenuItemBase_kind, "f"); - } - /** @ignore */ - constructor(rid, id, kind) { - super(rid); - /** @ignore */ - _MenuItemBase_id.set(this, void 0); - /** @ignore */ - _MenuItemBase_kind.set(this, void 0); - tslib_es6.__classPrivateFieldSet(this, _MenuItemBase_id, id, "f"); - tslib_es6.__classPrivateFieldSet(this, _MenuItemBase_kind, kind, "f"); - } -} -_MenuItemBase_id = new WeakMap(), _MenuItemBase_kind = new WeakMap(); - -exports.MenuItemBase = MenuItemBase; -exports.newMenu = newMenu; diff --git a/node_modules/@tauri-apps/api/menu/base.d.ts b/node_modules/@tauri-apps/api/menu/base.d.ts deleted file mode 100644 index ce3a985..0000000 --- a/node_modules/@tauri-apps/api/menu/base.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Resource } from '../core'; -import { CheckMenuItemOptions } from './checkMenuItem'; -import { IconMenuItemOptions } from './iconMenuItem'; -import { MenuOptions } from './menu'; -import { MenuItemOptions } from './menuItem'; -import { PredefinedMenuItemOptions } from './predefinedMenuItem'; -import { SubmenuOptions } from './submenu'; -export type ItemKind = 'MenuItem' | 'Predefined' | 'Check' | 'Icon' | 'Submenu' | 'Menu'; -export declare function newMenu(kind: ItemKind, opts?: MenuOptions | MenuItemOptions | SubmenuOptions | PredefinedMenuItemOptions | CheckMenuItemOptions | IconMenuItemOptions): Promise<[number, string]>; -export declare class MenuItemBase extends Resource { - #private; - /** The id of this item. */ - get id(): string; - /** @ignore */ - get kind(): string; - /** @ignore */ - protected constructor(rid: number, id: string, kind: ItemKind); -} diff --git a/node_modules/@tauri-apps/api/menu/base.js b/node_modules/@tauri-apps/api/menu/base.js deleted file mode 100644 index d59637a..0000000 --- a/node_modules/@tauri-apps/api/menu/base.js +++ /dev/null @@ -1,97 +0,0 @@ -import { __classPrivateFieldGet, __classPrivateFieldSet } from '../external/tslib/tslib.es6.js'; -import { Resource, Channel, invoke } from '../core.js'; -import { transformImage } from '../image.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -var _MenuItemBase_id, _MenuItemBase_kind; -function injectChannel(i) { - var _a; - if ('items' in i) { - i.items = (_a = i.items) === null || _a === void 0 ? void 0 : _a.map((item) => 'rid' in item ? item : injectChannel(item)); - } - else if ('action' in i && i.action) { - const handler = new Channel(); - handler.onmessage = i.action; - delete i.action; - return { ...i, handler }; - } - return i; -} -async function newMenu(kind, opts) { - const handler = new Channel(); - if (opts && typeof opts === 'object') { - if ('action' in opts && opts.action) { - handler.onmessage = opts.action; - delete opts.action; - } - // about predefined menu item icon - if ('item' in opts - && opts.item - && typeof opts.item === 'object' - && 'About' in opts.item - && opts.item.About - && typeof opts.item.About === 'object' - && 'icon' in opts.item.About - && opts.item.About.icon) { - opts.item.About.icon = transformImage(opts.item.About.icon); - } - // icon menu item icon - if ('icon' in opts && opts.icon) { - opts.icon = transformImage(opts.icon); - } - // submenu items - if ('items' in opts && opts.items) { - function prepareItem(i) { - var _a; - if ('rid' in i) { - return [i.rid, i.kind]; - } - if ('item' in i && typeof i.item === 'object' && ((_a = i.item.About) === null || _a === void 0 ? void 0 : _a.icon)) { - i.item.About.icon = transformImage(i.item.About.icon); - } - if ('icon' in i && i.icon) { - i.icon = transformImage(i.icon); - } - if ('items' in i && i.items) { - // @ts-expect-error the `prepareItem` return doesn't exactly match - // this is fine, because the difference is in `[number, string]` variant - i.items = i.items.map(prepareItem); - } - return injectChannel(i); - } - // @ts-expect-error the `prepareItem` return doesn't exactly match - // this is fine, because the difference is in `[number, string]` variant - opts.items = opts.items.map(prepareItem); - } - } - return invoke('plugin:menu|new', { - kind, - options: opts, - handler - }); -} -class MenuItemBase extends Resource { - /** The id of this item. */ - get id() { - return __classPrivateFieldGet(this, _MenuItemBase_id, "f"); - } - /** @ignore */ - get kind() { - return __classPrivateFieldGet(this, _MenuItemBase_kind, "f"); - } - /** @ignore */ - constructor(rid, id, kind) { - super(rid); - /** @ignore */ - _MenuItemBase_id.set(this, void 0); - /** @ignore */ - _MenuItemBase_kind.set(this, void 0); - __classPrivateFieldSet(this, _MenuItemBase_id, id, "f"); - __classPrivateFieldSet(this, _MenuItemBase_kind, kind, "f"); - } -} -_MenuItemBase_id = new WeakMap(), _MenuItemBase_kind = new WeakMap(); - -export { MenuItemBase, newMenu }; diff --git a/node_modules/@tauri-apps/api/menu/checkMenuItem.cjs b/node_modules/@tauri-apps/api/menu/checkMenuItem.cjs deleted file mode 100644 index 469b53f..0000000 --- a/node_modules/@tauri-apps/api/menu/checkMenuItem.cjs +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -var base = require('./base.cjs'); -var core = require('../core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * A check menu item inside a {@linkcode Menu} or {@linkcode Submenu} - * and usually contains a text and a check mark or a similar toggle - * that corresponds to a checked and unchecked states. - */ -class CheckMenuItem extends base.MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Check'); - } - /** Create a new check menu item. */ - static async new(opts) { - return base.newMenu('Check', opts).then(([rid, id]) => new CheckMenuItem(rid, id)); - } - /** Returns the text of this check menu item. */ - async text() { - return core.invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this check menu item. */ - async setText(text) { - return core.invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this check menu item is enabled or not. */ - async isEnabled() { - return core.invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this check menu item is enabled or not. */ - async setEnabled(enabled) { - return core.invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** Sets the accelerator for this check menu item. */ - async setAccelerator(accelerator) { - return core.invoke('plugin:menu|set_accelerator', { - rid: this.rid, - kind: this.kind, - accelerator - }); - } - /** Returns whether this check menu item is checked or not. */ - async isChecked() { - return core.invoke('plugin:menu|is_checked', { rid: this.rid }); - } - /** Sets whether this check menu item is checked or not. */ - async setChecked(checked) { - return core.invoke('plugin:menu|set_checked', { - rid: this.rid, - checked - }); - } -} - -exports.CheckMenuItem = CheckMenuItem; diff --git a/node_modules/@tauri-apps/api/menu/checkMenuItem.d.ts b/node_modules/@tauri-apps/api/menu/checkMenuItem.d.ts deleted file mode 100644 index ec4aa4b..0000000 --- a/node_modules/@tauri-apps/api/menu/checkMenuItem.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { MenuItemBase } from './base'; -import { type MenuItemOptions } from '../menu'; -/** Options for creating a new check menu item. */ -export interface CheckMenuItemOptions extends MenuItemOptions { - /** Whether the new check menu item is enabled or not. */ - checked?: boolean; -} -/** - * A check menu item inside a {@linkcode Menu} or {@linkcode Submenu} - * and usually contains a text and a check mark or a similar toggle - * that corresponds to a checked and unchecked states. - */ -export declare class CheckMenuItem extends MenuItemBase { - /** @ignore */ - protected constructor(rid: number, id: string); - /** Create a new check menu item. */ - static new(opts: CheckMenuItemOptions): Promise; - /** Returns the text of this check menu item. */ - text(): Promise; - /** Sets the text for this check menu item. */ - setText(text: string): Promise; - /** Returns whether this check menu item is enabled or not. */ - isEnabled(): Promise; - /** Sets whether this check menu item is enabled or not. */ - setEnabled(enabled: boolean): Promise; - /** Sets the accelerator for this check menu item. */ - setAccelerator(accelerator: string | null): Promise; - /** Returns whether this check menu item is checked or not. */ - isChecked(): Promise; - /** Sets whether this check menu item is checked or not. */ - setChecked(checked: boolean): Promise; -} diff --git a/node_modules/@tauri-apps/api/menu/checkMenuItem.js b/node_modules/@tauri-apps/api/menu/checkMenuItem.js deleted file mode 100644 index 84c4774..0000000 --- a/node_modules/@tauri-apps/api/menu/checkMenuItem.js +++ /dev/null @@ -1,66 +0,0 @@ -import { MenuItemBase, newMenu } from './base.js'; -import { invoke } from '../core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * A check menu item inside a {@linkcode Menu} or {@linkcode Submenu} - * and usually contains a text and a check mark or a similar toggle - * that corresponds to a checked and unchecked states. - */ -class CheckMenuItem extends MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Check'); - } - /** Create a new check menu item. */ - static async new(opts) { - return newMenu('Check', opts).then(([rid, id]) => new CheckMenuItem(rid, id)); - } - /** Returns the text of this check menu item. */ - async text() { - return invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this check menu item. */ - async setText(text) { - return invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this check menu item is enabled or not. */ - async isEnabled() { - return invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this check menu item is enabled or not. */ - async setEnabled(enabled) { - return invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** Sets the accelerator for this check menu item. */ - async setAccelerator(accelerator) { - return invoke('plugin:menu|set_accelerator', { - rid: this.rid, - kind: this.kind, - accelerator - }); - } - /** Returns whether this check menu item is checked or not. */ - async isChecked() { - return invoke('plugin:menu|is_checked', { rid: this.rid }); - } - /** Sets whether this check menu item is checked or not. */ - async setChecked(checked) { - return invoke('plugin:menu|set_checked', { - rid: this.rid, - checked - }); - } -} - -export { CheckMenuItem }; diff --git a/node_modules/@tauri-apps/api/menu/iconMenuItem.cjs b/node_modules/@tauri-apps/api/menu/iconMenuItem.cjs deleted file mode 100644 index 5a6a34b..0000000 --- a/node_modules/@tauri-apps/api/menu/iconMenuItem.cjs +++ /dev/null @@ -1,187 +0,0 @@ -'use strict'; - -var base = require('./base.cjs'); -var core = require('../core.cjs'); -var image = require('../image.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * A native Icon to be used for the menu item - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ -exports.NativeIcon = void 0; -(function (NativeIcon) { - /** An add item template image. */ - NativeIcon["Add"] = "Add"; - /** Advanced preferences toolbar icon for the preferences window. */ - NativeIcon["Advanced"] = "Advanced"; - /** A Bluetooth template image. */ - NativeIcon["Bluetooth"] = "Bluetooth"; - /** Bookmarks image suitable for a template. */ - NativeIcon["Bookmarks"] = "Bookmarks"; - /** A caution image. */ - NativeIcon["Caution"] = "Caution"; - /** A color panel toolbar icon. */ - NativeIcon["ColorPanel"] = "ColorPanel"; - /** A column view mode template image. */ - NativeIcon["ColumnView"] = "ColumnView"; - /** A computer icon. */ - NativeIcon["Computer"] = "Computer"; - /** An enter full-screen mode template image. */ - NativeIcon["EnterFullScreen"] = "EnterFullScreen"; - /** Permissions for all users. */ - NativeIcon["Everyone"] = "Everyone"; - /** An exit full-screen mode template image. */ - NativeIcon["ExitFullScreen"] = "ExitFullScreen"; - /** A cover flow view mode template image. */ - NativeIcon["FlowView"] = "FlowView"; - /** A folder image. */ - NativeIcon["Folder"] = "Folder"; - /** A burnable folder icon. */ - NativeIcon["FolderBurnable"] = "FolderBurnable"; - /** A smart folder icon. */ - NativeIcon["FolderSmart"] = "FolderSmart"; - /** A link template image. */ - NativeIcon["FollowLinkFreestanding"] = "FollowLinkFreestanding"; - /** A font panel toolbar icon. */ - NativeIcon["FontPanel"] = "FontPanel"; - /** A `go back` template image. */ - NativeIcon["GoLeft"] = "GoLeft"; - /** A `go forward` template image. */ - NativeIcon["GoRight"] = "GoRight"; - /** Home image suitable for a template. */ - NativeIcon["Home"] = "Home"; - /** An iChat Theater template image. */ - NativeIcon["IChatTheater"] = "IChatTheater"; - /** An icon view mode template image. */ - NativeIcon["IconView"] = "IconView"; - /** An information toolbar icon. */ - NativeIcon["Info"] = "Info"; - /** A template image used to denote invalid data. */ - NativeIcon["InvalidDataFreestanding"] = "InvalidDataFreestanding"; - /** A generic left-facing triangle template image. */ - NativeIcon["LeftFacingTriangle"] = "LeftFacingTriangle"; - /** A list view mode template image. */ - NativeIcon["ListView"] = "ListView"; - /** A locked padlock template image. */ - NativeIcon["LockLocked"] = "LockLocked"; - /** An unlocked padlock template image. */ - NativeIcon["LockUnlocked"] = "LockUnlocked"; - /** A horizontal dash, for use in menus. */ - NativeIcon["MenuMixedState"] = "MenuMixedState"; - /** A check mark template image, for use in menus. */ - NativeIcon["MenuOnState"] = "MenuOnState"; - /** A MobileMe icon. */ - NativeIcon["MobileMe"] = "MobileMe"; - /** A drag image for multiple items. */ - NativeIcon["MultipleDocuments"] = "MultipleDocuments"; - /** A network icon. */ - NativeIcon["Network"] = "Network"; - /** A path button template image. */ - NativeIcon["Path"] = "Path"; - /** General preferences toolbar icon for the preferences window. */ - NativeIcon["PreferencesGeneral"] = "PreferencesGeneral"; - /** A Quick Look template image. */ - NativeIcon["QuickLook"] = "QuickLook"; - /** A refresh template image. */ - NativeIcon["RefreshFreestanding"] = "RefreshFreestanding"; - /** A refresh template image. */ - NativeIcon["Refresh"] = "Refresh"; - /** A remove item template image. */ - NativeIcon["Remove"] = "Remove"; - /** A reveal contents template image. */ - NativeIcon["RevealFreestanding"] = "RevealFreestanding"; - /** A generic right-facing triangle template image. */ - NativeIcon["RightFacingTriangle"] = "RightFacingTriangle"; - /** A share view template image. */ - NativeIcon["Share"] = "Share"; - /** A slideshow template image. */ - NativeIcon["Slideshow"] = "Slideshow"; - /** A badge for a `smart` item. */ - NativeIcon["SmartBadge"] = "SmartBadge"; - /** Small green indicator, similar to iChat's available image. */ - NativeIcon["StatusAvailable"] = "StatusAvailable"; - /** Small clear indicator. */ - NativeIcon["StatusNone"] = "StatusNone"; - /** Small yellow indicator, similar to iChat's idle image. */ - NativeIcon["StatusPartiallyAvailable"] = "StatusPartiallyAvailable"; - /** Small red indicator, similar to iChat's unavailable image. */ - NativeIcon["StatusUnavailable"] = "StatusUnavailable"; - /** A stop progress template image. */ - NativeIcon["StopProgressFreestanding"] = "StopProgressFreestanding"; - /** A stop progress button template image. */ - NativeIcon["StopProgress"] = "StopProgress"; - /** An image of the empty trash can. */ - NativeIcon["TrashEmpty"] = "TrashEmpty"; - /** An image of the full trash can. */ - NativeIcon["TrashFull"] = "TrashFull"; - /** Permissions for a single user. */ - NativeIcon["User"] = "User"; - /** User account toolbar icon for the preferences window. */ - NativeIcon["UserAccounts"] = "UserAccounts"; - /** Permissions for a group of users. */ - NativeIcon["UserGroup"] = "UserGroup"; - /** Permissions for guests. */ - NativeIcon["UserGuest"] = "UserGuest"; -})(exports.NativeIcon || (exports.NativeIcon = {})); -/** - * An icon menu item inside a {@linkcode Menu} or {@linkcode Submenu} - * and usually contains an icon and a text. - */ -class IconMenuItem extends base.MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Icon'); - } - /** Create a new icon menu item. */ - static async new(opts) { - return base.newMenu('Icon', opts).then(([rid, id]) => new IconMenuItem(rid, id)); - } - /** Returns the text of this icon menu item. */ - async text() { - return core.invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this icon menu item. */ - async setText(text) { - return core.invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this icon menu item is enabled or not. */ - async isEnabled() { - return core.invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this icon menu item is enabled or not. */ - async setEnabled(enabled) { - return core.invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** Sets the accelerator for this icon menu item. */ - async setAccelerator(accelerator) { - return core.invoke('plugin:menu|set_accelerator', { - rid: this.rid, - kind: this.kind, - accelerator - }); - } - /** Sets an icon for this icon menu item */ - async setIcon(icon) { - return core.invoke('plugin:menu|set_icon', { - rid: this.rid, - kind: this.kind, - icon: image.transformImage(icon) - }); - } -} - -exports.IconMenuItem = IconMenuItem; diff --git a/node_modules/@tauri-apps/api/menu/iconMenuItem.d.ts b/node_modules/@tauri-apps/api/menu/iconMenuItem.d.ts deleted file mode 100644 index 10ae6b9..0000000 --- a/node_modules/@tauri-apps/api/menu/iconMenuItem.d.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { MenuItemBase } from './base'; -import { type MenuItemOptions } from '../menu'; -import { MenuIcon } from '../image'; -/** - * A native Icon to be used for the menu item - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ -export declare enum NativeIcon { - /** An add item template image. */ - Add = "Add", - /** Advanced preferences toolbar icon for the preferences window. */ - Advanced = "Advanced", - /** A Bluetooth template image. */ - Bluetooth = "Bluetooth", - /** Bookmarks image suitable for a template. */ - Bookmarks = "Bookmarks", - /** A caution image. */ - Caution = "Caution", - /** A color panel toolbar icon. */ - ColorPanel = "ColorPanel", - /** A column view mode template image. */ - ColumnView = "ColumnView", - /** A computer icon. */ - Computer = "Computer", - /** An enter full-screen mode template image. */ - EnterFullScreen = "EnterFullScreen", - /** Permissions for all users. */ - Everyone = "Everyone", - /** An exit full-screen mode template image. */ - ExitFullScreen = "ExitFullScreen", - /** A cover flow view mode template image. */ - FlowView = "FlowView", - /** A folder image. */ - Folder = "Folder", - /** A burnable folder icon. */ - FolderBurnable = "FolderBurnable", - /** A smart folder icon. */ - FolderSmart = "FolderSmart", - /** A link template image. */ - FollowLinkFreestanding = "FollowLinkFreestanding", - /** A font panel toolbar icon. */ - FontPanel = "FontPanel", - /** A `go back` template image. */ - GoLeft = "GoLeft", - /** A `go forward` template image. */ - GoRight = "GoRight", - /** Home image suitable for a template. */ - Home = "Home", - /** An iChat Theater template image. */ - IChatTheater = "IChatTheater", - /** An icon view mode template image. */ - IconView = "IconView", - /** An information toolbar icon. */ - Info = "Info", - /** A template image used to denote invalid data. */ - InvalidDataFreestanding = "InvalidDataFreestanding", - /** A generic left-facing triangle template image. */ - LeftFacingTriangle = "LeftFacingTriangle", - /** A list view mode template image. */ - ListView = "ListView", - /** A locked padlock template image. */ - LockLocked = "LockLocked", - /** An unlocked padlock template image. */ - LockUnlocked = "LockUnlocked", - /** A horizontal dash, for use in menus. */ - MenuMixedState = "MenuMixedState", - /** A check mark template image, for use in menus. */ - MenuOnState = "MenuOnState", - /** A MobileMe icon. */ - MobileMe = "MobileMe", - /** A drag image for multiple items. */ - MultipleDocuments = "MultipleDocuments", - /** A network icon. */ - Network = "Network", - /** A path button template image. */ - Path = "Path", - /** General preferences toolbar icon for the preferences window. */ - PreferencesGeneral = "PreferencesGeneral", - /** A Quick Look template image. */ - QuickLook = "QuickLook", - /** A refresh template image. */ - RefreshFreestanding = "RefreshFreestanding", - /** A refresh template image. */ - Refresh = "Refresh", - /** A remove item template image. */ - Remove = "Remove", - /** A reveal contents template image. */ - RevealFreestanding = "RevealFreestanding", - /** A generic right-facing triangle template image. */ - RightFacingTriangle = "RightFacingTriangle", - /** A share view template image. */ - Share = "Share", - /** A slideshow template image. */ - Slideshow = "Slideshow", - /** A badge for a `smart` item. */ - SmartBadge = "SmartBadge", - /** Small green indicator, similar to iChat's available image. */ - StatusAvailable = "StatusAvailable", - /** Small clear indicator. */ - StatusNone = "StatusNone", - /** Small yellow indicator, similar to iChat's idle image. */ - StatusPartiallyAvailable = "StatusPartiallyAvailable", - /** Small red indicator, similar to iChat's unavailable image. */ - StatusUnavailable = "StatusUnavailable", - /** A stop progress template image. */ - StopProgressFreestanding = "StopProgressFreestanding", - /** A stop progress button template image. */ - StopProgress = "StopProgress", - /** An image of the empty trash can. */ - TrashEmpty = "TrashEmpty", - /** An image of the full trash can. */ - TrashFull = "TrashFull", - /** Permissions for a single user. */ - User = "User", - /** User account toolbar icon for the preferences window. */ - UserAccounts = "UserAccounts", - /** Permissions for a group of users. */ - UserGroup = "UserGroup", - /** Permissions for guests. */ - UserGuest = "UserGuest" -} -/** Options for creating a new icon menu item. */ -export interface IconMenuItemOptions extends MenuItemOptions { - /** - * Icon to be used for the new icon menu item. - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - icon?: MenuIcon; -} -/** - * An icon menu item inside a {@linkcode Menu} or {@linkcode Submenu} - * and usually contains an icon and a text. - */ -export declare class IconMenuItem extends MenuItemBase { - /** @ignore */ - protected constructor(rid: number, id: string); - /** Create a new icon menu item. */ - static new(opts: IconMenuItemOptions): Promise; - /** Returns the text of this icon menu item. */ - text(): Promise; - /** Sets the text for this icon menu item. */ - setText(text: string): Promise; - /** Returns whether this icon menu item is enabled or not. */ - isEnabled(): Promise; - /** Sets whether this icon menu item is enabled or not. */ - setEnabled(enabled: boolean): Promise; - /** Sets the accelerator for this icon menu item. */ - setAccelerator(accelerator: string | null): Promise; - /** Sets an icon for this icon menu item */ - setIcon(icon: MenuIcon | null): Promise; -} diff --git a/node_modules/@tauri-apps/api/menu/iconMenuItem.js b/node_modules/@tauri-apps/api/menu/iconMenuItem.js deleted file mode 100644 index 6719bb0..0000000 --- a/node_modules/@tauri-apps/api/menu/iconMenuItem.js +++ /dev/null @@ -1,185 +0,0 @@ -import { MenuItemBase, newMenu } from './base.js'; -import { invoke } from '../core.js'; -import { transformImage } from '../image.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * A native Icon to be used for the menu item - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ -var NativeIcon; -(function (NativeIcon) { - /** An add item template image. */ - NativeIcon["Add"] = "Add"; - /** Advanced preferences toolbar icon for the preferences window. */ - NativeIcon["Advanced"] = "Advanced"; - /** A Bluetooth template image. */ - NativeIcon["Bluetooth"] = "Bluetooth"; - /** Bookmarks image suitable for a template. */ - NativeIcon["Bookmarks"] = "Bookmarks"; - /** A caution image. */ - NativeIcon["Caution"] = "Caution"; - /** A color panel toolbar icon. */ - NativeIcon["ColorPanel"] = "ColorPanel"; - /** A column view mode template image. */ - NativeIcon["ColumnView"] = "ColumnView"; - /** A computer icon. */ - NativeIcon["Computer"] = "Computer"; - /** An enter full-screen mode template image. */ - NativeIcon["EnterFullScreen"] = "EnterFullScreen"; - /** Permissions for all users. */ - NativeIcon["Everyone"] = "Everyone"; - /** An exit full-screen mode template image. */ - NativeIcon["ExitFullScreen"] = "ExitFullScreen"; - /** A cover flow view mode template image. */ - NativeIcon["FlowView"] = "FlowView"; - /** A folder image. */ - NativeIcon["Folder"] = "Folder"; - /** A burnable folder icon. */ - NativeIcon["FolderBurnable"] = "FolderBurnable"; - /** A smart folder icon. */ - NativeIcon["FolderSmart"] = "FolderSmart"; - /** A link template image. */ - NativeIcon["FollowLinkFreestanding"] = "FollowLinkFreestanding"; - /** A font panel toolbar icon. */ - NativeIcon["FontPanel"] = "FontPanel"; - /** A `go back` template image. */ - NativeIcon["GoLeft"] = "GoLeft"; - /** A `go forward` template image. */ - NativeIcon["GoRight"] = "GoRight"; - /** Home image suitable for a template. */ - NativeIcon["Home"] = "Home"; - /** An iChat Theater template image. */ - NativeIcon["IChatTheater"] = "IChatTheater"; - /** An icon view mode template image. */ - NativeIcon["IconView"] = "IconView"; - /** An information toolbar icon. */ - NativeIcon["Info"] = "Info"; - /** A template image used to denote invalid data. */ - NativeIcon["InvalidDataFreestanding"] = "InvalidDataFreestanding"; - /** A generic left-facing triangle template image. */ - NativeIcon["LeftFacingTriangle"] = "LeftFacingTriangle"; - /** A list view mode template image. */ - NativeIcon["ListView"] = "ListView"; - /** A locked padlock template image. */ - NativeIcon["LockLocked"] = "LockLocked"; - /** An unlocked padlock template image. */ - NativeIcon["LockUnlocked"] = "LockUnlocked"; - /** A horizontal dash, for use in menus. */ - NativeIcon["MenuMixedState"] = "MenuMixedState"; - /** A check mark template image, for use in menus. */ - NativeIcon["MenuOnState"] = "MenuOnState"; - /** A MobileMe icon. */ - NativeIcon["MobileMe"] = "MobileMe"; - /** A drag image for multiple items. */ - NativeIcon["MultipleDocuments"] = "MultipleDocuments"; - /** A network icon. */ - NativeIcon["Network"] = "Network"; - /** A path button template image. */ - NativeIcon["Path"] = "Path"; - /** General preferences toolbar icon for the preferences window. */ - NativeIcon["PreferencesGeneral"] = "PreferencesGeneral"; - /** A Quick Look template image. */ - NativeIcon["QuickLook"] = "QuickLook"; - /** A refresh template image. */ - NativeIcon["RefreshFreestanding"] = "RefreshFreestanding"; - /** A refresh template image. */ - NativeIcon["Refresh"] = "Refresh"; - /** A remove item template image. */ - NativeIcon["Remove"] = "Remove"; - /** A reveal contents template image. */ - NativeIcon["RevealFreestanding"] = "RevealFreestanding"; - /** A generic right-facing triangle template image. */ - NativeIcon["RightFacingTriangle"] = "RightFacingTriangle"; - /** A share view template image. */ - NativeIcon["Share"] = "Share"; - /** A slideshow template image. */ - NativeIcon["Slideshow"] = "Slideshow"; - /** A badge for a `smart` item. */ - NativeIcon["SmartBadge"] = "SmartBadge"; - /** Small green indicator, similar to iChat's available image. */ - NativeIcon["StatusAvailable"] = "StatusAvailable"; - /** Small clear indicator. */ - NativeIcon["StatusNone"] = "StatusNone"; - /** Small yellow indicator, similar to iChat's idle image. */ - NativeIcon["StatusPartiallyAvailable"] = "StatusPartiallyAvailable"; - /** Small red indicator, similar to iChat's unavailable image. */ - NativeIcon["StatusUnavailable"] = "StatusUnavailable"; - /** A stop progress template image. */ - NativeIcon["StopProgressFreestanding"] = "StopProgressFreestanding"; - /** A stop progress button template image. */ - NativeIcon["StopProgress"] = "StopProgress"; - /** An image of the empty trash can. */ - NativeIcon["TrashEmpty"] = "TrashEmpty"; - /** An image of the full trash can. */ - NativeIcon["TrashFull"] = "TrashFull"; - /** Permissions for a single user. */ - NativeIcon["User"] = "User"; - /** User account toolbar icon for the preferences window. */ - NativeIcon["UserAccounts"] = "UserAccounts"; - /** Permissions for a group of users. */ - NativeIcon["UserGroup"] = "UserGroup"; - /** Permissions for guests. */ - NativeIcon["UserGuest"] = "UserGuest"; -})(NativeIcon || (NativeIcon = {})); -/** - * An icon menu item inside a {@linkcode Menu} or {@linkcode Submenu} - * and usually contains an icon and a text. - */ -class IconMenuItem extends MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Icon'); - } - /** Create a new icon menu item. */ - static async new(opts) { - return newMenu('Icon', opts).then(([rid, id]) => new IconMenuItem(rid, id)); - } - /** Returns the text of this icon menu item. */ - async text() { - return invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this icon menu item. */ - async setText(text) { - return invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this icon menu item is enabled or not. */ - async isEnabled() { - return invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this icon menu item is enabled or not. */ - async setEnabled(enabled) { - return invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** Sets the accelerator for this icon menu item. */ - async setAccelerator(accelerator) { - return invoke('plugin:menu|set_accelerator', { - rid: this.rid, - kind: this.kind, - accelerator - }); - } - /** Sets an icon for this icon menu item */ - async setIcon(icon) { - return invoke('plugin:menu|set_icon', { - rid: this.rid, - kind: this.kind, - icon: transformImage(icon) - }); - } -} - -export { IconMenuItem, NativeIcon }; diff --git a/node_modules/@tauri-apps/api/menu/menu.cjs b/node_modules/@tauri-apps/api/menu/menu.cjs deleted file mode 100644 index f7eb3b6..0000000 --- a/node_modules/@tauri-apps/api/menu/menu.cjs +++ /dev/null @@ -1,148 +0,0 @@ -'use strict'; - -var submenu = require('./submenu.cjs'); -var dpi = require('../dpi.cjs'); -var core = require('../core.cjs'); -var base = require('./base.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** A type that is either a menu bar on the window - * on Windows and Linux or as a global menu in the menubar on macOS. - * - * #### Platform-specific: - * - * - **macOS**: if using {@linkcode Menu} for the global menubar, it can only contain {@linkcode Submenu}s. - */ -class Menu extends base.MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Menu'); - } - /** Create a new menu. */ - static async new(opts) { - return base.newMenu('Menu', opts).then(([rid, id]) => new Menu(rid, id)); - } - /** Create a default menu. */ - static async default() { - return core.invoke('plugin:menu|create_default').then(([rid, id]) => new Menu(rid, id)); - } - /** - * Add a menu item to the end of this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async append(items) { - return core.invoke('plugin:menu|append', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the beginning of this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async prepend(items) { - return core.invoke('plugin:menu|prepend', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the specified position in this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async insert(items, position) { - return core.invoke('plugin:menu|insert', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i), - position - }); - } - /** Remove a menu item from this menu. */ - async remove(item) { - return core.invoke('plugin:menu|remove', { - rid: this.rid, - kind: this.kind, - item: [item.rid, item.kind] - }); - } - /** Remove a menu item from this menu at the specified position. */ - async removeAt(position) { - return core.invoke('plugin:menu|remove_at', { - rid: this.rid, - kind: this.kind, - position - }).then(submenu.itemFromKind); - } - /** Returns a list of menu items that has been added to this menu. */ - async items() { - return core.invoke('plugin:menu|items', { - rid: this.rid, - kind: this.kind - }).then((i) => i.map(submenu.itemFromKind)); - } - /** Retrieves the menu item matching the given identifier. */ - async get(id) { - return core.invoke('plugin:menu|get', { - rid: this.rid, - kind: this.kind, - id - }).then((r) => (r ? submenu.itemFromKind(r) : null)); - } - /** - * Popup this menu as a context menu on the specified window. - * - * @param at If a position is provided, it is relative to the window's top-left corner. - * If there isn't one provided, the menu will pop up at the current location of the mouse. - */ - async popup(at, window) { - var _a; - return core.invoke('plugin:menu|popup', { - rid: this.rid, - kind: this.kind, - window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null, - at: at instanceof dpi.Position ? at : at ? new dpi.Position(at) : null - }); - } - /** - * Sets the app-wide menu and returns the previous one. - * - * If a window was not created with an explicit menu or had one set explicitly, - * this menu will be assigned to it. - */ - async setAsAppMenu() { - return core.invoke('plugin:menu|set_as_app_menu', { - rid: this.rid - }).then((r) => (r ? new Menu(r[0], r[1]) : null)); - } - /** - * Sets the window menu and returns the previous one. - * - * #### Platform-specific: - * - * - **macOS:** Unsupported. The menu on macOS is app-wide and not specific to one - * window, if you need to set it, use {@linkcode Menu.setAsAppMenu} instead. - */ - async setAsWindowMenu(window) { - var _a; - return core.invoke('plugin:menu|set_as_window_menu', { - rid: this.rid, - window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null - }).then((r) => (r ? new Menu(r[0], r[1]) : null)); - } -} - -exports.Menu = Menu; diff --git a/node_modules/@tauri-apps/api/menu/menu.d.ts b/node_modules/@tauri-apps/api/menu/menu.d.ts deleted file mode 100644 index 194673c..0000000 --- a/node_modules/@tauri-apps/api/menu/menu.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { MenuItemOptions, SubmenuOptions, IconMenuItemOptions, PredefinedMenuItemOptions, CheckMenuItemOptions } from '../menu'; -import { MenuItem } from './menuItem'; -import { CheckMenuItem } from './checkMenuItem'; -import { IconMenuItem } from './iconMenuItem'; -import { PredefinedMenuItem } from './predefinedMenuItem'; -import { Submenu } from './submenu'; -import { type LogicalPosition, PhysicalPosition, Position } from '../dpi'; -import { type Window } from '../window'; -import { MenuItemBase } from './base'; -/** Options for creating a new menu. */ -export interface MenuOptions { - /** Specify an id to use for the new menu. */ - id?: string; - /** List of items to add to the new menu. */ - items?: Array; -} -/** A type that is either a menu bar on the window - * on Windows and Linux or as a global menu in the menubar on macOS. - * - * #### Platform-specific: - * - * - **macOS**: if using {@linkcode Menu} for the global menubar, it can only contain {@linkcode Submenu}s. - */ -export declare class Menu extends MenuItemBase { - /** @ignore */ - protected constructor(rid: number, id: string); - /** Create a new menu. */ - static new(opts?: MenuOptions): Promise; - /** Create a default menu. */ - static default(): Promise; - /** - * Add a menu item to the end of this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - append(items: T | T[]): Promise; - /** - * Add a menu item to the beginning of this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - prepend(items: T | T[]): Promise; - /** - * Add a menu item to the specified position in this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - insert(items: T | T[], position: number): Promise; - /** Remove a menu item from this menu. */ - remove(item: Submenu | MenuItem | PredefinedMenuItem | CheckMenuItem | IconMenuItem): Promise; - /** Remove a menu item from this menu at the specified position. */ - removeAt(position: number): Promise; - /** Returns a list of menu items that has been added to this menu. */ - items(): Promise>; - /** Retrieves the menu item matching the given identifier. */ - get(id: string): Promise; - /** - * Popup this menu as a context menu on the specified window. - * - * @param at If a position is provided, it is relative to the window's top-left corner. - * If there isn't one provided, the menu will pop up at the current location of the mouse. - */ - popup(at?: PhysicalPosition | LogicalPosition | Position, window?: Window): Promise; - /** - * Sets the app-wide menu and returns the previous one. - * - * If a window was not created with an explicit menu or had one set explicitly, - * this menu will be assigned to it. - */ - setAsAppMenu(): Promise; - /** - * Sets the window menu and returns the previous one. - * - * #### Platform-specific: - * - * - **macOS:** Unsupported. The menu on macOS is app-wide and not specific to one - * window, if you need to set it, use {@linkcode Menu.setAsAppMenu} instead. - */ - setAsWindowMenu(window?: Window): Promise; -} diff --git a/node_modules/@tauri-apps/api/menu/menu.js b/node_modules/@tauri-apps/api/menu/menu.js deleted file mode 100644 index 9153283..0000000 --- a/node_modules/@tauri-apps/api/menu/menu.js +++ /dev/null @@ -1,146 +0,0 @@ -import { itemFromKind } from './submenu.js'; -import { Position } from '../dpi.js'; -import { invoke } from '../core.js'; -import { MenuItemBase, newMenu } from './base.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** A type that is either a menu bar on the window - * on Windows and Linux or as a global menu in the menubar on macOS. - * - * #### Platform-specific: - * - * - **macOS**: if using {@linkcode Menu} for the global menubar, it can only contain {@linkcode Submenu}s. - */ -class Menu extends MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Menu'); - } - /** Create a new menu. */ - static async new(opts) { - return newMenu('Menu', opts).then(([rid, id]) => new Menu(rid, id)); - } - /** Create a default menu. */ - static async default() { - return invoke('plugin:menu|create_default').then(([rid, id]) => new Menu(rid, id)); - } - /** - * Add a menu item to the end of this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async append(items) { - return invoke('plugin:menu|append', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the beginning of this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async prepend(items) { - return invoke('plugin:menu|prepend', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the specified position in this menu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async insert(items, position) { - return invoke('plugin:menu|insert', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i), - position - }); - } - /** Remove a menu item from this menu. */ - async remove(item) { - return invoke('plugin:menu|remove', { - rid: this.rid, - kind: this.kind, - item: [item.rid, item.kind] - }); - } - /** Remove a menu item from this menu at the specified position. */ - async removeAt(position) { - return invoke('plugin:menu|remove_at', { - rid: this.rid, - kind: this.kind, - position - }).then(itemFromKind); - } - /** Returns a list of menu items that has been added to this menu. */ - async items() { - return invoke('plugin:menu|items', { - rid: this.rid, - kind: this.kind - }).then((i) => i.map(itemFromKind)); - } - /** Retrieves the menu item matching the given identifier. */ - async get(id) { - return invoke('plugin:menu|get', { - rid: this.rid, - kind: this.kind, - id - }).then((r) => (r ? itemFromKind(r) : null)); - } - /** - * Popup this menu as a context menu on the specified window. - * - * @param at If a position is provided, it is relative to the window's top-left corner. - * If there isn't one provided, the menu will pop up at the current location of the mouse. - */ - async popup(at, window) { - var _a; - return invoke('plugin:menu|popup', { - rid: this.rid, - kind: this.kind, - window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null, - at: at instanceof Position ? at : at ? new Position(at) : null - }); - } - /** - * Sets the app-wide menu and returns the previous one. - * - * If a window was not created with an explicit menu or had one set explicitly, - * this menu will be assigned to it. - */ - async setAsAppMenu() { - return invoke('plugin:menu|set_as_app_menu', { - rid: this.rid - }).then((r) => (r ? new Menu(r[0], r[1]) : null)); - } - /** - * Sets the window menu and returns the previous one. - * - * #### Platform-specific: - * - * - **macOS:** Unsupported. The menu on macOS is app-wide and not specific to one - * window, if you need to set it, use {@linkcode Menu.setAsAppMenu} instead. - */ - async setAsWindowMenu(window) { - var _a; - return invoke('plugin:menu|set_as_window_menu', { - rid: this.rid, - window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null - }).then((r) => (r ? new Menu(r[0], r[1]) : null)); - } -} - -export { Menu }; diff --git a/node_modules/@tauri-apps/api/menu/menuItem.cjs b/node_modules/@tauri-apps/api/menu/menuItem.cjs deleted file mode 100644 index c16526f..0000000 --- a/node_modules/@tauri-apps/api/menu/menuItem.cjs +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -var base = require('./base.cjs'); -var core = require('../core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** A menu item inside a {@linkcode Menu} or {@linkcode Submenu} and contains only text. */ -class MenuItem extends base.MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'MenuItem'); - } - /** Create a new menu item. */ - static async new(opts) { - return base.newMenu('MenuItem', opts).then(([rid, id]) => new MenuItem(rid, id)); - } - /** Returns the text of this menu item. */ - async text() { - return core.invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this menu item. */ - async setText(text) { - return core.invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this menu item is enabled or not. */ - async isEnabled() { - return core.invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this menu item is enabled or not. */ - async setEnabled(enabled) { - return core.invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** Sets the accelerator for this menu item. */ - async setAccelerator(accelerator) { - return core.invoke('plugin:menu|set_accelerator', { - rid: this.rid, - kind: this.kind, - accelerator - }); - } -} - -exports.MenuItem = MenuItem; diff --git a/node_modules/@tauri-apps/api/menu/menuItem.d.ts b/node_modules/@tauri-apps/api/menu/menuItem.d.ts deleted file mode 100644 index b57093a..0000000 --- a/node_modules/@tauri-apps/api/menu/menuItem.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { MenuItemBase } from './base'; -/** Options for creating a new menu item. */ -export interface MenuItemOptions { - /** Specify an id to use for the new menu item. */ - id?: string; - /** The text of the new menu item. */ - text: string; - /** Whether the new menu item is enabled or not. */ - enabled?: boolean; - /** Specify an accelerator for the new menu item. */ - accelerator?: string; - /** Specify a handler to be called when this menu item is activated. */ - action?: (id: string) => void; -} -/** A menu item inside a {@linkcode Menu} or {@linkcode Submenu} and contains only text. */ -export declare class MenuItem extends MenuItemBase { - /** @ignore */ - protected constructor(rid: number, id: string); - /** Create a new menu item. */ - static new(opts: MenuItemOptions): Promise; - /** Returns the text of this menu item. */ - text(): Promise; - /** Sets the text for this menu item. */ - setText(text: string): Promise; - /** Returns whether this menu item is enabled or not. */ - isEnabled(): Promise; - /** Sets whether this menu item is enabled or not. */ - setEnabled(enabled: boolean): Promise; - /** Sets the accelerator for this menu item. */ - setAccelerator(accelerator: string | null): Promise; -} diff --git a/node_modules/@tauri-apps/api/menu/menuItem.js b/node_modules/@tauri-apps/api/menu/menuItem.js deleted file mode 100644 index 098101c..0000000 --- a/node_modules/@tauri-apps/api/menu/menuItem.js +++ /dev/null @@ -1,51 +0,0 @@ -import { MenuItemBase, newMenu } from './base.js'; -import { invoke } from '../core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** A menu item inside a {@linkcode Menu} or {@linkcode Submenu} and contains only text. */ -class MenuItem extends MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'MenuItem'); - } - /** Create a new menu item. */ - static async new(opts) { - return newMenu('MenuItem', opts).then(([rid, id]) => new MenuItem(rid, id)); - } - /** Returns the text of this menu item. */ - async text() { - return invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this menu item. */ - async setText(text) { - return invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this menu item is enabled or not. */ - async isEnabled() { - return invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this menu item is enabled or not. */ - async setEnabled(enabled) { - return invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** Sets the accelerator for this menu item. */ - async setAccelerator(accelerator) { - return invoke('plugin:menu|set_accelerator', { - rid: this.rid, - kind: this.kind, - accelerator - }); - } -} - -export { MenuItem }; diff --git a/node_modules/@tauri-apps/api/menu/predefinedMenuItem.cjs b/node_modules/@tauri-apps/api/menu/predefinedMenuItem.cjs deleted file mode 100644 index a693073..0000000 --- a/node_modules/@tauri-apps/api/menu/predefinedMenuItem.cjs +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -var base = require('./base.cjs'); -var core = require('../core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** A predefined (native) menu item which has a predefined behavior by the OS or by tauri. */ -class PredefinedMenuItem extends base.MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Predefined'); - } - /** Create a new predefined menu item. */ - static async new(opts) { - return base.newMenu('Predefined', opts).then(([rid, id]) => new PredefinedMenuItem(rid, id)); - } - /** Returns the text of this predefined menu item. */ - async text() { - return core.invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this predefined menu item. */ - async setText(text) { - return core.invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } -} - -exports.PredefinedMenuItem = PredefinedMenuItem; diff --git a/node_modules/@tauri-apps/api/menu/predefinedMenuItem.d.ts b/node_modules/@tauri-apps/api/menu/predefinedMenuItem.d.ts deleted file mode 100644 index b41a7cd..0000000 --- a/node_modules/@tauri-apps/api/menu/predefinedMenuItem.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { MenuItemBase } from './base'; -import { Image } from '../image'; -/** A metadata for the about predefined menu item. */ -export interface AboutMetadata { - /** Sets the application name. */ - name?: string; - /** The application version. */ - version?: string; - /** - * The short version, e.g. "1.0". - * - * #### Platform-specific - * - * - **Windows / Linux:** Appended to the end of `version` in parentheses. - */ - shortVersion?: string; - /** - * The authors of the application. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - */ - authors?: string[]; - /** - * Application comments. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - */ - comments?: string; - /** The copyright of the application. */ - copyright?: string; - /** - * The license of the application. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - */ - license?: string; - /** - * The application website. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - */ - website?: string; - /** - * The website label. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - */ - websiteLabel?: string; - /** - * The credits. - * - * #### Platform-specific - * - * - **Windows / Linux:** Unsupported. - */ - credits?: string; - /** - * The application icon. - * - * #### Platform-specific - * - * - **Windows:** Unsupported. - */ - icon?: string | Uint8Array | ArrayBuffer | number[] | Image; -} -/** Options for creating a new predefined menu item. */ -export interface PredefinedMenuItemOptions { - /** The text of the new predefined menu item. */ - text?: string; - /** The predefined item type */ - item: 'Separator' | 'Copy' | 'Cut' | 'Paste' | 'SelectAll' | 'Undo' | 'Redo' | 'Minimize' | 'Maximize' | 'Fullscreen' | 'Hide' | 'HideOthers' | 'ShowAll' | 'CloseWindow' | 'Quit' | 'Services' | { - About: AboutMetadata | null; - }; -} -/** A predefined (native) menu item which has a predefined behavior by the OS or by tauri. */ -export declare class PredefinedMenuItem extends MenuItemBase { - /** @ignore */ - protected constructor(rid: number, id: string); - /** Create a new predefined menu item. */ - static new(opts?: PredefinedMenuItemOptions): Promise; - /** Returns the text of this predefined menu item. */ - text(): Promise; - /** Sets the text for this predefined menu item. */ - setText(text: string): Promise; -} diff --git a/node_modules/@tauri-apps/api/menu/predefinedMenuItem.js b/node_modules/@tauri-apps/api/menu/predefinedMenuItem.js deleted file mode 100644 index 2e86254..0000000 --- a/node_modules/@tauri-apps/api/menu/predefinedMenuItem.js +++ /dev/null @@ -1,31 +0,0 @@ -import { MenuItemBase, newMenu } from './base.js'; -import { invoke } from '../core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** A predefined (native) menu item which has a predefined behavior by the OS or by tauri. */ -class PredefinedMenuItem extends MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Predefined'); - } - /** Create a new predefined menu item. */ - static async new(opts) { - return newMenu('Predefined', opts).then(([rid, id]) => new PredefinedMenuItem(rid, id)); - } - /** Returns the text of this predefined menu item. */ - async text() { - return invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this predefined menu item. */ - async setText(text) { - return invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } -} - -export { PredefinedMenuItem }; diff --git a/node_modules/@tauri-apps/api/menu/submenu.cjs b/node_modules/@tauri-apps/api/menu/submenu.cjs deleted file mode 100644 index aab25a2..0000000 --- a/node_modules/@tauri-apps/api/menu/submenu.cjs +++ /dev/null @@ -1,203 +0,0 @@ -'use strict'; - -var menuItem = require('./menuItem.cjs'); -var checkMenuItem = require('./checkMenuItem.cjs'); -var iconMenuItem = require('./iconMenuItem.cjs'); -var predefinedMenuItem = require('./predefinedMenuItem.cjs'); -var core = require('../core.cjs'); -var base = require('./base.cjs'); -var dpi = require('../dpi.cjs'); -var image = require('../image.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** @ignore */ -function itemFromKind([rid, id, kind]) { - /* eslint-disable @typescript-eslint/no-unsafe-return */ - switch (kind) { - case 'Submenu': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new Submenu(rid, id); - case 'Predefined': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new predefinedMenuItem.PredefinedMenuItem(rid, id); - case 'Check': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new checkMenuItem.CheckMenuItem(rid, id); - case 'Icon': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new iconMenuItem.IconMenuItem(rid, id); - case 'MenuItem': - default: - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new menuItem.MenuItem(rid, id); - } - /* eslint-enable @typescript-eslint/no-unsafe-return */ -} -/** A type that is a submenu inside a {@linkcode Menu} or {@linkcode Submenu}. */ -class Submenu extends base.MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Submenu'); - } - /** Create a new submenu. */ - static async new(opts) { - return base.newMenu('Submenu', opts).then(([rid, id]) => new Submenu(rid, id)); - } - /** Returns the text of this submenu. */ - async text() { - return core.invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this submenu. */ - async setText(text) { - return core.invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this submenu is enabled or not. */ - async isEnabled() { - return core.invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this submenu is enabled or not. */ - async setEnabled(enabled) { - return core.invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** - * Add a menu item to the end of this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async append(items) { - return core.invoke('plugin:menu|append', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the beginning of this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async prepend(items) { - return core.invoke('plugin:menu|prepend', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the specified position in this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async insert(items, position) { - return core.invoke('plugin:menu|insert', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i), - position - }); - } - /** Remove a menu item from this submenu. */ - async remove(item) { - return core.invoke('plugin:menu|remove', { - rid: this.rid, - kind: this.kind, - item: [item.rid, item.kind] - }); - } - /** Remove a menu item from this submenu at the specified position. */ - async removeAt(position) { - return core.invoke('plugin:menu|remove_at', { - rid: this.rid, - kind: this.kind, - position - }).then(itemFromKind); - } - /** Returns a list of menu items that has been added to this submenu. */ - async items() { - return core.invoke('plugin:menu|items', { - rid: this.rid, - kind: this.kind - }).then((i) => i.map(itemFromKind)); - } - /** Retrieves the menu item matching the given identifier. */ - async get(id) { - return core.invoke('plugin:menu|get', { - rid: this.rid, - kind: this.kind, - id - }).then((r) => (r ? itemFromKind(r) : null)); - } - /** - * Popup this submenu as a context menu on the specified window. - * - * If the position, is provided, it is relative to the window's top-left corner. - */ - async popup(at, window) { - var _a; - return core.invoke('plugin:menu|popup', { - rid: this.rid, - kind: this.kind, - window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null, - at: at instanceof dpi.Position ? at : at ? new dpi.Position(at) : null - }); - } - /** - * Set this submenu as the Window menu for the application on macOS. - * - * This will cause macOS to automatically add window-switching items and - * certain other items to the menu. - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ - async setAsWindowsMenuForNSApp() { - return core.invoke('plugin:menu|set_as_windows_menu_for_nsapp', { - rid: this.rid - }); - } - /** - * Set this submenu as the Help menu for the application on macOS. - * - * This will cause macOS to automatically add a search box to the menu. - * - * If no menu is set as the Help menu, macOS will automatically use any menu - * which has a title matching the localized word "Help". - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ - async setAsHelpMenuForNSApp() { - return core.invoke('plugin:menu|set_as_help_menu_for_nsapp', { - rid: this.rid - }); - } - /** Sets an icon for this submenu */ - async setIcon(icon) { - return core.invoke('plugin:menu|set_icon', { - rid: this.rid, - kind: this.kind, - icon: image.transformImage(icon) - }); - } -} - -exports.Submenu = Submenu; -exports.itemFromKind = itemFromKind; diff --git a/node_modules/@tauri-apps/api/menu/submenu.d.ts b/node_modules/@tauri-apps/api/menu/submenu.d.ts deleted file mode 100644 index 6e5ee8b..0000000 --- a/node_modules/@tauri-apps/api/menu/submenu.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { IconMenuItemOptions, PredefinedMenuItemOptions, CheckMenuItemOptions } from '../menu'; -import { MenuItem, type MenuItemOptions } from './menuItem'; -import { CheckMenuItem } from './checkMenuItem'; -import { IconMenuItem } from './iconMenuItem'; -import { PredefinedMenuItem } from './predefinedMenuItem'; -import { type LogicalPosition, PhysicalPosition, type Window } from '../window'; -import { type ItemKind, MenuItemBase } from './base'; -import { type MenuOptions } from './menu'; -import { MenuIcon } from '../image'; -/** @ignore */ -export declare function itemFromKind([rid, id, kind]: [number, string, ItemKind]): Submenu | MenuItem | PredefinedMenuItem | CheckMenuItem | IconMenuItem; -export type SubmenuOptions = (Omit & MenuOptions) & { - /** - * Icon to be used for the submenu. - * Note: you may need the `image-ico` or `image-png` Cargo features to use this API. - */ - icon?: MenuIcon; -}; -/** A type that is a submenu inside a {@linkcode Menu} or {@linkcode Submenu}. */ -export declare class Submenu extends MenuItemBase { - /** @ignore */ - protected constructor(rid: number, id: string); - /** Create a new submenu. */ - static new(opts: SubmenuOptions): Promise; - /** Returns the text of this submenu. */ - text(): Promise; - /** Sets the text for this submenu. */ - setText(text: string): Promise; - /** Returns whether this submenu is enabled or not. */ - isEnabled(): Promise; - /** Sets whether this submenu is enabled or not. */ - setEnabled(enabled: boolean): Promise; - /** - * Add a menu item to the end of this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - append(items: T | T[]): Promise; - /** - * Add a menu item to the beginning of this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - prepend(items: T | T[]): Promise; - /** - * Add a menu item to the specified position in this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - insert(items: T | T[], position: number): Promise; - /** Remove a menu item from this submenu. */ - remove(item: Submenu | MenuItem | PredefinedMenuItem | CheckMenuItem | IconMenuItem): Promise; - /** Remove a menu item from this submenu at the specified position. */ - removeAt(position: number): Promise; - /** Returns a list of menu items that has been added to this submenu. */ - items(): Promise>; - /** Retrieves the menu item matching the given identifier. */ - get(id: string): Promise; - /** - * Popup this submenu as a context menu on the specified window. - * - * If the position, is provided, it is relative to the window's top-left corner. - */ - popup(at?: PhysicalPosition | LogicalPosition, window?: Window): Promise; - /** - * Set this submenu as the Window menu for the application on macOS. - * - * This will cause macOS to automatically add window-switching items and - * certain other items to the menu. - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ - setAsWindowsMenuForNSApp(): Promise; - /** - * Set this submenu as the Help menu for the application on macOS. - * - * This will cause macOS to automatically add a search box to the menu. - * - * If no menu is set as the Help menu, macOS will automatically use any menu - * which has a title matching the localized word "Help". - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ - setAsHelpMenuForNSApp(): Promise; - /** Sets an icon for this submenu */ - setIcon(icon: MenuIcon | null): Promise; -} diff --git a/node_modules/@tauri-apps/api/menu/submenu.js b/node_modules/@tauri-apps/api/menu/submenu.js deleted file mode 100644 index 83facef..0000000 --- a/node_modules/@tauri-apps/api/menu/submenu.js +++ /dev/null @@ -1,200 +0,0 @@ -import { MenuItem } from './menuItem.js'; -import { CheckMenuItem } from './checkMenuItem.js'; -import { IconMenuItem } from './iconMenuItem.js'; -import { PredefinedMenuItem } from './predefinedMenuItem.js'; -import { invoke } from '../core.js'; -import { MenuItemBase, newMenu } from './base.js'; -import { Position } from '../dpi.js'; -import { transformImage } from '../image.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** @ignore */ -function itemFromKind([rid, id, kind]) { - /* eslint-disable @typescript-eslint/no-unsafe-return */ - switch (kind) { - case 'Submenu': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new Submenu(rid, id); - case 'Predefined': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new PredefinedMenuItem(rid, id); - case 'Check': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new CheckMenuItem(rid, id); - case 'Icon': - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new IconMenuItem(rid, id); - case 'MenuItem': - default: - // @ts-expect-error constructor is protected for external usage only, safe for us to use - return new MenuItem(rid, id); - } - /* eslint-enable @typescript-eslint/no-unsafe-return */ -} -/** A type that is a submenu inside a {@linkcode Menu} or {@linkcode Submenu}. */ -class Submenu extends MenuItemBase { - /** @ignore */ - constructor(rid, id) { - super(rid, id, 'Submenu'); - } - /** Create a new submenu. */ - static async new(opts) { - return newMenu('Submenu', opts).then(([rid, id]) => new Submenu(rid, id)); - } - /** Returns the text of this submenu. */ - async text() { - return invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); - } - /** Sets the text for this submenu. */ - async setText(text) { - return invoke('plugin:menu|set_text', { - rid: this.rid, - kind: this.kind, - text - }); - } - /** Returns whether this submenu is enabled or not. */ - async isEnabled() { - return invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); - } - /** Sets whether this submenu is enabled or not. */ - async setEnabled(enabled) { - return invoke('plugin:menu|set_enabled', { - rid: this.rid, - kind: this.kind, - enabled - }); - } - /** - * Add a menu item to the end of this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async append(items) { - return invoke('plugin:menu|append', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the beginning of this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async prepend(items) { - return invoke('plugin:menu|prepend', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i) - }); - } - /** - * Add a menu item to the specified position in this submenu. - * - * #### Platform-specific: - * - * - **macOS:** Only {@linkcode Submenu}s can be added to a {@linkcode Menu}. - */ - async insert(items, position) { - return invoke('plugin:menu|insert', { - rid: this.rid, - kind: this.kind, - items: (Array.isArray(items) ? items : [items]).map((i) => 'rid' in i ? [i.rid, i.kind] : i), - position - }); - } - /** Remove a menu item from this submenu. */ - async remove(item) { - return invoke('plugin:menu|remove', { - rid: this.rid, - kind: this.kind, - item: [item.rid, item.kind] - }); - } - /** Remove a menu item from this submenu at the specified position. */ - async removeAt(position) { - return invoke('plugin:menu|remove_at', { - rid: this.rid, - kind: this.kind, - position - }).then(itemFromKind); - } - /** Returns a list of menu items that has been added to this submenu. */ - async items() { - return invoke('plugin:menu|items', { - rid: this.rid, - kind: this.kind - }).then((i) => i.map(itemFromKind)); - } - /** Retrieves the menu item matching the given identifier. */ - async get(id) { - return invoke('plugin:menu|get', { - rid: this.rid, - kind: this.kind, - id - }).then((r) => (r ? itemFromKind(r) : null)); - } - /** - * Popup this submenu as a context menu on the specified window. - * - * If the position, is provided, it is relative to the window's top-left corner. - */ - async popup(at, window) { - var _a; - return invoke('plugin:menu|popup', { - rid: this.rid, - kind: this.kind, - window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null, - at: at instanceof Position ? at : at ? new Position(at) : null - }); - } - /** - * Set this submenu as the Window menu for the application on macOS. - * - * This will cause macOS to automatically add window-switching items and - * certain other items to the menu. - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ - async setAsWindowsMenuForNSApp() { - return invoke('plugin:menu|set_as_windows_menu_for_nsapp', { - rid: this.rid - }); - } - /** - * Set this submenu as the Help menu for the application on macOS. - * - * This will cause macOS to automatically add a search box to the menu. - * - * If no menu is set as the Help menu, macOS will automatically use any menu - * which has a title matching the localized word "Help". - * - * #### Platform-specific: - * - * - **Windows / Linux**: Unsupported. - */ - async setAsHelpMenuForNSApp() { - return invoke('plugin:menu|set_as_help_menu_for_nsapp', { - rid: this.rid - }); - } - /** Sets an icon for this submenu */ - async setIcon(icon) { - return invoke('plugin:menu|set_icon', { - rid: this.rid, - kind: this.kind, - icon: transformImage(icon) - }); - } -} - -export { Submenu, itemFromKind }; diff --git a/node_modules/@tauri-apps/api/mocks.cjs b/node_modules/@tauri-apps/api/mocks.cjs deleted file mode 100644 index 96d9e3b..0000000 --- a/node_modules/@tauri-apps/api/mocks.cjs +++ /dev/null @@ -1,297 +0,0 @@ -'use strict'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -function mockInternals() { - var _a, _b; - window.__TAURI_INTERNALS__ = (_a = window.__TAURI_INTERNALS__) !== null && _a !== void 0 ? _a : {}; - window.__TAURI_EVENT_PLUGIN_INTERNALS__ = - (_b = window.__TAURI_EVENT_PLUGIN_INTERNALS__) !== null && _b !== void 0 ? _b : {}; -} -/** - * Intercepts all IPC requests with the given mock handler. - * - * This function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation. - * - * # Examples - * - * Testing setup using Vitest: - * ```ts - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { invoke } from "@tauri-apps/api/core" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked command", () => { - * mockIPC((cmd, payload) => { - * switch (cmd) { - * case "add": - * return (payload.a as number) + (payload.b as number); - * default: - * break; - * } - * }); - * - * expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27); - * }) - * ``` - * - * The callback function can also return a Promise: - * ```js - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { invoke } from "@tauri-apps/api/core" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked command", () => { - * mockIPC((cmd, payload) => { - * if(cmd === "get_data") { - * return fetch("https://example.com/data.json") - * .then((response) => response.json()) - * } - * }); - * - * expect(invoke('get_data')).resolves.toBe({ foo: 'bar' }); - * }) - * ``` - * - * `listen` can also be mocked with direct calls to the `emit` function. This functionality is opt-in via the `shouldMockEvents` option: - * ```js - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { emit, listen } from "@tauri-apps/api/event" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked event", () => { - * mockIPC(() => {}, { shouldMockEvents: true }); // enable event mocking - * - * const eventHandler = vi.fn(); - * listen('test-event', eventHandler); // typically in component setup or similar - * - * emit('test-event', { foo: 'bar' }); - * expect(eventHandler).toHaveBeenCalledWith({ - * event: 'test-event', - * payload: { foo: 'bar' } - * }); - * }) - * ``` - * `emitTo` is currently **not** supported by this mock implementation. - * - * @since 1.0.0 - */ -function mockIPC(cb, options) { - mockInternals(); - function isEventPluginInvoke(cmd) { - return cmd.startsWith('plugin:event|'); - } - function handleEventPlugin(cmd, args) { - switch (cmd) { - case 'plugin:event|listen': - return handleListen(args); - case 'plugin:event|emit': - return handleEmit(args); - case 'plugin:event|unlisten': - return handleRemoveListener(args); - } - } - const listeners = new Map(); - function handleListen(args) { - if (!listeners.has(args.event)) { - listeners.set(args.event, []); - } - listeners.get(args.event).push(args.handler); - return args.handler; - } - function handleEmit(args) { - const eventListeners = listeners.get(args.event) || []; - for (const handler of eventListeners) { - runCallback(handler, args); - } - return null; - } - function handleRemoveListener(args) { - const eventListeners = listeners.get(args.event); - if (eventListeners) { - const index = eventListeners.indexOf(args.id); - if (index !== -1) { - eventListeners.splice(index, 1); - } - } - } - // eslint-disable-next-line @typescript-eslint/require-await - async function invoke(cmd, args, _options) { - if ((options === null || options === void 0 ? void 0 : options.shouldMockEvents) && isEventPluginInvoke(cmd)) { - return handleEventPlugin(cmd, args); - } - return cb(cmd, args); - } - const callbacks = new Map(); - function registerCallback(callback, once = false) { - const identifier = window.crypto.getRandomValues(new Uint32Array(1))[0]; - callbacks.set(identifier, (data) => { - if (once) { - unregisterCallback(identifier); - } - return callback && callback(data); - }); - return identifier; - } - function unregisterCallback(id) { - callbacks.delete(id); - } - function runCallback(id, data) { - const callback = callbacks.get(id); - if (callback) { - callback(data); - } - else { - // eslint-disable-next-line no-console - console.warn(`[TAURI] Couldn't find callback id ${id}. This might happen when the app is reloaded while Rust is running an asynchronous operation.`); - } - } - function unregisterListener(event, id) { - unregisterCallback(id); - } - window.__TAURI_INTERNALS__.invoke = invoke; - window.__TAURI_INTERNALS__.transformCallback = registerCallback; - window.__TAURI_INTERNALS__.unregisterCallback = unregisterCallback; - window.__TAURI_INTERNALS__.runCallback = runCallback; - window.__TAURI_INTERNALS__.callbacks = callbacks; - window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener = - unregisterListener; -} -/** - * Mocks one or many window labels. - * In non-tauri context it is required to call this function *before* using the `@tauri-apps/api/window` module. - * - * This function only mocks the *presence* of windows, - * window properties (e.g. width and height) can be mocked like regular IPC calls using the `mockIPC` function. - * - * # Examples - * - * ```js - * import { mockWindows } from "@tauri-apps/api/mocks"; - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * - * mockWindows("main", "second", "third"); - * - * const win = getCurrentWindow(); - * - * win.label // "main" - * ``` - * - * ```js - * import { mockWindows } from "@tauri-apps/api/mocks"; - * - * mockWindows("main", "second", "third"); - * - * mockIPC((cmd, args) => { - * if (cmd === "plugin:event|emit") { - * console.log('emit event', args?.event, args?.payload); - * } - * }); - * - * const { emit } = await import("@tauri-apps/api/event"); - * await emit('loaded'); // this will cause the mocked IPC handler to log to the console. - * ``` - * - * @param current Label of window this JavaScript context is running in. - * - * @since 1.0.0 - */ -function mockWindows(current, ..._additionalWindows) { - mockInternals(); - window.__TAURI_INTERNALS__.metadata = { - currentWindow: { label: current }, - currentWebview: { windowLabel: current, label: current } - }; -} -/** - * Mock `convertFileSrc` function - * - * - * @example - * ```js - * import { mockConvertFileSrc } from "@tauri-apps/api/mocks"; - * import { convertFileSrc } from "@tauri-apps/api/core"; - * - * mockConvertFileSrc("windows") - * - * const url = convertFileSrc("C:\\Users\\user\\file.txt") - * ``` - * - * @param osName The operating system to mock, can be one of linux, macos, or windows - * - * @since 1.6.0 - */ -function mockConvertFileSrc(osName) { - mockInternals(); - window.__TAURI_INTERNALS__.convertFileSrc = function (filePath, protocol = 'asset') { - const path = encodeURIComponent(filePath); - return osName === 'windows' - ? `http://${protocol}.localhost/${path}` - : `${protocol}://localhost/${path}`; - }; -} -/** - * Clears mocked functions/data injected by the other functions in this module. - * When using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties. - * - * # Example - * - * ```js - * import { mockWindows, clearMocks } from "@tauri-apps/api/mocks" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked windows", () => { - * mockWindows("main", "second", "third"); - * - * expect(window.__TAURI_INTERNALS__).toHaveProperty("metadata") - * }) - * - * test("no mocked windows", () => { - * expect(window.__TAURI_INTERNALS__).not.toHaveProperty("metadata") - * }) - * ``` - * - * @since 1.0.0 - */ -function clearMocks() { - if (typeof window.__TAURI_INTERNALS__ !== 'object') { - return; - } - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.invoke; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.transformCallback; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.unregisterCallback; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.runCallback; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.callbacks; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.convertFileSrc; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.metadata; - if (typeof window.__TAURI_EVENT_PLUGIN_INTERNALS__ !== 'object') { - return; - } - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener; -} - -exports.clearMocks = clearMocks; -exports.mockConvertFileSrc = mockConvertFileSrc; -exports.mockIPC = mockIPC; -exports.mockWindows = mockWindows; diff --git a/node_modules/@tauri-apps/api/mocks.d.ts b/node_modules/@tauri-apps/api/mocks.d.ts deleted file mode 100644 index 8eeb818..0000000 --- a/node_modules/@tauri-apps/api/mocks.d.ts +++ /dev/null @@ -1,177 +0,0 @@ -import type { InvokeArgs } from './core'; -/** - * Options for `mockIPC`. - * - * # Options - * `shouldMockEvents`: If true, the `listen` and `emit` functions will be mocked, allowing you to test event handling without a real backend. - * **This will consume any events emitted with the `plugin:event` prefix.** - * - * @since 2.7.0 - */ -export interface MockIPCOptions { - shouldMockEvents?: boolean; -} -/** - * Intercepts all IPC requests with the given mock handler. - * - * This function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation. - * - * # Examples - * - * Testing setup using Vitest: - * ```ts - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { invoke } from "@tauri-apps/api/core" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked command", () => { - * mockIPC((cmd, payload) => { - * switch (cmd) { - * case "add": - * return (payload.a as number) + (payload.b as number); - * default: - * break; - * } - * }); - * - * expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27); - * }) - * ``` - * - * The callback function can also return a Promise: - * ```js - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { invoke } from "@tauri-apps/api/core" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked command", () => { - * mockIPC((cmd, payload) => { - * if(cmd === "get_data") { - * return fetch("https://example.com/data.json") - * .then((response) => response.json()) - * } - * }); - * - * expect(invoke('get_data')).resolves.toBe({ foo: 'bar' }); - * }) - * ``` - * - * `listen` can also be mocked with direct calls to the `emit` function. This functionality is opt-in via the `shouldMockEvents` option: - * ```js - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { emit, listen } from "@tauri-apps/api/event" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked event", () => { - * mockIPC(() => {}, { shouldMockEvents: true }); // enable event mocking - * - * const eventHandler = vi.fn(); - * listen('test-event', eventHandler); // typically in component setup or similar - * - * emit('test-event', { foo: 'bar' }); - * expect(eventHandler).toHaveBeenCalledWith({ - * event: 'test-event', - * payload: { foo: 'bar' } - * }); - * }) - * ``` - * `emitTo` is currently **not** supported by this mock implementation. - * - * @since 1.0.0 - */ -export declare function mockIPC(cb: (cmd: string, payload?: InvokeArgs) => unknown, options?: MockIPCOptions): void; -/** - * Mocks one or many window labels. - * In non-tauri context it is required to call this function *before* using the `@tauri-apps/api/window` module. - * - * This function only mocks the *presence* of windows, - * window properties (e.g. width and height) can be mocked like regular IPC calls using the `mockIPC` function. - * - * # Examples - * - * ```js - * import { mockWindows } from "@tauri-apps/api/mocks"; - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * - * mockWindows("main", "second", "third"); - * - * const win = getCurrentWindow(); - * - * win.label // "main" - * ``` - * - * ```js - * import { mockWindows } from "@tauri-apps/api/mocks"; - * - * mockWindows("main", "second", "third"); - * - * mockIPC((cmd, args) => { - * if (cmd === "plugin:event|emit") { - * console.log('emit event', args?.event, args?.payload); - * } - * }); - * - * const { emit } = await import("@tauri-apps/api/event"); - * await emit('loaded'); // this will cause the mocked IPC handler to log to the console. - * ``` - * - * @param current Label of window this JavaScript context is running in. - * - * @since 1.0.0 - */ -export declare function mockWindows(current: string, ..._additionalWindows: string[]): void; -/** - * Mock `convertFileSrc` function - * - * - * @example - * ```js - * import { mockConvertFileSrc } from "@tauri-apps/api/mocks"; - * import { convertFileSrc } from "@tauri-apps/api/core"; - * - * mockConvertFileSrc("windows") - * - * const url = convertFileSrc("C:\\Users\\user\\file.txt") - * ``` - * - * @param osName The operating system to mock, can be one of linux, macos, or windows - * - * @since 1.6.0 - */ -export declare function mockConvertFileSrc(osName: string): void; -/** - * Clears mocked functions/data injected by the other functions in this module. - * When using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties. - * - * # Example - * - * ```js - * import { mockWindows, clearMocks } from "@tauri-apps/api/mocks" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked windows", () => { - * mockWindows("main", "second", "third"); - * - * expect(window.__TAURI_INTERNALS__).toHaveProperty("metadata") - * }) - * - * test("no mocked windows", () => { - * expect(window.__TAURI_INTERNALS__).not.toHaveProperty("metadata") - * }) - * ``` - * - * @since 1.0.0 - */ -export declare function clearMocks(): void; diff --git a/node_modules/@tauri-apps/api/mocks.js b/node_modules/@tauri-apps/api/mocks.js deleted file mode 100644 index a08c0b2..0000000 --- a/node_modules/@tauri-apps/api/mocks.js +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -function mockInternals() { - var _a, _b; - window.__TAURI_INTERNALS__ = (_a = window.__TAURI_INTERNALS__) !== null && _a !== void 0 ? _a : {}; - window.__TAURI_EVENT_PLUGIN_INTERNALS__ = - (_b = window.__TAURI_EVENT_PLUGIN_INTERNALS__) !== null && _b !== void 0 ? _b : {}; -} -/** - * Intercepts all IPC requests with the given mock handler. - * - * This function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation. - * - * # Examples - * - * Testing setup using Vitest: - * ```ts - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { invoke } from "@tauri-apps/api/core" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked command", () => { - * mockIPC((cmd, payload) => { - * switch (cmd) { - * case "add": - * return (payload.a as number) + (payload.b as number); - * default: - * break; - * } - * }); - * - * expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27); - * }) - * ``` - * - * The callback function can also return a Promise: - * ```js - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { invoke } from "@tauri-apps/api/core" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked command", () => { - * mockIPC((cmd, payload) => { - * if(cmd === "get_data") { - * return fetch("https://example.com/data.json") - * .then((response) => response.json()) - * } - * }); - * - * expect(invoke('get_data')).resolves.toBe({ foo: 'bar' }); - * }) - * ``` - * - * `listen` can also be mocked with direct calls to the `emit` function. This functionality is opt-in via the `shouldMockEvents` option: - * ```js - * import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" - * import { emit, listen } from "@tauri-apps/api/event" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked event", () => { - * mockIPC(() => {}, { shouldMockEvents: true }); // enable event mocking - * - * const eventHandler = vi.fn(); - * listen('test-event', eventHandler); // typically in component setup or similar - * - * emit('test-event', { foo: 'bar' }); - * expect(eventHandler).toHaveBeenCalledWith({ - * event: 'test-event', - * payload: { foo: 'bar' } - * }); - * }) - * ``` - * `emitTo` is currently **not** supported by this mock implementation. - * - * @since 1.0.0 - */ -function mockIPC(cb, options) { - mockInternals(); - function isEventPluginInvoke(cmd) { - return cmd.startsWith('plugin:event|'); - } - function handleEventPlugin(cmd, args) { - switch (cmd) { - case 'plugin:event|listen': - return handleListen(args); - case 'plugin:event|emit': - return handleEmit(args); - case 'plugin:event|unlisten': - return handleRemoveListener(args); - } - } - const listeners = new Map(); - function handleListen(args) { - if (!listeners.has(args.event)) { - listeners.set(args.event, []); - } - listeners.get(args.event).push(args.handler); - return args.handler; - } - function handleEmit(args) { - const eventListeners = listeners.get(args.event) || []; - for (const handler of eventListeners) { - runCallback(handler, args); - } - return null; - } - function handleRemoveListener(args) { - const eventListeners = listeners.get(args.event); - if (eventListeners) { - const index = eventListeners.indexOf(args.id); - if (index !== -1) { - eventListeners.splice(index, 1); - } - } - } - // eslint-disable-next-line @typescript-eslint/require-await - async function invoke(cmd, args, _options) { - if ((options === null || options === void 0 ? void 0 : options.shouldMockEvents) && isEventPluginInvoke(cmd)) { - return handleEventPlugin(cmd, args); - } - return cb(cmd, args); - } - const callbacks = new Map(); - function registerCallback(callback, once = false) { - const identifier = window.crypto.getRandomValues(new Uint32Array(1))[0]; - callbacks.set(identifier, (data) => { - if (once) { - unregisterCallback(identifier); - } - return callback && callback(data); - }); - return identifier; - } - function unregisterCallback(id) { - callbacks.delete(id); - } - function runCallback(id, data) { - const callback = callbacks.get(id); - if (callback) { - callback(data); - } - else { - // eslint-disable-next-line no-console - console.warn(`[TAURI] Couldn't find callback id ${id}. This might happen when the app is reloaded while Rust is running an asynchronous operation.`); - } - } - function unregisterListener(event, id) { - unregisterCallback(id); - } - window.__TAURI_INTERNALS__.invoke = invoke; - window.__TAURI_INTERNALS__.transformCallback = registerCallback; - window.__TAURI_INTERNALS__.unregisterCallback = unregisterCallback; - window.__TAURI_INTERNALS__.runCallback = runCallback; - window.__TAURI_INTERNALS__.callbacks = callbacks; - window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener = - unregisterListener; -} -/** - * Mocks one or many window labels. - * In non-tauri context it is required to call this function *before* using the `@tauri-apps/api/window` module. - * - * This function only mocks the *presence* of windows, - * window properties (e.g. width and height) can be mocked like regular IPC calls using the `mockIPC` function. - * - * # Examples - * - * ```js - * import { mockWindows } from "@tauri-apps/api/mocks"; - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * - * mockWindows("main", "second", "third"); - * - * const win = getCurrentWindow(); - * - * win.label // "main" - * ``` - * - * ```js - * import { mockWindows } from "@tauri-apps/api/mocks"; - * - * mockWindows("main", "second", "third"); - * - * mockIPC((cmd, args) => { - * if (cmd === "plugin:event|emit") { - * console.log('emit event', args?.event, args?.payload); - * } - * }); - * - * const { emit } = await import("@tauri-apps/api/event"); - * await emit('loaded'); // this will cause the mocked IPC handler to log to the console. - * ``` - * - * @param current Label of window this JavaScript context is running in. - * - * @since 1.0.0 - */ -function mockWindows(current, ..._additionalWindows) { - mockInternals(); - window.__TAURI_INTERNALS__.metadata = { - currentWindow: { label: current }, - currentWebview: { windowLabel: current, label: current } - }; -} -/** - * Mock `convertFileSrc` function - * - * - * @example - * ```js - * import { mockConvertFileSrc } from "@tauri-apps/api/mocks"; - * import { convertFileSrc } from "@tauri-apps/api/core"; - * - * mockConvertFileSrc("windows") - * - * const url = convertFileSrc("C:\\Users\\user\\file.txt") - * ``` - * - * @param osName The operating system to mock, can be one of linux, macos, or windows - * - * @since 1.6.0 - */ -function mockConvertFileSrc(osName) { - mockInternals(); - window.__TAURI_INTERNALS__.convertFileSrc = function (filePath, protocol = 'asset') { - const path = encodeURIComponent(filePath); - return osName === 'windows' - ? `http://${protocol}.localhost/${path}` - : `${protocol}://localhost/${path}`; - }; -} -/** - * Clears mocked functions/data injected by the other functions in this module. - * When using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties. - * - * # Example - * - * ```js - * import { mockWindows, clearMocks } from "@tauri-apps/api/mocks" - * - * afterEach(() => { - * clearMocks() - * }) - * - * test("mocked windows", () => { - * mockWindows("main", "second", "third"); - * - * expect(window.__TAURI_INTERNALS__).toHaveProperty("metadata") - * }) - * - * test("no mocked windows", () => { - * expect(window.__TAURI_INTERNALS__).not.toHaveProperty("metadata") - * }) - * ``` - * - * @since 1.0.0 - */ -function clearMocks() { - if (typeof window.__TAURI_INTERNALS__ !== 'object') { - return; - } - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.invoke; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.transformCallback; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.unregisterCallback; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.runCallback; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.callbacks; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.convertFileSrc; - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_INTERNALS__.metadata; - if (typeof window.__TAURI_EVENT_PLUGIN_INTERNALS__ !== 'object') { - return; - } - // @ts-expect-error "The operand of a 'delete' operator must be optional." does not matter in this case - delete window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener; -} - -export { clearMocks, mockConvertFileSrc, mockIPC, mockWindows }; diff --git a/node_modules/@tauri-apps/api/package.json b/node_modules/@tauri-apps/api/package.json deleted file mode 100644 index f5ac01a..0000000 --- a/node_modules/@tauri-apps/api/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@tauri-apps/api", - "version": "2.10.1", - "description": "Tauri API definitions", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/tauri" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/tauri-apps/tauri.git" - }, - "contributors": [ - "Tauri Programme within The Commons Conservancy" - ], - "license": "Apache-2.0 OR MIT", - "bugs": { - "url": "https://github.com/tauri-apps/tauri/issues" - }, - "homepage": "https://github.com/tauri-apps/tauri#readme", - "type": "module", - "main": "./index.cjs", - "module": "./index.js", - "types": "./index.d.ts", - "exports": { - ".": { - "import": "./index.js", - "require": "./index.cjs", - "types": "./index.d.ts" - }, - "./*": { - "import": "./*.js", - "require": "./*.cjs", - "types": "./*.d.ts" - }, - "./package.json": "./package.json" - }, - "devDependencies": { - "@eslint/js": "^9.29.0", - "@rollup/plugin-terser": "0.4.4", - "@rollup/plugin-typescript": "12.3.0", - "@types/eslint": "^9.6.1", - "@types/node": "^24.0.0", - "eslint": "^9.29.0", - "eslint-config-prettier": "10.1.8", - "eslint-plugin-security": "3.0.1", - "fast-glob": "3.3.3", - "globals": "^17.0.0", - "rollup": "4.57.0", - "tslib": "^2.8.1", - "typescript": "^5.8.3", - "typescript-eslint": "^8.34.1" - }, - "scripts": { - "build": "rollup -c --configPlugin typescript", - "build:debug": "rollup -c --configPlugin typescript", - "npm-pack": "pnpm build && cd ./dist && npm pack", - "npm-publish": "pnpm build && cd ./dist && pnpm publish --access public --loglevel silly --no-git-checks", - "ts:check": "tsc --noEmit", - "eslint:check": "eslint src/**/*.ts", - "eslint:fix": "eslint src/**/*.ts --fix" - } -} \ No newline at end of file diff --git a/node_modules/@tauri-apps/api/path.cjs b/node_modules/@tauri-apps/api/path.cjs deleted file mode 100644 index 15f16c2..0000000 --- a/node_modules/@tauri-apps/api/path.cjs +++ /dev/null @@ -1,753 +0,0 @@ -'use strict'; - -var core = require('./core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * The path module provides utilities for working with file and directory paths. - * - * This package is also accessible with `window.__TAURI__.path` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * - * It is recommended to allowlist only the APIs you use for optimal bundle size and security. - * @module - */ -/** - * @since 2.0.0 - */ -exports.BaseDirectory = void 0; -(function (BaseDirectory) { - /** - * @see {@link audioDir} for more information. - */ - BaseDirectory[BaseDirectory["Audio"] = 1] = "Audio"; - /** - * @see {@link cacheDir} for more information. - */ - BaseDirectory[BaseDirectory["Cache"] = 2] = "Cache"; - /** - * @see {@link configDir} for more information. - */ - BaseDirectory[BaseDirectory["Config"] = 3] = "Config"; - /** - * @see {@link dataDir} for more information. - */ - BaseDirectory[BaseDirectory["Data"] = 4] = "Data"; - /** - * @see {@link localDataDir} for more information. - */ - BaseDirectory[BaseDirectory["LocalData"] = 5] = "LocalData"; - /** - * @see {@link documentDir} for more information. - */ - BaseDirectory[BaseDirectory["Document"] = 6] = "Document"; - /** - * @see {@link downloadDir} for more information. - */ - BaseDirectory[BaseDirectory["Download"] = 7] = "Download"; - /** - * @see {@link pictureDir} for more information. - */ - BaseDirectory[BaseDirectory["Picture"] = 8] = "Picture"; - /** - * @see {@link publicDir} for more information. - */ - BaseDirectory[BaseDirectory["Public"] = 9] = "Public"; - /** - * @see {@link videoDir} for more information. - */ - BaseDirectory[BaseDirectory["Video"] = 10] = "Video"; - /** - * @see {@link resourceDir} for more information. - */ - BaseDirectory[BaseDirectory["Resource"] = 11] = "Resource"; - /** - * @see {@link tempDir} for more information. - */ - BaseDirectory[BaseDirectory["Temp"] = 12] = "Temp"; - /** - * @see {@link appConfigDir} for more information. - */ - BaseDirectory[BaseDirectory["AppConfig"] = 13] = "AppConfig"; - /** - * @see {@link appDataDir} for more information. - */ - BaseDirectory[BaseDirectory["AppData"] = 14] = "AppData"; - /** - * @see {@link appLocalDataDir} for more information. - */ - BaseDirectory[BaseDirectory["AppLocalData"] = 15] = "AppLocalData"; - /** - * @see {@link appCacheDir} for more information. - */ - BaseDirectory[BaseDirectory["AppCache"] = 16] = "AppCache"; - /** - * @see {@link appLogDir} for more information. - */ - BaseDirectory[BaseDirectory["AppLog"] = 17] = "AppLog"; - /** - * @see {@link desktopDir} for more information. - */ - BaseDirectory[BaseDirectory["Desktop"] = 18] = "Desktop"; - /** - * @see {@link executableDir} for more information. - */ - BaseDirectory[BaseDirectory["Executable"] = 19] = "Executable"; - /** - * @see {@link fontDir} for more information. - */ - BaseDirectory[BaseDirectory["Font"] = 20] = "Font"; - /** - * @see {@link homeDir} for more information. - */ - BaseDirectory[BaseDirectory["Home"] = 21] = "Home"; - /** - * @see {@link runtimeDir} for more information. - */ - BaseDirectory[BaseDirectory["Runtime"] = 22] = "Runtime"; - /** - * @see {@link templateDir} for more information. - */ - BaseDirectory[BaseDirectory["Template"] = 23] = "Template"; -})(exports.BaseDirectory || (exports.BaseDirectory = {})); -/** - * Returns the path to the suggested directory for your app's config files. - * Resolves to `${configDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appConfigDir } from '@tauri-apps/api/path'; - * const appConfigDirPath = await appConfigDir(); - * ``` - * - * @since 1.2.0 - */ -async function appConfigDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.AppConfig - }); -} -/** - * Returns the path to the suggested directory for your app's data files. - * Resolves to `${dataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * ``` - * - * @since 1.2.0 - */ -async function appDataDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.AppData - }); -} -/** - * Returns the path to the suggested directory for your app's local data files. - * Resolves to `${localDataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appLocalDataDir } from '@tauri-apps/api/path'; - * const appLocalDataDirPath = await appLocalDataDir(); - * ``` - * - * @since 1.2.0 - */ -async function appLocalDataDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.AppLocalData - }); -} -/** - * Returns the path to the suggested directory for your app's cache files. - * Resolves to `${cacheDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appCacheDir } from '@tauri-apps/api/path'; - * const appCacheDirPath = await appCacheDir(); - * ``` - * - * @since 1.2.0 - */ -async function appCacheDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.AppCache - }); -} -/** - * Returns the path to the user's audio directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_MUSIC_DIR`. - * - **macOS:** Resolves to `$HOME/Music`. - * - **Windows:** Resolves to `{FOLDERID_Music}`. - * @example - * ```typescript - * import { audioDir } from '@tauri-apps/api/path'; - * const audioDirPath = await audioDir(); - * ``` - * - * @since 1.0.0 - */ -async function audioDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Audio - }); -} -/** - * Returns the path to the user's cache directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_CACHE_HOME` or `$HOME/.cache`. - * - **macOS:** Resolves to `$HOME/Library/Caches`. - * - **Windows:** Resolves to `{FOLDERID_LocalAppData}`. - * @example - * ```typescript - * import { cacheDir } from '@tauri-apps/api/path'; - * const cacheDirPath = await cacheDir(); - * ``` - * - * @since 1.0.0 - */ -async function cacheDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Cache - }); -} -/** - * Returns the path to the user's config directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_CONFIG_HOME` or `$HOME/.config`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`. - * @example - * ```typescript - * import { configDir } from '@tauri-apps/api/path'; - * const configDirPath = await configDir(); - * ``` - * - * @since 1.0.0 - */ -async function configDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Config - }); -} -/** - * Returns the path to the user's data directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`. - * @example - * ```typescript - * import { dataDir } from '@tauri-apps/api/path'; - * const dataDirPath = await dataDir(); - * ``` - * - * @since 1.0.0 - */ -async function dataDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Data - }); -} -/** - * Returns the path to the user's desktop directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DESKTOP_DIR`. - * - **macOS:** Resolves to `$HOME/Desktop`. - * - **Windows:** Resolves to `{FOLDERID_Desktop}`. - * @example - * ```typescript - * import { desktopDir } from '@tauri-apps/api/path'; - * const desktopPath = await desktopDir(); - * ``` - * - * @since 1.0.0 - */ -async function desktopDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Desktop - }); -} -/** - * Returns the path to the user's document directory. - * @example - * ```typescript - * import { documentDir } from '@tauri-apps/api/path'; - * const documentDirPath = await documentDir(); - * ``` - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOCUMENTS_DIR`. - * - **macOS:** Resolves to `$HOME/Documents`. - * - **Windows:** Resolves to `{FOLDERID_Documents}`. - * - * @since 1.0.0 - */ -async function documentDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Document - }); -} -/** - * Returns the path to the user's download directory. - * - * #### Platform-specific - * - * - **Linux**: Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOWNLOAD_DIR`. - * - **macOS**: Resolves to `$HOME/Downloads`. - * - **Windows**: Resolves to `{FOLDERID_Downloads}`. - * @example - * ```typescript - * import { downloadDir } from '@tauri-apps/api/path'; - * const downloadDirPath = await downloadDir(); - * ``` - * - * @since 1.0.0 - */ -async function downloadDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Download - }); -} -/** - * Returns the path to the user's executable directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_BIN_HOME/../bin` or `$XDG_DATA_HOME/../bin` or `$HOME/.local/bin`. - * - **macOS:** Not supported. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { executableDir } from '@tauri-apps/api/path'; - * const executableDirPath = await executableDir(); - * ``` - * - * @since 1.0.0 - */ -async function executableDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Executable - }); -} -/** - * Returns the path to the user's font directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME/fonts` or `$HOME/.local/share/fonts`. - * - **macOS:** Resolves to `$HOME/Library/Fonts`. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { fontDir } from '@tauri-apps/api/path'; - * const fontDirPath = await fontDir(); - * ``` - * - * @since 1.0.0 - */ -async function fontDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Font - }); -} -/** - * Returns the path to the user's home directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$HOME`. - * - **macOS:** Resolves to `$HOME`. - * - **Windows:** Resolves to `{FOLDERID_Profile}`. - * @example - * ```typescript - * import { homeDir } from '@tauri-apps/api/path'; - * const homeDirPath = await homeDir(); - * ``` - * - * @since 1.0.0 - */ -async function homeDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Home - }); -} -/** - * Returns the path to the user's local data directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_LocalAppData}`. - * @example - * ```typescript - * import { localDataDir } from '@tauri-apps/api/path'; - * const localDataDirPath = await localDataDir(); - * ``` - * - * @since 1.0.0 - */ -async function localDataDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.LocalData - }); -} -/** - * Returns the path to the user's picture directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PICTURES_DIR`. - * - **macOS:** Resolves to `$HOME/Pictures`. - * - **Windows:** Resolves to `{FOLDERID_Pictures}`. - * @example - * ```typescript - * import { pictureDir } from '@tauri-apps/api/path'; - * const pictureDirPath = await pictureDir(); - * ``` - * - * @since 1.0.0 - */ -async function pictureDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Picture - }); -} -/** - * Returns the path to the user's public directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PUBLICSHARE_DIR`. - * - **macOS:** Resolves to `$HOME/Public`. - * - **Windows:** Resolves to `{FOLDERID_Public}`. - * @example - * ```typescript - * import { publicDir } from '@tauri-apps/api/path'; - * const publicDirPath = await publicDir(); - * ``` - * - * @since 1.0.0 - */ -async function publicDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Public - }); -} -/** - * Returns the path to the application's resource directory. - * To resolve a resource path, see {@linkcode resolveResource}. - * - * ## Platform-specific - * - * Although we provide the exact path where this function resolves to, - * this is not a contract and things might change in the future - * - * - **Windows:** Resolves to the directory that contains the main executable. - * - **Linux:** When running in an AppImage, the `APPDIR` variable will be set to - * the mounted location of the app, and the resource dir will be `${APPDIR}/usr/lib/${exe_name}`. - * If not running in an AppImage, the path is `/usr/lib/${exe_name}`. - * When running the app from `src-tauri/target/(debug|release)/`, the path is `${exe_dir}/../lib/${exe_name}`. - * - **macOS:** Resolves to `${exe_dir}/../Resources` (inside .app). - * - **iOS:** Resolves to `${exe_dir}/assets`. - * - **Android:** Currently the resources are stored in the APK as assets so it's not a normal file system path, - * we return a special URI prefix `asset://localhost/` here that can be used with the [file system plugin](https://tauri.app/plugin/file-system/), - * - * @example - * ```typescript - * import { resourceDir } from '@tauri-apps/api/path'; - * const resourceDirPath = await resourceDir(); - * ``` - * - * @since 1.0.0 - */ -async function resourceDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Resource - }); -} -/** - * Resolve the path to a resource file. - * @example - * ```typescript - * import { resolveResource } from '@tauri-apps/api/path'; - * const resourcePath = await resolveResource('script.sh'); - * ``` - * - * @param resourcePath The path to the resource. - * Must follow the same syntax as defined in `tauri.conf.json > bundle > resources`, i.e. keeping subfolders and parent dir components (`../`). - * @returns The full path to the resource. - * - * @since 1.0.0 - */ -async function resolveResource(resourcePath) { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Resource, - path: resourcePath - }); -} -/** - * Returns the path to the user's runtime directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_RUNTIME_DIR`. - * - **macOS:** Not supported. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { runtimeDir } from '@tauri-apps/api/path'; - * const runtimeDirPath = await runtimeDir(); - * ``` - * - * @since 1.0.0 - */ -async function runtimeDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Runtime - }); -} -/** - * Returns the path to the user's template directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_TEMPLATES_DIR`. - * - **macOS:** Not supported. - * - **Windows:** Resolves to `{FOLDERID_Templates}`. - * @example - * ```typescript - * import { templateDir } from '@tauri-apps/api/path'; - * const templateDirPath = await templateDir(); - * ``` - * - * @since 1.0.0 - */ -async function templateDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Template - }); -} -/** - * Returns the path to the user's video directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_VIDEOS_DIR`. - * - **macOS:** Resolves to `$HOME/Movies`. - * - **Windows:** Resolves to `{FOLDERID_Videos}`. - * @example - * ```typescript - * import { videoDir } from '@tauri-apps/api/path'; - * const videoDirPath = await videoDir(); - * ``` - * - * @since 1.0.0 - */ -async function videoDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Video - }); -} -/** - * Returns the path to the suggested directory for your app's log files. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `${configDir}/${bundleIdentifier}/logs`. - * - **macOS:** Resolves to `${homeDir}/Library/Logs/{bundleIdentifier}` - * - **Windows:** Resolves to `${configDir}/${bundleIdentifier}/logs`. - * @example - * ```typescript - * import { appLogDir } from '@tauri-apps/api/path'; - * const appLogDirPath = await appLogDir(); - * ``` - * - * @since 1.2.0 - */ -async function appLogDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.AppLog - }); -} -/** - * Returns a temporary directory. - * @example - * ```typescript - * import { tempDir } from '@tauri-apps/api/path'; - * const temp = await tempDir(); - * ``` - * - * @since 2.0.0 - */ -async function tempDir() { - return core.invoke('plugin:path|resolve_directory', { - directory: exports.BaseDirectory.Temp - }); -} -/** - * Returns the platform-specific path segment separator: - * - `\` on Windows - * - `/` on POSIX - * - * @since 2.0.0 - */ -function sep() { - return window.__TAURI_INTERNALS__.plugins.path.sep; -} -/** - * Returns the platform-specific path segment delimiter: - * - `;` on Windows - * - `:` on POSIX - * - * @since 2.0.0 - */ -function delimiter() { - return window.__TAURI_INTERNALS__.plugins.path.delimiter; -} -/** - * Resolves a sequence of `paths` or `path` segments into an absolute path. - * @example - * ```typescript - * import { resolve, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png'); - * ``` - * - * @since 1.0.0 - */ -async function resolve(...paths) { - return core.invoke('plugin:path|resolve', { paths }); -} -/** - * Normalizes the given `path`, resolving `'..'` and `'.'` segments and resolve symbolic links. - * @example - * ```typescript - * import { normalize, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await normalize(`${appDataDirPath}/../users/tauri/avatar.png`); - * ``` - * - * @since 1.0.0 - */ -async function normalize(path) { - return core.invoke('plugin:path|normalize', { path }); -} -/** - * Joins all given `path` segments together using the platform-specific separator as a delimiter, then normalizes the resulting path. - * @example - * ```typescript - * import { join, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png'); - * ``` - * - * @since 1.0.0 - */ -async function join(...paths) { - return core.invoke('plugin:path|join', { paths }); -} -/** - * Returns the parent directory of a given `path`. Trailing directory separators are ignored. - * @example - * ```typescript - * import { dirname } from '@tauri-apps/api/path'; - * const dir = await dirname('/path/to/somedir/'); - * assert(dir === '/path/to'); - * ``` - * - * @since 1.0.0 - */ -async function dirname(path) { - return core.invoke('plugin:path|dirname', { path }); -} -/** - * Returns the extension of the `path`. - * @example - * ```typescript - * import { extname } from '@tauri-apps/api/path'; - * const ext = await extname('/path/to/file.html'); - * assert(ext === 'html'); - * ``` - * - * @since 1.0.0 - */ -async function extname(path) { - return core.invoke('plugin:path|extname', { path }); -} -/** - * Returns the last portion of a `path`. Trailing directory separators are ignored. - * @example - * ```typescript - * import { basename } from '@tauri-apps/api/path'; - * const base = await basename('path/to/app.conf'); - * assert(base === 'app.conf'); - * ``` - * @param ext An optional file extension to be removed from the returned path. - * - * @since 1.0.0 - */ -async function basename(path, ext) { - return core.invoke('plugin:path|basename', { path, ext }); -} -/** - * Returns whether the path is absolute or not. - * @example - * ```typescript - * import { isAbsolute } from '@tauri-apps/api/path'; - * assert(await isAbsolute('/home/tauri')); - * ``` - * - * @since 1.0.0 - */ -async function isAbsolute(path) { - return core.invoke('plugin:path|is_absolute', { path }); -} - -exports.appCacheDir = appCacheDir; -exports.appConfigDir = appConfigDir; -exports.appDataDir = appDataDir; -exports.appLocalDataDir = appLocalDataDir; -exports.appLogDir = appLogDir; -exports.audioDir = audioDir; -exports.basename = basename; -exports.cacheDir = cacheDir; -exports.configDir = configDir; -exports.dataDir = dataDir; -exports.delimiter = delimiter; -exports.desktopDir = desktopDir; -exports.dirname = dirname; -exports.documentDir = documentDir; -exports.downloadDir = downloadDir; -exports.executableDir = executableDir; -exports.extname = extname; -exports.fontDir = fontDir; -exports.homeDir = homeDir; -exports.isAbsolute = isAbsolute; -exports.join = join; -exports.localDataDir = localDataDir; -exports.normalize = normalize; -exports.pictureDir = pictureDir; -exports.publicDir = publicDir; -exports.resolve = resolve; -exports.resolveResource = resolveResource; -exports.resourceDir = resourceDir; -exports.runtimeDir = runtimeDir; -exports.sep = sep; -exports.tempDir = tempDir; -exports.templateDir = templateDir; -exports.videoDir = videoDir; diff --git a/node_modules/@tauri-apps/api/path.d.ts b/node_modules/@tauri-apps/api/path.d.ts deleted file mode 100644 index 1808f68..0000000 --- a/node_modules/@tauri-apps/api/path.d.ts +++ /dev/null @@ -1,589 +0,0 @@ -/** - * @since 2.0.0 - */ -declare enum BaseDirectory { - /** - * @see {@link audioDir} for more information. - */ - Audio = 1, - /** - * @see {@link cacheDir} for more information. - */ - Cache = 2, - /** - * @see {@link configDir} for more information. - */ - Config = 3, - /** - * @see {@link dataDir} for more information. - */ - Data = 4, - /** - * @see {@link localDataDir} for more information. - */ - LocalData = 5, - /** - * @see {@link documentDir} for more information. - */ - Document = 6, - /** - * @see {@link downloadDir} for more information. - */ - Download = 7, - /** - * @see {@link pictureDir} for more information. - */ - Picture = 8, - /** - * @see {@link publicDir} for more information. - */ - Public = 9, - /** - * @see {@link videoDir} for more information. - */ - Video = 10, - /** - * @see {@link resourceDir} for more information. - */ - Resource = 11, - /** - * @see {@link tempDir} for more information. - */ - Temp = 12, - /** - * @see {@link appConfigDir} for more information. - */ - AppConfig = 13, - /** - * @see {@link appDataDir} for more information. - */ - AppData = 14, - /** - * @see {@link appLocalDataDir} for more information. - */ - AppLocalData = 15, - /** - * @see {@link appCacheDir} for more information. - */ - AppCache = 16, - /** - * @see {@link appLogDir} for more information. - */ - AppLog = 17, - /** - * @see {@link desktopDir} for more information. - */ - Desktop = 18, - /** - * @see {@link executableDir} for more information. - */ - Executable = 19, - /** - * @see {@link fontDir} for more information. - */ - Font = 20, - /** - * @see {@link homeDir} for more information. - */ - Home = 21, - /** - * @see {@link runtimeDir} for more information. - */ - Runtime = 22, - /** - * @see {@link templateDir} for more information. - */ - Template = 23 -} -/** - * Returns the path to the suggested directory for your app's config files. - * Resolves to `${configDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appConfigDir } from '@tauri-apps/api/path'; - * const appConfigDirPath = await appConfigDir(); - * ``` - * - * @since 1.2.0 - */ -declare function appConfigDir(): Promise; -/** - * Returns the path to the suggested directory for your app's data files. - * Resolves to `${dataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * ``` - * - * @since 1.2.0 - */ -declare function appDataDir(): Promise; -/** - * Returns the path to the suggested directory for your app's local data files. - * Resolves to `${localDataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appLocalDataDir } from '@tauri-apps/api/path'; - * const appLocalDataDirPath = await appLocalDataDir(); - * ``` - * - * @since 1.2.0 - */ -declare function appLocalDataDir(): Promise; -/** - * Returns the path to the suggested directory for your app's cache files. - * Resolves to `${cacheDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appCacheDir } from '@tauri-apps/api/path'; - * const appCacheDirPath = await appCacheDir(); - * ``` - * - * @since 1.2.0 - */ -declare function appCacheDir(): Promise; -/** - * Returns the path to the user's audio directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_MUSIC_DIR`. - * - **macOS:** Resolves to `$HOME/Music`. - * - **Windows:** Resolves to `{FOLDERID_Music}`. - * @example - * ```typescript - * import { audioDir } from '@tauri-apps/api/path'; - * const audioDirPath = await audioDir(); - * ``` - * - * @since 1.0.0 - */ -declare function audioDir(): Promise; -/** - * Returns the path to the user's cache directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_CACHE_HOME` or `$HOME/.cache`. - * - **macOS:** Resolves to `$HOME/Library/Caches`. - * - **Windows:** Resolves to `{FOLDERID_LocalAppData}`. - * @example - * ```typescript - * import { cacheDir } from '@tauri-apps/api/path'; - * const cacheDirPath = await cacheDir(); - * ``` - * - * @since 1.0.0 - */ -declare function cacheDir(): Promise; -/** - * Returns the path to the user's config directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_CONFIG_HOME` or `$HOME/.config`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`. - * @example - * ```typescript - * import { configDir } from '@tauri-apps/api/path'; - * const configDirPath = await configDir(); - * ``` - * - * @since 1.0.0 - */ -declare function configDir(): Promise; -/** - * Returns the path to the user's data directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`. - * @example - * ```typescript - * import { dataDir } from '@tauri-apps/api/path'; - * const dataDirPath = await dataDir(); - * ``` - * - * @since 1.0.0 - */ -declare function dataDir(): Promise; -/** - * Returns the path to the user's desktop directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DESKTOP_DIR`. - * - **macOS:** Resolves to `$HOME/Desktop`. - * - **Windows:** Resolves to `{FOLDERID_Desktop}`. - * @example - * ```typescript - * import { desktopDir } from '@tauri-apps/api/path'; - * const desktopPath = await desktopDir(); - * ``` - * - * @since 1.0.0 - */ -declare function desktopDir(): Promise; -/** - * Returns the path to the user's document directory. - * @example - * ```typescript - * import { documentDir } from '@tauri-apps/api/path'; - * const documentDirPath = await documentDir(); - * ``` - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOCUMENTS_DIR`. - * - **macOS:** Resolves to `$HOME/Documents`. - * - **Windows:** Resolves to `{FOLDERID_Documents}`. - * - * @since 1.0.0 - */ -declare function documentDir(): Promise; -/** - * Returns the path to the user's download directory. - * - * #### Platform-specific - * - * - **Linux**: Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOWNLOAD_DIR`. - * - **macOS**: Resolves to `$HOME/Downloads`. - * - **Windows**: Resolves to `{FOLDERID_Downloads}`. - * @example - * ```typescript - * import { downloadDir } from '@tauri-apps/api/path'; - * const downloadDirPath = await downloadDir(); - * ``` - * - * @since 1.0.0 - */ -declare function downloadDir(): Promise; -/** - * Returns the path to the user's executable directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_BIN_HOME/../bin` or `$XDG_DATA_HOME/../bin` or `$HOME/.local/bin`. - * - **macOS:** Not supported. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { executableDir } from '@tauri-apps/api/path'; - * const executableDirPath = await executableDir(); - * ``` - * - * @since 1.0.0 - */ -declare function executableDir(): Promise; -/** - * Returns the path to the user's font directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME/fonts` or `$HOME/.local/share/fonts`. - * - **macOS:** Resolves to `$HOME/Library/Fonts`. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { fontDir } from '@tauri-apps/api/path'; - * const fontDirPath = await fontDir(); - * ``` - * - * @since 1.0.0 - */ -declare function fontDir(): Promise; -/** - * Returns the path to the user's home directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$HOME`. - * - **macOS:** Resolves to `$HOME`. - * - **Windows:** Resolves to `{FOLDERID_Profile}`. - * @example - * ```typescript - * import { homeDir } from '@tauri-apps/api/path'; - * const homeDirPath = await homeDir(); - * ``` - * - * @since 1.0.0 - */ -declare function homeDir(): Promise; -/** - * Returns the path to the user's local data directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_LocalAppData}`. - * @example - * ```typescript - * import { localDataDir } from '@tauri-apps/api/path'; - * const localDataDirPath = await localDataDir(); - * ``` - * - * @since 1.0.0 - */ -declare function localDataDir(): Promise; -/** - * Returns the path to the user's picture directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PICTURES_DIR`. - * - **macOS:** Resolves to `$HOME/Pictures`. - * - **Windows:** Resolves to `{FOLDERID_Pictures}`. - * @example - * ```typescript - * import { pictureDir } from '@tauri-apps/api/path'; - * const pictureDirPath = await pictureDir(); - * ``` - * - * @since 1.0.0 - */ -declare function pictureDir(): Promise; -/** - * Returns the path to the user's public directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PUBLICSHARE_DIR`. - * - **macOS:** Resolves to `$HOME/Public`. - * - **Windows:** Resolves to `{FOLDERID_Public}`. - * @example - * ```typescript - * import { publicDir } from '@tauri-apps/api/path'; - * const publicDirPath = await publicDir(); - * ``` - * - * @since 1.0.0 - */ -declare function publicDir(): Promise; -/** - * Returns the path to the application's resource directory. - * To resolve a resource path, see {@linkcode resolveResource}. - * - * ## Platform-specific - * - * Although we provide the exact path where this function resolves to, - * this is not a contract and things might change in the future - * - * - **Windows:** Resolves to the directory that contains the main executable. - * - **Linux:** When running in an AppImage, the `APPDIR` variable will be set to - * the mounted location of the app, and the resource dir will be `${APPDIR}/usr/lib/${exe_name}`. - * If not running in an AppImage, the path is `/usr/lib/${exe_name}`. - * When running the app from `src-tauri/target/(debug|release)/`, the path is `${exe_dir}/../lib/${exe_name}`. - * - **macOS:** Resolves to `${exe_dir}/../Resources` (inside .app). - * - **iOS:** Resolves to `${exe_dir}/assets`. - * - **Android:** Currently the resources are stored in the APK as assets so it's not a normal file system path, - * we return a special URI prefix `asset://localhost/` here that can be used with the [file system plugin](https://tauri.app/plugin/file-system/), - * - * @example - * ```typescript - * import { resourceDir } from '@tauri-apps/api/path'; - * const resourceDirPath = await resourceDir(); - * ``` - * - * @since 1.0.0 - */ -declare function resourceDir(): Promise; -/** - * Resolve the path to a resource file. - * @example - * ```typescript - * import { resolveResource } from '@tauri-apps/api/path'; - * const resourcePath = await resolveResource('script.sh'); - * ``` - * - * @param resourcePath The path to the resource. - * Must follow the same syntax as defined in `tauri.conf.json > bundle > resources`, i.e. keeping subfolders and parent dir components (`../`). - * @returns The full path to the resource. - * - * @since 1.0.0 - */ -declare function resolveResource(resourcePath: string): Promise; -/** - * Returns the path to the user's runtime directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_RUNTIME_DIR`. - * - **macOS:** Not supported. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { runtimeDir } from '@tauri-apps/api/path'; - * const runtimeDirPath = await runtimeDir(); - * ``` - * - * @since 1.0.0 - */ -declare function runtimeDir(): Promise; -/** - * Returns the path to the user's template directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_TEMPLATES_DIR`. - * - **macOS:** Not supported. - * - **Windows:** Resolves to `{FOLDERID_Templates}`. - * @example - * ```typescript - * import { templateDir } from '@tauri-apps/api/path'; - * const templateDirPath = await templateDir(); - * ``` - * - * @since 1.0.0 - */ -declare function templateDir(): Promise; -/** - * Returns the path to the user's video directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_VIDEOS_DIR`. - * - **macOS:** Resolves to `$HOME/Movies`. - * - **Windows:** Resolves to `{FOLDERID_Videos}`. - * @example - * ```typescript - * import { videoDir } from '@tauri-apps/api/path'; - * const videoDirPath = await videoDir(); - * ``` - * - * @since 1.0.0 - */ -declare function videoDir(): Promise; -/** - * Returns the path to the suggested directory for your app's log files. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `${configDir}/${bundleIdentifier}/logs`. - * - **macOS:** Resolves to `${homeDir}/Library/Logs/{bundleIdentifier}` - * - **Windows:** Resolves to `${configDir}/${bundleIdentifier}/logs`. - * @example - * ```typescript - * import { appLogDir } from '@tauri-apps/api/path'; - * const appLogDirPath = await appLogDir(); - * ``` - * - * @since 1.2.0 - */ -declare function appLogDir(): Promise; -/** - * Returns a temporary directory. - * @example - * ```typescript - * import { tempDir } from '@tauri-apps/api/path'; - * const temp = await tempDir(); - * ``` - * - * @since 2.0.0 - */ -declare function tempDir(): Promise; -/** - * Returns the platform-specific path segment separator: - * - `\` on Windows - * - `/` on POSIX - * - * @since 2.0.0 - */ -declare function sep(): string; -/** - * Returns the platform-specific path segment delimiter: - * - `;` on Windows - * - `:` on POSIX - * - * @since 2.0.0 - */ -declare function delimiter(): string; -/** - * Resolves a sequence of `paths` or `path` segments into an absolute path. - * @example - * ```typescript - * import { resolve, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png'); - * ``` - * - * @since 1.0.0 - */ -declare function resolve(...paths: string[]): Promise; -/** - * Normalizes the given `path`, resolving `'..'` and `'.'` segments and resolve symbolic links. - * @example - * ```typescript - * import { normalize, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await normalize(`${appDataDirPath}/../users/tauri/avatar.png`); - * ``` - * - * @since 1.0.0 - */ -declare function normalize(path: string): Promise; -/** - * Joins all given `path` segments together using the platform-specific separator as a delimiter, then normalizes the resulting path. - * @example - * ```typescript - * import { join, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png'); - * ``` - * - * @since 1.0.0 - */ -declare function join(...paths: string[]): Promise; -/** - * Returns the parent directory of a given `path`. Trailing directory separators are ignored. - * @example - * ```typescript - * import { dirname } from '@tauri-apps/api/path'; - * const dir = await dirname('/path/to/somedir/'); - * assert(dir === '/path/to'); - * ``` - * - * @since 1.0.0 - */ -declare function dirname(path: string): Promise; -/** - * Returns the extension of the `path`. - * @example - * ```typescript - * import { extname } from '@tauri-apps/api/path'; - * const ext = await extname('/path/to/file.html'); - * assert(ext === 'html'); - * ``` - * - * @since 1.0.0 - */ -declare function extname(path: string): Promise; -/** - * Returns the last portion of a `path`. Trailing directory separators are ignored. - * @example - * ```typescript - * import { basename } from '@tauri-apps/api/path'; - * const base = await basename('path/to/app.conf'); - * assert(base === 'app.conf'); - * ``` - * @param ext An optional file extension to be removed from the returned path. - * - * @since 1.0.0 - */ -declare function basename(path: string, ext?: string): Promise; -/** - * Returns whether the path is absolute or not. - * @example - * ```typescript - * import { isAbsolute } from '@tauri-apps/api/path'; - * assert(await isAbsolute('/home/tauri')); - * ``` - * - * @since 1.0.0 - */ -declare function isAbsolute(path: string): Promise; -export { BaseDirectory, appConfigDir, appDataDir, appLocalDataDir, appCacheDir, appLogDir, audioDir, cacheDir, configDir, dataDir, desktopDir, documentDir, downloadDir, executableDir, fontDir, homeDir, localDataDir, pictureDir, publicDir, resourceDir, resolveResource, runtimeDir, templateDir, videoDir, sep, delimiter, resolve, normalize, join, dirname, extname, basename, isAbsolute, tempDir }; diff --git a/node_modules/@tauri-apps/api/path.js b/node_modules/@tauri-apps/api/path.js deleted file mode 100644 index 76d0ae6..0000000 --- a/node_modules/@tauri-apps/api/path.js +++ /dev/null @@ -1,719 +0,0 @@ -import { invoke } from './core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * The path module provides utilities for working with file and directory paths. - * - * This package is also accessible with `window.__TAURI__.path` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * - * It is recommended to allowlist only the APIs you use for optimal bundle size and security. - * @module - */ -/** - * @since 2.0.0 - */ -var BaseDirectory; -(function (BaseDirectory) { - /** - * @see {@link audioDir} for more information. - */ - BaseDirectory[BaseDirectory["Audio"] = 1] = "Audio"; - /** - * @see {@link cacheDir} for more information. - */ - BaseDirectory[BaseDirectory["Cache"] = 2] = "Cache"; - /** - * @see {@link configDir} for more information. - */ - BaseDirectory[BaseDirectory["Config"] = 3] = "Config"; - /** - * @see {@link dataDir} for more information. - */ - BaseDirectory[BaseDirectory["Data"] = 4] = "Data"; - /** - * @see {@link localDataDir} for more information. - */ - BaseDirectory[BaseDirectory["LocalData"] = 5] = "LocalData"; - /** - * @see {@link documentDir} for more information. - */ - BaseDirectory[BaseDirectory["Document"] = 6] = "Document"; - /** - * @see {@link downloadDir} for more information. - */ - BaseDirectory[BaseDirectory["Download"] = 7] = "Download"; - /** - * @see {@link pictureDir} for more information. - */ - BaseDirectory[BaseDirectory["Picture"] = 8] = "Picture"; - /** - * @see {@link publicDir} for more information. - */ - BaseDirectory[BaseDirectory["Public"] = 9] = "Public"; - /** - * @see {@link videoDir} for more information. - */ - BaseDirectory[BaseDirectory["Video"] = 10] = "Video"; - /** - * @see {@link resourceDir} for more information. - */ - BaseDirectory[BaseDirectory["Resource"] = 11] = "Resource"; - /** - * @see {@link tempDir} for more information. - */ - BaseDirectory[BaseDirectory["Temp"] = 12] = "Temp"; - /** - * @see {@link appConfigDir} for more information. - */ - BaseDirectory[BaseDirectory["AppConfig"] = 13] = "AppConfig"; - /** - * @see {@link appDataDir} for more information. - */ - BaseDirectory[BaseDirectory["AppData"] = 14] = "AppData"; - /** - * @see {@link appLocalDataDir} for more information. - */ - BaseDirectory[BaseDirectory["AppLocalData"] = 15] = "AppLocalData"; - /** - * @see {@link appCacheDir} for more information. - */ - BaseDirectory[BaseDirectory["AppCache"] = 16] = "AppCache"; - /** - * @see {@link appLogDir} for more information. - */ - BaseDirectory[BaseDirectory["AppLog"] = 17] = "AppLog"; - /** - * @see {@link desktopDir} for more information. - */ - BaseDirectory[BaseDirectory["Desktop"] = 18] = "Desktop"; - /** - * @see {@link executableDir} for more information. - */ - BaseDirectory[BaseDirectory["Executable"] = 19] = "Executable"; - /** - * @see {@link fontDir} for more information. - */ - BaseDirectory[BaseDirectory["Font"] = 20] = "Font"; - /** - * @see {@link homeDir} for more information. - */ - BaseDirectory[BaseDirectory["Home"] = 21] = "Home"; - /** - * @see {@link runtimeDir} for more information. - */ - BaseDirectory[BaseDirectory["Runtime"] = 22] = "Runtime"; - /** - * @see {@link templateDir} for more information. - */ - BaseDirectory[BaseDirectory["Template"] = 23] = "Template"; -})(BaseDirectory || (BaseDirectory = {})); -/** - * Returns the path to the suggested directory for your app's config files. - * Resolves to `${configDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appConfigDir } from '@tauri-apps/api/path'; - * const appConfigDirPath = await appConfigDir(); - * ``` - * - * @since 1.2.0 - */ -async function appConfigDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.AppConfig - }); -} -/** - * Returns the path to the suggested directory for your app's data files. - * Resolves to `${dataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * ``` - * - * @since 1.2.0 - */ -async function appDataDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.AppData - }); -} -/** - * Returns the path to the suggested directory for your app's local data files. - * Resolves to `${localDataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appLocalDataDir } from '@tauri-apps/api/path'; - * const appLocalDataDirPath = await appLocalDataDir(); - * ``` - * - * @since 1.2.0 - */ -async function appLocalDataDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.AppLocalData - }); -} -/** - * Returns the path to the suggested directory for your app's cache files. - * Resolves to `${cacheDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`. - * @example - * ```typescript - * import { appCacheDir } from '@tauri-apps/api/path'; - * const appCacheDirPath = await appCacheDir(); - * ``` - * - * @since 1.2.0 - */ -async function appCacheDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.AppCache - }); -} -/** - * Returns the path to the user's audio directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_MUSIC_DIR`. - * - **macOS:** Resolves to `$HOME/Music`. - * - **Windows:** Resolves to `{FOLDERID_Music}`. - * @example - * ```typescript - * import { audioDir } from '@tauri-apps/api/path'; - * const audioDirPath = await audioDir(); - * ``` - * - * @since 1.0.0 - */ -async function audioDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Audio - }); -} -/** - * Returns the path to the user's cache directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_CACHE_HOME` or `$HOME/.cache`. - * - **macOS:** Resolves to `$HOME/Library/Caches`. - * - **Windows:** Resolves to `{FOLDERID_LocalAppData}`. - * @example - * ```typescript - * import { cacheDir } from '@tauri-apps/api/path'; - * const cacheDirPath = await cacheDir(); - * ``` - * - * @since 1.0.0 - */ -async function cacheDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Cache - }); -} -/** - * Returns the path to the user's config directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_CONFIG_HOME` or `$HOME/.config`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`. - * @example - * ```typescript - * import { configDir } from '@tauri-apps/api/path'; - * const configDirPath = await configDir(); - * ``` - * - * @since 1.0.0 - */ -async function configDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Config - }); -} -/** - * Returns the path to the user's data directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`. - * @example - * ```typescript - * import { dataDir } from '@tauri-apps/api/path'; - * const dataDirPath = await dataDir(); - * ``` - * - * @since 1.0.0 - */ -async function dataDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Data - }); -} -/** - * Returns the path to the user's desktop directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DESKTOP_DIR`. - * - **macOS:** Resolves to `$HOME/Desktop`. - * - **Windows:** Resolves to `{FOLDERID_Desktop}`. - * @example - * ```typescript - * import { desktopDir } from '@tauri-apps/api/path'; - * const desktopPath = await desktopDir(); - * ``` - * - * @since 1.0.0 - */ -async function desktopDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Desktop - }); -} -/** - * Returns the path to the user's document directory. - * @example - * ```typescript - * import { documentDir } from '@tauri-apps/api/path'; - * const documentDirPath = await documentDir(); - * ``` - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOCUMENTS_DIR`. - * - **macOS:** Resolves to `$HOME/Documents`. - * - **Windows:** Resolves to `{FOLDERID_Documents}`. - * - * @since 1.0.0 - */ -async function documentDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Document - }); -} -/** - * Returns the path to the user's download directory. - * - * #### Platform-specific - * - * - **Linux**: Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOWNLOAD_DIR`. - * - **macOS**: Resolves to `$HOME/Downloads`. - * - **Windows**: Resolves to `{FOLDERID_Downloads}`. - * @example - * ```typescript - * import { downloadDir } from '@tauri-apps/api/path'; - * const downloadDirPath = await downloadDir(); - * ``` - * - * @since 1.0.0 - */ -async function downloadDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Download - }); -} -/** - * Returns the path to the user's executable directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_BIN_HOME/../bin` or `$XDG_DATA_HOME/../bin` or `$HOME/.local/bin`. - * - **macOS:** Not supported. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { executableDir } from '@tauri-apps/api/path'; - * const executableDirPath = await executableDir(); - * ``` - * - * @since 1.0.0 - */ -async function executableDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Executable - }); -} -/** - * Returns the path to the user's font directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME/fonts` or `$HOME/.local/share/fonts`. - * - **macOS:** Resolves to `$HOME/Library/Fonts`. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { fontDir } from '@tauri-apps/api/path'; - * const fontDirPath = await fontDir(); - * ``` - * - * @since 1.0.0 - */ -async function fontDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Font - }); -} -/** - * Returns the path to the user's home directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$HOME`. - * - **macOS:** Resolves to `$HOME`. - * - **Windows:** Resolves to `{FOLDERID_Profile}`. - * @example - * ```typescript - * import { homeDir } from '@tauri-apps/api/path'; - * const homeDirPath = await homeDir(); - * ``` - * - * @since 1.0.0 - */ -async function homeDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Home - }); -} -/** - * Returns the path to the user's local data directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`. - * - **macOS:** Resolves to `$HOME/Library/Application Support`. - * - **Windows:** Resolves to `{FOLDERID_LocalAppData}`. - * @example - * ```typescript - * import { localDataDir } from '@tauri-apps/api/path'; - * const localDataDirPath = await localDataDir(); - * ``` - * - * @since 1.0.0 - */ -async function localDataDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.LocalData - }); -} -/** - * Returns the path to the user's picture directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PICTURES_DIR`. - * - **macOS:** Resolves to `$HOME/Pictures`. - * - **Windows:** Resolves to `{FOLDERID_Pictures}`. - * @example - * ```typescript - * import { pictureDir } from '@tauri-apps/api/path'; - * const pictureDirPath = await pictureDir(); - * ``` - * - * @since 1.0.0 - */ -async function pictureDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Picture - }); -} -/** - * Returns the path to the user's public directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PUBLICSHARE_DIR`. - * - **macOS:** Resolves to `$HOME/Public`. - * - **Windows:** Resolves to `{FOLDERID_Public}`. - * @example - * ```typescript - * import { publicDir } from '@tauri-apps/api/path'; - * const publicDirPath = await publicDir(); - * ``` - * - * @since 1.0.0 - */ -async function publicDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Public - }); -} -/** - * Returns the path to the application's resource directory. - * To resolve a resource path, see {@linkcode resolveResource}. - * - * ## Platform-specific - * - * Although we provide the exact path where this function resolves to, - * this is not a contract and things might change in the future - * - * - **Windows:** Resolves to the directory that contains the main executable. - * - **Linux:** When running in an AppImage, the `APPDIR` variable will be set to - * the mounted location of the app, and the resource dir will be `${APPDIR}/usr/lib/${exe_name}`. - * If not running in an AppImage, the path is `/usr/lib/${exe_name}`. - * When running the app from `src-tauri/target/(debug|release)/`, the path is `${exe_dir}/../lib/${exe_name}`. - * - **macOS:** Resolves to `${exe_dir}/../Resources` (inside .app). - * - **iOS:** Resolves to `${exe_dir}/assets`. - * - **Android:** Currently the resources are stored in the APK as assets so it's not a normal file system path, - * we return a special URI prefix `asset://localhost/` here that can be used with the [file system plugin](https://tauri.app/plugin/file-system/), - * - * @example - * ```typescript - * import { resourceDir } from '@tauri-apps/api/path'; - * const resourceDirPath = await resourceDir(); - * ``` - * - * @since 1.0.0 - */ -async function resourceDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Resource - }); -} -/** - * Resolve the path to a resource file. - * @example - * ```typescript - * import { resolveResource } from '@tauri-apps/api/path'; - * const resourcePath = await resolveResource('script.sh'); - * ``` - * - * @param resourcePath The path to the resource. - * Must follow the same syntax as defined in `tauri.conf.json > bundle > resources`, i.e. keeping subfolders and parent dir components (`../`). - * @returns The full path to the resource. - * - * @since 1.0.0 - */ -async function resolveResource(resourcePath) { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Resource, - path: resourcePath - }); -} -/** - * Returns the path to the user's runtime directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `$XDG_RUNTIME_DIR`. - * - **macOS:** Not supported. - * - **Windows:** Not supported. - * @example - * ```typescript - * import { runtimeDir } from '@tauri-apps/api/path'; - * const runtimeDirPath = await runtimeDir(); - * ``` - * - * @since 1.0.0 - */ -async function runtimeDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Runtime - }); -} -/** - * Returns the path to the user's template directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_TEMPLATES_DIR`. - * - **macOS:** Not supported. - * - **Windows:** Resolves to `{FOLDERID_Templates}`. - * @example - * ```typescript - * import { templateDir } from '@tauri-apps/api/path'; - * const templateDirPath = await templateDir(); - * ``` - * - * @since 1.0.0 - */ -async function templateDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Template - }); -} -/** - * Returns the path to the user's video directory. - * - * #### Platform-specific - * - * - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_VIDEOS_DIR`. - * - **macOS:** Resolves to `$HOME/Movies`. - * - **Windows:** Resolves to `{FOLDERID_Videos}`. - * @example - * ```typescript - * import { videoDir } from '@tauri-apps/api/path'; - * const videoDirPath = await videoDir(); - * ``` - * - * @since 1.0.0 - */ -async function videoDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Video - }); -} -/** - * Returns the path to the suggested directory for your app's log files. - * - * #### Platform-specific - * - * - **Linux:** Resolves to `${configDir}/${bundleIdentifier}/logs`. - * - **macOS:** Resolves to `${homeDir}/Library/Logs/{bundleIdentifier}` - * - **Windows:** Resolves to `${configDir}/${bundleIdentifier}/logs`. - * @example - * ```typescript - * import { appLogDir } from '@tauri-apps/api/path'; - * const appLogDirPath = await appLogDir(); - * ``` - * - * @since 1.2.0 - */ -async function appLogDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.AppLog - }); -} -/** - * Returns a temporary directory. - * @example - * ```typescript - * import { tempDir } from '@tauri-apps/api/path'; - * const temp = await tempDir(); - * ``` - * - * @since 2.0.0 - */ -async function tempDir() { - return invoke('plugin:path|resolve_directory', { - directory: BaseDirectory.Temp - }); -} -/** - * Returns the platform-specific path segment separator: - * - `\` on Windows - * - `/` on POSIX - * - * @since 2.0.0 - */ -function sep() { - return window.__TAURI_INTERNALS__.plugins.path.sep; -} -/** - * Returns the platform-specific path segment delimiter: - * - `;` on Windows - * - `:` on POSIX - * - * @since 2.0.0 - */ -function delimiter() { - return window.__TAURI_INTERNALS__.plugins.path.delimiter; -} -/** - * Resolves a sequence of `paths` or `path` segments into an absolute path. - * @example - * ```typescript - * import { resolve, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png'); - * ``` - * - * @since 1.0.0 - */ -async function resolve(...paths) { - return invoke('plugin:path|resolve', { paths }); -} -/** - * Normalizes the given `path`, resolving `'..'` and `'.'` segments and resolve symbolic links. - * @example - * ```typescript - * import { normalize, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await normalize(`${appDataDirPath}/../users/tauri/avatar.png`); - * ``` - * - * @since 1.0.0 - */ -async function normalize(path) { - return invoke('plugin:path|normalize', { path }); -} -/** - * Joins all given `path` segments together using the platform-specific separator as a delimiter, then normalizes the resulting path. - * @example - * ```typescript - * import { join, appDataDir } from '@tauri-apps/api/path'; - * const appDataDirPath = await appDataDir(); - * const path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png'); - * ``` - * - * @since 1.0.0 - */ -async function join(...paths) { - return invoke('plugin:path|join', { paths }); -} -/** - * Returns the parent directory of a given `path`. Trailing directory separators are ignored. - * @example - * ```typescript - * import { dirname } from '@tauri-apps/api/path'; - * const dir = await dirname('/path/to/somedir/'); - * assert(dir === '/path/to'); - * ``` - * - * @since 1.0.0 - */ -async function dirname(path) { - return invoke('plugin:path|dirname', { path }); -} -/** - * Returns the extension of the `path`. - * @example - * ```typescript - * import { extname } from '@tauri-apps/api/path'; - * const ext = await extname('/path/to/file.html'); - * assert(ext === 'html'); - * ``` - * - * @since 1.0.0 - */ -async function extname(path) { - return invoke('plugin:path|extname', { path }); -} -/** - * Returns the last portion of a `path`. Trailing directory separators are ignored. - * @example - * ```typescript - * import { basename } from '@tauri-apps/api/path'; - * const base = await basename('path/to/app.conf'); - * assert(base === 'app.conf'); - * ``` - * @param ext An optional file extension to be removed from the returned path. - * - * @since 1.0.0 - */ -async function basename(path, ext) { - return invoke('plugin:path|basename', { path, ext }); -} -/** - * Returns whether the path is absolute or not. - * @example - * ```typescript - * import { isAbsolute } from '@tauri-apps/api/path'; - * assert(await isAbsolute('/home/tauri')); - * ``` - * - * @since 1.0.0 - */ -async function isAbsolute(path) { - return invoke('plugin:path|is_absolute', { path }); -} - -export { BaseDirectory, appCacheDir, appConfigDir, appDataDir, appLocalDataDir, appLogDir, audioDir, basename, cacheDir, configDir, dataDir, delimiter, desktopDir, dirname, documentDir, downloadDir, executableDir, extname, fontDir, homeDir, isAbsolute, join, localDataDir, normalize, pictureDir, publicDir, resolve, resolveResource, resourceDir, runtimeDir, sep, tempDir, templateDir, videoDir }; diff --git a/node_modules/@tauri-apps/api/tray.cjs b/node_modules/@tauri-apps/api/tray.cjs deleted file mode 100644 index e6d8817..0000000 --- a/node_modules/@tauri-apps/api/tray.cjs +++ /dev/null @@ -1,188 +0,0 @@ -'use strict'; - -var core = require('./core.cjs'); -var image = require('./image.cjs'); -var dpi = require('./dpi.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Tray icon class and associated methods. This type constructor is private, - * instead, you should use the static method {@linkcode TrayIcon.new}. - * - * #### Warning - * - * Unlike Rust, javascript does not have any way to run cleanup code - * when an object is being removed by garbage collection, but this tray icon - * will be cleaned up when the tauri app exists, however if you want to cleanup - * this object early, you need to call {@linkcode TrayIcon.close}. - * - * @example - * ```ts - * import { TrayIcon } from '@tauri-apps/api/tray'; - * const tray = await TrayIcon.new({ tooltip: 'awesome tray tooltip' }); - * tray.set_tooltip('new tooltip'); - * ``` - */ -class TrayIcon extends core.Resource { - constructor(rid, id) { - super(rid); - this.id = id; - } - /** Gets a tray icon using the provided id. */ - static async getById(id) { - return core.invoke('plugin:tray|get_by_id', { id }).then((rid) => rid ? new TrayIcon(rid, id) : null); - } - /** - * Removes a tray icon using the provided id from tauri's internal state. - * - * Note that this may cause the tray icon to disappear - * if it wasn't cloned somewhere else or referenced by JS. - */ - static async removeById(id) { - return core.invoke('plugin:tray|remove_by_id', { id }); - } - /** - * Creates a new {@linkcode TrayIcon} - * - * #### Platform-specific: - * - * - **Linux:** Sometimes the icon won't be visible unless a menu is set. - * Setting an empty {@linkcode Menu} is enough. - */ - static async new(options) { - if (options === null || options === void 0 ? void 0 : options.menu) { - // @ts-expect-error we only need the rid and kind - options.menu = [options.menu.rid, options.menu.kind]; - } - if (options === null || options === void 0 ? void 0 : options.icon) { - options.icon = image.transformImage(options.icon); - } - const handler = new core.Channel(); - if (options === null || options === void 0 ? void 0 : options.action) { - const action = options.action; - handler.onmessage = (e) => action(mapEvent(e)); - delete options.action; - } - return core.invoke('plugin:tray|new', { - options: options !== null && options !== void 0 ? options : {}, - handler - }).then(([rid, id]) => new TrayIcon(rid, id)); - } - /** - * Sets a new tray icon. If `null` is provided, it will remove the icon. - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - async setIcon(icon) { - let trayIcon = null; - if (icon) { - trayIcon = image.transformImage(icon); - } - return core.invoke('plugin:tray|set_icon', { rid: this.rid, icon: trayIcon }); - } - /** - * Sets a new tray menu. - * - * #### Platform-specific: - * - * - **Linux**: once a menu is set it cannot be removed so `null` has no effect - */ - async setMenu(menu) { - if (menu) { - // @ts-expect-error we only need the rid and kind - menu = [menu.rid, menu.kind]; - } - return core.invoke('plugin:tray|set_menu', { rid: this.rid, menu }); - } - /** - * Sets the tooltip for this tray icon. - * - * #### Platform-specific: - * - * - **Linux:** Unsupported - */ - async setTooltip(tooltip) { - return core.invoke('plugin:tray|set_tooltip', { rid: this.rid, tooltip }); - } - /** - * Sets the tooltip for this tray icon. - * - * #### Platform-specific: - * - * - **Linux:** The title will not be shown unless there is an icon - * as well. The title is useful for numerical and other frequently - * updated information. In general, it shouldn't be shown unless a - * user requests it as it can take up a significant amount of space - * on the user's panel. This may not be shown in all visualizations. - * - **Windows:** Unsupported - */ - async setTitle(title) { - return core.invoke('plugin:tray|set_title', { rid: this.rid, title }); - } - /** Show or hide this tray icon. */ - async setVisible(visible) { - return core.invoke('plugin:tray|set_visible', { rid: this.rid, visible }); - } - /** - * Sets the tray icon temp dir path. **Linux only**. - * - * On Linux, we need to write the icon to the disk and usually it will - * be `$XDG_RUNTIME_DIR/tray-icon` or `$TEMP/tray-icon`. - */ - async setTempDirPath(path) { - return core.invoke('plugin:tray|set_temp_dir_path', { rid: this.rid, path }); - } - /** Sets the current icon as a [template](https://developer.apple.com/documentation/appkit/nsimage/1520017-template?language=objc). **macOS only** */ - async setIconAsTemplate(asTemplate) { - return core.invoke('plugin:tray|set_icon_as_template', { - rid: this.rid, - asTemplate - }); - } - /** - * Disable or enable showing the tray menu on left click. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @deprecated use {@linkcode TrayIcon.setShowMenuOnLeftClick} instead. - */ - async setMenuOnLeftClick(onLeft) { - return core.invoke('plugin:tray|set_show_menu_on_left_click', { - rid: this.rid, - onLeft - }); - } - /** - * Disable or enable showing the tray menu on left click. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @since 2.2.0 - */ - async setShowMenuOnLeftClick(onLeft) { - return core.invoke('plugin:tray|set_show_menu_on_left_click', { - rid: this.rid, - onLeft - }); - } -} -function mapEvent(e) { - const out = e; - out.position = new dpi.PhysicalPosition(e.position); - out.rect.position = new dpi.PhysicalPosition(e.rect.position); - out.rect.size = new dpi.PhysicalSize(e.rect.size); - return out; -} - -exports.TrayIcon = TrayIcon; diff --git a/node_modules/@tauri-apps/api/tray.d.ts b/node_modules/@tauri-apps/api/tray.d.ts deleted file mode 100644 index d3ee8ed..0000000 --- a/node_modules/@tauri-apps/api/tray.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -import type { Menu, Submenu } from './menu'; -import { Resource } from './core'; -import { Image } from './image'; -import { PhysicalPosition, PhysicalSize } from './dpi'; -export type MouseButtonState = 'Up' | 'Down'; -export type MouseButton = 'Left' | 'Right' | 'Middle'; -export type TrayIconEventType = 'Click' | 'DoubleClick' | 'Enter' | 'Move' | 'Leave'; -export type TrayIconEventBase = { - /** The tray icon event type */ - type: T; - /** Id of the tray icon which triggered this event. */ - id: string; - /** Physical position of the click the triggered this event. */ - position: PhysicalPosition; - /** Position and size of the tray icon. */ - rect: { - position: PhysicalPosition; - size: PhysicalSize; - }; -}; -export type TrayIconClickEvent = { - /** Mouse button that triggered this event. */ - button: MouseButton; - /** Mouse button state when this event was triggered. */ - buttonState: MouseButtonState; -}; -/** - * Describes a tray icon event. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. The event is not emitted even though the icon is shown, - * the icon will still show a context menu on right click. - */ -export type TrayIconEvent = (TrayIconEventBase<'Click'> & TrayIconClickEvent) | (TrayIconEventBase<'DoubleClick'> & Omit) | TrayIconEventBase<'Enter'> | TrayIconEventBase<'Move'> | TrayIconEventBase<'Leave'>; -/** - * Tray icon types and utilities. - * - * This package is also accessible with `window.__TAURI__.tray` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ -/** {@link TrayIcon.new|`TrayIcon`} creation options */ -export interface TrayIconOptions { - /** The tray icon id. If undefined, a random one will be assigned */ - id?: string; - /** The tray icon menu */ - menu?: Menu | Submenu; - /** - * The tray icon which could be icon bytes or path to the icon file. - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - icon?: string | Uint8Array | ArrayBuffer | number[] | Image; - /** The tray icon tooltip */ - tooltip?: string; - /** - * The tray title - * - * #### Platform-specific - * - * - **Linux:** The title will not be shown unless there is an icon - * as well. The title is useful for numerical and other frequently - * updated information. In general, it shouldn't be shown unless a - * user requests it as it can take up a significant amount of space - * on the user's panel. This may not be shown in all visualizations. - * - **Windows:** Unsupported. - */ - title?: string; - /** - * The tray icon temp dir path. **Linux only**. - * - * On Linux, we need to write the icon to the disk and usually it will - * be `$XDG_RUNTIME_DIR/tray-icon` or `$TEMP/tray-icon`. - */ - tempDirPath?: string; - /** - * Use the icon as a [template](https://developer.apple.com/documentation/appkit/nsimage/1520017-template?language=objc). **macOS only**. - */ - iconAsTemplate?: boolean; - /** - * Whether to show the tray menu on left click or not, default is `true`. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @deprecated use {@linkcode TrayIconOptions.showMenuOnLeftClick} instead. - */ - menuOnLeftClick?: boolean; - /** - * Whether to show the tray menu on left click or not, default is `true`. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @since 2.2.0 - */ - showMenuOnLeftClick?: boolean; - /** A handler for an event on the tray icon. */ - action?: (event: TrayIconEvent) => void; -} -/** - * Tray icon class and associated methods. This type constructor is private, - * instead, you should use the static method {@linkcode TrayIcon.new}. - * - * #### Warning - * - * Unlike Rust, javascript does not have any way to run cleanup code - * when an object is being removed by garbage collection, but this tray icon - * will be cleaned up when the tauri app exists, however if you want to cleanup - * this object early, you need to call {@linkcode TrayIcon.close}. - * - * @example - * ```ts - * import { TrayIcon } from '@tauri-apps/api/tray'; - * const tray = await TrayIcon.new({ tooltip: 'awesome tray tooltip' }); - * tray.set_tooltip('new tooltip'); - * ``` - */ -export declare class TrayIcon extends Resource { - /** The id associated with this tray icon. */ - id: string; - private constructor(); - /** Gets a tray icon using the provided id. */ - static getById(id: string): Promise; - /** - * Removes a tray icon using the provided id from tauri's internal state. - * - * Note that this may cause the tray icon to disappear - * if it wasn't cloned somewhere else or referenced by JS. - */ - static removeById(id: string): Promise; - /** - * Creates a new {@linkcode TrayIcon} - * - * #### Platform-specific: - * - * - **Linux:** Sometimes the icon won't be visible unless a menu is set. - * Setting an empty {@linkcode Menu} is enough. - */ - static new(options?: TrayIconOptions): Promise; - /** - * Sets a new tray icon. If `null` is provided, it will remove the icon. - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - setIcon(icon: string | Image | Uint8Array | ArrayBuffer | number[] | null): Promise; - /** - * Sets a new tray menu. - * - * #### Platform-specific: - * - * - **Linux**: once a menu is set it cannot be removed so `null` has no effect - */ - setMenu(menu: Menu | Submenu | null): Promise; - /** - * Sets the tooltip for this tray icon. - * - * #### Platform-specific: - * - * - **Linux:** Unsupported - */ - setTooltip(tooltip: string | null): Promise; - /** - * Sets the tooltip for this tray icon. - * - * #### Platform-specific: - * - * - **Linux:** The title will not be shown unless there is an icon - * as well. The title is useful for numerical and other frequently - * updated information. In general, it shouldn't be shown unless a - * user requests it as it can take up a significant amount of space - * on the user's panel. This may not be shown in all visualizations. - * - **Windows:** Unsupported - */ - setTitle(title: string | null): Promise; - /** Show or hide this tray icon. */ - setVisible(visible: boolean): Promise; - /** - * Sets the tray icon temp dir path. **Linux only**. - * - * On Linux, we need to write the icon to the disk and usually it will - * be `$XDG_RUNTIME_DIR/tray-icon` or `$TEMP/tray-icon`. - */ - setTempDirPath(path: string | null): Promise; - /** Sets the current icon as a [template](https://developer.apple.com/documentation/appkit/nsimage/1520017-template?language=objc). **macOS only** */ - setIconAsTemplate(asTemplate: boolean): Promise; - /** - * Disable or enable showing the tray menu on left click. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @deprecated use {@linkcode TrayIcon.setShowMenuOnLeftClick} instead. - */ - setMenuOnLeftClick(onLeft: boolean): Promise; - /** - * Disable or enable showing the tray menu on left click. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @since 2.2.0 - */ - setShowMenuOnLeftClick(onLeft: boolean): Promise; -} diff --git a/node_modules/@tauri-apps/api/tray.js b/node_modules/@tauri-apps/api/tray.js deleted file mode 100644 index dceda43..0000000 --- a/node_modules/@tauri-apps/api/tray.js +++ /dev/null @@ -1,186 +0,0 @@ -import { Resource, invoke, Channel } from './core.js'; -import { transformImage } from './image.js'; -import { PhysicalPosition, PhysicalSize } from './dpi.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Tray icon class and associated methods. This type constructor is private, - * instead, you should use the static method {@linkcode TrayIcon.new}. - * - * #### Warning - * - * Unlike Rust, javascript does not have any way to run cleanup code - * when an object is being removed by garbage collection, but this tray icon - * will be cleaned up when the tauri app exists, however if you want to cleanup - * this object early, you need to call {@linkcode TrayIcon.close}. - * - * @example - * ```ts - * import { TrayIcon } from '@tauri-apps/api/tray'; - * const tray = await TrayIcon.new({ tooltip: 'awesome tray tooltip' }); - * tray.set_tooltip('new tooltip'); - * ``` - */ -class TrayIcon extends Resource { - constructor(rid, id) { - super(rid); - this.id = id; - } - /** Gets a tray icon using the provided id. */ - static async getById(id) { - return invoke('plugin:tray|get_by_id', { id }).then((rid) => rid ? new TrayIcon(rid, id) : null); - } - /** - * Removes a tray icon using the provided id from tauri's internal state. - * - * Note that this may cause the tray icon to disappear - * if it wasn't cloned somewhere else or referenced by JS. - */ - static async removeById(id) { - return invoke('plugin:tray|remove_by_id', { id }); - } - /** - * Creates a new {@linkcode TrayIcon} - * - * #### Platform-specific: - * - * - **Linux:** Sometimes the icon won't be visible unless a menu is set. - * Setting an empty {@linkcode Menu} is enough. - */ - static async new(options) { - if (options === null || options === void 0 ? void 0 : options.menu) { - // @ts-expect-error we only need the rid and kind - options.menu = [options.menu.rid, options.menu.kind]; - } - if (options === null || options === void 0 ? void 0 : options.icon) { - options.icon = transformImage(options.icon); - } - const handler = new Channel(); - if (options === null || options === void 0 ? void 0 : options.action) { - const action = options.action; - handler.onmessage = (e) => action(mapEvent(e)); - delete options.action; - } - return invoke('plugin:tray|new', { - options: options !== null && options !== void 0 ? options : {}, - handler - }).then(([rid, id]) => new TrayIcon(rid, id)); - } - /** - * Sets a new tray icon. If `null` is provided, it will remove the icon. - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - */ - async setIcon(icon) { - let trayIcon = null; - if (icon) { - trayIcon = transformImage(icon); - } - return invoke('plugin:tray|set_icon', { rid: this.rid, icon: trayIcon }); - } - /** - * Sets a new tray menu. - * - * #### Platform-specific: - * - * - **Linux**: once a menu is set it cannot be removed so `null` has no effect - */ - async setMenu(menu) { - if (menu) { - // @ts-expect-error we only need the rid and kind - menu = [menu.rid, menu.kind]; - } - return invoke('plugin:tray|set_menu', { rid: this.rid, menu }); - } - /** - * Sets the tooltip for this tray icon. - * - * #### Platform-specific: - * - * - **Linux:** Unsupported - */ - async setTooltip(tooltip) { - return invoke('plugin:tray|set_tooltip', { rid: this.rid, tooltip }); - } - /** - * Sets the tooltip for this tray icon. - * - * #### Platform-specific: - * - * - **Linux:** The title will not be shown unless there is an icon - * as well. The title is useful for numerical and other frequently - * updated information. In general, it shouldn't be shown unless a - * user requests it as it can take up a significant amount of space - * on the user's panel. This may not be shown in all visualizations. - * - **Windows:** Unsupported - */ - async setTitle(title) { - return invoke('plugin:tray|set_title', { rid: this.rid, title }); - } - /** Show or hide this tray icon. */ - async setVisible(visible) { - return invoke('plugin:tray|set_visible', { rid: this.rid, visible }); - } - /** - * Sets the tray icon temp dir path. **Linux only**. - * - * On Linux, we need to write the icon to the disk and usually it will - * be `$XDG_RUNTIME_DIR/tray-icon` or `$TEMP/tray-icon`. - */ - async setTempDirPath(path) { - return invoke('plugin:tray|set_temp_dir_path', { rid: this.rid, path }); - } - /** Sets the current icon as a [template](https://developer.apple.com/documentation/appkit/nsimage/1520017-template?language=objc). **macOS only** */ - async setIconAsTemplate(asTemplate) { - return invoke('plugin:tray|set_icon_as_template', { - rid: this.rid, - asTemplate - }); - } - /** - * Disable or enable showing the tray menu on left click. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @deprecated use {@linkcode TrayIcon.setShowMenuOnLeftClick} instead. - */ - async setMenuOnLeftClick(onLeft) { - return invoke('plugin:tray|set_show_menu_on_left_click', { - rid: this.rid, - onLeft - }); - } - /** - * Disable or enable showing the tray menu on left click. - * - * #### Platform-specific: - * - * - **Linux**: Unsupported. - * - * @since 2.2.0 - */ - async setShowMenuOnLeftClick(onLeft) { - return invoke('plugin:tray|set_show_menu_on_left_click', { - rid: this.rid, - onLeft - }); - } -} -function mapEvent(e) { - const out = e; - out.position = new PhysicalPosition(e.position); - out.rect.position = new PhysicalPosition(e.rect.position); - out.rect.size = new PhysicalSize(e.rect.size); - return out; -} - -export { TrayIcon }; diff --git a/node_modules/@tauri-apps/api/webview.cjs b/node_modules/@tauri-apps/api/webview.cjs deleted file mode 100644 index 6feee33..0000000 --- a/node_modules/@tauri-apps/api/webview.cjs +++ /dev/null @@ -1,594 +0,0 @@ -'use strict'; - -var dpi = require('./dpi.cjs'); -var event = require('./event.cjs'); -var core = require('./core.cjs'); -var window$1 = require('./window.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Provides APIs to create webviews, communicate with other webviews and manipulate the current webview. - * - * #### Webview events - * - * Events can be listened to using {@link Webview.listen}: - * ```typescript - * import { getCurrentWebview } from "@tauri-apps/api/webview"; - * getCurrentWebview().listen("my-webview-event", ({ event, payload }) => { }); - * ``` - * - * @module - */ -/** - * Get an instance of `Webview` for the current webview. - * - * @since 2.0.0 - */ -function getCurrentWebview() { - return new Webview(window$1.getCurrentWindow(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }); -} -/** - * Gets a list of instances of `Webview` for all available webviews. - * - * @since 2.0.0 - */ -async function getAllWebviews() { - return core.invoke('plugin:webview|get_all_webviews').then((webviews) => webviews.map((w) => new Webview(new window$1.Window(w.windowLabel, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }), w.label, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }))); -} -/** @ignore */ -// events that are emitted right here instead of by the created webview -const localTauriEvents = ['tauri://created', 'tauri://error']; -/** - * Create new webview or get a handle to an existing one. - * - * Webviews are identified by a *label* a unique identifier that can be used to reference it later. - * It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`. - * - * @example - * ```typescript - * import { Window } from "@tauri-apps/api/window" - * import { Webview } from "@tauri-apps/api/webview" - * - * const appWindow = new Window('uniqueLabel'); - * - * appWindow.once('tauri://created', async function () { - * // `new Webview` Should be called after the window is successfully created, - * // or webview may not be attached to the window since window is not created yet. - * - * // loading embedded asset: - * const webview = new Webview(appWindow, 'theUniqueLabel', { - * url: 'path/to/page.html', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * // alternatively, load a remote URL: - * const webview = new Webview(appWindow, 'theUniqueLabel', { - * url: 'https://github.com/tauri-apps/tauri', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * - * - * // emit an event to the backend - * await webview.emit("some-event", "data"); - * // listen to an event from the backend - * const unlisten = await webview.listen("event-name", e => { }); - * unlisten(); - * }); - * ``` - * - * @since 2.0.0 - */ -class Webview { - /** - * Creates a new Webview. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window' - * import { Webview } from '@tauri-apps/api/webview' - * const appWindow = new Window('my-label') - * - * appWindow.once('tauri://created', async function() { - * const webview = new Webview(appWindow, 'my-label', { - * url: 'https://github.com/tauri-apps/tauri', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * }); - * ``` - * - * @param window the window to add this webview to. - * @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link Webview} instance to communicate with the webview. - */ - constructor(window, label, options) { - this.window = window; - this.label = label; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - this.listeners = Object.create(null); - // @ts-expect-error `skip` is not a public API so it is not defined in WebviewOptions - if (!(options === null || options === void 0 ? void 0 : options.skip)) { - core.invoke('plugin:webview|create_webview', { - windowLabel: window.label, - options: { - ...options, - label - } - }) - .then(async () => this.emit('tauri://created')) - .catch(async (e) => this.emit('tauri://error', e)); - } - } - /** - * Gets the Webview for the webview associated with the given label. - * @example - * ```typescript - * import { Webview } from '@tauri-apps/api/webview'; - * const mainWebview = Webview.getByLabel('main'); - * ``` - * - * @param label The webview label. - * @returns The Webview instance to communicate with the webview or null if the webview doesn't exist. - */ - static async getByLabel(label) { - var _a; - return (_a = (await getAllWebviews()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null; - } - /** - * Get an instance of `Webview` for the current webview. - */ - static getCurrent() { - return getCurrentWebview(); - } - /** - * Gets a list of instances of `Webview` for all available webviews. - */ - static async getAll() { - return getAllWebviews(); - } - /** - * Listen to an emitted event on this webview. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const unlisten = await getCurrentWebview().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async listen(event$1, handler) { - if (this._handleTauriEvent(event$1, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event$1]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return event.listen(event$1, handler, { - target: { kind: 'Webview', label: this.label } - }); - } - /** - * Listen to an emitted event on this webview only once. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const unlisten = await getCurrent().once('initialized', (event) => { - * console.log(`Webview initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async once(event$1, handler) { - if (this._handleTauriEvent(event$1, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event$1]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return event.once(event$1, handler, { - target: { kind: 'Webview', label: this.label } - }); - } - /** - * Emits an event to all {@link EventTarget|targets}. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().emit('webview-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emit(event$1, payload) { - if (localTauriEvents.includes(event$1)) { - // eslint-disable-next-line - for (const handler of this.listeners[event$1] || []) { - handler({ - event: event$1, - id: -1, - payload - }); - } - return; - } - return event.emit(event$1, payload); - } - /** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emitTo(target, event$1, payload) { - if (localTauriEvents.includes(event$1)) { - // eslint-disable-next-line - for (const handler of this.listeners[event$1] || []) { - handler({ - event: event$1, - id: -1, - payload - }); - } - return; - } - return event.emitTo(target, event$1, payload); - } - /** @ignore */ - _handleTauriEvent(event, handler) { - if (localTauriEvents.includes(event)) { - if (!(event in this.listeners)) { - // eslint-disable-next-line security/detect-object-injection - this.listeners[event] = [handler]; - } - else { - // eslint-disable-next-line security/detect-object-injection - this.listeners[event].push(handler); - } - return true; - } - return false; - } - // Getters - /** - * The position of the top-left hand corner of the webview's client area relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const position = await getCurrentWebview().position(); - * ``` - * - * @returns The webview's position. - */ - async position() { - return core.invoke('plugin:webview|webview_position', { - label: this.label - }).then((p) => new dpi.PhysicalPosition(p)); - } - /** - * The physical size of the webview's client area. - * The client area is the content of the webview, excluding the title bar and borders. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const size = await getCurrentWebview().size(); - * ``` - * - * @returns The webview's size. - */ - async size() { - return core.invoke('plugin:webview|webview_size', { - label: this.label - }).then((s) => new dpi.PhysicalSize(s)); - } - // Setters - /** - * Closes the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().close(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async close() { - return core.invoke('plugin:webview|webview_close', { - label: this.label - }); - } - /** - * Resizes the webview. - * @example - * ```typescript - * import { getCurrent, LogicalSize } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical size. - * @returns A promise indicating the success or failure of the operation. - */ - async setSize(size) { - return core.invoke('plugin:webview|set_webview_size', { - label: this.label, - value: size instanceof dpi.Size ? size : new dpi.Size(size) - }); - } - /** - * Sets the webview position. - * @example - * ```typescript - * import { getCurrent, LogicalPosition } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setPosition(new LogicalPosition(600, 500)); - * ``` - * - * @param position The new position, in logical or physical pixels. - * @returns A promise indicating the success or failure of the operation. - */ - async setPosition(position) { - return core.invoke('plugin:webview|set_webview_position', { - label: this.label, - value: position instanceof dpi.Position ? position : new dpi.Position(position) - }); - } - /** - * Bring the webview to front and focus. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setFocus(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setFocus() { - return core.invoke('plugin:webview|set_webview_focus', { - label: this.label - }); - } - /** - * Sets whether the webview should automatically grow and shrink its size and position when the parent window resizes. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setAutoResize(true); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setAutoResize(autoResize) { - return core.invoke('plugin:webview|set_webview_auto_resize', { - label: this.label, - value: autoResize - }); - } - /** - * Hide the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().hide(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async hide() { - return core.invoke('plugin:webview|webview_hide', { - label: this.label - }); - } - /** - * Show the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().show(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async show() { - return core.invoke('plugin:webview|webview_show', { - label: this.label - }); - } - /** - * Set webview zoom level. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setZoom(1.5); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setZoom(scaleFactor) { - return core.invoke('plugin:webview|set_webview_zoom', { - label: this.label, - value: scaleFactor - }); - } - /** - * Moves this webview to the given label. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().reparent('other-window'); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async reparent(window) { - return core.invoke('plugin:webview|reparent', { - label: this.label, - window: typeof window === 'string' ? window : window.label - }); - } - /** - * Clears all browsing data for this webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().clearAllBrowsingData(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async clearAllBrowsingData() { - return core.invoke('plugin:webview|clear_all_browsing_data'); - } - /** - * Specify the webview background color. - * - * #### Platfrom-specific: - * - * - **macOS / iOS**: Not implemented. - * - **Windows**: - * - On Windows 7, transparency is not supported and the alpha value will be ignored. - * - On Windows higher than 7: translucent colors are not supported so any alpha value other than `0` will be replaced by `255` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - async setBackgroundColor(color) { - return core.invoke('plugin:webview|set_webview_background_color', { color }); - } - // Listeners - /** - * Listen to a file drop event. - * The listener is triggered when the user hovers the selected files on the webview, - * drops the files or cancels the operation. - * - * @example - * ```typescript - * import { getCurrentWebview } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrentWebview().onDragDropEvent((event) => { - * if (event.payload.type === 'over') { - * console.log('User hovering', event.payload.position); - * } else if (event.payload.type === 'drop') { - * console.log('User dropped', event.payload.paths); - * } else { - * console.log('File drop cancelled'); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * When the debugger panel is open, the drop position of this event may be inaccurate due to a known limitation. - * To retrieve the correct drop position, please detach the debugger. - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onDragDropEvent(handler) { - const unlistenDragEnter = await this.listen(event.TauriEvent.DRAG_ENTER, (event) => { - handler({ - ...event, - payload: { - type: 'enter', - paths: event.payload.paths, - position: new dpi.PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragOver = await this.listen(event.TauriEvent.DRAG_OVER, (event) => { - handler({ - ...event, - payload: { - type: 'over', - position: new dpi.PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragDrop = await this.listen(event.TauriEvent.DRAG_DROP, (event) => { - handler({ - ...event, - payload: { - type: 'drop', - paths: event.payload.paths, - position: new dpi.PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragLeave = await this.listen(event.TauriEvent.DRAG_LEAVE, (event) => { - handler({ ...event, payload: { type: 'leave' } }); - }); - return () => { - unlistenDragEnter(); - unlistenDragDrop(); - unlistenDragOver(); - unlistenDragLeave(); - }; - } -} - -exports.Webview = Webview; -exports.getAllWebviews = getAllWebviews; -exports.getCurrentWebview = getCurrentWebview; diff --git a/node_modules/@tauri-apps/api/webview.d.ts b/node_modules/@tauri-apps/api/webview.d.ts deleted file mode 100644 index c3048c1..0000000 --- a/node_modules/@tauri-apps/api/webview.d.ts +++ /dev/null @@ -1,612 +0,0 @@ -/** - * Provides APIs to create webviews, communicate with other webviews and manipulate the current webview. - * - * #### Webview events - * - * Events can be listened to using {@link Webview.listen}: - * ```typescript - * import { getCurrentWebview } from "@tauri-apps/api/webview"; - * getCurrentWebview().listen("my-webview-event", ({ event, payload }) => { }); - * ``` - * - * @module - */ -import { PhysicalPosition, PhysicalSize } from './dpi'; -import type { LogicalPosition, LogicalSize } from './dpi'; -import { Position, Size } from './dpi'; -import type { EventName, EventCallback, UnlistenFn } from './event'; -import { type EventTarget } from './event'; -import { BackgroundThrottlingPolicy, ScrollBarStyle, Color, Window } from './window'; -import { WebviewWindow } from './webviewWindow'; -/** The drag and drop event types. */ -type DragDropEvent = { - type: 'enter'; - paths: string[]; - position: PhysicalPosition; -} | { - type: 'over'; - position: PhysicalPosition; -} | { - type: 'drop'; - paths: string[]; - position: PhysicalPosition; -} | { - type: 'leave'; -}; -/** - * Get an instance of `Webview` for the current webview. - * - * @since 2.0.0 - */ -declare function getCurrentWebview(): Webview; -/** - * Gets a list of instances of `Webview` for all available webviews. - * - * @since 2.0.0 - */ -declare function getAllWebviews(): Promise; -/** @ignore */ -export type WebviewLabel = string; -/** - * Create new webview or get a handle to an existing one. - * - * Webviews are identified by a *label* a unique identifier that can be used to reference it later. - * It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`. - * - * @example - * ```typescript - * import { Window } from "@tauri-apps/api/window" - * import { Webview } from "@tauri-apps/api/webview" - * - * const appWindow = new Window('uniqueLabel'); - * - * appWindow.once('tauri://created', async function () { - * // `new Webview` Should be called after the window is successfully created, - * // or webview may not be attached to the window since window is not created yet. - * - * // loading embedded asset: - * const webview = new Webview(appWindow, 'theUniqueLabel', { - * url: 'path/to/page.html', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * // alternatively, load a remote URL: - * const webview = new Webview(appWindow, 'theUniqueLabel', { - * url: 'https://github.com/tauri-apps/tauri', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * - * - * // emit an event to the backend - * await webview.emit("some-event", "data"); - * // listen to an event from the backend - * const unlisten = await webview.listen("event-name", e => { }); - * unlisten(); - * }); - * ``` - * - * @since 2.0.0 - */ -declare class Webview { - /** The webview label. It is a unique identifier for the webview, can be used to reference it later. */ - label: WebviewLabel; - /** The window hosting this webview. */ - window: Window; - /** Local event listeners. */ - listeners: Record>>; - /** - * Creates a new Webview. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window' - * import { Webview } from '@tauri-apps/api/webview' - * const appWindow = new Window('my-label') - * - * appWindow.once('tauri://created', async function() { - * const webview = new Webview(appWindow, 'my-label', { - * url: 'https://github.com/tauri-apps/tauri', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * }); - * ``` - * - * @param window the window to add this webview to. - * @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link Webview} instance to communicate with the webview. - */ - constructor(window: Window, label: WebviewLabel, options: WebviewOptions); - /** - * Gets the Webview for the webview associated with the given label. - * @example - * ```typescript - * import { Webview } from '@tauri-apps/api/webview'; - * const mainWebview = Webview.getByLabel('main'); - * ``` - * - * @param label The webview label. - * @returns The Webview instance to communicate with the webview or null if the webview doesn't exist. - */ - static getByLabel(label: string): Promise; - /** - * Get an instance of `Webview` for the current webview. - */ - static getCurrent(): Webview; - /** - * Gets a list of instances of `Webview` for all available webviews. - */ - static getAll(): Promise; - /** - * Listen to an emitted event on this webview. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const unlisten = await getCurrentWebview().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - listen(event: EventName, handler: EventCallback): Promise; - /** - * Listen to an emitted event on this webview only once. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const unlisten = await getCurrent().once('initialized', (event) => { - * console.log(`Webview initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - once(event: EventName, handler: EventCallback): Promise; - /** - * Emits an event to all {@link EventTarget|targets}. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().emit('webview-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - emit(event: string, payload?: T): Promise; - /** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - emitTo(target: string | EventTarget, event: string, payload?: T): Promise; - /** @ignore */ - _handleTauriEvent(event: string, handler: EventCallback): boolean; - /** - * The position of the top-left hand corner of the webview's client area relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const position = await getCurrentWebview().position(); - * ``` - * - * @returns The webview's position. - */ - position(): Promise; - /** - * The physical size of the webview's client area. - * The client area is the content of the webview, excluding the title bar and borders. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const size = await getCurrentWebview().size(); - * ``` - * - * @returns The webview's size. - */ - size(): Promise; - /** - * Closes the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().close(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - close(): Promise; - /** - * Resizes the webview. - * @example - * ```typescript - * import { getCurrent, LogicalSize } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical size. - * @returns A promise indicating the success or failure of the operation. - */ - setSize(size: LogicalSize | PhysicalSize | Size): Promise; - /** - * Sets the webview position. - * @example - * ```typescript - * import { getCurrent, LogicalPosition } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setPosition(new LogicalPosition(600, 500)); - * ``` - * - * @param position The new position, in logical or physical pixels. - * @returns A promise indicating the success or failure of the operation. - */ - setPosition(position: LogicalPosition | PhysicalPosition | Position): Promise; - /** - * Bring the webview to front and focus. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setFocus(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setFocus(): Promise; - /** - * Sets whether the webview should automatically grow and shrink its size and position when the parent window resizes. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setAutoResize(true); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setAutoResize(autoResize: boolean): Promise; - /** - * Hide the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().hide(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - hide(): Promise; - /** - * Show the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().show(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - show(): Promise; - /** - * Set webview zoom level. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setZoom(1.5); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setZoom(scaleFactor: number): Promise; - /** - * Moves this webview to the given label. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().reparent('other-window'); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - reparent(window: Window | WebviewWindow | string): Promise; - /** - * Clears all browsing data for this webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().clearAllBrowsingData(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - clearAllBrowsingData(): Promise; - /** - * Specify the webview background color. - * - * #### Platfrom-specific: - * - * - **macOS / iOS**: Not implemented. - * - **Windows**: - * - On Windows 7, transparency is not supported and the alpha value will be ignored. - * - On Windows higher than 7: translucent colors are not supported so any alpha value other than `0` will be replaced by `255` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - setBackgroundColor(color: Color | null): Promise; - /** - * Listen to a file drop event. - * The listener is triggered when the user hovers the selected files on the webview, - * drops the files or cancels the operation. - * - * @example - * ```typescript - * import { getCurrentWebview } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrentWebview().onDragDropEvent((event) => { - * if (event.payload.type === 'over') { - * console.log('User hovering', event.payload.position); - * } else if (event.payload.type === 'drop') { - * console.log('User dropped', event.payload.paths); - * } else { - * console.log('File drop cancelled'); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * When the debugger panel is open, the drop position of this event may be inaccurate due to a known limitation. - * To retrieve the correct drop position, please detach the debugger. - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onDragDropEvent(handler: EventCallback): Promise; -} -/** - * Configuration for the webview to create. - * - * @since 2.0.0 - */ -interface WebviewOptions { - /** - * Remote URL or local file path to open. - * - * - URL such as `https://github.com/tauri-apps` is opened directly on a Tauri webview. - * - data: URL such as `data:text/html,...` is only supported with the `webview-data-url` Cargo feature for the `tauri` dependency. - * - local file path or route such as `/path/to/page.html` or `/users` is appended to the application URL (the devServer URL on development, or `tauri://localhost/` and `https://tauri.localhost/` on production). - */ - url?: string; - /** The initial vertical position in logical pixels. */ - x: number; - /** The initial horizontal position in logical pixels. */ - y: number; - /** The initial width in logical pixels. */ - width: number; - /** The initial height in logical pixels. */ - height: number; - /** - * Whether the webview is transparent or not. - * Note that on `macOS` this requires the `macos-private-api` feature flag, enabled under `tauri.conf.json > app > macOSPrivateApi`. - * WARNING: Using private APIs on `macOS` prevents your application from being accepted to the `App Store`. - */ - transparent?: boolean; - /** - * Whether the webview should have focus or not - * - * @since 2.1.0 - */ - focus?: boolean; - /** - * Whether the drag and drop is enabled or not on the webview. By default it is enabled. - * - * Disabling it is required to use HTML5 drag and drop on the frontend on Windows. - */ - dragDropEnabled?: boolean; - /** - * Whether clicking an inactive webview also clicks through to the webview on macOS. - */ - acceptFirstMouse?: boolean; - /** - * The user agent for the webview. - */ - userAgent?: string; - /** - * Whether or not the webview should be launched in incognito mode. - * - * #### Platform-specific - * - * - **Android:** Unsupported. - */ - incognito?: boolean; - /** - * The proxy URL for the WebView for all network requests. - * - * Must be either a `http://` or a `socks5://` URL. - * - * #### Platform-specific - * - * - **macOS**: Requires the `macos-proxy` feature flag and only compiles for macOS 14+. - * */ - proxyUrl?: string; - /** - * Whether page zooming by hotkeys is enabled - * - * #### Platform-specific: - * - * - **Windows**: Controls WebView2's [`IsZoomControlEnabled`](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2settings?view=webview2-winrt-1.0.2420.47#iszoomcontrolenabled) setting. - * - **MacOS / Linux**: Injects a polyfill that zooms in and out with `ctrl/command` + `-/=`, - * 20% in each step, ranging from 20% to 1000%. Requires `webview:allow-set-webview-zoom` permission - * - * - **Android / iOS**: Unsupported. - */ - zoomHotkeysEnabled?: boolean; - /** - * Sets whether the custom protocols should use `https://.localhost` instead of the default `http://.localhost` on Windows and Android. Defaults to `false`. - * - * #### Note - * - * Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `://localhost` protocols used on macOS and Linux. - * - * #### Warning - * - * Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access them. - * - * @since 2.1.0 - */ - useHttpsScheme?: boolean; - /** - * Whether web inspector, which is usually called browser devtools, is enabled or not. Enabled by default. - * - * This API works in **debug** builds, but requires `devtools` feature flag to enable it in **release** builds. - * - * #### Platform-specific - * - * - macOS: This will call private functions on **macOS**. - * - Android: Open `chrome://inspect/#devices` in Chrome to get the devtools window. Wry's `WebView` devtools API isn't supported on Android. - * - iOS: Open Safari > Develop > [Your Device Name] > [Your WebView] to get the devtools window. - * - * @since 2.1.0 - */ - devtools?: boolean; - /** - * Set the window and webview background color. - * - * #### Platform-specific: - * - * - **macOS / iOS**: Not implemented. - * - **Windows**: - * - On Windows 7, alpha channel is ignored. - * - On Windows 8 and newer, if alpha channel is not `0`, it will be ignored. - * - * @since 2.1.0 - */ - backgroundColor?: Color; - /** Change the default background throttling behaviour. - * - * By default, browsers use a suspend policy that will throttle timers and even unload - * the whole tab (view) to free resources after roughly 5 minutes when a view became - * minimized or hidden. This will pause all tasks until the documents visibility state - * changes back from hidden to visible by bringing the view back to the foreground. - * - * ## Platform-specific - * - * - **Linux / Windows / Android**: Unsupported. Workarounds like a pending WebLock transaction might suffice. - * - **iOS**: Supported since version 17.0+. - * - **macOS**: Supported since version 14.0+. - * - * see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578 - * - * @since 2.3.0 - */ - backgroundThrottling?: BackgroundThrottlingPolicy; - /** - * Whether we should disable JavaScript code execution on the webview or not. - */ - javascriptDisabled?: boolean; - /** - * on macOS and iOS there is a link preview on long pressing links, this is enabled by default. - * see https://docs.rs/objc2-web-kit/latest/objc2_web_kit/struct.WKWebView.html#method.allowsLinkPreview - */ - allowLinkPreview?: boolean; - /** - * Allows disabling the input accessory view on iOS. - * - * The accessory view is the view that appears above the keyboard when a text input element is focused. - * It usually displays a view with "Done", "Next" buttons. - */ - disableInputAccessoryView?: boolean; - /** - * Set a custom path for the webview's data directory (localStorage, cache, etc.) **relative to [`appDataDir()`]/${label}**. - * For security reasons, paths outside of that location can only be configured on the Rust side. - * - * #### Platform-specific: - * - * - **Windows**: WebViews with different values for settings like `additionalBrowserArgs`, `browserExtensionsEnabled` or `scrollBarStyle` must have different data directories. - * - **macOS / iOS**: Unsupported, use `dataStoreIdentifier` instead. - * - **Android**: Unsupported. - * - * @since 2.9.0 - */ - dataDirectory?: string; - /** - * Initialize the WebView with a custom data store identifier. This can be seen as a replacement for `dataDirectory` which is unavailable in WKWebView. - * See https://developer.apple.com/documentation/webkit/wkwebsitedatastore/init(foridentifier:)?language=objc - * - * The array must contain 16 u8 numbers. - * - * #### Platform-specific: - * - * - **macOS / iOS**: Available on macOS >= 14 and iOS >= 17 - * - **Windows / Linux / Android**: Unsupported. - * - * @since 2.9.0 - */ - dataStoreIdentifier?: number[]; - /** - * Specifies the native scrollbar style to use with the webview. - * CSS styles that modify the scrollbar are applied on top of the native appearance configured here. - * - * Defaults to `default`, which is the browser default. - * - * ## Platform-specific - * - * - **Windows**: - * - `fluentOverlay` requires WebView2 Runtime version 125.0.2535.41 or higher, and does nothing - * on older versions. - * - This option must be given the same value for all webviews. - * - **Linux / Android / iOS / macOS**: Unsupported. Only supports `Default` and performs no operation. - */ - scrollBarStyle?: ScrollBarStyle; -} -export { Webview, getCurrentWebview, getAllWebviews }; -export type { DragDropEvent, WebviewOptions, Color }; diff --git a/node_modules/@tauri-apps/api/webview.js b/node_modules/@tauri-apps/api/webview.js deleted file mode 100644 index 703a556..0000000 --- a/node_modules/@tauri-apps/api/webview.js +++ /dev/null @@ -1,590 +0,0 @@ -import { PhysicalPosition, PhysicalSize, Size, Position } from './dpi.js'; -import { listen, once, emit, emitTo, TauriEvent } from './event.js'; -import { invoke } from './core.js'; -import { Window, getCurrentWindow } from './window.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Provides APIs to create webviews, communicate with other webviews and manipulate the current webview. - * - * #### Webview events - * - * Events can be listened to using {@link Webview.listen}: - * ```typescript - * import { getCurrentWebview } from "@tauri-apps/api/webview"; - * getCurrentWebview().listen("my-webview-event", ({ event, payload }) => { }); - * ``` - * - * @module - */ -/** - * Get an instance of `Webview` for the current webview. - * - * @since 2.0.0 - */ -function getCurrentWebview() { - return new Webview(getCurrentWindow(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }); -} -/** - * Gets a list of instances of `Webview` for all available webviews. - * - * @since 2.0.0 - */ -async function getAllWebviews() { - return invoke('plugin:webview|get_all_webviews').then((webviews) => webviews.map((w) => new Webview(new Window(w.windowLabel, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }), w.label, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }))); -} -/** @ignore */ -// events that are emitted right here instead of by the created webview -const localTauriEvents = ['tauri://created', 'tauri://error']; -/** - * Create new webview or get a handle to an existing one. - * - * Webviews are identified by a *label* a unique identifier that can be used to reference it later. - * It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`. - * - * @example - * ```typescript - * import { Window } from "@tauri-apps/api/window" - * import { Webview } from "@tauri-apps/api/webview" - * - * const appWindow = new Window('uniqueLabel'); - * - * appWindow.once('tauri://created', async function () { - * // `new Webview` Should be called after the window is successfully created, - * // or webview may not be attached to the window since window is not created yet. - * - * // loading embedded asset: - * const webview = new Webview(appWindow, 'theUniqueLabel', { - * url: 'path/to/page.html', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * // alternatively, load a remote URL: - * const webview = new Webview(appWindow, 'theUniqueLabel', { - * url: 'https://github.com/tauri-apps/tauri', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * - * - * // emit an event to the backend - * await webview.emit("some-event", "data"); - * // listen to an event from the backend - * const unlisten = await webview.listen("event-name", e => { }); - * unlisten(); - * }); - * ``` - * - * @since 2.0.0 - */ -class Webview { - /** - * Creates a new Webview. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window' - * import { Webview } from '@tauri-apps/api/webview' - * const appWindow = new Window('my-label') - * - * appWindow.once('tauri://created', async function() { - * const webview = new Webview(appWindow, 'my-label', { - * url: 'https://github.com/tauri-apps/tauri', - * - * // create a webview with specific logical position and size - * x: 0, - * y: 0, - * width: 800, - * height: 600, - * }); - * - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * }); - * ``` - * - * @param window the window to add this webview to. - * @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link Webview} instance to communicate with the webview. - */ - constructor(window, label, options) { - this.window = window; - this.label = label; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - this.listeners = Object.create(null); - // @ts-expect-error `skip` is not a public API so it is not defined in WebviewOptions - if (!(options === null || options === void 0 ? void 0 : options.skip)) { - invoke('plugin:webview|create_webview', { - windowLabel: window.label, - options: { - ...options, - label - } - }) - .then(async () => this.emit('tauri://created')) - .catch(async (e) => this.emit('tauri://error', e)); - } - } - /** - * Gets the Webview for the webview associated with the given label. - * @example - * ```typescript - * import { Webview } from '@tauri-apps/api/webview'; - * const mainWebview = Webview.getByLabel('main'); - * ``` - * - * @param label The webview label. - * @returns The Webview instance to communicate with the webview or null if the webview doesn't exist. - */ - static async getByLabel(label) { - var _a; - return (_a = (await getAllWebviews()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null; - } - /** - * Get an instance of `Webview` for the current webview. - */ - static getCurrent() { - return getCurrentWebview(); - } - /** - * Gets a list of instances of `Webview` for all available webviews. - */ - static async getAll() { - return getAllWebviews(); - } - /** - * Listen to an emitted event on this webview. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const unlisten = await getCurrentWebview().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async listen(event, handler) { - if (this._handleTauriEvent(event, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return listen(event, handler, { - target: { kind: 'Webview', label: this.label } - }); - } - /** - * Listen to an emitted event on this webview only once. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const unlisten = await getCurrent().once('initialized', (event) => { - * console.log(`Webview initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async once(event, handler) { - if (this._handleTauriEvent(event, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return once(event, handler, { - target: { kind: 'Webview', label: this.label } - }); - } - /** - * Emits an event to all {@link EventTarget|targets}. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().emit('webview-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emit(event, payload) { - if (localTauriEvents.includes(event)) { - // eslint-disable-next-line - for (const handler of this.listeners[event] || []) { - handler({ - event, - id: -1, - payload - }); - } - return; - } - return emit(event, payload); - } - /** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emitTo(target, event, payload) { - if (localTauriEvents.includes(event)) { - // eslint-disable-next-line - for (const handler of this.listeners[event] || []) { - handler({ - event, - id: -1, - payload - }); - } - return; - } - return emitTo(target, event, payload); - } - /** @ignore */ - _handleTauriEvent(event, handler) { - if (localTauriEvents.includes(event)) { - if (!(event in this.listeners)) { - // eslint-disable-next-line security/detect-object-injection - this.listeners[event] = [handler]; - } - else { - // eslint-disable-next-line security/detect-object-injection - this.listeners[event].push(handler); - } - return true; - } - return false; - } - // Getters - /** - * The position of the top-left hand corner of the webview's client area relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const position = await getCurrentWebview().position(); - * ``` - * - * @returns The webview's position. - */ - async position() { - return invoke('plugin:webview|webview_position', { - label: this.label - }).then((p) => new PhysicalPosition(p)); - } - /** - * The physical size of the webview's client area. - * The client area is the content of the webview, excluding the title bar and borders. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * const size = await getCurrentWebview().size(); - * ``` - * - * @returns The webview's size. - */ - async size() { - return invoke('plugin:webview|webview_size', { - label: this.label - }).then((s) => new PhysicalSize(s)); - } - // Setters - /** - * Closes the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().close(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async close() { - return invoke('plugin:webview|webview_close', { - label: this.label - }); - } - /** - * Resizes the webview. - * @example - * ```typescript - * import { getCurrent, LogicalSize } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical size. - * @returns A promise indicating the success or failure of the operation. - */ - async setSize(size) { - return invoke('plugin:webview|set_webview_size', { - label: this.label, - value: size instanceof Size ? size : new Size(size) - }); - } - /** - * Sets the webview position. - * @example - * ```typescript - * import { getCurrent, LogicalPosition } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setPosition(new LogicalPosition(600, 500)); - * ``` - * - * @param position The new position, in logical or physical pixels. - * @returns A promise indicating the success or failure of the operation. - */ - async setPosition(position) { - return invoke('plugin:webview|set_webview_position', { - label: this.label, - value: position instanceof Position ? position : new Position(position) - }); - } - /** - * Bring the webview to front and focus. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setFocus(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setFocus() { - return invoke('plugin:webview|set_webview_focus', { - label: this.label - }); - } - /** - * Sets whether the webview should automatically grow and shrink its size and position when the parent window resizes. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setAutoResize(true); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setAutoResize(autoResize) { - return invoke('plugin:webview|set_webview_auto_resize', { - label: this.label, - value: autoResize - }); - } - /** - * Hide the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().hide(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async hide() { - return invoke('plugin:webview|webview_hide', { - label: this.label - }); - } - /** - * Show the webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().show(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async show() { - return invoke('plugin:webview|webview_show', { - label: this.label - }); - } - /** - * Set webview zoom level. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().setZoom(1.5); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setZoom(scaleFactor) { - return invoke('plugin:webview|set_webview_zoom', { - label: this.label, - value: scaleFactor - }); - } - /** - * Moves this webview to the given label. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().reparent('other-window'); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async reparent(window) { - return invoke('plugin:webview|reparent', { - label: this.label, - window: typeof window === 'string' ? window : window.label - }); - } - /** - * Clears all browsing data for this webview. - * @example - * ```typescript - * import { getCurrentWebview } from '@tauri-apps/api/webview'; - * await getCurrentWebview().clearAllBrowsingData(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async clearAllBrowsingData() { - return invoke('plugin:webview|clear_all_browsing_data'); - } - /** - * Specify the webview background color. - * - * #### Platfrom-specific: - * - * - **macOS / iOS**: Not implemented. - * - **Windows**: - * - On Windows 7, transparency is not supported and the alpha value will be ignored. - * - On Windows higher than 7: translucent colors are not supported so any alpha value other than `0` will be replaced by `255` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - async setBackgroundColor(color) { - return invoke('plugin:webview|set_webview_background_color', { color }); - } - // Listeners - /** - * Listen to a file drop event. - * The listener is triggered when the user hovers the selected files on the webview, - * drops the files or cancels the operation. - * - * @example - * ```typescript - * import { getCurrentWebview } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrentWebview().onDragDropEvent((event) => { - * if (event.payload.type === 'over') { - * console.log('User hovering', event.payload.position); - * } else if (event.payload.type === 'drop') { - * console.log('User dropped', event.payload.paths); - * } else { - * console.log('File drop cancelled'); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * When the debugger panel is open, the drop position of this event may be inaccurate due to a known limitation. - * To retrieve the correct drop position, please detach the debugger. - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onDragDropEvent(handler) { - const unlistenDragEnter = await this.listen(TauriEvent.DRAG_ENTER, (event) => { - handler({ - ...event, - payload: { - type: 'enter', - paths: event.payload.paths, - position: new PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragOver = await this.listen(TauriEvent.DRAG_OVER, (event) => { - handler({ - ...event, - payload: { - type: 'over', - position: new PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragDrop = await this.listen(TauriEvent.DRAG_DROP, (event) => { - handler({ - ...event, - payload: { - type: 'drop', - paths: event.payload.paths, - position: new PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragLeave = await this.listen(TauriEvent.DRAG_LEAVE, (event) => { - handler({ ...event, payload: { type: 'leave' } }); - }); - return () => { - unlistenDragEnter(); - unlistenDragDrop(); - unlistenDragOver(); - unlistenDragLeave(); - }; - } -} - -export { Webview, getAllWebviews, getCurrentWebview }; diff --git a/node_modules/@tauri-apps/api/webviewWindow.cjs b/node_modules/@tauri-apps/api/webviewWindow.cjs deleted file mode 100644 index 3740633..0000000 --- a/node_modules/@tauri-apps/api/webviewWindow.cjs +++ /dev/null @@ -1,211 +0,0 @@ -'use strict'; - -var webview = require('./webview.cjs'); -var window = require('./window.cjs'); -var event = require('./event.cjs'); -var core = require('./core.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Get an instance of `Webview` for the current webview window. - * - * @since 2.0.0 - */ -function getCurrentWebviewWindow() { - const webview$1 = webview.getCurrentWebview(); - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - return new WebviewWindow(webview$1.label, { skip: true }); -} -/** - * Gets a list of instances of `Webview` for all available webview windows. - * - * @since 2.0.0 - */ -async function getAllWebviewWindows() { - return core.invoke('plugin:window|get_all_windows').then((windows) => windows.map((w) => new WebviewWindow(w, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }))); -} -// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging -class WebviewWindow { - /** - * Creates a new {@link Window} hosting a {@link Webview}. - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow' - * const webview = new WebviewWindow('my-label', { - * url: 'https://github.com/tauri-apps/tauri' - * }); - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * ``` - * - * @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link WebviewWindow} instance to communicate with the window and webview. - */ - constructor(label, options = {}) { - var _a; - this.label = label; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - this.listeners = Object.create(null); - // @ts-expect-error `skip` is not a public API so it is not defined in WebviewOptions - if (!(options === null || options === void 0 ? void 0 : options.skip)) { - core.invoke('plugin:webview|create_webview_window', { - options: { - ...options, - parent: typeof options.parent === 'string' - ? options.parent - : (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label, - label - } - }) - .then(async () => this.emit('tauri://created')) - .catch(async (e) => this.emit('tauri://error', e)); - } - } - /** - * Gets the Webview for the webview associated with the given label. - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const mainWebview = WebviewWindow.getByLabel('main'); - * ``` - * - * @param label The webview label. - * @returns The Webview instance to communicate with the webview or null if the webview doesn't exist. - */ - static async getByLabel(label) { - var _a; - const webview = (_a = (await getAllWebviewWindows()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null; - if (webview) { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - return new WebviewWindow(webview.label, { skip: true }); - } - return null; - } - /** - * Get an instance of `Webview` for the current webview. - */ - static getCurrent() { - return getCurrentWebviewWindow(); - } - /** - * Gets a list of instances of `Webview` for all available webviews. - */ - static async getAll() { - return getAllWebviewWindows(); - } - /** - * Listen to an emitted event on this webview window. - * - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const unlisten = await WebviewWindow.getCurrent().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async listen(event$1, handler) { - if (this._handleTauriEvent(event$1, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event$1]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return event.listen(event$1, handler, { - target: { kind: 'WebviewWindow', label: this.label } - }); - } - /** - * Listen to an emitted event on this webview window only once. - * - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const unlisten = await WebviewWindow.getCurrent().once('initialized', (event) => { - * console.log(`Webview initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async once(event$1, handler) { - if (this._handleTauriEvent(event$1, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event$1]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return event.once(event$1, handler, { - target: { kind: 'WebviewWindow', label: this.label } - }); - } - /** - * Set the window and webview background color. - * - * #### Platform-specific: - * - * - **Android / iOS:** Unsupported for the window layer. - * - **macOS / iOS**: Not implemented for the webview layer. - * - **Windows**: - * - alpha channel is ignored for the window layer. - * - On Windows 7, alpha channel is ignored for the webview layer. - * - On Windows 8 and newer, if alpha channel is not `0`, it will be ignored. - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - async setBackgroundColor(color) { - return core.invoke('plugin:window|set_background_color', { color }).then(() => { - return core.invoke('plugin:webview|set_webview_background_color', { color }); - }); - } -} -// Order matters, we use window APIs by default -applyMixins(WebviewWindow, [window.Window, webview.Webview]); -/** Extends a base class by other specified classes, without overriding existing properties */ -function applyMixins(baseClass, extendedClasses) { - (Array.isArray(extendedClasses) - ? extendedClasses - : [extendedClasses]).forEach((extendedClass) => { - Object.getOwnPropertyNames(extendedClass.prototype).forEach((name) => { - var _a; - if (typeof baseClass.prototype === 'object' - && baseClass.prototype - && name in baseClass.prototype) - return; - Object.defineProperty(baseClass.prototype, name, - // eslint-disable-next-line - (_a = Object.getOwnPropertyDescriptor(extendedClass.prototype, name)) !== null && _a !== void 0 ? _a : Object.create(null)); - }); - }); -} - -exports.WebviewWindow = WebviewWindow; -exports.getAllWebviewWindows = getAllWebviewWindows; -exports.getCurrentWebviewWindow = getCurrentWebviewWindow; diff --git a/node_modules/@tauri-apps/api/webviewWindow.d.ts b/node_modules/@tauri-apps/api/webviewWindow.d.ts deleted file mode 100644 index f5ae32c..0000000 --- a/node_modules/@tauri-apps/api/webviewWindow.d.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { Webview, WebviewLabel, WebviewOptions } from './webview'; -import type { WindowOptions } from './window'; -import { Window } from './window'; -import type { EventName, EventCallback, UnlistenFn } from './event'; -import type { Color, DragDropEvent } from './webview'; -/** - * Get an instance of `Webview` for the current webview window. - * - * @since 2.0.0 - */ -declare function getCurrentWebviewWindow(): WebviewWindow; -/** - * Gets a list of instances of `Webview` for all available webview windows. - * - * @since 2.0.0 - */ -declare function getAllWebviewWindows(): Promise; -interface WebviewWindow extends Webview, Window { -} -declare class WebviewWindow { - label: string; - /** Local event listeners. */ - listeners: Record>>; - /** - * Creates a new {@link Window} hosting a {@link Webview}. - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow' - * const webview = new WebviewWindow('my-label', { - * url: 'https://github.com/tauri-apps/tauri' - * }); - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * ``` - * - * @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link WebviewWindow} instance to communicate with the window and webview. - */ - constructor(label: WebviewLabel, options?: Omit & WindowOptions); - /** - * Gets the Webview for the webview associated with the given label. - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const mainWebview = WebviewWindow.getByLabel('main'); - * ``` - * - * @param label The webview label. - * @returns The Webview instance to communicate with the webview or null if the webview doesn't exist. - */ - static getByLabel(label: string): Promise; - /** - * Get an instance of `Webview` for the current webview. - */ - static getCurrent(): WebviewWindow; - /** - * Gets a list of instances of `Webview` for all available webviews. - */ - static getAll(): Promise; - /** - * Listen to an emitted event on this webview window. - * - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const unlisten = await WebviewWindow.getCurrent().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - listen(event: EventName, handler: EventCallback): Promise; - /** - * Listen to an emitted event on this webview window only once. - * - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const unlisten = await WebviewWindow.getCurrent().once('initialized', (event) => { - * console.log(`Webview initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - once(event: EventName, handler: EventCallback): Promise; - /** - * Set the window and webview background color. - * - * #### Platform-specific: - * - * - **Android / iOS:** Unsupported for the window layer. - * - **macOS / iOS**: Not implemented for the webview layer. - * - **Windows**: - * - alpha channel is ignored for the window layer. - * - On Windows 7, alpha channel is ignored for the webview layer. - * - On Windows 8 and newer, if alpha channel is not `0`, it will be ignored. - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - setBackgroundColor(color: Color): Promise; -} -export { WebviewWindow, getCurrentWebviewWindow, getAllWebviewWindows }; -export type { DragDropEvent, Color }; diff --git a/node_modules/@tauri-apps/api/webviewWindow.js b/node_modules/@tauri-apps/api/webviewWindow.js deleted file mode 100644 index 38a6a4c..0000000 --- a/node_modules/@tauri-apps/api/webviewWindow.js +++ /dev/null @@ -1,207 +0,0 @@ -import { getCurrentWebview, Webview } from './webview.js'; -import { Window } from './window.js'; -import { listen, once } from './event.js'; -import { invoke } from './core.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Get an instance of `Webview` for the current webview window. - * - * @since 2.0.0 - */ -function getCurrentWebviewWindow() { - const webview = getCurrentWebview(); - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - return new WebviewWindow(webview.label, { skip: true }); -} -/** - * Gets a list of instances of `Webview` for all available webview windows. - * - * @since 2.0.0 - */ -async function getAllWebviewWindows() { - return invoke('plugin:window|get_all_windows').then((windows) => windows.map((w) => new WebviewWindow(w, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }))); -} -// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging -class WebviewWindow { - /** - * Creates a new {@link Window} hosting a {@link Webview}. - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow' - * const webview = new WebviewWindow('my-label', { - * url: 'https://github.com/tauri-apps/tauri' - * }); - * webview.once('tauri://created', function () { - * // webview successfully created - * }); - * webview.once('tauri://error', function (e) { - * // an error happened creating the webview - * }); - * ``` - * - * @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link WebviewWindow} instance to communicate with the window and webview. - */ - constructor(label, options = {}) { - var _a; - this.label = label; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - this.listeners = Object.create(null); - // @ts-expect-error `skip` is not a public API so it is not defined in WebviewOptions - if (!(options === null || options === void 0 ? void 0 : options.skip)) { - invoke('plugin:webview|create_webview_window', { - options: { - ...options, - parent: typeof options.parent === 'string' - ? options.parent - : (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label, - label - } - }) - .then(async () => this.emit('tauri://created')) - .catch(async (e) => this.emit('tauri://error', e)); - } - } - /** - * Gets the Webview for the webview associated with the given label. - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const mainWebview = WebviewWindow.getByLabel('main'); - * ``` - * - * @param label The webview label. - * @returns The Webview instance to communicate with the webview or null if the webview doesn't exist. - */ - static async getByLabel(label) { - var _a; - const webview = (_a = (await getAllWebviewWindows()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null; - if (webview) { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - return new WebviewWindow(webview.label, { skip: true }); - } - return null; - } - /** - * Get an instance of `Webview` for the current webview. - */ - static getCurrent() { - return getCurrentWebviewWindow(); - } - /** - * Gets a list of instances of `Webview` for all available webviews. - */ - static async getAll() { - return getAllWebviewWindows(); - } - /** - * Listen to an emitted event on this webview window. - * - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const unlisten = await WebviewWindow.getCurrent().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async listen(event, handler) { - if (this._handleTauriEvent(event, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return listen(event, handler, { - target: { kind: 'WebviewWindow', label: this.label } - }); - } - /** - * Listen to an emitted event on this webview window only once. - * - * @example - * ```typescript - * import { WebviewWindow } from '@tauri-apps/api/webviewWindow'; - * const unlisten = await WebviewWindow.getCurrent().once('initialized', (event) => { - * console.log(`Webview initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async once(event, handler) { - if (this._handleTauriEvent(event, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return once(event, handler, { - target: { kind: 'WebviewWindow', label: this.label } - }); - } - /** - * Set the window and webview background color. - * - * #### Platform-specific: - * - * - **Android / iOS:** Unsupported for the window layer. - * - **macOS / iOS**: Not implemented for the webview layer. - * - **Windows**: - * - alpha channel is ignored for the window layer. - * - On Windows 7, alpha channel is ignored for the webview layer. - * - On Windows 8 and newer, if alpha channel is not `0`, it will be ignored. - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - async setBackgroundColor(color) { - return invoke('plugin:window|set_background_color', { color }).then(() => { - return invoke('plugin:webview|set_webview_background_color', { color }); - }); - } -} -// Order matters, we use window APIs by default -applyMixins(WebviewWindow, [Window, Webview]); -/** Extends a base class by other specified classes, without overriding existing properties */ -function applyMixins(baseClass, extendedClasses) { - (Array.isArray(extendedClasses) - ? extendedClasses - : [extendedClasses]).forEach((extendedClass) => { - Object.getOwnPropertyNames(extendedClass.prototype).forEach((name) => { - var _a; - if (typeof baseClass.prototype === 'object' - && baseClass.prototype - && name in baseClass.prototype) - return; - Object.defineProperty(baseClass.prototype, name, - // eslint-disable-next-line - (_a = Object.getOwnPropertyDescriptor(extendedClass.prototype, name)) !== null && _a !== void 0 ? _a : Object.create(null)); - }); - }); -} - -export { WebviewWindow, getAllWebviewWindows, getCurrentWebviewWindow }; diff --git a/node_modules/@tauri-apps/api/window.cjs b/node_modules/@tauri-apps/api/window.cjs deleted file mode 100644 index d49d1c6..0000000 --- a/node_modules/@tauri-apps/api/window.cjs +++ /dev/null @@ -1,2051 +0,0 @@ -'use strict'; - -var dpi = require('./dpi.cjs'); -var event = require('./event.cjs'); -var core = require('./core.cjs'); -var image = require('./image.cjs'); - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Provides APIs to create windows, communicate with other windows and manipulate the current window. - * - * #### Window events - * - * Events can be listened to using {@link Window.listen}: - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * getCurrentWindow().listen("my-window-event", ({ event, payload }) => { }); - * ``` - * - * @module - */ -/** - * Attention type to request on a window. - * - * @since 1.0.0 - */ -exports.UserAttentionType = void 0; -(function (UserAttentionType) { - /** - * #### Platform-specific - * - **macOS:** Bounces the dock icon until the application is in focus. - * - **Windows:** Flashes both the window and the taskbar button until the application is in focus. - */ - UserAttentionType[UserAttentionType["Critical"] = 1] = "Critical"; - /** - * #### Platform-specific - * - **macOS:** Bounces the dock icon once. - * - **Windows:** Flashes the taskbar button until the application is in focus. - */ - UserAttentionType[UserAttentionType["Informational"] = 2] = "Informational"; -})(exports.UserAttentionType || (exports.UserAttentionType = {})); -class CloseRequestedEvent { - constructor(event) { - this._preventDefault = false; - this.event = event.event; - this.id = event.id; - } - preventDefault() { - this._preventDefault = true; - } - isPreventDefault() { - return this._preventDefault; - } -} -exports.ProgressBarStatus = void 0; -(function (ProgressBarStatus) { - /** - * Hide progress bar. - */ - ProgressBarStatus["None"] = "none"; - /** - * Normal state. - */ - ProgressBarStatus["Normal"] = "normal"; - /** - * Indeterminate state. **Treated as Normal on Linux and macOS** - */ - ProgressBarStatus["Indeterminate"] = "indeterminate"; - /** - * Paused state. **Treated as Normal on Linux** - */ - ProgressBarStatus["Paused"] = "paused"; - /** - * Error state. **Treated as Normal on linux** - */ - ProgressBarStatus["Error"] = "error"; -})(exports.ProgressBarStatus || (exports.ProgressBarStatus = {})); -/** - * Get an instance of `Window` for the current window. - * - * @since 1.0.0 - */ -function getCurrentWindow() { - return new Window(window.__TAURI_INTERNALS__.metadata.currentWindow.label, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }); -} -/** - * Gets a list of instances of `Window` for all available windows. - * - * @since 1.0.0 - */ -async function getAllWindows() { - return core.invoke('plugin:window|get_all_windows').then((windows) => windows.map((w) => new Window(w, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }))); -} -/** @ignore */ -// events that are emitted right here instead of by the created window -const localTauriEvents = ['tauri://created', 'tauri://error']; -/** - * Create new window or get a handle to an existing one. - * - * Windows are identified by a *label* a unique identifier that can be used to reference it later. - * It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`. - * - * @example - * ```typescript - * import { Window } from "@tauri-apps/api/window" - * - * const appWindow = new Window('theUniqueLabel'); - * - * appWindow.once('tauri://created', function () { - * // window successfully created - * }); - * appWindow.once('tauri://error', function (e) { - * // an error happened creating the window - * }); - * - * // emit an event to the backend - * await appWindow.emit("some-event", "data"); - * // listen to an event from the backend - * const unlisten = await appWindow.listen("event-name", e => {}); - * unlisten(); - * ``` - * - * @since 2.0.0 - */ -class Window { - /** - * Creates a new Window. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const appWindow = new Window('my-label'); - * appWindow.once('tauri://created', function () { - * // window successfully created - * }); - * appWindow.once('tauri://error', function (e) { - * // an error happened creating the window - * }); - * ``` - * - * @param label The unique window label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link Window} instance to communicate with the window. - */ - constructor(label, options = {}) { - var _a; - this.label = label; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - this.listeners = Object.create(null); - // @ts-expect-error `skip` is not a public API so it is not defined in WindowOptions - if (!(options === null || options === void 0 ? void 0 : options.skip)) { - core.invoke('plugin:window|create', { - options: { - ...options, - parent: typeof options.parent === 'string' - ? options.parent - : (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label, - label - } - }) - .then(async () => this.emit('tauri://created')) - .catch(async (e) => this.emit('tauri://error', e)); - } - } - /** - * Gets the Window associated with the given label. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const mainWindow = Window.getByLabel('main'); - * ``` - * - * @param label The window label. - * @returns The Window instance to communicate with the window or null if the window doesn't exist. - */ - static async getByLabel(label) { - var _a; - return (_a = (await getAllWindows()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null; - } - /** - * Get an instance of `Window` for the current window. - */ - static getCurrent() { - return getCurrentWindow(); - } - /** - * Gets a list of instances of `Window` for all available windows. - */ - static async getAll() { - return getAllWindows(); - } - /** - * Gets the focused window. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const focusedWindow = Window.getFocusedWindow(); - * ``` - * - * @returns The Window instance or `undefined` if there is not any focused window. - */ - static async getFocusedWindow() { - for (const w of await getAllWindows()) { - if (await w.isFocused()) { - return w; - } - } - return null; - } - /** - * Listen to an emitted event on this window. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const unlisten = await getCurrentWindow().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async listen(event$1, handler) { - if (this._handleTauriEvent(event$1, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event$1]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return event.listen(event$1, handler, { - target: { kind: 'Window', label: this.label } - }); - } - /** - * Listen to an emitted event on this window only once. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const unlisten = await getCurrentWindow().once('initialized', (event) => { - * console.log(`Window initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async once(event$1, handler) { - if (this._handleTauriEvent(event$1, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event$1]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return event.once(event$1, handler, { - target: { kind: 'Window', label: this.label } - }); - } - /** - * Emits an event to all {@link EventTarget|targets}. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emit(event$1, payload) { - if (localTauriEvents.includes(event$1)) { - // eslint-disable-next-line - for (const handler of this.listeners[event$1] || []) { - handler({ - event: event$1, - id: -1, - payload - }); - } - return; - } - return event.emit(event$1, payload); - } - /** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emitTo(target, event$1, payload) { - if (localTauriEvents.includes(event$1)) { - // eslint-disable-next-line security/detect-object-injection - for (const handler of this.listeners[event$1] || []) { - handler({ - event: event$1, - id: -1, - payload - }); - } - return; - } - return event.emitTo(target, event$1, payload); - } - /** @ignore */ - _handleTauriEvent(event, handler) { - if (localTauriEvents.includes(event)) { - if (!(event in this.listeners)) { - // eslint-disable-next-line - this.listeners[event] = [handler]; - } - else { - // eslint-disable-next-line - this.listeners[event].push(handler); - } - return true; - } - return false; - } - // Getters - /** - * The scale factor that can be used to map physical pixels to logical pixels. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const factor = await getCurrentWindow().scaleFactor(); - * ``` - * - * @returns The window's monitor scale factor. - */ - async scaleFactor() { - return core.invoke('plugin:window|scale_factor', { - label: this.label - }); - } - /** - * The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const position = await getCurrentWindow().innerPosition(); - * ``` - * - * @returns The window's inner position. - */ - async innerPosition() { - return core.invoke('plugin:window|inner_position', { - label: this.label - }).then((p) => new dpi.PhysicalPosition(p)); - } - /** - * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const position = await getCurrentWindow().outerPosition(); - * ``` - * - * @returns The window's outer position. - */ - async outerPosition() { - return core.invoke('plugin:window|outer_position', { - label: this.label - }).then((p) => new dpi.PhysicalPosition(p)); - } - /** - * The physical size of the window's client area. - * The client area is the content of the window, excluding the title bar and borders. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const size = await getCurrentWindow().innerSize(); - * ``` - * - * @returns The window's inner size. - */ - async innerSize() { - return core.invoke('plugin:window|inner_size', { - label: this.label - }).then((s) => new dpi.PhysicalSize(s)); - } - /** - * The physical size of the entire window. - * These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const size = await getCurrentWindow().outerSize(); - * ``` - * - * @returns The window's outer size. - */ - async outerSize() { - return core.invoke('plugin:window|outer_size', { - label: this.label - }).then((s) => new dpi.PhysicalSize(s)); - } - /** - * Gets the window's current fullscreen state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const fullscreen = await getCurrentWindow().isFullscreen(); - * ``` - * - * @returns Whether the window is in fullscreen mode or not. - */ - async isFullscreen() { - return core.invoke('plugin:window|is_fullscreen', { - label: this.label - }); - } - /** - * Gets the window's current minimized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const minimized = await getCurrentWindow().isMinimized(); - * ``` - */ - async isMinimized() { - return core.invoke('plugin:window|is_minimized', { - label: this.label - }); - } - /** - * Gets the window's current maximized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const maximized = await getCurrentWindow().isMaximized(); - * ``` - * - * @returns Whether the window is maximized or not. - */ - async isMaximized() { - return core.invoke('plugin:window|is_maximized', { - label: this.label - }); - } - /** - * Gets the window's current focus state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const focused = await getCurrentWindow().isFocused(); - * ``` - * - * @returns Whether the window is focused or not. - */ - async isFocused() { - return core.invoke('plugin:window|is_focused', { - label: this.label - }); - } - /** - * Gets the window's current decorated state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const decorated = await getCurrentWindow().isDecorated(); - * ``` - * - * @returns Whether the window is decorated or not. - */ - async isDecorated() { - return core.invoke('plugin:window|is_decorated', { - label: this.label - }); - } - /** - * Gets the window's current resizable state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const resizable = await getCurrentWindow().isResizable(); - * ``` - * - * @returns Whether the window is resizable or not. - */ - async isResizable() { - return core.invoke('plugin:window|is_resizable', { - label: this.label - }); - } - /** - * Gets the window's native maximize button state. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const maximizable = await getCurrentWindow().isMaximizable(); - * ``` - * - * @returns Whether the window's native maximize button is enabled or not. - */ - async isMaximizable() { - return core.invoke('plugin:window|is_maximizable', { - label: this.label - }); - } - /** - * Gets the window's native minimize button state. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const minimizable = await getCurrentWindow().isMinimizable(); - * ``` - * - * @returns Whether the window's native minimize button is enabled or not. - */ - async isMinimizable() { - return core.invoke('plugin:window|is_minimizable', { - label: this.label - }); - } - /** - * Gets the window's native close button state. - * - * #### Platform-specific - * - * - **iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const closable = await getCurrentWindow().isClosable(); - * ``` - * - * @returns Whether the window's native close button is enabled or not. - */ - async isClosable() { - return core.invoke('plugin:window|is_closable', { - label: this.label - }); - } - /** - * Gets the window's current visible state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const visible = await getCurrentWindow().isVisible(); - * ``` - * - * @returns Whether the window is visible or not. - */ - async isVisible() { - return core.invoke('plugin:window|is_visible', { - label: this.label - }); - } - /** - * Gets the window's current title. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const title = await getCurrentWindow().title(); - * ``` - */ - async title() { - return core.invoke('plugin:window|title', { - label: this.label - }); - } - /** - * Gets the window's current theme. - * - * #### Platform-specific - * - * - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const theme = await getCurrentWindow().theme(); - * ``` - * - * @returns The window theme. - */ - async theme() { - return core.invoke('plugin:window|theme', { - label: this.label - }); - } - /** - * Whether the window is configured to be always on top of other windows or not. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop(); - * ``` - * - * @returns Whether the window is visible or not. - */ - async isAlwaysOnTop() { - return core.invoke('plugin:window|is_always_on_top', { - label: this.label - }); - } - // Setters - /** - * Centers the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().center(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async center() { - return core.invoke('plugin:window|center', { - label: this.label - }); - } - /** - * Requests user attention to the window, this has no effect if the application - * is already focused. How requesting for user attention manifests is platform dependent, - * see `UserAttentionType` for details. - * - * Providing `null` will unset the request for user attention. Unsetting the request for - * user attention might not be done automatically by the WM when the window receives input. - * - * #### Platform-specific - * - * - **macOS:** `null` has no effect. - * - **Linux:** Urgency levels have the same effect. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().requestUserAttention(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async requestUserAttention(requestType) { - let requestType_ = null; - if (requestType) { - if (requestType === exports.UserAttentionType.Critical) { - requestType_ = { type: 'Critical' }; - } - else { - requestType_ = { type: 'Informational' }; - } - } - return core.invoke('plugin:window|request_user_attention', { - label: this.label, - value: requestType_ - }); - } - /** - * Updates the window resizable flag. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setResizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setResizable(resizable) { - return core.invoke('plugin:window|set_resizable', { - label: this.label, - value: resizable - }); - } - /** - * Enable or disable the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setEnabled(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.0.0 - */ - async setEnabled(enabled) { - return core.invoke('plugin:window|set_enabled', { - label: this.label, - value: enabled - }); - } - /** - * Whether the window is enabled or disabled. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setEnabled(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.0.0 - */ - async isEnabled() { - return core.invoke('plugin:window|is_enabled', { - label: this.label - }); - } - /** - * Sets whether the window's native maximize button is enabled or not. - * If resizable is set to false, this setting is ignored. - * - * #### Platform-specific - * - * - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode. - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMaximizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setMaximizable(maximizable) { - return core.invoke('plugin:window|set_maximizable', { - label: this.label, - value: maximizable - }); - } - /** - * Sets whether the window's native minimize button is enabled or not. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMinimizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setMinimizable(minimizable) { - return core.invoke('plugin:window|set_minimizable', { - label: this.label, - value: minimizable - }); - } - /** - * Sets whether the window's native close button is enabled or not. - * - * #### Platform-specific - * - * - **Linux:** GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible - * - **iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setClosable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setClosable(closable) { - return core.invoke('plugin:window|set_closable', { - label: this.label, - value: closable - }); - } - /** - * Sets the window title. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setTitle('Tauri'); - * ``` - * - * @param title The new title - * @returns A promise indicating the success or failure of the operation. - */ - async setTitle(title) { - return core.invoke('plugin:window|set_title', { - label: this.label, - value: title - }); - } - /** - * Maximizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().maximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async maximize() { - return core.invoke('plugin:window|maximize', { - label: this.label - }); - } - /** - * Unmaximizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().unmaximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async unmaximize() { - return core.invoke('plugin:window|unmaximize', { - label: this.label - }); - } - /** - * Toggles the window maximized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().toggleMaximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async toggleMaximize() { - return core.invoke('plugin:window|toggle_maximize', { - label: this.label - }); - } - /** - * Minimizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().minimize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async minimize() { - return core.invoke('plugin:window|minimize', { - label: this.label - }); - } - /** - * Unminimizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().unminimize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async unminimize() { - return core.invoke('plugin:window|unminimize', { - label: this.label - }); - } - /** - * Sets the window visibility to true. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().show(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async show() { - return core.invoke('plugin:window|show', { - label: this.label - }); - } - /** - * Sets the window visibility to false. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().hide(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async hide() { - return core.invoke('plugin:window|hide', { - label: this.label - }); - } - /** - * Closes the window. - * - * Note this emits a closeRequested event so you can intercept it. To force window close, use {@link Window.destroy}. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().close(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async close() { - return core.invoke('plugin:window|close', { - label: this.label - }); - } - /** - * Destroys the window. Behaves like {@link Window.close} but forces the window close instead of emitting a closeRequested event. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().destroy(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async destroy() { - return core.invoke('plugin:window|destroy', { - label: this.label - }); - } - /** - * Whether the window should have borders and bars. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setDecorations(false); - * ``` - * - * @param decorations Whether the window should have borders and bars. - * @returns A promise indicating the success or failure of the operation. - */ - async setDecorations(decorations) { - return core.invoke('plugin:window|set_decorations', { - label: this.label, - value: decorations - }); - } - /** - * Whether or not the window should have shadow. - * - * #### Platform-specific - * - * - **Windows:** - * - `false` has no effect on decorated window, shadows are always ON. - * - `true` will make undecorated window have a 1px white border, - * and on Windows 11, it will have a rounded corners. - * - **Linux:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setShadow(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setShadow(enable) { - return core.invoke('plugin:window|set_shadow', { - label: this.label, - value: enable - }); - } - /** - * Set window effects. - */ - async setEffects(effects) { - return core.invoke('plugin:window|set_effects', { - label: this.label, - value: effects - }); - } - /** - * Clear any applied effects if possible. - */ - async clearEffects() { - return core.invoke('plugin:window|set_effects', { - label: this.label, - value: null - }); - } - /** - * Whether the window should always be on top of other windows. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setAlwaysOnTop(true); - * ``` - * - * @param alwaysOnTop Whether the window should always be on top of other windows or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setAlwaysOnTop(alwaysOnTop) { - return core.invoke('plugin:window|set_always_on_top', { - label: this.label, - value: alwaysOnTop - }); - } - /** - * Whether the window should always be below other windows. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setAlwaysOnBottom(true); - * ``` - * - * @param alwaysOnBottom Whether the window should always be below other windows or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setAlwaysOnBottom(alwaysOnBottom) { - return core.invoke('plugin:window|set_always_on_bottom', { - label: this.label, - value: alwaysOnBottom - }); - } - /** - * Prevents the window contents from being captured by other apps. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setContentProtected(true); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setContentProtected(protected_) { - return core.invoke('plugin:window|set_content_protected', { - label: this.label, - value: protected_ - }); - } - /** - * Resizes the window with a new inner size. - * @example - * ```typescript - * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size. - * @returns A promise indicating the success or failure of the operation. - */ - async setSize(size) { - return core.invoke('plugin:window|set_size', { - label: this.label, - value: size instanceof dpi.Size ? size : new dpi.Size(size) - }); - } - /** - * Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset. - * @example - * ```typescript - * import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMinSize(new PhysicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - async setMinSize(size) { - return core.invoke('plugin:window|set_min_size', { - label: this.label, - value: size instanceof dpi.Size ? size : size ? new dpi.Size(size) : null - }); - } - /** - * Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset. - * @example - * ```typescript - * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMaxSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - async setMaxSize(size) { - return core.invoke('plugin:window|set_max_size', { - label: this.label, - value: size instanceof dpi.Size ? size : size ? new dpi.Size(size) : null - }); - } - /** - * Sets the window inner size constraints. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSizeConstraints({ minWidth: 300 }); - * ``` - * - * @param constraints The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - async setSizeConstraints(constraints) { - function logical(pixel) { - return pixel ? { Logical: pixel } : null; - } - return core.invoke('plugin:window|set_size_constraints', { - label: this.label, - value: { - minWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minWidth), - minHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minHeight), - maxWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxWidth), - maxHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxHeight) - } - }); - } - /** - * Sets the window outer position. - * @example - * ```typescript - * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window'; - * await getCurrentWindow().setPosition(new LogicalPosition(600, 500)); - * ``` - * - * @param position The new position, in logical or physical pixels. - * @returns A promise indicating the success or failure of the operation. - */ - async setPosition(position) { - return core.invoke('plugin:window|set_position', { - label: this.label, - value: position instanceof dpi.Position ? position : new dpi.Position(position) - }); - } - /** - * Sets the window fullscreen state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFullscreen(true); - * ``` - * - * @param fullscreen Whether the window should go to fullscreen or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setFullscreen(fullscreen) { - return core.invoke('plugin:window|set_fullscreen', { - label: this.label, - value: fullscreen - }); - } - /** - * On macOS, Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won’t work if the window was already in the native fullscreen). - * This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor. - * - * On other platforms, this is the same as {@link Window.setFullscreen}. - * - * @param fullscreen Whether the window should go to simple fullscreen or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setSimpleFullscreen(fullscreen) { - return core.invoke('plugin:window|set_simple_fullscreen', { - label: this.label, - value: fullscreen - }); - } - /** - * Bring the window to front and focus. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFocus(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setFocus() { - return core.invoke('plugin:window|set_focus', { - label: this.label - }); - } - /** - * Sets whether the window can be focused. - * - * #### Platform-specific - * - * - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`. - * In this case, you might consider calling {@link Window.setFocus} but it will move the window to the back i.e. at the bottom in terms of z-order. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFocusable(true); - * ``` - * - * @param focusable Whether the window can be focused. - * @returns A promise indicating the success or failure of the operation. - */ - async setFocusable(focusable) { - return core.invoke('plugin:window|set_focusable', { - label: this.label, - value: focusable - }); - } - /** - * Sets the window icon. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setIcon('/tauri/awesome.png'); - * ``` - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - * - * @param icon Icon bytes or path to the icon file. - * @returns A promise indicating the success or failure of the operation. - */ - async setIcon(icon) { - return core.invoke('plugin:window|set_icon', { - label: this.label, - value: image.transformImage(icon) - }); - } - /** - * Whether the window icon should be hidden from the taskbar or not. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSkipTaskbar(true); - * ``` - * - * @param skip true to hide window icon, false to show it. - * @returns A promise indicating the success or failure of the operation. - */ - async setSkipTaskbar(skip) { - return core.invoke('plugin:window|set_skip_taskbar', { - label: this.label, - value: skip - }); - } - /** - * Grabs the cursor, preventing it from leaving the window. - * - * There's no guarantee that the cursor will be hidden. You should - * hide it by yourself if you want so. - * - * #### Platform-specific - * - * - **Linux:** Unsupported. - * - **macOS:** This locks the cursor in a fixed location, which looks visually awkward. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorGrab(true); - * ``` - * - * @param grab `true` to grab the cursor icon, `false` to release it. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorGrab(grab) { - return core.invoke('plugin:window|set_cursor_grab', { - label: this.label, - value: grab - }); - } - /** - * Modifies the cursor's visibility. - * - * #### Platform-specific - * - * - **Windows:** The cursor is only hidden within the confines of the window. - * - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is - * outside of the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorVisible(false); - * ``` - * - * @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorVisible(visible) { - return core.invoke('plugin:window|set_cursor_visible', { - label: this.label, - value: visible - }); - } - /** - * Modifies the cursor icon of the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorIcon('help'); - * ``` - * - * @param icon The new cursor icon. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorIcon(icon) { - return core.invoke('plugin:window|set_cursor_icon', { - label: this.label, - value: icon - }); - } - /** - * Sets the window background color. - * - * #### Platform-specific: - * - * - **Windows:** alpha channel is ignored. - * - **iOS / Android:** Unsupported. - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - async setBackgroundColor(color) { - return core.invoke('plugin:window|set_background_color', { color }); - } - /** - * Changes the position of the cursor in window coordinates. - * @example - * ```typescript - * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300)); - * ``` - * - * @param position The new cursor position. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorPosition(position) { - return core.invoke('plugin:window|set_cursor_position', { - label: this.label, - value: position instanceof dpi.Position ? position : new dpi.Position(position) - }); - } - /** - * Changes the cursor events behavior. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setIgnoreCursorEvents(true); - * ``` - * - * @param ignore `true` to ignore the cursor events; `false` to process them as usual. - * @returns A promise indicating the success or failure of the operation. - */ - async setIgnoreCursorEvents(ignore) { - return core.invoke('plugin:window|set_ignore_cursor_events', { - label: this.label, - value: ignore - }); - } - /** - * Starts dragging the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().startDragging(); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - async startDragging() { - return core.invoke('plugin:window|start_dragging', { - label: this.label - }); - } - /** - * Starts resize-dragging the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().startResizeDragging(); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - async startResizeDragging(direction) { - return core.invoke('plugin:window|start_resize_dragging', { - label: this.label, - value: direction - }); - } - /** - * Sets the badge count. It is app wide and not specific to this window. - * - * #### Platform-specific - * - * - **Windows**: Unsupported. Use @{linkcode Window.setOverlayIcon} instead. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setBadgeCount(5); - * ``` - * - * @param count The badge count. Use `undefined` to remove the badge. - * @return A promise indicating the success or failure of the operation. - */ - async setBadgeCount(count) { - return core.invoke('plugin:window|set_badge_count', { - label: this.label, - value: count - }); - } - /** - * Sets the badge cont **macOS only**. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setBadgeLabel("Hello"); - * ``` - * - * @param label The badge label. Use `undefined` to remove the badge. - * @return A promise indicating the success or failure of the operation. - */ - async setBadgeLabel(label) { - return core.invoke('plugin:window|set_badge_label', { - label: this.label, - value: label - }); - } - /** - * Sets the overlay icon. **Windows only** - * The overlay icon can be set for every window. - * - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setOverlayIcon("/tauri/awesome.png"); - * ``` - * - * @param icon Icon bytes or path to the icon file. Use `undefined` to remove the overlay icon. - * @return A promise indicating the success or failure of the operation. - */ - async setOverlayIcon(icon) { - return core.invoke('plugin:window|set_overlay_icon', { - label: this.label, - value: icon ? image.transformImage(icon) : undefined - }); - } - /** - * Sets the taskbar progress state. - * - * #### Platform-specific - * - * - **Linux / macOS**: Progress bar is app-wide and not specific to this window. - * - **Linux**: Only supported desktop environments with `libunity` (e.g. GNOME). - * - * @example - * ```typescript - * import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window'; - * await getCurrentWindow().setProgressBar({ - * status: ProgressBarStatus.Normal, - * progress: 50, - * }); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - async setProgressBar(state) { - return core.invoke('plugin:window|set_progress_bar', { - label: this.label, - value: state - }); - } - /** - * Sets whether the window should be visible on all workspaces or virtual desktops. - * - * #### Platform-specific - * - * - **Windows / iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ - async setVisibleOnAllWorkspaces(visible) { - return core.invoke('plugin:window|set_visible_on_all_workspaces', { - label: this.label, - value: visible - }); - } - /** - * Sets the title bar style. **macOS only**. - * - * @since 2.0.0 - */ - async setTitleBarStyle(style) { - return core.invoke('plugin:window|set_title_bar_style', { - label: this.label, - value: style - }); - } - /** - * Set window theme, pass in `null` or `undefined` to follow system theme - * - * #### Platform-specific - * - * - **Linux / macOS**: Theme is app-wide and not specific to this window. - * - **iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ - async setTheme(theme) { - return core.invoke('plugin:window|set_theme', { - label: this.label, - value: theme - }); - } - // Listeners - /** - * Listen to window resize. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onResized(({ payload: size }) => { - * console.log('Window resized', size); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onResized(handler) { - return this.listen(event.TauriEvent.WINDOW_RESIZED, (e) => { - e.payload = new dpi.PhysicalSize(e.payload); - handler(e); - }); - } - /** - * Listen to window move. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => { - * console.log('Window moved', position); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onMoved(handler) { - return this.listen(event.TauriEvent.WINDOW_MOVED, (e) => { - e.payload = new dpi.PhysicalPosition(e.payload); - handler(e); - }); - } - /** - * Listen to window close requested. Emitted when the user requests to closes the window. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * import { confirm } from '@tauri-apps/api/dialog'; - * const unlisten = await getCurrentWindow().onCloseRequested(async (event) => { - * const confirmed = await confirm('Are you sure?'); - * if (!confirmed) { - * // user did not confirm closing the window; let's prevent it - * event.preventDefault(); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onCloseRequested(handler) { - // eslint-disable-next-line @typescript-eslint/no-misused-promises - return this.listen(event.TauriEvent.WINDOW_CLOSE_REQUESTED, async (event) => { - const evt = new CloseRequestedEvent(event); - await handler(evt); - if (!evt.isPreventDefault()) { - await this.destroy(); - } - }); - } - /** - * Listen to a file drop event. - * The listener is triggered when the user hovers the selected files on the webview, - * drops the files or cancels the operation. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrentWindow().onDragDropEvent((event) => { - * if (event.payload.type === 'over') { - * console.log('User hovering', event.payload.position); - * } else if (event.payload.type === 'drop') { - * console.log('User dropped', event.payload.paths); - * } else { - * console.log('File drop cancelled'); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onDragDropEvent(handler) { - const unlistenDrag = await this.listen(event.TauriEvent.DRAG_ENTER, (event) => { - handler({ - ...event, - payload: { - type: 'enter', - paths: event.payload.paths, - position: new dpi.PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragOver = await this.listen(event.TauriEvent.DRAG_OVER, (event) => { - handler({ - ...event, - payload: { - type: 'over', - position: new dpi.PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDrop = await this.listen(event.TauriEvent.DRAG_DROP, (event) => { - handler({ - ...event, - payload: { - type: 'drop', - paths: event.payload.paths, - position: new dpi.PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenCancel = await this.listen(event.TauriEvent.DRAG_LEAVE, (event) => { - handler({ ...event, payload: { type: 'leave' } }); - }); - return () => { - unlistenDrag(); - unlistenDrop(); - unlistenDragOver(); - unlistenCancel(); - }; - } - /** - * Listen to window focus change. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => { - * console.log('Focus changed, window is focused? ' + focused); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onFocusChanged(handler) { - const unlistenFocus = await this.listen(event.TauriEvent.WINDOW_FOCUS, (event) => { - handler({ ...event, payload: true }); - }); - const unlistenBlur = await this.listen(event.TauriEvent.WINDOW_BLUR, (event) => { - handler({ ...event, payload: false }); - }); - return () => { - unlistenFocus(); - unlistenBlur(); - }; - } - /** - * Listen to window scale change. Emitted when the window's scale factor has changed. - * The following user actions can cause DPI changes: - * - Changing the display's resolution. - * - Changing the display's scale factor (e.g. in Control Panel on Windows). - * - Moving the window to a display with a different scale factor. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => { - * console.log('Scale changed', payload.scaleFactor, payload.size); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onScaleChanged(handler) { - return this.listen(event.TauriEvent.WINDOW_SCALE_FACTOR_CHANGED, handler); - } - /** - * Listen to the system theme change. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => { - * console.log('New theme: ' + theme); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onThemeChanged(handler) { - return this.listen(event.TauriEvent.WINDOW_THEME_CHANGED, handler); - } -} -/** - * Background throttling policy - * - * @since 2.0.0 - */ -var BackgroundThrottlingPolicy; -(function (BackgroundThrottlingPolicy) { - BackgroundThrottlingPolicy["Disabled"] = "disabled"; - BackgroundThrottlingPolicy["Throttle"] = "throttle"; - BackgroundThrottlingPolicy["Suspend"] = "suspend"; -})(BackgroundThrottlingPolicy || (BackgroundThrottlingPolicy = {})); -/** - * The scrollbar style to use in the webview. - * - * ## Platform-specific - * - * **Windows**: This option must be given the same value for all webviews. - * - * @since 2.8.0 - */ -var ScrollBarStyle; -(function (ScrollBarStyle) { - /** - * The default scrollbar style for the webview. - */ - ScrollBarStyle["Default"] = "default"; - /** - * Fluent UI style overlay scrollbars. **Windows Only** - * - * Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions, - * see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541 - */ - ScrollBarStyle["FluentOverlay"] = "fluentOverlay"; -})(ScrollBarStyle || (ScrollBarStyle = {})); -/** - * Platform-specific window effects - * - * @since 2.0.0 - */ -exports.Effect = void 0; -(function (Effect) { - /** - * A default material appropriate for the view's effectiveAppearance. **macOS 10.14-** - * - * @deprecated since macOS 10.14. You should instead choose an appropriate semantic material. - */ - Effect["AppearanceBased"] = "appearanceBased"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["Light"] = "light"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["Dark"] = "dark"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["MediumLight"] = "mediumLight"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["UltraDark"] = "ultraDark"; - /** - * **macOS 10.10+** - */ - Effect["Titlebar"] = "titlebar"; - /** - * **macOS 10.10+** - */ - Effect["Selection"] = "selection"; - /** - * **macOS 10.11+** - */ - Effect["Menu"] = "menu"; - /** - * **macOS 10.11+** - */ - Effect["Popover"] = "popover"; - /** - * **macOS 10.11+** - */ - Effect["Sidebar"] = "sidebar"; - /** - * **macOS 10.14+** - */ - Effect["HeaderView"] = "headerView"; - /** - * **macOS 10.14+** - */ - Effect["Sheet"] = "sheet"; - /** - * **macOS 10.14+** - */ - Effect["WindowBackground"] = "windowBackground"; - /** - * **macOS 10.14+** - */ - Effect["HudWindow"] = "hudWindow"; - /** - * **macOS 10.14+** - */ - Effect["FullScreenUI"] = "fullScreenUI"; - /** - * **macOS 10.14+** - */ - Effect["Tooltip"] = "tooltip"; - /** - * **macOS 10.14+** - */ - Effect["ContentBackground"] = "contentBackground"; - /** - * **macOS 10.14+** - */ - Effect["UnderWindowBackground"] = "underWindowBackground"; - /** - * **macOS 10.14+** - */ - Effect["UnderPageBackground"] = "underPageBackground"; - /** - * **Windows 11 Only** - */ - Effect["Mica"] = "mica"; - /** - * **Windows 7/10/11(22H1) Only** - * - * #### Notes - * - * This effect has bad performance when resizing/dragging the window on Windows 11 build 22621. - */ - Effect["Blur"] = "blur"; - /** - * **Windows 10/11** - * - * #### Notes - * - * This effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000. - */ - Effect["Acrylic"] = "acrylic"; - /** - * Tabbed effect that matches the system dark preference **Windows 11 Only** - */ - Effect["Tabbed"] = "tabbed"; - /** - * Tabbed effect with dark mode but only if dark mode is enabled on the system **Windows 11 Only** - */ - Effect["TabbedDark"] = "tabbedDark"; - /** - * Tabbed effect with light mode **Windows 11 Only** - */ - Effect["TabbedLight"] = "tabbedLight"; -})(exports.Effect || (exports.Effect = {})); -/** - * Window effect state **macOS only** - * - * @see https://developer.apple.com/documentation/appkit/nsvisualeffectview/state - * - * @since 2.0.0 - */ -exports.EffectState = void 0; -(function (EffectState) { - /** - * Make window effect state follow the window's active state **macOS only** - */ - EffectState["FollowsWindowActiveState"] = "followsWindowActiveState"; - /** - * Make window effect state always active **macOS only** - */ - EffectState["Active"] = "active"; - /** - * Make window effect state always inactive **macOS only** - */ - EffectState["Inactive"] = "inactive"; -})(exports.EffectState || (exports.EffectState = {})); -function mapMonitor(m) { - return m === null - ? null - : { - name: m.name, - scaleFactor: m.scaleFactor, - position: new dpi.PhysicalPosition(m.position), - size: new dpi.PhysicalSize(m.size), - workArea: { - position: new dpi.PhysicalPosition(m.workArea.position), - size: new dpi.PhysicalSize(m.workArea.size) - } - }; -} -/** - * Returns the monitor on which the window currently resides. - * Returns `null` if current monitor can't be detected. - * @example - * ```typescript - * import { currentMonitor } from '@tauri-apps/api/window'; - * const monitor = await currentMonitor(); - * ``` - * - * @since 1.0.0 - */ -async function currentMonitor() { - return core.invoke('plugin:window|current_monitor').then(mapMonitor); -} -/** - * Returns the primary monitor of the system. - * Returns `null` if it can't identify any monitor as a primary one. - * @example - * ```typescript - * import { primaryMonitor } from '@tauri-apps/api/window'; - * const monitor = await primaryMonitor(); - * ``` - * - * @since 1.0.0 - */ -async function primaryMonitor() { - return core.invoke('plugin:window|primary_monitor').then(mapMonitor); -} -/** - * Returns the monitor that contains the given point. Returns `null` if can't find any. - * @example - * ```typescript - * import { monitorFromPoint } from '@tauri-apps/api/window'; - * const monitor = await monitorFromPoint(100.0, 200.0); - * ``` - * - * @since 1.0.0 - */ -async function monitorFromPoint(x, y) { - return core.invoke('plugin:window|monitor_from_point', { - x, - y - }).then(mapMonitor); -} -/** - * Returns the list of all the monitors available on the system. - * @example - * ```typescript - * import { availableMonitors } from '@tauri-apps/api/window'; - * const monitors = await availableMonitors(); - * ``` - * - * @since 1.0.0 - */ -async function availableMonitors() { - return core.invoke('plugin:window|available_monitors').then((ms) => ms.map(mapMonitor)); -} -/** - * Get the cursor position relative to the top-left hand corner of the desktop. - * - * Note that the top-left hand corner of the desktop is not necessarily the same as the screen. - * If the user uses a desktop with multiple monitors, - * the top-left hand corner of the desktop is the top-left hand corner of the main monitor on Windows and macOS - * or the top-left of the leftmost monitor on X11. - * - * The coordinates can be negative if the top-left hand corner of the window is outside of the visible screen region. - */ -async function cursorPosition() { - return core.invoke('plugin:window|cursor_position').then((v) => new dpi.PhysicalPosition(v)); -} - -exports.LogicalPosition = dpi.LogicalPosition; -exports.LogicalSize = dpi.LogicalSize; -exports.PhysicalPosition = dpi.PhysicalPosition; -exports.PhysicalSize = dpi.PhysicalSize; -exports.CloseRequestedEvent = CloseRequestedEvent; -exports.Window = Window; -exports.availableMonitors = availableMonitors; -exports.currentMonitor = currentMonitor; -exports.cursorPosition = cursorPosition; -exports.getAllWindows = getAllWindows; -exports.getCurrentWindow = getCurrentWindow; -exports.monitorFromPoint = monitorFromPoint; -exports.primaryMonitor = primaryMonitor; diff --git a/node_modules/@tauri-apps/api/window.d.ts b/node_modules/@tauri-apps/api/window.d.ts deleted file mode 100644 index 7aa8184..0000000 --- a/node_modules/@tauri-apps/api/window.d.ts +++ /dev/null @@ -1,1803 +0,0 @@ -/** - * Provides APIs to create windows, communicate with other windows and manipulate the current window. - * - * #### Window events - * - * Events can be listened to using {@link Window.listen}: - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * getCurrentWindow().listen("my-window-event", ({ event, payload }) => { }); - * ``` - * - * @module - */ -import { LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size } from './dpi'; -import type { Event, EventName, EventCallback, UnlistenFn } from './event'; -import { type EventTarget } from './event'; -import { WebviewWindow } from './webviewWindow'; -import type { DragDropEvent } from './webview'; -import { Image } from './image'; -/** - * Allows you to retrieve information about a given monitor. - * - * @since 1.0.0 - */ -export interface Monitor { - /** Human-readable name of the monitor */ - name: string | null; - /** The monitor's resolution. */ - size: PhysicalSize; - /** the Top-left corner position of the monitor relative to the larger full screen area. */ - position: PhysicalPosition; - /** The monitor's work area. */ - workArea: { - position: PhysicalPosition; - size: PhysicalSize; - }; - /** The scale factor that can be used to map physical pixels to logical pixels. */ - scaleFactor: number; -} -type Theme = 'light' | 'dark'; -type TitleBarStyle = 'visible' | 'transparent' | 'overlay'; -type ResizeDirection = 'East' | 'North' | 'NorthEast' | 'NorthWest' | 'South' | 'SouthEast' | 'SouthWest' | 'West'; -/** - * The payload for the `scaleChange` event. - * - * @since 1.0.2 - */ -interface ScaleFactorChanged { - /** The new window scale factor. */ - scaleFactor: number; - /** The new window size */ - size: PhysicalSize; -} -/** - * Attention type to request on a window. - * - * @since 1.0.0 - */ -declare enum UserAttentionType { - /** - * #### Platform-specific - * - **macOS:** Bounces the dock icon until the application is in focus. - * - **Windows:** Flashes both the window and the taskbar button until the application is in focus. - */ - Critical = 1, - /** - * #### Platform-specific - * - **macOS:** Bounces the dock icon once. - * - **Windows:** Flashes the taskbar button until the application is in focus. - */ - Informational = 2 -} -declare class CloseRequestedEvent { - /** Event name */ - event: EventName; - /** Event identifier used to unlisten */ - id: number; - private _preventDefault; - constructor(event: Event); - preventDefault(): void; - isPreventDefault(): boolean; -} -export type CursorIcon = 'default' | 'crosshair' | 'hand' | 'arrow' | 'move' | 'text' | 'wait' | 'help' | 'progress' | 'notAllowed' | 'contextMenu' | 'cell' | 'verticalText' | 'alias' | 'copy' | 'noDrop' | 'grab' | 'grabbing' | 'allScroll' | 'zoomIn' | 'zoomOut' | 'eResize' | 'nResize' | 'neResize' | 'nwResize' | 'sResize' | 'seResize' | 'swResize' | 'wResize' | 'ewResize' | 'nsResize' | 'neswResize' | 'nwseResize' | 'colResize' | 'rowResize'; -export declare enum ProgressBarStatus { - /** - * Hide progress bar. - */ - None = "none", - /** - * Normal state. - */ - Normal = "normal", - /** - * Indeterminate state. **Treated as Normal on Linux and macOS** - */ - Indeterminate = "indeterminate", - /** - * Paused state. **Treated as Normal on Linux** - */ - Paused = "paused", - /** - * Error state. **Treated as Normal on linux** - */ - Error = "error" -} -export interface WindowSizeConstraints { - minWidth?: number; - minHeight?: number; - maxWidth?: number; - maxHeight?: number; -} -export interface ProgressBarState { - /** - * The progress bar status. - */ - status?: ProgressBarStatus; - /** - * The progress bar progress. This can be a value ranging from `0` to `100` - */ - progress?: number; -} -/** - * Get an instance of `Window` for the current window. - * - * @since 1.0.0 - */ -declare function getCurrentWindow(): Window; -/** - * Gets a list of instances of `Window` for all available windows. - * - * @since 1.0.0 - */ -declare function getAllWindows(): Promise; -/** @ignore */ -export type WindowLabel = string; -/** - * Create new window or get a handle to an existing one. - * - * Windows are identified by a *label* a unique identifier that can be used to reference it later. - * It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`. - * - * @example - * ```typescript - * import { Window } from "@tauri-apps/api/window" - * - * const appWindow = new Window('theUniqueLabel'); - * - * appWindow.once('tauri://created', function () { - * // window successfully created - * }); - * appWindow.once('tauri://error', function (e) { - * // an error happened creating the window - * }); - * - * // emit an event to the backend - * await appWindow.emit("some-event", "data"); - * // listen to an event from the backend - * const unlisten = await appWindow.listen("event-name", e => {}); - * unlisten(); - * ``` - * - * @since 2.0.0 - */ -declare class Window { - /** The window label. It is a unique identifier for the window, can be used to reference it later. */ - label: WindowLabel; - /** Local event listeners. */ - listeners: Record>>; - /** - * Creates a new Window. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const appWindow = new Window('my-label'); - * appWindow.once('tauri://created', function () { - * // window successfully created - * }); - * appWindow.once('tauri://error', function (e) { - * // an error happened creating the window - * }); - * ``` - * - * @param label The unique window label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link Window} instance to communicate with the window. - */ - constructor(label: WindowLabel, options?: WindowOptions); - /** - * Gets the Window associated with the given label. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const mainWindow = Window.getByLabel('main'); - * ``` - * - * @param label The window label. - * @returns The Window instance to communicate with the window or null if the window doesn't exist. - */ - static getByLabel(label: string): Promise; - /** - * Get an instance of `Window` for the current window. - */ - static getCurrent(): Window; - /** - * Gets a list of instances of `Window` for all available windows. - */ - static getAll(): Promise; - /** - * Gets the focused window. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const focusedWindow = Window.getFocusedWindow(); - * ``` - * - * @returns The Window instance or `undefined` if there is not any focused window. - */ - static getFocusedWindow(): Promise; - /** - * Listen to an emitted event on this window. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const unlisten = await getCurrentWindow().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - listen(event: EventName, handler: EventCallback): Promise; - /** - * Listen to an emitted event on this window only once. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const unlisten = await getCurrentWindow().once('initialized', (event) => { - * console.log(`Window initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - once(event: EventName, handler: EventCallback): Promise; - /** - * Emits an event to all {@link EventTarget|targets}. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - emit(event: string, payload?: T): Promise; - /** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - emitTo(target: string | EventTarget, event: string, payload?: T): Promise; - /** @ignore */ - _handleTauriEvent(event: string, handler: EventCallback): boolean; - /** - * The scale factor that can be used to map physical pixels to logical pixels. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const factor = await getCurrentWindow().scaleFactor(); - * ``` - * - * @returns The window's monitor scale factor. - */ - scaleFactor(): Promise; - /** - * The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const position = await getCurrentWindow().innerPosition(); - * ``` - * - * @returns The window's inner position. - */ - innerPosition(): Promise; - /** - * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const position = await getCurrentWindow().outerPosition(); - * ``` - * - * @returns The window's outer position. - */ - outerPosition(): Promise; - /** - * The physical size of the window's client area. - * The client area is the content of the window, excluding the title bar and borders. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const size = await getCurrentWindow().innerSize(); - * ``` - * - * @returns The window's inner size. - */ - innerSize(): Promise; - /** - * The physical size of the entire window. - * These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const size = await getCurrentWindow().outerSize(); - * ``` - * - * @returns The window's outer size. - */ - outerSize(): Promise; - /** - * Gets the window's current fullscreen state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const fullscreen = await getCurrentWindow().isFullscreen(); - * ``` - * - * @returns Whether the window is in fullscreen mode or not. - */ - isFullscreen(): Promise; - /** - * Gets the window's current minimized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const minimized = await getCurrentWindow().isMinimized(); - * ``` - */ - isMinimized(): Promise; - /** - * Gets the window's current maximized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const maximized = await getCurrentWindow().isMaximized(); - * ``` - * - * @returns Whether the window is maximized or not. - */ - isMaximized(): Promise; - /** - * Gets the window's current focus state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const focused = await getCurrentWindow().isFocused(); - * ``` - * - * @returns Whether the window is focused or not. - */ - isFocused(): Promise; - /** - * Gets the window's current decorated state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const decorated = await getCurrentWindow().isDecorated(); - * ``` - * - * @returns Whether the window is decorated or not. - */ - isDecorated(): Promise; - /** - * Gets the window's current resizable state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const resizable = await getCurrentWindow().isResizable(); - * ``` - * - * @returns Whether the window is resizable or not. - */ - isResizable(): Promise; - /** - * Gets the window's native maximize button state. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const maximizable = await getCurrentWindow().isMaximizable(); - * ``` - * - * @returns Whether the window's native maximize button is enabled or not. - */ - isMaximizable(): Promise; - /** - * Gets the window's native minimize button state. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const minimizable = await getCurrentWindow().isMinimizable(); - * ``` - * - * @returns Whether the window's native minimize button is enabled or not. - */ - isMinimizable(): Promise; - /** - * Gets the window's native close button state. - * - * #### Platform-specific - * - * - **iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const closable = await getCurrentWindow().isClosable(); - * ``` - * - * @returns Whether the window's native close button is enabled or not. - */ - isClosable(): Promise; - /** - * Gets the window's current visible state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const visible = await getCurrentWindow().isVisible(); - * ``` - * - * @returns Whether the window is visible or not. - */ - isVisible(): Promise; - /** - * Gets the window's current title. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const title = await getCurrentWindow().title(); - * ``` - */ - title(): Promise; - /** - * Gets the window's current theme. - * - * #### Platform-specific - * - * - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const theme = await getCurrentWindow().theme(); - * ``` - * - * @returns The window theme. - */ - theme(): Promise; - /** - * Whether the window is configured to be always on top of other windows or not. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop(); - * ``` - * - * @returns Whether the window is visible or not. - */ - isAlwaysOnTop(): Promise; - /** - * Centers the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().center(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - center(): Promise; - /** - * Requests user attention to the window, this has no effect if the application - * is already focused. How requesting for user attention manifests is platform dependent, - * see `UserAttentionType` for details. - * - * Providing `null` will unset the request for user attention. Unsetting the request for - * user attention might not be done automatically by the WM when the window receives input. - * - * #### Platform-specific - * - * - **macOS:** `null` has no effect. - * - **Linux:** Urgency levels have the same effect. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().requestUserAttention(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - requestUserAttention(requestType: UserAttentionType | null): Promise; - /** - * Updates the window resizable flag. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setResizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setResizable(resizable: boolean): Promise; - /** - * Enable or disable the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setEnabled(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.0.0 - */ - setEnabled(enabled: boolean): Promise; - /** - * Whether the window is enabled or disabled. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setEnabled(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.0.0 - */ - isEnabled(): Promise; - /** - * Sets whether the window's native maximize button is enabled or not. - * If resizable is set to false, this setting is ignored. - * - * #### Platform-specific - * - * - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode. - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMaximizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setMaximizable(maximizable: boolean): Promise; - /** - * Sets whether the window's native minimize button is enabled or not. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMinimizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setMinimizable(minimizable: boolean): Promise; - /** - * Sets whether the window's native close button is enabled or not. - * - * #### Platform-specific - * - * - **Linux:** GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible - * - **iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setClosable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setClosable(closable: boolean): Promise; - /** - * Sets the window title. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setTitle('Tauri'); - * ``` - * - * @param title The new title - * @returns A promise indicating the success or failure of the operation. - */ - setTitle(title: string): Promise; - /** - * Maximizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().maximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - maximize(): Promise; - /** - * Unmaximizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().unmaximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - unmaximize(): Promise; - /** - * Toggles the window maximized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().toggleMaximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - toggleMaximize(): Promise; - /** - * Minimizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().minimize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - minimize(): Promise; - /** - * Unminimizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().unminimize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - unminimize(): Promise; - /** - * Sets the window visibility to true. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().show(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - show(): Promise; - /** - * Sets the window visibility to false. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().hide(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - hide(): Promise; - /** - * Closes the window. - * - * Note this emits a closeRequested event so you can intercept it. To force window close, use {@link Window.destroy}. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().close(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - close(): Promise; - /** - * Destroys the window. Behaves like {@link Window.close} but forces the window close instead of emitting a closeRequested event. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().destroy(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - destroy(): Promise; - /** - * Whether the window should have borders and bars. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setDecorations(false); - * ``` - * - * @param decorations Whether the window should have borders and bars. - * @returns A promise indicating the success or failure of the operation. - */ - setDecorations(decorations: boolean): Promise; - /** - * Whether or not the window should have shadow. - * - * #### Platform-specific - * - * - **Windows:** - * - `false` has no effect on decorated window, shadows are always ON. - * - `true` will make undecorated window have a 1px white border, - * and on Windows 11, it will have a rounded corners. - * - **Linux:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setShadow(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setShadow(enable: boolean): Promise; - /** - * Set window effects. - */ - setEffects(effects: Effects): Promise; - /** - * Clear any applied effects if possible. - */ - clearEffects(): Promise; - /** - * Whether the window should always be on top of other windows. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setAlwaysOnTop(true); - * ``` - * - * @param alwaysOnTop Whether the window should always be on top of other windows or not. - * @returns A promise indicating the success or failure of the operation. - */ - setAlwaysOnTop(alwaysOnTop: boolean): Promise; - /** - * Whether the window should always be below other windows. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setAlwaysOnBottom(true); - * ``` - * - * @param alwaysOnBottom Whether the window should always be below other windows or not. - * @returns A promise indicating the success or failure of the operation. - */ - setAlwaysOnBottom(alwaysOnBottom: boolean): Promise; - /** - * Prevents the window contents from being captured by other apps. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setContentProtected(true); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setContentProtected(protected_: boolean): Promise; - /** - * Resizes the window with a new inner size. - * @example - * ```typescript - * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size. - * @returns A promise indicating the success or failure of the operation. - */ - setSize(size: LogicalSize | PhysicalSize | Size): Promise; - /** - * Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset. - * @example - * ```typescript - * import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMinSize(new PhysicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - setMinSize(size: LogicalSize | PhysicalSize | Size | null | undefined): Promise; - /** - * Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset. - * @example - * ```typescript - * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMaxSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - setMaxSize(size: LogicalSize | PhysicalSize | Size | null | undefined): Promise; - /** - * Sets the window inner size constraints. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSizeConstraints({ minWidth: 300 }); - * ``` - * - * @param constraints The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - setSizeConstraints(constraints: WindowSizeConstraints | null | undefined): Promise; - /** - * Sets the window outer position. - * @example - * ```typescript - * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window'; - * await getCurrentWindow().setPosition(new LogicalPosition(600, 500)); - * ``` - * - * @param position The new position, in logical or physical pixels. - * @returns A promise indicating the success or failure of the operation. - */ - setPosition(position: LogicalPosition | PhysicalPosition | Position): Promise; - /** - * Sets the window fullscreen state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFullscreen(true); - * ``` - * - * @param fullscreen Whether the window should go to fullscreen or not. - * @returns A promise indicating the success or failure of the operation. - */ - setFullscreen(fullscreen: boolean): Promise; - /** - * On macOS, Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won’t work if the window was already in the native fullscreen). - * This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor. - * - * On other platforms, this is the same as {@link Window.setFullscreen}. - * - * @param fullscreen Whether the window should go to simple fullscreen or not. - * @returns A promise indicating the success or failure of the operation. - */ - setSimpleFullscreen(fullscreen: boolean): Promise; - /** - * Bring the window to front and focus. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFocus(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - setFocus(): Promise; - /** - * Sets whether the window can be focused. - * - * #### Platform-specific - * - * - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`. - * In this case, you might consider calling {@link Window.setFocus} but it will move the window to the back i.e. at the bottom in terms of z-order. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFocusable(true); - * ``` - * - * @param focusable Whether the window can be focused. - * @returns A promise indicating the success or failure of the operation. - */ - setFocusable(focusable: boolean): Promise; - /** - * Sets the window icon. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setIcon('/tauri/awesome.png'); - * ``` - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - * - * @param icon Icon bytes or path to the icon file. - * @returns A promise indicating the success or failure of the operation. - */ - setIcon(icon: string | Image | Uint8Array | ArrayBuffer | number[]): Promise; - /** - * Whether the window icon should be hidden from the taskbar or not. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSkipTaskbar(true); - * ``` - * - * @param skip true to hide window icon, false to show it. - * @returns A promise indicating the success or failure of the operation. - */ - setSkipTaskbar(skip: boolean): Promise; - /** - * Grabs the cursor, preventing it from leaving the window. - * - * There's no guarantee that the cursor will be hidden. You should - * hide it by yourself if you want so. - * - * #### Platform-specific - * - * - **Linux:** Unsupported. - * - **macOS:** This locks the cursor in a fixed location, which looks visually awkward. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorGrab(true); - * ``` - * - * @param grab `true` to grab the cursor icon, `false` to release it. - * @returns A promise indicating the success or failure of the operation. - */ - setCursorGrab(grab: boolean): Promise; - /** - * Modifies the cursor's visibility. - * - * #### Platform-specific - * - * - **Windows:** The cursor is only hidden within the confines of the window. - * - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is - * outside of the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorVisible(false); - * ``` - * - * @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor. - * @returns A promise indicating the success or failure of the operation. - */ - setCursorVisible(visible: boolean): Promise; - /** - * Modifies the cursor icon of the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorIcon('help'); - * ``` - * - * @param icon The new cursor icon. - * @returns A promise indicating the success or failure of the operation. - */ - setCursorIcon(icon: CursorIcon): Promise; - /** - * Sets the window background color. - * - * #### Platform-specific: - * - * - **Windows:** alpha channel is ignored. - * - **iOS / Android:** Unsupported. - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - setBackgroundColor(color: Color): Promise; - /** - * Changes the position of the cursor in window coordinates. - * @example - * ```typescript - * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300)); - * ``` - * - * @param position The new cursor position. - * @returns A promise indicating the success or failure of the operation. - */ - setCursorPosition(position: LogicalPosition | PhysicalPosition | Position): Promise; - /** - * Changes the cursor events behavior. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setIgnoreCursorEvents(true); - * ``` - * - * @param ignore `true` to ignore the cursor events; `false` to process them as usual. - * @returns A promise indicating the success or failure of the operation. - */ - setIgnoreCursorEvents(ignore: boolean): Promise; - /** - * Starts dragging the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().startDragging(); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - startDragging(): Promise; - /** - * Starts resize-dragging the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().startResizeDragging(); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - startResizeDragging(direction: ResizeDirection): Promise; - /** - * Sets the badge count. It is app wide and not specific to this window. - * - * #### Platform-specific - * - * - **Windows**: Unsupported. Use @{linkcode Window.setOverlayIcon} instead. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setBadgeCount(5); - * ``` - * - * @param count The badge count. Use `undefined` to remove the badge. - * @return A promise indicating the success or failure of the operation. - */ - setBadgeCount(count?: number): Promise; - /** - * Sets the badge cont **macOS only**. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setBadgeLabel("Hello"); - * ``` - * - * @param label The badge label. Use `undefined` to remove the badge. - * @return A promise indicating the success or failure of the operation. - */ - setBadgeLabel(label?: string): Promise; - /** - * Sets the overlay icon. **Windows only** - * The overlay icon can be set for every window. - * - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setOverlayIcon("/tauri/awesome.png"); - * ``` - * - * @param icon Icon bytes or path to the icon file. Use `undefined` to remove the overlay icon. - * @return A promise indicating the success or failure of the operation. - */ - setOverlayIcon(icon?: string | Image | Uint8Array | ArrayBuffer | number[]): Promise; - /** - * Sets the taskbar progress state. - * - * #### Platform-specific - * - * - **Linux / macOS**: Progress bar is app-wide and not specific to this window. - * - **Linux**: Only supported desktop environments with `libunity` (e.g. GNOME). - * - * @example - * ```typescript - * import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window'; - * await getCurrentWindow().setProgressBar({ - * status: ProgressBarStatus.Normal, - * progress: 50, - * }); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - setProgressBar(state: ProgressBarState): Promise; - /** - * Sets whether the window should be visible on all workspaces or virtual desktops. - * - * #### Platform-specific - * - * - **Windows / iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ - setVisibleOnAllWorkspaces(visible: boolean): Promise; - /** - * Sets the title bar style. **macOS only**. - * - * @since 2.0.0 - */ - setTitleBarStyle(style: TitleBarStyle): Promise; - /** - * Set window theme, pass in `null` or `undefined` to follow system theme - * - * #### Platform-specific - * - * - **Linux / macOS**: Theme is app-wide and not specific to this window. - * - **iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ - setTheme(theme?: Theme | null): Promise; - /** - * Listen to window resize. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onResized(({ payload: size }) => { - * console.log('Window resized', size); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onResized(handler: EventCallback): Promise; - /** - * Listen to window move. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => { - * console.log('Window moved', position); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onMoved(handler: EventCallback): Promise; - /** - * Listen to window close requested. Emitted when the user requests to closes the window. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * import { confirm } from '@tauri-apps/api/dialog'; - * const unlisten = await getCurrentWindow().onCloseRequested(async (event) => { - * const confirmed = await confirm('Are you sure?'); - * if (!confirmed) { - * // user did not confirm closing the window; let's prevent it - * event.preventDefault(); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onCloseRequested(handler: (event: CloseRequestedEvent) => void | Promise): Promise; - /** - * Listen to a file drop event. - * The listener is triggered when the user hovers the selected files on the webview, - * drops the files or cancels the operation. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrentWindow().onDragDropEvent((event) => { - * if (event.payload.type === 'over') { - * console.log('User hovering', event.payload.position); - * } else if (event.payload.type === 'drop') { - * console.log('User dropped', event.payload.paths); - * } else { - * console.log('File drop cancelled'); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onDragDropEvent(handler: EventCallback): Promise; - /** - * Listen to window focus change. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => { - * console.log('Focus changed, window is focused? ' + focused); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onFocusChanged(handler: EventCallback): Promise; - /** - * Listen to window scale change. Emitted when the window's scale factor has changed. - * The following user actions can cause DPI changes: - * - Changing the display's resolution. - * - Changing the display's scale factor (e.g. in Control Panel on Windows). - * - Moving the window to a display with a different scale factor. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => { - * console.log('Scale changed', payload.scaleFactor, payload.size); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onScaleChanged(handler: EventCallback): Promise; - /** - * Listen to the system theme change. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => { - * console.log('New theme: ' + theme); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - onThemeChanged(handler: EventCallback): Promise; -} -/** - * An RGBA color. Each value has minimum of 0 and maximum of 255. - * - * It can be either a string `#ffffff`, an array of 3 or 4 elements or an object. - * - * @since 2.0.0 - */ -type Color = [number, number, number] | [number, number, number, number] | { - red: number; - green: number; - blue: number; - alpha: number; -} | string; -/** - * Background throttling policy - * - * @since 2.0.0 - */ -declare enum BackgroundThrottlingPolicy { - Disabled = "disabled", - Throttle = "throttle", - Suspend = "suspend" -} -/** - * The scrollbar style to use in the webview. - * - * ## Platform-specific - * - * **Windows**: This option must be given the same value for all webviews. - * - * @since 2.8.0 - */ -declare enum ScrollBarStyle { - /** - * The default scrollbar style for the webview. - */ - Default = "default", - /** - * Fluent UI style overlay scrollbars. **Windows Only** - * - * Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions, - * see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541 - */ - FluentOverlay = "fluentOverlay" -} -/** - * Platform-specific window effects - * - * @since 2.0.0 - */ -declare enum Effect { - /** - * A default material appropriate for the view's effectiveAppearance. **macOS 10.14-** - * - * @deprecated since macOS 10.14. You should instead choose an appropriate semantic material. - */ - AppearanceBased = "appearanceBased", - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Light = "light", - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Dark = "dark", - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - MediumLight = "mediumLight", - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - UltraDark = "ultraDark", - /** - * **macOS 10.10+** - */ - Titlebar = "titlebar", - /** - * **macOS 10.10+** - */ - Selection = "selection", - /** - * **macOS 10.11+** - */ - Menu = "menu", - /** - * **macOS 10.11+** - */ - Popover = "popover", - /** - * **macOS 10.11+** - */ - Sidebar = "sidebar", - /** - * **macOS 10.14+** - */ - HeaderView = "headerView", - /** - * **macOS 10.14+** - */ - Sheet = "sheet", - /** - * **macOS 10.14+** - */ - WindowBackground = "windowBackground", - /** - * **macOS 10.14+** - */ - HudWindow = "hudWindow", - /** - * **macOS 10.14+** - */ - FullScreenUI = "fullScreenUI", - /** - * **macOS 10.14+** - */ - Tooltip = "tooltip", - /** - * **macOS 10.14+** - */ - ContentBackground = "contentBackground", - /** - * **macOS 10.14+** - */ - UnderWindowBackground = "underWindowBackground", - /** - * **macOS 10.14+** - */ - UnderPageBackground = "underPageBackground", - /** - * **Windows 11 Only** - */ - Mica = "mica", - /** - * **Windows 7/10/11(22H1) Only** - * - * #### Notes - * - * This effect has bad performance when resizing/dragging the window on Windows 11 build 22621. - */ - Blur = "blur", - /** - * **Windows 10/11** - * - * #### Notes - * - * This effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000. - */ - Acrylic = "acrylic", - /** - * Tabbed effect that matches the system dark preference **Windows 11 Only** - */ - Tabbed = "tabbed", - /** - * Tabbed effect with dark mode but only if dark mode is enabled on the system **Windows 11 Only** - */ - TabbedDark = "tabbedDark", - /** - * Tabbed effect with light mode **Windows 11 Only** - */ - TabbedLight = "tabbedLight" -} -/** - * Window effect state **macOS only** - * - * @see https://developer.apple.com/documentation/appkit/nsvisualeffectview/state - * - * @since 2.0.0 - */ -declare enum EffectState { - /** - * Make window effect state follow the window's active state **macOS only** - */ - FollowsWindowActiveState = "followsWindowActiveState", - /** - * Make window effect state always active **macOS only** - */ - Active = "active", - /** - * Make window effect state always inactive **macOS only** - */ - Inactive = "inactive" -} -/** The window effects configuration object - * - * @since 2.0.0 - */ -interface Effects { - /** - * List of Window effects to apply to the Window. - * Conflicting effects will apply the first one and ignore the rest. - */ - effects: Effect[]; - /** - * Window effect state **macOS Only** - */ - state?: EffectState; - /** - * Window effect corner radius **macOS Only** - */ - radius?: number; - /** - * Window effect color. Affects {@link Effect.Blur} and {@link Effect.Acrylic} only - * on Windows 10 v1903+. Doesn't have any effect on Windows 7 or Windows 11. - */ - color?: Color; -} -/** - * Minimum margin to work area - */ -interface PreventOverflowMargin { - width: number; - height: number; -} -/** - * Configuration for the window to create. - * - * @since 1.0.0 - */ -interface WindowOptions { - /** Show window in the center of the screen.. */ - center?: boolean; - /** The initial vertical position in logical pixels. Only applies if `y` is also set. */ - x?: number; - /** The initial horizontal position in logical pixels. Only applies if `x` is also set. */ - y?: number; - /** The initial width in logical pixels. */ - width?: number; - /** The initial height in logical pixels. */ - height?: number; - /** The minimum width in logical pixels. Only applies if `minHeight` is also set. */ - minWidth?: number; - /** The minimum height in logical pixels. Only applies if `minWidth` is also set. */ - minHeight?: number; - /** The maximum width in logical pixels. Only applies if `maxHeight` is also set. */ - maxWidth?: number; - /** The maximum height in logical pixels. Only applies if `maxWidth` is also set. */ - maxHeight?: number; - /** - * Prevent the window from overflowing the working area (e.g. monitor size - taskbar size) - * on creation, which means the window size will be limited to `monitor size - taskbar size` - * - * Can either be set to `true` or to a {@link PreventOverflowMargin} object to set an additional margin - * that should be considered to determine the working area - * (in this case the window size will be limited to `monitor size - taskbar size - margin`) - * - * **NOTE**: The overflow check is only performed on window creation, resizes can still overflow - * - * #### Platform-specific - * - * - **iOS / Android:** Unsupported. - */ - preventOverflow?: boolean | PreventOverflowMargin; - /** Whether the window is resizable or not. */ - resizable?: boolean; - /** Window title. */ - title?: string; - /** Whether the window is in fullscreen mode or not. */ - fullscreen?: boolean; - /** Whether the window will be initially focused or not. */ - focus?: boolean; - /** Whether the window can be focused or not. */ - focusable?: boolean; - /** - * Whether the window is transparent or not. - * Note that on `macOS` this requires the `macos-private-api` feature flag, enabled under `tauri.conf.json > app > macOSPrivateApi`. - * WARNING: Using private APIs on `macOS` prevents your application from being accepted to the `App Store`. - */ - transparent?: boolean; - /** Whether the window should be maximized upon creation or not. */ - maximized?: boolean; - /** Whether the window should be immediately visible upon creation or not. */ - visible?: boolean; - /** Whether the window should have borders and bars or not. */ - decorations?: boolean; - /** Whether the window should always be on top of other windows or not. */ - alwaysOnTop?: boolean; - /** Whether the window should always be below other windows. */ - alwaysOnBottom?: boolean; - /** Prevents the window contents from being captured by other apps. */ - contentProtected?: boolean; - /** Whether or not the window icon should be added to the taskbar. */ - skipTaskbar?: boolean; - /** - * Whether or not the window has shadow. - * - * #### Platform-specific - * - * - **Windows:** - * - `false` has no effect on decorated window, shadows are always ON. - * - `true` will make undecorated window have a 1px white border, - * and on Windows 11, it will have a rounded corners. - * - **Linux:** Unsupported. - * - * @since 2.0.0 - */ - shadow?: boolean; - /** - * The initial window theme. Defaults to the system theme. - * - * Only implemented on Windows and macOS 10.14+. - */ - theme?: Theme; - /** - * The style of the macOS title bar. - */ - titleBarStyle?: TitleBarStyle; - /** - * The position of the window controls on macOS. - * - * Requires `titleBarStyle: 'overlay'` and `decorations: true`. - * - * @since 2.4.0 - */ - trafficLightPosition?: LogicalPosition; - /** - * If `true`, sets the window title to be hidden on macOS. - */ - hiddenTitle?: boolean; - /** - * Defines the window [tabbing identifier](https://developer.apple.com/documentation/appkit/nswindow/1644704-tabbingidentifier) on macOS. - * - * Windows with the same tabbing identifier will be grouped together. - * If the tabbing identifier is not set, automatic tabbing will be disabled. - */ - tabbingIdentifier?: string; - /** - * Whether the window's native maximize button is enabled or not. Defaults to `true`. - */ - maximizable?: boolean; - /** - * Whether the window's native minimize button is enabled or not. Defaults to `true`. - */ - minimizable?: boolean; - /** - * Whether the window's native close button is enabled or not. Defaults to `true`. - */ - closable?: boolean; - /** - * Sets a parent to the window to be created. Can be either a {@linkcode Window} or a label of the window. - * - * #### Platform-specific - * - * - **Windows**: This sets the passed parent as an owner window to the window to be created. - * From [MSDN owned windows docs](https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features#owned-windows): - * - An owned window is always above its owner in the z-order. - * - The system automatically destroys an owned window when its owner is destroyed. - * - An owned window is hidden when its owner is minimized. - * - **Linux**: This makes the new window transient for parent, see - * - **macOS**: This adds the window as a child of parent, see - */ - parent?: Window | WebviewWindow | string; - /** Whether the window should be visible on all workspaces or virtual desktops. - * - * #### Platform-specific - * - * - **Windows / iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ - visibleOnAllWorkspaces?: boolean; - /** - * Window effects. - * - * Requires the window to be transparent. - * - * #### Platform-specific: - * - * - **Windows**: If using decorations or shadows, you may want to try this workaround - * - **Linux**: Unsupported - */ - windowEffects?: Effects; - /** - * Set the window background color. - * - * #### Platform-specific: - * - * - **Android / iOS:** Unsupported. - * - **Windows**: alpha channel is ignored. - * - * @since 2.1.0 - */ - backgroundColor?: Color; - /** Change the default background throttling behaviour. - * - * ## Platform-specific - * - * - **Linux / Windows / Android**: Unsupported. Workarounds like a pending WebLock transaction might suffice. - * - **iOS**: Supported since version 17.0+. - * - **macOS**: Supported since version 14.0+. - * - * see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578 - * - * @since 2.3.0 - */ - backgroundThrottling?: BackgroundThrottlingPolicy; - /** - * Whether we should disable JavaScript code execution on the webview or not. - */ - javascriptDisabled?: boolean; - /** - * on macOS and iOS there is a link preview on long pressing links, this is enabled by default. - * see https://docs.rs/objc2-web-kit/latest/objc2_web_kit/struct.WKWebView.html#method.allowsLinkPreview - */ - allowLinkPreview?: boolean; - /** - * Allows disabling the input accessory view on iOS. - * - * The accessory view is the view that appears above the keyboard when a text input element is focused. - * It usually displays a view with "Done", "Next" buttons. - */ - disableInputAccessoryView?: boolean; - /** - * Specifies the native scrollbar style to use with the webview. - * CSS styles that modify the scrollbar are applied on top of the native appearance configured here. - * - * Defaults to `default`, which is the browser default. - * - * ## Platform-specific - * - * - **Windows**: - * - `fluentOverlay` requires WebView2 Runtime version 125.0.2535.41 or higher, and does nothing - * on older versions. - * - This option must be given the same value for all webviews. - * - **Linux / Android / iOS / macOS**: Unsupported. Only supports `Default` and performs no operation. - */ - scrollBarStyle?: ScrollBarStyle; -} -/** - * Returns the monitor on which the window currently resides. - * Returns `null` if current monitor can't be detected. - * @example - * ```typescript - * import { currentMonitor } from '@tauri-apps/api/window'; - * const monitor = await currentMonitor(); - * ``` - * - * @since 1.0.0 - */ -declare function currentMonitor(): Promise; -/** - * Returns the primary monitor of the system. - * Returns `null` if it can't identify any monitor as a primary one. - * @example - * ```typescript - * import { primaryMonitor } from '@tauri-apps/api/window'; - * const monitor = await primaryMonitor(); - * ``` - * - * @since 1.0.0 - */ -declare function primaryMonitor(): Promise; -/** - * Returns the monitor that contains the given point. Returns `null` if can't find any. - * @example - * ```typescript - * import { monitorFromPoint } from '@tauri-apps/api/window'; - * const monitor = await monitorFromPoint(100.0, 200.0); - * ``` - * - * @since 1.0.0 - */ -declare function monitorFromPoint(x: number, y: number): Promise; -/** - * Returns the list of all the monitors available on the system. - * @example - * ```typescript - * import { availableMonitors } from '@tauri-apps/api/window'; - * const monitors = await availableMonitors(); - * ``` - * - * @since 1.0.0 - */ -declare function availableMonitors(): Promise; -/** - * Get the cursor position relative to the top-left hand corner of the desktop. - * - * Note that the top-left hand corner of the desktop is not necessarily the same as the screen. - * If the user uses a desktop with multiple monitors, - * the top-left hand corner of the desktop is the top-left hand corner of the main monitor on Windows and macOS - * or the top-left of the leftmost monitor on X11. - * - * The coordinates can be negative if the top-left hand corner of the window is outside of the visible screen region. - */ -declare function cursorPosition(): Promise; -export { Window, CloseRequestedEvent, getCurrentWindow, getAllWindows, LogicalSize, PhysicalSize, LogicalPosition, PhysicalPosition, UserAttentionType, Effect, EffectState, currentMonitor, monitorFromPoint, primaryMonitor, availableMonitors, cursorPosition }; -export type { Effects, Theme, TitleBarStyle, ScaleFactorChanged, WindowOptions, Color, BackgroundThrottlingPolicy, DragDropEvent, ScrollBarStyle }; diff --git a/node_modules/@tauri-apps/api/window.js b/node_modules/@tauri-apps/api/window.js deleted file mode 100644 index d775577..0000000 --- a/node_modules/@tauri-apps/api/window.js +++ /dev/null @@ -1,2038 +0,0 @@ -import { PhysicalPosition, PhysicalSize, Size, Position } from './dpi.js'; -export { LogicalPosition, LogicalSize } from './dpi.js'; -import { listen, once, emit, emitTo, TauriEvent } from './event.js'; -import { invoke } from './core.js'; -import { transformImage } from './image.js'; - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Provides APIs to create windows, communicate with other windows and manipulate the current window. - * - * #### Window events - * - * Events can be listened to using {@link Window.listen}: - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * getCurrentWindow().listen("my-window-event", ({ event, payload }) => { }); - * ``` - * - * @module - */ -/** - * Attention type to request on a window. - * - * @since 1.0.0 - */ -var UserAttentionType; -(function (UserAttentionType) { - /** - * #### Platform-specific - * - **macOS:** Bounces the dock icon until the application is in focus. - * - **Windows:** Flashes both the window and the taskbar button until the application is in focus. - */ - UserAttentionType[UserAttentionType["Critical"] = 1] = "Critical"; - /** - * #### Platform-specific - * - **macOS:** Bounces the dock icon once. - * - **Windows:** Flashes the taskbar button until the application is in focus. - */ - UserAttentionType[UserAttentionType["Informational"] = 2] = "Informational"; -})(UserAttentionType || (UserAttentionType = {})); -class CloseRequestedEvent { - constructor(event) { - this._preventDefault = false; - this.event = event.event; - this.id = event.id; - } - preventDefault() { - this._preventDefault = true; - } - isPreventDefault() { - return this._preventDefault; - } -} -var ProgressBarStatus; -(function (ProgressBarStatus) { - /** - * Hide progress bar. - */ - ProgressBarStatus["None"] = "none"; - /** - * Normal state. - */ - ProgressBarStatus["Normal"] = "normal"; - /** - * Indeterminate state. **Treated as Normal on Linux and macOS** - */ - ProgressBarStatus["Indeterminate"] = "indeterminate"; - /** - * Paused state. **Treated as Normal on Linux** - */ - ProgressBarStatus["Paused"] = "paused"; - /** - * Error state. **Treated as Normal on linux** - */ - ProgressBarStatus["Error"] = "error"; -})(ProgressBarStatus || (ProgressBarStatus = {})); -/** - * Get an instance of `Window` for the current window. - * - * @since 1.0.0 - */ -function getCurrentWindow() { - return new Window(window.__TAURI_INTERNALS__.metadata.currentWindow.label, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }); -} -/** - * Gets a list of instances of `Window` for all available windows. - * - * @since 1.0.0 - */ -async function getAllWindows() { - return invoke('plugin:window|get_all_windows').then((windows) => windows.map((w) => new Window(w, { - // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor - skip: true - }))); -} -/** @ignore */ -// events that are emitted right here instead of by the created window -const localTauriEvents = ['tauri://created', 'tauri://error']; -/** - * Create new window or get a handle to an existing one. - * - * Windows are identified by a *label* a unique identifier that can be used to reference it later. - * It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`. - * - * @example - * ```typescript - * import { Window } from "@tauri-apps/api/window" - * - * const appWindow = new Window('theUniqueLabel'); - * - * appWindow.once('tauri://created', function () { - * // window successfully created - * }); - * appWindow.once('tauri://error', function (e) { - * // an error happened creating the window - * }); - * - * // emit an event to the backend - * await appWindow.emit("some-event", "data"); - * // listen to an event from the backend - * const unlisten = await appWindow.listen("event-name", e => {}); - * unlisten(); - * ``` - * - * @since 2.0.0 - */ -class Window { - /** - * Creates a new Window. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const appWindow = new Window('my-label'); - * appWindow.once('tauri://created', function () { - * // window successfully created - * }); - * appWindow.once('tauri://error', function (e) { - * // an error happened creating the window - * }); - * ``` - * - * @param label The unique window label. Must be alphanumeric: `a-zA-Z-/:_`. - * @returns The {@link Window} instance to communicate with the window. - */ - constructor(label, options = {}) { - var _a; - this.label = label; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - this.listeners = Object.create(null); - // @ts-expect-error `skip` is not a public API so it is not defined in WindowOptions - if (!(options === null || options === void 0 ? void 0 : options.skip)) { - invoke('plugin:window|create', { - options: { - ...options, - parent: typeof options.parent === 'string' - ? options.parent - : (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label, - label - } - }) - .then(async () => this.emit('tauri://created')) - .catch(async (e) => this.emit('tauri://error', e)); - } - } - /** - * Gets the Window associated with the given label. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const mainWindow = Window.getByLabel('main'); - * ``` - * - * @param label The window label. - * @returns The Window instance to communicate with the window or null if the window doesn't exist. - */ - static async getByLabel(label) { - var _a; - return (_a = (await getAllWindows()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null; - } - /** - * Get an instance of `Window` for the current window. - */ - static getCurrent() { - return getCurrentWindow(); - } - /** - * Gets a list of instances of `Window` for all available windows. - */ - static async getAll() { - return getAllWindows(); - } - /** - * Gets the focused window. - * @example - * ```typescript - * import { Window } from '@tauri-apps/api/window'; - * const focusedWindow = Window.getFocusedWindow(); - * ``` - * - * @returns The Window instance or `undefined` if there is not any focused window. - */ - static async getFocusedWindow() { - for (const w of await getAllWindows()) { - if (await w.isFocused()) { - return w; - } - } - return null; - } - /** - * Listen to an emitted event on this window. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const unlisten = await getCurrentWindow().listen('state-changed', (event) => { - * console.log(`Got error: ${payload}`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async listen(event, handler) { - if (this._handleTauriEvent(event, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return listen(event, handler, { - target: { kind: 'Window', label: this.label } - }); - } - /** - * Listen to an emitted event on this window only once. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const unlisten = await getCurrentWindow().once('initialized', (event) => { - * console.log(`Window initialized!`); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param handler Event handler. - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async once(event, handler) { - if (this._handleTauriEvent(event, handler)) { - return () => { - // eslint-disable-next-line security/detect-object-injection - const listeners = this.listeners[event]; - listeners.splice(listeners.indexOf(handler), 1); - }; - } - return once(event, handler, { - target: { kind: 'Window', label: this.label } - }); - } - /** - * Emits an event to all {@link EventTarget|targets}. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emit(event, payload) { - if (localTauriEvents.includes(event)) { - // eslint-disable-next-line - for (const handler of this.listeners[event] || []) { - handler({ - event, - id: -1, - payload - }); - } - return; - } - return emit(event, payload); - } - /** - * Emits an event to all {@link EventTarget|targets} matching the given target. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' }); - * ``` - * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object. - * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. - * @param payload Event payload. - */ - async emitTo(target, event, payload) { - if (localTauriEvents.includes(event)) { - // eslint-disable-next-line security/detect-object-injection - for (const handler of this.listeners[event] || []) { - handler({ - event, - id: -1, - payload - }); - } - return; - } - return emitTo(target, event, payload); - } - /** @ignore */ - _handleTauriEvent(event, handler) { - if (localTauriEvents.includes(event)) { - if (!(event in this.listeners)) { - // eslint-disable-next-line - this.listeners[event] = [handler]; - } - else { - // eslint-disable-next-line - this.listeners[event].push(handler); - } - return true; - } - return false; - } - // Getters - /** - * The scale factor that can be used to map physical pixels to logical pixels. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const factor = await getCurrentWindow().scaleFactor(); - * ``` - * - * @returns The window's monitor scale factor. - */ - async scaleFactor() { - return invoke('plugin:window|scale_factor', { - label: this.label - }); - } - /** - * The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const position = await getCurrentWindow().innerPosition(); - * ``` - * - * @returns The window's inner position. - */ - async innerPosition() { - return invoke('plugin:window|inner_position', { - label: this.label - }).then((p) => new PhysicalPosition(p)); - } - /** - * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const position = await getCurrentWindow().outerPosition(); - * ``` - * - * @returns The window's outer position. - */ - async outerPosition() { - return invoke('plugin:window|outer_position', { - label: this.label - }).then((p) => new PhysicalPosition(p)); - } - /** - * The physical size of the window's client area. - * The client area is the content of the window, excluding the title bar and borders. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const size = await getCurrentWindow().innerSize(); - * ``` - * - * @returns The window's inner size. - */ - async innerSize() { - return invoke('plugin:window|inner_size', { - label: this.label - }).then((s) => new PhysicalSize(s)); - } - /** - * The physical size of the entire window. - * These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const size = await getCurrentWindow().outerSize(); - * ``` - * - * @returns The window's outer size. - */ - async outerSize() { - return invoke('plugin:window|outer_size', { - label: this.label - }).then((s) => new PhysicalSize(s)); - } - /** - * Gets the window's current fullscreen state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const fullscreen = await getCurrentWindow().isFullscreen(); - * ``` - * - * @returns Whether the window is in fullscreen mode or not. - */ - async isFullscreen() { - return invoke('plugin:window|is_fullscreen', { - label: this.label - }); - } - /** - * Gets the window's current minimized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const minimized = await getCurrentWindow().isMinimized(); - * ``` - */ - async isMinimized() { - return invoke('plugin:window|is_minimized', { - label: this.label - }); - } - /** - * Gets the window's current maximized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const maximized = await getCurrentWindow().isMaximized(); - * ``` - * - * @returns Whether the window is maximized or not. - */ - async isMaximized() { - return invoke('plugin:window|is_maximized', { - label: this.label - }); - } - /** - * Gets the window's current focus state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const focused = await getCurrentWindow().isFocused(); - * ``` - * - * @returns Whether the window is focused or not. - */ - async isFocused() { - return invoke('plugin:window|is_focused', { - label: this.label - }); - } - /** - * Gets the window's current decorated state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const decorated = await getCurrentWindow().isDecorated(); - * ``` - * - * @returns Whether the window is decorated or not. - */ - async isDecorated() { - return invoke('plugin:window|is_decorated', { - label: this.label - }); - } - /** - * Gets the window's current resizable state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const resizable = await getCurrentWindow().isResizable(); - * ``` - * - * @returns Whether the window is resizable or not. - */ - async isResizable() { - return invoke('plugin:window|is_resizable', { - label: this.label - }); - } - /** - * Gets the window's native maximize button state. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const maximizable = await getCurrentWindow().isMaximizable(); - * ``` - * - * @returns Whether the window's native maximize button is enabled or not. - */ - async isMaximizable() { - return invoke('plugin:window|is_maximizable', { - label: this.label - }); - } - /** - * Gets the window's native minimize button state. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const minimizable = await getCurrentWindow().isMinimizable(); - * ``` - * - * @returns Whether the window's native minimize button is enabled or not. - */ - async isMinimizable() { - return invoke('plugin:window|is_minimizable', { - label: this.label - }); - } - /** - * Gets the window's native close button state. - * - * #### Platform-specific - * - * - **iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const closable = await getCurrentWindow().isClosable(); - * ``` - * - * @returns Whether the window's native close button is enabled or not. - */ - async isClosable() { - return invoke('plugin:window|is_closable', { - label: this.label - }); - } - /** - * Gets the window's current visible state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const visible = await getCurrentWindow().isVisible(); - * ``` - * - * @returns Whether the window is visible or not. - */ - async isVisible() { - return invoke('plugin:window|is_visible', { - label: this.label - }); - } - /** - * Gets the window's current title. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const title = await getCurrentWindow().title(); - * ``` - */ - async title() { - return invoke('plugin:window|title', { - label: this.label - }); - } - /** - * Gets the window's current theme. - * - * #### Platform-specific - * - * - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const theme = await getCurrentWindow().theme(); - * ``` - * - * @returns The window theme. - */ - async theme() { - return invoke('plugin:window|theme', { - label: this.label - }); - } - /** - * Whether the window is configured to be always on top of other windows or not. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop(); - * ``` - * - * @returns Whether the window is visible or not. - */ - async isAlwaysOnTop() { - return invoke('plugin:window|is_always_on_top', { - label: this.label - }); - } - // Setters - /** - * Centers the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().center(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async center() { - return invoke('plugin:window|center', { - label: this.label - }); - } - /** - * Requests user attention to the window, this has no effect if the application - * is already focused. How requesting for user attention manifests is platform dependent, - * see `UserAttentionType` for details. - * - * Providing `null` will unset the request for user attention. Unsetting the request for - * user attention might not be done automatically by the WM when the window receives input. - * - * #### Platform-specific - * - * - **macOS:** `null` has no effect. - * - **Linux:** Urgency levels have the same effect. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().requestUserAttention(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async requestUserAttention(requestType) { - let requestType_ = null; - if (requestType) { - if (requestType === UserAttentionType.Critical) { - requestType_ = { type: 'Critical' }; - } - else { - requestType_ = { type: 'Informational' }; - } - } - return invoke('plugin:window|request_user_attention', { - label: this.label, - value: requestType_ - }); - } - /** - * Updates the window resizable flag. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setResizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setResizable(resizable) { - return invoke('plugin:window|set_resizable', { - label: this.label, - value: resizable - }); - } - /** - * Enable or disable the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setEnabled(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.0.0 - */ - async setEnabled(enabled) { - return invoke('plugin:window|set_enabled', { - label: this.label, - value: enabled - }); - } - /** - * Whether the window is enabled or disabled. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setEnabled(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.0.0 - */ - async isEnabled() { - return invoke('plugin:window|is_enabled', { - label: this.label - }); - } - /** - * Sets whether the window's native maximize button is enabled or not. - * If resizable is set to false, this setting is ignored. - * - * #### Platform-specific - * - * - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode. - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMaximizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setMaximizable(maximizable) { - return invoke('plugin:window|set_maximizable', { - label: this.label, - value: maximizable - }); - } - /** - * Sets whether the window's native minimize button is enabled or not. - * - * #### Platform-specific - * - * - **Linux / iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMinimizable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setMinimizable(minimizable) { - return invoke('plugin:window|set_minimizable', { - label: this.label, - value: minimizable - }); - } - /** - * Sets whether the window's native close button is enabled or not. - * - * #### Platform-specific - * - * - **Linux:** GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible - * - **iOS / Android:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setClosable(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setClosable(closable) { - return invoke('plugin:window|set_closable', { - label: this.label, - value: closable - }); - } - /** - * Sets the window title. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setTitle('Tauri'); - * ``` - * - * @param title The new title - * @returns A promise indicating the success or failure of the operation. - */ - async setTitle(title) { - return invoke('plugin:window|set_title', { - label: this.label, - value: title - }); - } - /** - * Maximizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().maximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async maximize() { - return invoke('plugin:window|maximize', { - label: this.label - }); - } - /** - * Unmaximizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().unmaximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async unmaximize() { - return invoke('plugin:window|unmaximize', { - label: this.label - }); - } - /** - * Toggles the window maximized state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().toggleMaximize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async toggleMaximize() { - return invoke('plugin:window|toggle_maximize', { - label: this.label - }); - } - /** - * Minimizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().minimize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async minimize() { - return invoke('plugin:window|minimize', { - label: this.label - }); - } - /** - * Unminimizes the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().unminimize(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async unminimize() { - return invoke('plugin:window|unminimize', { - label: this.label - }); - } - /** - * Sets the window visibility to true. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().show(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async show() { - return invoke('plugin:window|show', { - label: this.label - }); - } - /** - * Sets the window visibility to false. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().hide(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async hide() { - return invoke('plugin:window|hide', { - label: this.label - }); - } - /** - * Closes the window. - * - * Note this emits a closeRequested event so you can intercept it. To force window close, use {@link Window.destroy}. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().close(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async close() { - return invoke('plugin:window|close', { - label: this.label - }); - } - /** - * Destroys the window. Behaves like {@link Window.close} but forces the window close instead of emitting a closeRequested event. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().destroy(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async destroy() { - return invoke('plugin:window|destroy', { - label: this.label - }); - } - /** - * Whether the window should have borders and bars. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setDecorations(false); - * ``` - * - * @param decorations Whether the window should have borders and bars. - * @returns A promise indicating the success or failure of the operation. - */ - async setDecorations(decorations) { - return invoke('plugin:window|set_decorations', { - label: this.label, - value: decorations - }); - } - /** - * Whether or not the window should have shadow. - * - * #### Platform-specific - * - * - **Windows:** - * - `false` has no effect on decorated window, shadows are always ON. - * - `true` will make undecorated window have a 1px white border, - * and on Windows 11, it will have a rounded corners. - * - **Linux:** Unsupported. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setShadow(false); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setShadow(enable) { - return invoke('plugin:window|set_shadow', { - label: this.label, - value: enable - }); - } - /** - * Set window effects. - */ - async setEffects(effects) { - return invoke('plugin:window|set_effects', { - label: this.label, - value: effects - }); - } - /** - * Clear any applied effects if possible. - */ - async clearEffects() { - return invoke('plugin:window|set_effects', { - label: this.label, - value: null - }); - } - /** - * Whether the window should always be on top of other windows. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setAlwaysOnTop(true); - * ``` - * - * @param alwaysOnTop Whether the window should always be on top of other windows or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setAlwaysOnTop(alwaysOnTop) { - return invoke('plugin:window|set_always_on_top', { - label: this.label, - value: alwaysOnTop - }); - } - /** - * Whether the window should always be below other windows. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setAlwaysOnBottom(true); - * ``` - * - * @param alwaysOnBottom Whether the window should always be below other windows or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setAlwaysOnBottom(alwaysOnBottom) { - return invoke('plugin:window|set_always_on_bottom', { - label: this.label, - value: alwaysOnBottom - }); - } - /** - * Prevents the window contents from being captured by other apps. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setContentProtected(true); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setContentProtected(protected_) { - return invoke('plugin:window|set_content_protected', { - label: this.label, - value: protected_ - }); - } - /** - * Resizes the window with a new inner size. - * @example - * ```typescript - * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size. - * @returns A promise indicating the success or failure of the operation. - */ - async setSize(size) { - return invoke('plugin:window|set_size', { - label: this.label, - value: size instanceof Size ? size : new Size(size) - }); - } - /** - * Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset. - * @example - * ```typescript - * import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMinSize(new PhysicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - async setMinSize(size) { - return invoke('plugin:window|set_min_size', { - label: this.label, - value: size instanceof Size ? size : size ? new Size(size) : null - }); - } - /** - * Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset. - * @example - * ```typescript - * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window'; - * await getCurrentWindow().setMaxSize(new LogicalSize(600, 500)); - * ``` - * - * @param size The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - async setMaxSize(size) { - return invoke('plugin:window|set_max_size', { - label: this.label, - value: size instanceof Size ? size : size ? new Size(size) : null - }); - } - /** - * Sets the window inner size constraints. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSizeConstraints({ minWidth: 300 }); - * ``` - * - * @param constraints The logical or physical inner size, or `null` to unset the constraint. - * @returns A promise indicating the success or failure of the operation. - */ - async setSizeConstraints(constraints) { - function logical(pixel) { - return pixel ? { Logical: pixel } : null; - } - return invoke('plugin:window|set_size_constraints', { - label: this.label, - value: { - minWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minWidth), - minHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minHeight), - maxWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxWidth), - maxHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxHeight) - } - }); - } - /** - * Sets the window outer position. - * @example - * ```typescript - * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window'; - * await getCurrentWindow().setPosition(new LogicalPosition(600, 500)); - * ``` - * - * @param position The new position, in logical or physical pixels. - * @returns A promise indicating the success or failure of the operation. - */ - async setPosition(position) { - return invoke('plugin:window|set_position', { - label: this.label, - value: position instanceof Position ? position : new Position(position) - }); - } - /** - * Sets the window fullscreen state. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFullscreen(true); - * ``` - * - * @param fullscreen Whether the window should go to fullscreen or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setFullscreen(fullscreen) { - return invoke('plugin:window|set_fullscreen', { - label: this.label, - value: fullscreen - }); - } - /** - * On macOS, Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won’t work if the window was already in the native fullscreen). - * This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor. - * - * On other platforms, this is the same as {@link Window.setFullscreen}. - * - * @param fullscreen Whether the window should go to simple fullscreen or not. - * @returns A promise indicating the success or failure of the operation. - */ - async setSimpleFullscreen(fullscreen) { - return invoke('plugin:window|set_simple_fullscreen', { - label: this.label, - value: fullscreen - }); - } - /** - * Bring the window to front and focus. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFocus(); - * ``` - * - * @returns A promise indicating the success or failure of the operation. - */ - async setFocus() { - return invoke('plugin:window|set_focus', { - label: this.label - }); - } - /** - * Sets whether the window can be focused. - * - * #### Platform-specific - * - * - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`. - * In this case, you might consider calling {@link Window.setFocus} but it will move the window to the back i.e. at the bottom in terms of z-order. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setFocusable(true); - * ``` - * - * @param focusable Whether the window can be focused. - * @returns A promise indicating the success or failure of the operation. - */ - async setFocusable(focusable) { - return invoke('plugin:window|set_focusable', { - label: this.label, - value: focusable - }); - } - /** - * Sets the window icon. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setIcon('/tauri/awesome.png'); - * ``` - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - * - * @param icon Icon bytes or path to the icon file. - * @returns A promise indicating the success or failure of the operation. - */ - async setIcon(icon) { - return invoke('plugin:window|set_icon', { - label: this.label, - value: transformImage(icon) - }); - } - /** - * Whether the window icon should be hidden from the taskbar or not. - * - * #### Platform-specific - * - * - **macOS:** Unsupported. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setSkipTaskbar(true); - * ``` - * - * @param skip true to hide window icon, false to show it. - * @returns A promise indicating the success or failure of the operation. - */ - async setSkipTaskbar(skip) { - return invoke('plugin:window|set_skip_taskbar', { - label: this.label, - value: skip - }); - } - /** - * Grabs the cursor, preventing it from leaving the window. - * - * There's no guarantee that the cursor will be hidden. You should - * hide it by yourself if you want so. - * - * #### Platform-specific - * - * - **Linux:** Unsupported. - * - **macOS:** This locks the cursor in a fixed location, which looks visually awkward. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorGrab(true); - * ``` - * - * @param grab `true` to grab the cursor icon, `false` to release it. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorGrab(grab) { - return invoke('plugin:window|set_cursor_grab', { - label: this.label, - value: grab - }); - } - /** - * Modifies the cursor's visibility. - * - * #### Platform-specific - * - * - **Windows:** The cursor is only hidden within the confines of the window. - * - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is - * outside of the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorVisible(false); - * ``` - * - * @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorVisible(visible) { - return invoke('plugin:window|set_cursor_visible', { - label: this.label, - value: visible - }); - } - /** - * Modifies the cursor icon of the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorIcon('help'); - * ``` - * - * @param icon The new cursor icon. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorIcon(icon) { - return invoke('plugin:window|set_cursor_icon', { - label: this.label, - value: icon - }); - } - /** - * Sets the window background color. - * - * #### Platform-specific: - * - * - **Windows:** alpha channel is ignored. - * - **iOS / Android:** Unsupported. - * - * @returns A promise indicating the success or failure of the operation. - * - * @since 2.1.0 - */ - async setBackgroundColor(color) { - return invoke('plugin:window|set_background_color', { color }); - } - /** - * Changes the position of the cursor in window coordinates. - * @example - * ```typescript - * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window'; - * await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300)); - * ``` - * - * @param position The new cursor position. - * @returns A promise indicating the success or failure of the operation. - */ - async setCursorPosition(position) { - return invoke('plugin:window|set_cursor_position', { - label: this.label, - value: position instanceof Position ? position : new Position(position) - }); - } - /** - * Changes the cursor events behavior. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setIgnoreCursorEvents(true); - * ``` - * - * @param ignore `true` to ignore the cursor events; `false` to process them as usual. - * @returns A promise indicating the success or failure of the operation. - */ - async setIgnoreCursorEvents(ignore) { - return invoke('plugin:window|set_ignore_cursor_events', { - label: this.label, - value: ignore - }); - } - /** - * Starts dragging the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().startDragging(); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - async startDragging() { - return invoke('plugin:window|start_dragging', { - label: this.label - }); - } - /** - * Starts resize-dragging the window. - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().startResizeDragging(); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - async startResizeDragging(direction) { - return invoke('plugin:window|start_resize_dragging', { - label: this.label, - value: direction - }); - } - /** - * Sets the badge count. It is app wide and not specific to this window. - * - * #### Platform-specific - * - * - **Windows**: Unsupported. Use @{linkcode Window.setOverlayIcon} instead. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setBadgeCount(5); - * ``` - * - * @param count The badge count. Use `undefined` to remove the badge. - * @return A promise indicating the success or failure of the operation. - */ - async setBadgeCount(count) { - return invoke('plugin:window|set_badge_count', { - label: this.label, - value: count - }); - } - /** - * Sets the badge cont **macOS only**. - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setBadgeLabel("Hello"); - * ``` - * - * @param label The badge label. Use `undefined` to remove the badge. - * @return A promise indicating the success or failure of the operation. - */ - async setBadgeLabel(label) { - return invoke('plugin:window|set_badge_label', { - label: this.label, - value: label - }); - } - /** - * Sets the overlay icon. **Windows only** - * The overlay icon can be set for every window. - * - * - * Note that you may need the `image-ico` or `image-png` Cargo features to use this API. - * To enable it, change your Cargo.toml file: - * - * ```toml - * [dependencies] - * tauri = { version = "...", features = ["...", "image-png"] } - * ``` - * - * @example - * ```typescript - * import { getCurrentWindow } from '@tauri-apps/api/window'; - * await getCurrentWindow().setOverlayIcon("/tauri/awesome.png"); - * ``` - * - * @param icon Icon bytes or path to the icon file. Use `undefined` to remove the overlay icon. - * @return A promise indicating the success or failure of the operation. - */ - async setOverlayIcon(icon) { - return invoke('plugin:window|set_overlay_icon', { - label: this.label, - value: icon ? transformImage(icon) : undefined - }); - } - /** - * Sets the taskbar progress state. - * - * #### Platform-specific - * - * - **Linux / macOS**: Progress bar is app-wide and not specific to this window. - * - **Linux**: Only supported desktop environments with `libunity` (e.g. GNOME). - * - * @example - * ```typescript - * import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window'; - * await getCurrentWindow().setProgressBar({ - * status: ProgressBarStatus.Normal, - * progress: 50, - * }); - * ``` - * - * @return A promise indicating the success or failure of the operation. - */ - async setProgressBar(state) { - return invoke('plugin:window|set_progress_bar', { - label: this.label, - value: state - }); - } - /** - * Sets whether the window should be visible on all workspaces or virtual desktops. - * - * #### Platform-specific - * - * - **Windows / iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ - async setVisibleOnAllWorkspaces(visible) { - return invoke('plugin:window|set_visible_on_all_workspaces', { - label: this.label, - value: visible - }); - } - /** - * Sets the title bar style. **macOS only**. - * - * @since 2.0.0 - */ - async setTitleBarStyle(style) { - return invoke('plugin:window|set_title_bar_style', { - label: this.label, - value: style - }); - } - /** - * Set window theme, pass in `null` or `undefined` to follow system theme - * - * #### Platform-specific - * - * - **Linux / macOS**: Theme is app-wide and not specific to this window. - * - **iOS / Android:** Unsupported. - * - * @since 2.0.0 - */ - async setTheme(theme) { - return invoke('plugin:window|set_theme', { - label: this.label, - value: theme - }); - } - // Listeners - /** - * Listen to window resize. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onResized(({ payload: size }) => { - * console.log('Window resized', size); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onResized(handler) { - return this.listen(TauriEvent.WINDOW_RESIZED, (e) => { - e.payload = new PhysicalSize(e.payload); - handler(e); - }); - } - /** - * Listen to window move. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => { - * console.log('Window moved', position); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onMoved(handler) { - return this.listen(TauriEvent.WINDOW_MOVED, (e) => { - e.payload = new PhysicalPosition(e.payload); - handler(e); - }); - } - /** - * Listen to window close requested. Emitted when the user requests to closes the window. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * import { confirm } from '@tauri-apps/api/dialog'; - * const unlisten = await getCurrentWindow().onCloseRequested(async (event) => { - * const confirmed = await confirm('Are you sure?'); - * if (!confirmed) { - * // user did not confirm closing the window; let's prevent it - * event.preventDefault(); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onCloseRequested(handler) { - // eslint-disable-next-line @typescript-eslint/no-misused-promises - return this.listen(TauriEvent.WINDOW_CLOSE_REQUESTED, async (event) => { - const evt = new CloseRequestedEvent(event); - await handler(evt); - if (!evt.isPreventDefault()) { - await this.destroy(); - } - }); - } - /** - * Listen to a file drop event. - * The listener is triggered when the user hovers the selected files on the webview, - * drops the files or cancels the operation. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/webview"; - * const unlisten = await getCurrentWindow().onDragDropEvent((event) => { - * if (event.payload.type === 'over') { - * console.log('User hovering', event.payload.position); - * } else if (event.payload.type === 'drop') { - * console.log('User dropped', event.payload.paths); - * } else { - * console.log('File drop cancelled'); - * } - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onDragDropEvent(handler) { - const unlistenDrag = await this.listen(TauriEvent.DRAG_ENTER, (event) => { - handler({ - ...event, - payload: { - type: 'enter', - paths: event.payload.paths, - position: new PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDragOver = await this.listen(TauriEvent.DRAG_OVER, (event) => { - handler({ - ...event, - payload: { - type: 'over', - position: new PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenDrop = await this.listen(TauriEvent.DRAG_DROP, (event) => { - handler({ - ...event, - payload: { - type: 'drop', - paths: event.payload.paths, - position: new PhysicalPosition(event.payload.position) - } - }); - }); - const unlistenCancel = await this.listen(TauriEvent.DRAG_LEAVE, (event) => { - handler({ ...event, payload: { type: 'leave' } }); - }); - return () => { - unlistenDrag(); - unlistenDrop(); - unlistenDragOver(); - unlistenCancel(); - }; - } - /** - * Listen to window focus change. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => { - * console.log('Focus changed, window is focused? ' + focused); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onFocusChanged(handler) { - const unlistenFocus = await this.listen(TauriEvent.WINDOW_FOCUS, (event) => { - handler({ ...event, payload: true }); - }); - const unlistenBlur = await this.listen(TauriEvent.WINDOW_BLUR, (event) => { - handler({ ...event, payload: false }); - }); - return () => { - unlistenFocus(); - unlistenBlur(); - }; - } - /** - * Listen to window scale change. Emitted when the window's scale factor has changed. - * The following user actions can cause DPI changes: - * - Changing the display's resolution. - * - Changing the display's scale factor (e.g. in Control Panel on Windows). - * - Moving the window to a display with a different scale factor. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => { - * console.log('Scale changed', payload.scaleFactor, payload.size); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onScaleChanged(handler) { - return this.listen(TauriEvent.WINDOW_SCALE_FACTOR_CHANGED, handler); - } - /** - * Listen to the system theme change. - * - * @example - * ```typescript - * import { getCurrentWindow } from "@tauri-apps/api/window"; - * const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => { - * console.log('New theme: ' + theme); - * }); - * - * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted - * unlisten(); - * ``` - * - * @returns A promise resolving to a function to unlisten to the event. - * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. - */ - async onThemeChanged(handler) { - return this.listen(TauriEvent.WINDOW_THEME_CHANGED, handler); - } -} -/** - * Background throttling policy - * - * @since 2.0.0 - */ -var BackgroundThrottlingPolicy; -(function (BackgroundThrottlingPolicy) { - BackgroundThrottlingPolicy["Disabled"] = "disabled"; - BackgroundThrottlingPolicy["Throttle"] = "throttle"; - BackgroundThrottlingPolicy["Suspend"] = "suspend"; -})(BackgroundThrottlingPolicy || (BackgroundThrottlingPolicy = {})); -/** - * The scrollbar style to use in the webview. - * - * ## Platform-specific - * - * **Windows**: This option must be given the same value for all webviews. - * - * @since 2.8.0 - */ -var ScrollBarStyle; -(function (ScrollBarStyle) { - /** - * The default scrollbar style for the webview. - */ - ScrollBarStyle["Default"] = "default"; - /** - * Fluent UI style overlay scrollbars. **Windows Only** - * - * Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions, - * see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541 - */ - ScrollBarStyle["FluentOverlay"] = "fluentOverlay"; -})(ScrollBarStyle || (ScrollBarStyle = {})); -/** - * Platform-specific window effects - * - * @since 2.0.0 - */ -var Effect; -(function (Effect) { - /** - * A default material appropriate for the view's effectiveAppearance. **macOS 10.14-** - * - * @deprecated since macOS 10.14. You should instead choose an appropriate semantic material. - */ - Effect["AppearanceBased"] = "appearanceBased"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["Light"] = "light"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["Dark"] = "dark"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["MediumLight"] = "mediumLight"; - /** - * **macOS 10.14-** - * - * @deprecated since macOS 10.14. Use a semantic material instead. - */ - Effect["UltraDark"] = "ultraDark"; - /** - * **macOS 10.10+** - */ - Effect["Titlebar"] = "titlebar"; - /** - * **macOS 10.10+** - */ - Effect["Selection"] = "selection"; - /** - * **macOS 10.11+** - */ - Effect["Menu"] = "menu"; - /** - * **macOS 10.11+** - */ - Effect["Popover"] = "popover"; - /** - * **macOS 10.11+** - */ - Effect["Sidebar"] = "sidebar"; - /** - * **macOS 10.14+** - */ - Effect["HeaderView"] = "headerView"; - /** - * **macOS 10.14+** - */ - Effect["Sheet"] = "sheet"; - /** - * **macOS 10.14+** - */ - Effect["WindowBackground"] = "windowBackground"; - /** - * **macOS 10.14+** - */ - Effect["HudWindow"] = "hudWindow"; - /** - * **macOS 10.14+** - */ - Effect["FullScreenUI"] = "fullScreenUI"; - /** - * **macOS 10.14+** - */ - Effect["Tooltip"] = "tooltip"; - /** - * **macOS 10.14+** - */ - Effect["ContentBackground"] = "contentBackground"; - /** - * **macOS 10.14+** - */ - Effect["UnderWindowBackground"] = "underWindowBackground"; - /** - * **macOS 10.14+** - */ - Effect["UnderPageBackground"] = "underPageBackground"; - /** - * **Windows 11 Only** - */ - Effect["Mica"] = "mica"; - /** - * **Windows 7/10/11(22H1) Only** - * - * #### Notes - * - * This effect has bad performance when resizing/dragging the window on Windows 11 build 22621. - */ - Effect["Blur"] = "blur"; - /** - * **Windows 10/11** - * - * #### Notes - * - * This effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000. - */ - Effect["Acrylic"] = "acrylic"; - /** - * Tabbed effect that matches the system dark preference **Windows 11 Only** - */ - Effect["Tabbed"] = "tabbed"; - /** - * Tabbed effect with dark mode but only if dark mode is enabled on the system **Windows 11 Only** - */ - Effect["TabbedDark"] = "tabbedDark"; - /** - * Tabbed effect with light mode **Windows 11 Only** - */ - Effect["TabbedLight"] = "tabbedLight"; -})(Effect || (Effect = {})); -/** - * Window effect state **macOS only** - * - * @see https://developer.apple.com/documentation/appkit/nsvisualeffectview/state - * - * @since 2.0.0 - */ -var EffectState; -(function (EffectState) { - /** - * Make window effect state follow the window's active state **macOS only** - */ - EffectState["FollowsWindowActiveState"] = "followsWindowActiveState"; - /** - * Make window effect state always active **macOS only** - */ - EffectState["Active"] = "active"; - /** - * Make window effect state always inactive **macOS only** - */ - EffectState["Inactive"] = "inactive"; -})(EffectState || (EffectState = {})); -function mapMonitor(m) { - return m === null - ? null - : { - name: m.name, - scaleFactor: m.scaleFactor, - position: new PhysicalPosition(m.position), - size: new PhysicalSize(m.size), - workArea: { - position: new PhysicalPosition(m.workArea.position), - size: new PhysicalSize(m.workArea.size) - } - }; -} -/** - * Returns the monitor on which the window currently resides. - * Returns `null` if current monitor can't be detected. - * @example - * ```typescript - * import { currentMonitor } from '@tauri-apps/api/window'; - * const monitor = await currentMonitor(); - * ``` - * - * @since 1.0.0 - */ -async function currentMonitor() { - return invoke('plugin:window|current_monitor').then(mapMonitor); -} -/** - * Returns the primary monitor of the system. - * Returns `null` if it can't identify any monitor as a primary one. - * @example - * ```typescript - * import { primaryMonitor } from '@tauri-apps/api/window'; - * const monitor = await primaryMonitor(); - * ``` - * - * @since 1.0.0 - */ -async function primaryMonitor() { - return invoke('plugin:window|primary_monitor').then(mapMonitor); -} -/** - * Returns the monitor that contains the given point. Returns `null` if can't find any. - * @example - * ```typescript - * import { monitorFromPoint } from '@tauri-apps/api/window'; - * const monitor = await monitorFromPoint(100.0, 200.0); - * ``` - * - * @since 1.0.0 - */ -async function monitorFromPoint(x, y) { - return invoke('plugin:window|monitor_from_point', { - x, - y - }).then(mapMonitor); -} -/** - * Returns the list of all the monitors available on the system. - * @example - * ```typescript - * import { availableMonitors } from '@tauri-apps/api/window'; - * const monitors = await availableMonitors(); - * ``` - * - * @since 1.0.0 - */ -async function availableMonitors() { - return invoke('plugin:window|available_monitors').then((ms) => ms.map(mapMonitor)); -} -/** - * Get the cursor position relative to the top-left hand corner of the desktop. - * - * Note that the top-left hand corner of the desktop is not necessarily the same as the screen. - * If the user uses a desktop with multiple monitors, - * the top-left hand corner of the desktop is the top-left hand corner of the main monitor on Windows and macOS - * or the top-left of the leftmost monitor on X11. - * - * The coordinates can be negative if the top-left hand corner of the window is outside of the visible screen region. - */ -async function cursorPosition() { - return invoke('plugin:window|cursor_position').then((v) => new PhysicalPosition(v)); -} - -export { CloseRequestedEvent, Effect, EffectState, PhysicalPosition, PhysicalSize, ProgressBarStatus, UserAttentionType, Window, availableMonitors, currentMonitor, cursorPosition, getAllWindows, getCurrentWindow, monitorFromPoint, primaryMonitor }; diff --git a/node_modules/tauri-plugin-mic-recorder-api/LICENSE b/node_modules/tauri-plugin-mic-recorder-api/LICENSE deleted file mode 100644 index 18e98d2..0000000 --- a/node_modules/tauri-plugin-mic-recorder-api/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2025 ayangweb - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/tauri-plugin-mic-recorder-api/README.md b/node_modules/tauri-plugin-mic-recorder-api/README.md deleted file mode 100644 index 9b43d8e..0000000 --- a/node_modules/tauri-plugin-mic-recorder-api/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# tauri-plugin-mic-recorder - -> This plugin only works on tauri v2, if you need the v1 plugin, feel free to submit a PR! - -Supports recording audio using a microphone and saving the recorded data as a file. - -https://github.com/user-attachments/assets/7c6f1df4-96e6-4cac-806b-098e8bccc1f7 - -## Platform Support - -| Platform | Supported | -| -------- | --------- | -| Windows | ✅ | -| macOS | ✅ | -| Linux | ✅ | -| Android | ✅ | -| iOS | ✅ | - -## Install - -```shell -cargo add tauri-plugin-mic-recorder -``` - -You can install the JavaScript Guest bindings using your preferred JavaScript package manager: - -```shell -pnpm add tauri-plugin-mic-recorder-api -``` - -## Usage - -`src-tauri/src/lib.rs` - -```diff -pub fn run() { - tauri::Builder::default() -+ .plugin(tauri_plugin_mic_recorder::init()) - .run(tauri::generate_context!()) - .expect("error while running tauri application"); -} -``` - -`src-tauri/capabilities/default.json` - -```diff -{ - ... - "permissions": [ - ... -+ "mic-recorder:default" - ] -} -``` - -Afterwards all the plugin's APIs are available through the JavaScript guest bindings: - -```ts -import { startRecording } from "tauri-plugin-mic-recorder-api"; - -startRecording(); -``` - -## Methods - -| Method | Description | -| ---------------- | ----------------------- | -| `startRecording` | Starts recording audio. | -| `stopRecording` | Stops recording audio. | - -## Example - -```shell -git clone https://github.com/ayangweb/tauri-plugin-mic-recorder.git -``` - -```shell -pnpm install - -pnpm build - -cd examples/tauri-app - -pnpm install - -pnpm dev -``` - -## Thanks - -- Use [cpal](https://github.com/RustAudio/cpal) and [hound](https://github.com/ruuda/hound) record and generate wav files. - -## Who's Use It - -- [Coco AI](https://github.com/infinilabs/coco-app) - Search, Connect, Collaborate, Your Personal AI Search and Assistant, all in one space. diff --git a/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.cjs b/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.cjs deleted file mode 100644 index eafd75c..0000000 --- a/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.cjs +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -var core = require('@tauri-apps/api/core'); - -const COMMAND = { - START_RECORDING: "plugin:mic-recorder|start_recording", - STOP_RECORDING: "plugin:mic-recorder|stop_recording", -}; -/** - * Starts recording audio. - * - * @example - * ``` - * import { startRecording } from 'tauri-plugin-mic-recorder-api'; - * - * startRecording().then(() => { - * console.log("Recording started"); - * }); - * ``` - */ -const startRecording = () => { - return core.invoke(COMMAND.START_RECORDING); -}; -/** - * Stops recording audio. - * - * @returns Returns the path where the recording file is stored. - * - * @example - * ``` - * import { stopRecording } from 'tauri-plugin-mic-recorder-api'; - * - * const savePath = await stopRecording(); - * console.log("Recording saved at:", savePath); - * ``` - */ -const stopRecording = () => { - return core.invoke(COMMAND.STOP_RECORDING); -}; - -exports.COMMAND = COMMAND; -exports.startRecording = startRecording; -exports.stopRecording = stopRecording; diff --git a/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.d.ts b/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.d.ts deleted file mode 100644 index f775b20..0000000 --- a/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export declare const COMMAND: { - START_RECORDING: string; - STOP_RECORDING: string; -}; -/** - * Starts recording audio. - * - * @example - * ``` - * import { startRecording } from 'tauri-plugin-mic-recorder-api'; - * - * startRecording().then(() => { - * console.log("Recording started"); - * }); - * ``` - */ -export declare const startRecording: () => Promise; -/** - * Stops recording audio. - * - * @returns Returns the path where the recording file is stored. - * - * @example - * ``` - * import { stopRecording } from 'tauri-plugin-mic-recorder-api'; - * - * const savePath = await stopRecording(); - * console.log("Recording saved at:", savePath); - * ``` - */ -export declare const stopRecording: () => Promise; diff --git a/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.js b/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.js deleted file mode 100644 index e5575d0..0000000 --- a/node_modules/tauri-plugin-mic-recorder-api/dist-js/index.js +++ /dev/null @@ -1,39 +0,0 @@ -import { invoke } from '@tauri-apps/api/core'; - -const COMMAND = { - START_RECORDING: "plugin:mic-recorder|start_recording", - STOP_RECORDING: "plugin:mic-recorder|stop_recording", -}; -/** - * Starts recording audio. - * - * @example - * ``` - * import { startRecording } from 'tauri-plugin-mic-recorder-api'; - * - * startRecording().then(() => { - * console.log("Recording started"); - * }); - * ``` - */ -const startRecording = () => { - return invoke(COMMAND.START_RECORDING); -}; -/** - * Stops recording audio. - * - * @returns Returns the path where the recording file is stored. - * - * @example - * ``` - * import { stopRecording } from 'tauri-plugin-mic-recorder-api'; - * - * const savePath = await stopRecording(); - * console.log("Recording saved at:", savePath); - * ``` - */ -const stopRecording = () => { - return invoke(COMMAND.STOP_RECORDING); -}; - -export { COMMAND, startRecording, stopRecording }; diff --git a/node_modules/tauri-plugin-mic-recorder-api/package.json b/node_modules/tauri-plugin-mic-recorder-api/package.json deleted file mode 100644 index b491187..0000000 --- a/node_modules/tauri-plugin-mic-recorder-api/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "tauri-plugin-mic-recorder-api", - "version": "2.0.0", - "author": "ayangweb", - "description": "Supports recording audio using a microphone and saving the recorded data as a file.", - "keywords": [ - "audio-recording", - "microphone-recording", - "tauri", - "tauri-plugin" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/ayangweb/tauri-plugin-mic-recorder.git" - }, - "homepage": "https://github.com/ayangweb/tauri-plugin-mic-recorder#readme", - "bugs": "https://github.com/ayangweb/tauri-plugin-mic-recorder/issues", - "license": "MIT", - "type": "module", - "types": "./dist-js/index.d.ts", - "main": "./dist-js/index.cjs", - "module": "./dist-js/index.js", - "exports": { - "types": "./dist-js/index.d.ts", - "import": "./dist-js/index.js", - "require": "./dist-js/index.cjs" - }, - "files": [ - "dist-js", - "README.md" - ], - "scripts": { - "build": "rollup -c", - "prepublishOnly": "pnpm build", - "pretest": "pnpm build", - "release": "release-it" - }, - "dependencies": { - "@tauri-apps/api": ">=2.0.0-beta.6" - }, - "devDependencies": { - "@rollup/plugin-typescript": "^11.1.6", - "release-it": "^18.1.2", - "rollup": "^4.9.6", - "tslib": "^2.6.2", - "typescript": "^5.3.3" - } -}