chore: update to tauri alpha.16, api alpha.9 (#673)

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
Lucas Fernandes Nogueira
2023-10-20 13:50:18 -03:00
committed by GitHub
parent b7c5407cac
commit 5c137365c6
132 changed files with 1569 additions and 1692 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ Save window positions and sizes and restore them when the app is reopened.
## Install
_This plugin requires a Rust version of at least **1.65**_
_This plugin requires a Rust version of at least **1.70**_
There are three general methods of installation that we can recommend.
+3 -7
View File
@@ -2,11 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
declare global {
interface Window {
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
}
}
import { invoke } from "@tauri-apps/api/primitives";
interface WindowDef {
label: string;
@@ -35,7 +31,7 @@ export enum StateFlags {
* Save the state of all open windows to disk.
*/
async function saveWindowState(flags: StateFlags): Promise<void> {
return window.__TAURI_INVOKE__("plugin:window-state|save_window_state", {
return invoke("plugin:window-state|save_window_state", {
flags,
});
}
@@ -44,7 +40,7 @@ async function saveWindowState(flags: StateFlags): Promise<void> {
* Restore the state for the specified window from disk.
*/
async function restoreState(label: string, flags: StateFlags): Promise<void> {
return window.__TAURI_INVOKE__("plugin:window-state|restore_state", {
return invoke("plugin:window-state|restore_state", {
label,
flags,
});
+1 -1
View File
@@ -28,6 +28,6 @@
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.8"
"@tauri-apps/api": "2.0.0-alpha.9"
}
}
+1 -1
View File
@@ -1 +1 @@
if("__TAURI__"in window){var __TAURI_WINDOWSTATE__=function(t){"use strict";var _;async function e(t,_){return window.__TAURI_INVOKE__("plugin:window-state|restore_state",{label:t,flags:_})}return t.StateFlags=void 0,(_=t.StateFlags||(t.StateFlags={}))[_.SIZE=1]="SIZE",_[_.POSITION=2]="POSITION",_[_.MAXIMIZED=4]="MAXIMIZED",_[_.VISIBLE=8]="VISIBLE",_[_.DECORATIONS=16]="DECORATIONS",_[_.FULLSCREEN=32]="FULLSCREEN",_[_.ALL=63]="ALL",t.restoreState=e,t.restoreStateCurrent=async function(t){return e(window.__TAURI_METADATA__.__currentWindow.label,t)},t.saveWindowState=async function(t){return window.__TAURI_INVOKE__("plugin:window-state|save_window_state",{flags:t})},t}({});Object.defineProperty(window.__TAURI__,"windowState",{value:__TAURI_WINDOWSTATE__})}
if("__TAURI__"in window){var __TAURI_WINDOWSTATE__=function(e){"use strict";var t=Object.defineProperty,n=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},r=(e,t,r)=>(n(e,t,"read from private field"),r?r.call(e):t.get(e));function a(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})({},{Channel:()=>s,PluginListener:()=>o,addPluginListener:()=>l,convertFileSrc:()=>u,invoke:()=>c,transformCallback:()=>a});var i,s=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,i,(()=>{})),this.id=a((e=>{r(this,i).call(this,e)}))}set onmessage(e){var t,r,a,s;a=e,n(t=this,r=i,"write to private field"),s?s.call(t,a):r.set(t,a)}get onmessage(){return r(this,i)}toJSON(){return`__CHANNEL__:${this.id}`}};i=new WeakMap;var _,o=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return c(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l(e,t,n){let r=new s;return r.onmessage=n,c(`plugin:${e}|register_listener`,{event:t,handler:r}).then((()=>new o(e,t,r.id)))}async function c(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}function u(e,t="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,t)}async function I(e,t){return c("plugin:window-state|restore_state",{label:e,flags:t})}return e.StateFlags=void 0,(_=e.StateFlags||(e.StateFlags={}))[_.SIZE=1]="SIZE",_[_.POSITION=2]="POSITION",_[_.MAXIMIZED=4]="MAXIMIZED",_[_.VISIBLE=8]="VISIBLE",_[_.DECORATIONS=16]="DECORATIONS",_[_.FULLSCREEN=32]="FULLSCREEN",_[_.ALL=63]="ALL",e.restoreState=I,e.restoreStateCurrent=async function(e){return I(window.__TAURI_METADATA__.__currentWindow.label,e)},e.saveWindowState=async function(e){return c("plugin:window-state|save_window_state",{flags:e})},e}({});Object.defineProperty(window.__TAURI__,"windowState",{value:__TAURI_WINDOWSTATE__})}