feat: update dependencies
This commit is contained in:
parent
55fe1d144f
commit
3e087bd257
16 changed files with 2004 additions and 474 deletions
1781
Cargo.lock
generated
1781
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
24
Cargo.toml
24
Cargo.toml
|
@ -6,21 +6,21 @@ version = "0.1.0"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
futures = { version = "0.3.25", optional = true }
|
||||
js-sys = "0.3.59"
|
||||
log = "0.4.17"
|
||||
semver = {version = "1.0.14", optional = true, features = ["serde"]}
|
||||
serde = {version = "1.0.140", features = ["derive"]}
|
||||
serde-wasm-bindgen = "0.4.3"
|
||||
serde_repr = "0.1.10"
|
||||
thiserror = "1.0.37"
|
||||
url = {version = "2.3.1", optional = true, features = ["serde"]}
|
||||
wasm-bindgen = {version = "0.2.82", features = ["serde_json"]}
|
||||
wasm-bindgen-futures = "0.4.32"
|
||||
futures = { version = "0.3.29", optional = true }
|
||||
js-sys = "0.3.66"
|
||||
log = "0.4.20"
|
||||
semver = {version = "1.0.20", optional = true, features = ["serde"]}
|
||||
serde = {version = "1.0.193", features = ["derive"]}
|
||||
serde-wasm-bindgen = "0.6.3"
|
||||
serde_repr = "0.1.17"
|
||||
thiserror = "1.0.50"
|
||||
url = {version = "2.5.0", optional = true, features = ["serde"]}
|
||||
wasm-bindgen = {version = "0.2.89", features = ["serde_json"]}
|
||||
wasm-bindgen-futures = "0.4.39"
|
||||
|
||||
[dev-dependencies]
|
||||
tauri-sys = {path = ".", features = ["all"]}
|
||||
wasm-bindgen-test = "0.3.33"
|
||||
wasm-bindgen-test = "0.3.39"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -7,13 +7,13 @@ edition = "2021"
|
|||
[dependencies]
|
||||
tauri-sys = { path = "../../", features = ["all"] }
|
||||
sycamore = { git = "https://github.com/sycamore-rs/sycamore", rev = "abd556cbc02047042dad2ebd04405e455a9b11b2", features = ["suspense"] }
|
||||
anyhow = "1.0.66"
|
||||
anyhow = "1.0.75"
|
||||
console_error_panic_hook = "0.1.7"
|
||||
wasm-bindgen-futures = "0.4.32"
|
||||
serde = { version = "1.0.147", features = ["derive"] }
|
||||
log = { version = "0.4.17", features = ["serde"] }
|
||||
futures = "0.3.25"
|
||||
gloo-timers = { version = "0.2.4", features = ["futures"] }
|
||||
wasm-bindgen-futures = "0.4.39"
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
log = { version = "0.4.20", features = ["serde"] }
|
||||
futures = "0.3.29"
|
||||
gloo-timers = { version = "0.3", features = ["futures"] }
|
||||
|
||||
[features]
|
||||
ci = []
|
||||
|
|
|
@ -7,4 +7,8 @@ ignore = ["./src-tauri"]
|
|||
[serve]
|
||||
address = "127.0.0.1"
|
||||
port = 1420
|
||||
open = false
|
||||
open = false
|
||||
|
||||
[tools]
|
||||
# Default wasm-bindgen version to download.
|
||||
wasm_bindgen = "0.2.89"
|
|
@ -11,18 +11,18 @@ rust-version = "1.57"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.2", features = [] }
|
||||
tauri-build = { version = "1.5.0", features = [] }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri-plugin-log = {git = "https://github.com/tauri-apps/tauri-plugin-log", features = ["colored"] }
|
||||
tauri = { version = "1.2", features = ["api-all", "updater"] }
|
||||
tauri = { version = "1.5.3", features = ["api-all", "updater"] }
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||
default = [ "custom-protocol" ]
|
||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||
# this feature is used for production builds where `devPath` points to the filesystem
|
||||
# DO NOT remove this
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
||||
|
|
|
@ -25,8 +25,8 @@ pub async fn get_tauri_version() -> anyhow::Result<()> {
|
|||
let version = app::get_tauri_version().await?;
|
||||
|
||||
ensure!(version.major == 1);
|
||||
ensure!(version.minor == 2);
|
||||
ensure!(version.patch == 0);
|
||||
ensure!(version.minor == 5);
|
||||
ensure!(version.patch == 3);
|
||||
ensure!(version.build.is_empty());
|
||||
ensure!(version.pre.is_empty());
|
||||
|
||||
|
|
73
pnpm-lock.yaml
generated
73
pnpm-lock.yaml
generated
|
@ -1,14 +1,17 @@
|
|||
lockfileVersion: 5.4
|
||||
lockfileVersion: '6.0'
|
||||
|
||||
specifiers:
|
||||
esbuild: ^0.15.13
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
devDependencies:
|
||||
esbuild: 0.15.13
|
||||
esbuild:
|
||||
specifier: ^0.15.13
|
||||
version: 0.15.13
|
||||
|
||||
packages:
|
||||
|
||||
/@esbuild/android-arm/0.15.13:
|
||||
/@esbuild/android-arm@0.15.13:
|
||||
resolution: {integrity: sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm]
|
||||
|
@ -17,7 +20,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-loong64/0.15.13:
|
||||
/@esbuild/linux-loong64@0.15.13:
|
||||
resolution: {integrity: sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [loong64]
|
||||
|
@ -26,7 +29,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-android-64/0.15.13:
|
||||
/esbuild-android-64@0.15.13:
|
||||
resolution: {integrity: sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -35,7 +38,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-android-arm64/0.15.13:
|
||||
/esbuild-android-arm64@0.15.13:
|
||||
resolution: {integrity: sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
|
@ -44,7 +47,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-darwin-64/0.15.13:
|
||||
/esbuild-darwin-64@0.15.13:
|
||||
resolution: {integrity: sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -53,7 +56,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-darwin-arm64/0.15.13:
|
||||
/esbuild-darwin-arm64@0.15.13:
|
||||
resolution: {integrity: sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
|
@ -62,7 +65,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-freebsd-64/0.15.13:
|
||||
/esbuild-freebsd-64@0.15.13:
|
||||
resolution: {integrity: sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -71,7 +74,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-freebsd-arm64/0.15.13:
|
||||
/esbuild-freebsd-arm64@0.15.13:
|
||||
resolution: {integrity: sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
|
@ -80,7 +83,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-32/0.15.13:
|
||||
/esbuild-linux-32@0.15.13:
|
||||
resolution: {integrity: sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [ia32]
|
||||
|
@ -89,7 +92,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-64/0.15.13:
|
||||
/esbuild-linux-64@0.15.13:
|
||||
resolution: {integrity: sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -98,16 +101,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-arm/0.15.13:
|
||||
resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-arm64/0.15.13:
|
||||
/esbuild-linux-arm64@0.15.13:
|
||||
resolution: {integrity: sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
|
@ -116,7 +110,16 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-mips64le/0.15.13:
|
||||
/esbuild-linux-arm@0.15.13:
|
||||
resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-mips64le@0.15.13:
|
||||
resolution: {integrity: sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [mips64el]
|
||||
|
@ -125,7 +128,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-ppc64le/0.15.13:
|
||||
/esbuild-linux-ppc64le@0.15.13:
|
||||
resolution: {integrity: sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [ppc64]
|
||||
|
@ -134,7 +137,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-riscv64/0.15.13:
|
||||
/esbuild-linux-riscv64@0.15.13:
|
||||
resolution: {integrity: sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [riscv64]
|
||||
|
@ -143,7 +146,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-s390x/0.15.13:
|
||||
/esbuild-linux-s390x@0.15.13:
|
||||
resolution: {integrity: sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [s390x]
|
||||
|
@ -152,7 +155,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-netbsd-64/0.15.13:
|
||||
/esbuild-netbsd-64@0.15.13:
|
||||
resolution: {integrity: sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -161,7 +164,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-openbsd-64/0.15.13:
|
||||
/esbuild-openbsd-64@0.15.13:
|
||||
resolution: {integrity: sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -170,7 +173,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-sunos-64/0.15.13:
|
||||
/esbuild-sunos-64@0.15.13:
|
||||
resolution: {integrity: sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -179,7 +182,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-windows-32/0.15.13:
|
||||
/esbuild-windows-32@0.15.13:
|
||||
resolution: {integrity: sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [ia32]
|
||||
|
@ -188,7 +191,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-windows-64/0.15.13:
|
||||
/esbuild-windows-64@0.15.13:
|
||||
resolution: {integrity: sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
|
@ -197,7 +200,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild-windows-arm64/0.15.13:
|
||||
/esbuild-windows-arm64@0.15.13:
|
||||
resolution: {integrity: sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
|
@ -206,7 +209,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/esbuild/0.15.13:
|
||||
/esbuild@0.15.13:
|
||||
resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==}
|
||||
engines: {node: '>=12'}
|
||||
hasBin: true
|
||||
|
|
|
@ -74,7 +74,8 @@ async function message(message2, options) {
|
|||
cmd: "messageDialog",
|
||||
message: message2.toString(),
|
||||
title: opts?.title?.toString(),
|
||||
type: opts?.type
|
||||
type: opts?.type,
|
||||
buttonLabel: opts?.okLabel?.toString()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -86,7 +87,11 @@ async function ask(message2, options) {
|
|||
cmd: "askDialog",
|
||||
message: message2.toString(),
|
||||
title: opts?.title?.toString(),
|
||||
type: opts?.type
|
||||
type: opts?.type,
|
||||
buttonLabels: [
|
||||
opts?.okLabel?.toString() ?? "Yes",
|
||||
opts?.cancelLabel?.toString() ?? "No"
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -98,7 +103,11 @@ async function confirm(message2, options) {
|
|||
cmd: "confirmDialog",
|
||||
message: message2.toString(),
|
||||
title: opts?.title?.toString(),
|
||||
type: opts?.type
|
||||
type: opts?.type,
|
||||
buttonLabels: [
|
||||
opts?.okLabel?.toString() ?? "Ok",
|
||||
opts?.cancelLabel?.toString() ?? "Cancel"
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
66
src/http.js
66
src/http.js
|
@ -48,40 +48,47 @@ var ResponseType = /* @__PURE__ */ ((ResponseType2) => {
|
|||
ResponseType2[ResponseType2["Binary"] = 3] = "Binary";
|
||||
return ResponseType2;
|
||||
})(ResponseType || {});
|
||||
async function formBody(data) {
|
||||
const form = {};
|
||||
const append = async (key, v) => {
|
||||
if (v !== null) {
|
||||
let r;
|
||||
if (typeof v === "string") {
|
||||
r = v;
|
||||
} else if (v instanceof Uint8Array || Array.isArray(v)) {
|
||||
r = Array.from(v);
|
||||
} else if (v instanceof File) {
|
||||
r = {
|
||||
file: Array.from(new Uint8Array(await v.arrayBuffer())),
|
||||
mime: v.type,
|
||||
fileName: v.name
|
||||
};
|
||||
} else if (typeof v.file === "string") {
|
||||
r = { file: v.file, mime: v.mime, fileName: v.fileName };
|
||||
} else {
|
||||
r = { file: Array.from(v.file), mime: v.mime, fileName: v.fileName };
|
||||
}
|
||||
form[String(key)] = r;
|
||||
}
|
||||
};
|
||||
if (data instanceof FormData) {
|
||||
for (const [key, value] of data) {
|
||||
await append(key, value);
|
||||
}
|
||||
} else {
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
await append(key, value);
|
||||
}
|
||||
}
|
||||
return form;
|
||||
}
|
||||
var Body = class {
|
||||
constructor(type, payload) {
|
||||
this.type = type;
|
||||
this.payload = payload;
|
||||
}
|
||||
static form(data) {
|
||||
const form = {};
|
||||
const append = (key, v) => {
|
||||
if (v !== null) {
|
||||
let r;
|
||||
if (typeof v === "string") {
|
||||
r = v;
|
||||
} else if (v instanceof Uint8Array || Array.isArray(v)) {
|
||||
r = Array.from(v);
|
||||
} else if (v instanceof File) {
|
||||
r = { file: v.name, mime: v.type, fileName: v.name };
|
||||
} else if (typeof v.file === "string") {
|
||||
r = { file: v.file, mime: v.mime, fileName: v.fileName };
|
||||
} else {
|
||||
r = { file: Array.from(v.file), mime: v.mime, fileName: v.fileName };
|
||||
}
|
||||
form[String(key)] = r;
|
||||
}
|
||||
};
|
||||
if (data instanceof FormData) {
|
||||
for (const [key, value] of data) {
|
||||
append(key, value);
|
||||
}
|
||||
} else {
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
append(key, value);
|
||||
}
|
||||
}
|
||||
return new Body("Form", form);
|
||||
return new Body("Form", data);
|
||||
}
|
||||
static json(data) {
|
||||
return new Body("Json", data);
|
||||
|
@ -124,6 +131,9 @@ var Client = class {
|
|||
if (jsonResponse) {
|
||||
options.responseType = 2 /* Text */;
|
||||
}
|
||||
if (options.body?.type === "Form") {
|
||||
options.body.payload = await formBody(options.body.payload);
|
||||
}
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Http",
|
||||
message: {
|
||||
|
|
277
src/index.js
277
src/index.js
|
@ -58,8 +58,7 @@ async function invoke(cmd, args = {}) {
|
|||
});
|
||||
}
|
||||
function convertFileSrc(filePath, protocol = "asset") {
|
||||
const path = encodeURIComponent(filePath);
|
||||
return navigator.userAgent.includes("Windows") ? `https://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}`;
|
||||
return window.__TAURI__.convertFileSrc(filePath, protocol);
|
||||
}
|
||||
|
||||
// tauri/tooling/api/src/helpers/tauri.ts
|
||||
|
@ -189,7 +188,8 @@ async function message(message2, options) {
|
|||
cmd: "messageDialog",
|
||||
message: message2.toString(),
|
||||
title: opts?.title?.toString(),
|
||||
type: opts?.type
|
||||
type: opts?.type,
|
||||
buttonLabel: opts?.okLabel?.toString()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -201,7 +201,11 @@ async function ask(message2, options) {
|
|||
cmd: "askDialog",
|
||||
message: message2.toString(),
|
||||
title: opts?.title?.toString(),
|
||||
type: opts?.type
|
||||
type: opts?.type,
|
||||
buttonLabels: [
|
||||
opts?.okLabel?.toString() ?? "Yes",
|
||||
opts?.cancelLabel?.toString() ?? "No"
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -213,7 +217,11 @@ async function confirm(message2, options) {
|
|||
cmd: "confirmDialog",
|
||||
message: message2.toString(),
|
||||
title: opts?.title?.toString(),
|
||||
type: opts?.type
|
||||
type: opts?.type,
|
||||
buttonLabels: [
|
||||
opts?.okLabel?.toString() ?? "Ok",
|
||||
opts?.cancelLabel?.toString() ?? "Cancel"
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -576,40 +584,47 @@ var ResponseType = /* @__PURE__ */ ((ResponseType2) => {
|
|||
ResponseType2[ResponseType2["Binary"] = 3] = "Binary";
|
||||
return ResponseType2;
|
||||
})(ResponseType || {});
|
||||
async function formBody(data) {
|
||||
const form = {};
|
||||
const append = async (key, v) => {
|
||||
if (v !== null) {
|
||||
let r;
|
||||
if (typeof v === "string") {
|
||||
r = v;
|
||||
} else if (v instanceof Uint8Array || Array.isArray(v)) {
|
||||
r = Array.from(v);
|
||||
} else if (v instanceof File) {
|
||||
r = {
|
||||
file: Array.from(new Uint8Array(await v.arrayBuffer())),
|
||||
mime: v.type,
|
||||
fileName: v.name
|
||||
};
|
||||
} else if (typeof v.file === "string") {
|
||||
r = { file: v.file, mime: v.mime, fileName: v.fileName };
|
||||
} else {
|
||||
r = { file: Array.from(v.file), mime: v.mime, fileName: v.fileName };
|
||||
}
|
||||
form[String(key)] = r;
|
||||
}
|
||||
};
|
||||
if (data instanceof FormData) {
|
||||
for (const [key, value] of data) {
|
||||
await append(key, value);
|
||||
}
|
||||
} else {
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
await append(key, value);
|
||||
}
|
||||
}
|
||||
return form;
|
||||
}
|
||||
var Body = class {
|
||||
constructor(type2, payload) {
|
||||
this.type = type2;
|
||||
this.payload = payload;
|
||||
}
|
||||
static form(data) {
|
||||
const form = {};
|
||||
const append = (key, v) => {
|
||||
if (v !== null) {
|
||||
let r;
|
||||
if (typeof v === "string") {
|
||||
r = v;
|
||||
} else if (v instanceof Uint8Array || Array.isArray(v)) {
|
||||
r = Array.from(v);
|
||||
} else if (v instanceof File) {
|
||||
r = { file: v.name, mime: v.type, fileName: v.name };
|
||||
} else if (typeof v.file === "string") {
|
||||
r = { file: v.file, mime: v.mime, fileName: v.fileName };
|
||||
} else {
|
||||
r = { file: Array.from(v.file), mime: v.mime, fileName: v.fileName };
|
||||
}
|
||||
form[String(key)] = r;
|
||||
}
|
||||
};
|
||||
if (data instanceof FormData) {
|
||||
for (const [key, value] of data) {
|
||||
append(key, value);
|
||||
}
|
||||
} else {
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
append(key, value);
|
||||
}
|
||||
}
|
||||
return new Body("Form", form);
|
||||
return new Body("Form", data);
|
||||
}
|
||||
static json(data) {
|
||||
return new Body("Json", data);
|
||||
|
@ -652,6 +667,9 @@ var Client = class {
|
|||
if (jsonResponse) {
|
||||
options.responseType = 2 /* Text */;
|
||||
}
|
||||
if (options.body?.type === "Form") {
|
||||
options.body.payload = await formBody(options.body.payload);
|
||||
}
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Http",
|
||||
message: {
|
||||
|
@ -1353,11 +1371,12 @@ async function installUpdate() {
|
|||
function onStatusChange(statusResult) {
|
||||
if (statusResult.error) {
|
||||
cleanListener();
|
||||
return reject(statusResult.error);
|
||||
reject(statusResult.error);
|
||||
return;
|
||||
}
|
||||
if (statusResult.status === "DONE") {
|
||||
cleanListener();
|
||||
return resolve2();
|
||||
resolve2();
|
||||
}
|
||||
}
|
||||
onUpdaterEvent(onStatusChange).then((fn) => {
|
||||
|
@ -1383,7 +1402,7 @@ async function checkUpdate() {
|
|||
return new Promise((resolve2, reject) => {
|
||||
function onUpdateAvailable(manifest) {
|
||||
cleanListener();
|
||||
return resolve2({
|
||||
resolve2({
|
||||
manifest,
|
||||
shouldUpdate: true
|
||||
});
|
||||
|
@ -1391,11 +1410,12 @@ async function checkUpdate() {
|
|||
function onStatusChange(statusResult) {
|
||||
if (statusResult.error) {
|
||||
cleanListener();
|
||||
return reject(statusResult.error);
|
||||
reject(statusResult.error);
|
||||
return;
|
||||
}
|
||||
if (statusResult.status === "UPTODATE") {
|
||||
cleanListener();
|
||||
return resolve2({
|
||||
resolve2({
|
||||
shouldUpdate: false
|
||||
});
|
||||
}
|
||||
|
@ -1619,6 +1639,20 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async isMinimized() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isMinimized"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isMaximized() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -1633,6 +1667,20 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async isFocused() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isFocused"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isDecorated() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -1661,6 +1709,48 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async isMaximizable() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isMaximizable"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isMinimizable() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isMinimizable"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isClosable() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isClosable"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isVisible() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -1675,6 +1765,20 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async title() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "title"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async theme() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -1741,6 +1845,51 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async setMaximizable(maximizable) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setMaximizable",
|
||||
payload: maximizable
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setMinimizable(minimizable) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setMinimizable",
|
||||
payload: minimizable
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setClosable(closable) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setClosable",
|
||||
payload: closable
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setTitle(title) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -1898,6 +2047,21 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async setContentProtected(protected_) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setContentProtected",
|
||||
payload: protected_
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setSize(size) {
|
||||
if (!size || size.type !== "Logical" && size.type !== "Physical") {
|
||||
throw new Error(
|
||||
|
@ -2164,10 +2328,16 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
});
|
||||
}
|
||||
async onResized(handler) {
|
||||
return this.listen("tauri://resize" /* WINDOW_RESIZED */, handler);
|
||||
return this.listen("tauri://resize" /* WINDOW_RESIZED */, (e) => {
|
||||
e.payload = mapPhysicalSize(e.payload);
|
||||
handler(e);
|
||||
});
|
||||
}
|
||||
async onMoved(handler) {
|
||||
return this.listen("tauri://move" /* WINDOW_MOVED */, handler);
|
||||
return this.listen("tauri://move" /* WINDOW_MOVED */, (e) => {
|
||||
e.payload = mapPhysicalPosition(e.payload);
|
||||
handler(e);
|
||||
});
|
||||
}
|
||||
async onCloseRequested(handler) {
|
||||
return this.listen("tauri://close-requested" /* WINDOW_CLOSE_REQUESTED */, (event) => {
|
||||
|
@ -2273,6 +2443,14 @@ var WebviewWindow = class extends WindowManager {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
static async getFocusedWindow() {
|
||||
for (const w of getAll()) {
|
||||
if (await w.isFocused()) {
|
||||
return w;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var appWindow;
|
||||
if ("__TAURI_METADATA__" in window) {
|
||||
|
@ -2295,10 +2473,16 @@ function mapMonitor(m) {
|
|||
return m === null ? null : {
|
||||
name: m.name,
|
||||
scaleFactor: m.scaleFactor,
|
||||
position: new PhysicalPosition(m.position.x, m.position.y),
|
||||
size: new PhysicalSize(m.size.width, m.size.height)
|
||||
position: mapPhysicalPosition(m.position),
|
||||
size: mapPhysicalSize(m.size)
|
||||
};
|
||||
}
|
||||
function mapPhysicalPosition(m) {
|
||||
return new PhysicalPosition(m.x, m.y);
|
||||
}
|
||||
function mapPhysicalSize(m) {
|
||||
return new PhysicalSize(m.width, m.height);
|
||||
}
|
||||
async function currentMonitor() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -2344,6 +2528,7 @@ var os_exports = {};
|
|||
__export(os_exports, {
|
||||
EOL: () => EOL,
|
||||
arch: () => arch,
|
||||
locale: () => locale,
|
||||
platform: () => platform,
|
||||
tempdir: () => tempdir,
|
||||
type: () => type,
|
||||
|
@ -2390,6 +2575,14 @@ async function tempdir() {
|
|||
}
|
||||
});
|
||||
}
|
||||
async function locale() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Os",
|
||||
message: {
|
||||
cmd: "locale"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// tauri/tooling/api/src/index.ts
|
||||
var invoke2 = invoke;
|
||||
|
|
16
src/mocks.js
16
src/mocks.js
|
@ -19,12 +19,24 @@ function mockWindows(current, ...additionalWindows) {
|
|||
__currentWindow: { label: current }
|
||||
};
|
||||
}
|
||||
function mockConvertFileSrc(osName, windowsProtocolScheme = "https") {
|
||||
window.__TAURI__ = window.__TAURI__ ?? {};
|
||||
window.__TAURI__.convertFileSrc = function(filePath, protocol = "asset") {
|
||||
const path = encodeURIComponent(filePath);
|
||||
return osName === "windows" ? `${windowsProtocolScheme}://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}`;
|
||||
};
|
||||
}
|
||||
function clearMocks() {
|
||||
delete window.__TAURI_IPC__;
|
||||
delete window.__TAURI_METADATA__;
|
||||
if (window.__TAURI__?.convertFileSrc)
|
||||
delete window.__TAURI__.convertFileSrc;
|
||||
if (window.__TAURI_IPC__)
|
||||
delete window.__TAURI_IPC__;
|
||||
if (window.__TAURI_METADATA__)
|
||||
delete window.__TAURI_METADATA__;
|
||||
}
|
||||
export {
|
||||
clearMocks,
|
||||
mockConvertFileSrc,
|
||||
mockIPC,
|
||||
mockWindows
|
||||
};
|
||||
|
|
|
@ -88,9 +88,18 @@ async function tempdir() {
|
|||
}
|
||||
});
|
||||
}
|
||||
async function locale() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Os",
|
||||
message: {
|
||||
cmd: "locale"
|
||||
}
|
||||
});
|
||||
}
|
||||
export {
|
||||
EOL,
|
||||
arch,
|
||||
locale,
|
||||
platform,
|
||||
tempdir,
|
||||
type,
|
||||
|
|
|
@ -36,8 +36,7 @@ async function invoke(cmd, args = {}) {
|
|||
});
|
||||
}
|
||||
function convertFileSrc(filePath, protocol = "asset") {
|
||||
const path = encodeURIComponent(filePath);
|
||||
return navigator.userAgent.includes("Windows") ? `https://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}`;
|
||||
return window.__TAURI__.convertFileSrc(filePath, protocol);
|
||||
}
|
||||
export {
|
||||
convertFileSrc,
|
||||
|
|
|
@ -113,11 +113,12 @@ async function installUpdate() {
|
|||
function onStatusChange(statusResult) {
|
||||
if (statusResult.error) {
|
||||
cleanListener();
|
||||
return reject(statusResult.error);
|
||||
reject(statusResult.error);
|
||||
return;
|
||||
}
|
||||
if (statusResult.status === "DONE") {
|
||||
cleanListener();
|
||||
return resolve();
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
onUpdaterEvent(onStatusChange).then((fn) => {
|
||||
|
@ -143,7 +144,7 @@ async function checkUpdate() {
|
|||
return new Promise((resolve, reject) => {
|
||||
function onUpdateAvailable(manifest) {
|
||||
cleanListener();
|
||||
return resolve({
|
||||
resolve({
|
||||
manifest,
|
||||
shouldUpdate: true
|
||||
});
|
||||
|
@ -151,11 +152,12 @@ async function checkUpdate() {
|
|||
function onStatusChange(statusResult) {
|
||||
if (statusResult.error) {
|
||||
cleanListener();
|
||||
return reject(statusResult.error);
|
||||
reject(statusResult.error);
|
||||
return;
|
||||
}
|
||||
if (statusResult.status === "UPTODATE") {
|
||||
cleanListener();
|
||||
return resolve({
|
||||
resolve({
|
||||
shouldUpdate: false
|
||||
});
|
||||
}
|
||||
|
|
172
src/window.js
172
src/window.js
|
@ -266,6 +266,20 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async isMinimized() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isMinimized"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isMaximized() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -280,6 +294,20 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async isFocused() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isFocused"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isDecorated() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -308,6 +336,48 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async isMaximizable() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isMaximizable"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isMinimizable() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isMinimizable"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isClosable() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "isClosable"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async isVisible() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -322,6 +392,20 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async title() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "title"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async theme() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -388,6 +472,51 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async setMaximizable(maximizable) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setMaximizable",
|
||||
payload: maximizable
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setMinimizable(minimizable) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setMinimizable",
|
||||
payload: minimizable
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setClosable(closable) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setClosable",
|
||||
payload: closable
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setTitle(title) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
@ -545,6 +674,21 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
}
|
||||
});
|
||||
}
|
||||
async setContentProtected(protected_) {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
message: {
|
||||
cmd: "manage",
|
||||
data: {
|
||||
label: this.label,
|
||||
cmd: {
|
||||
type: "setContentProtected",
|
||||
payload: protected_
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async setSize(size) {
|
||||
if (!size || size.type !== "Logical" && size.type !== "Physical") {
|
||||
throw new Error(
|
||||
|
@ -811,10 +955,16 @@ var WindowManager = class extends WebviewWindowHandle {
|
|||
});
|
||||
}
|
||||
async onResized(handler) {
|
||||
return this.listen("tauri://resize" /* WINDOW_RESIZED */, handler);
|
||||
return this.listen("tauri://resize" /* WINDOW_RESIZED */, (e) => {
|
||||
e.payload = mapPhysicalSize(e.payload);
|
||||
handler(e);
|
||||
});
|
||||
}
|
||||
async onMoved(handler) {
|
||||
return this.listen("tauri://move" /* WINDOW_MOVED */, handler);
|
||||
return this.listen("tauri://move" /* WINDOW_MOVED */, (e) => {
|
||||
e.payload = mapPhysicalPosition(e.payload);
|
||||
handler(e);
|
||||
});
|
||||
}
|
||||
async onCloseRequested(handler) {
|
||||
return this.listen("tauri://close-requested" /* WINDOW_CLOSE_REQUESTED */, (event) => {
|
||||
|
@ -920,6 +1070,14 @@ var WebviewWindow = class extends WindowManager {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
static async getFocusedWindow() {
|
||||
for (const w of getAll()) {
|
||||
if (await w.isFocused()) {
|
||||
return w;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var appWindow;
|
||||
if ("__TAURI_METADATA__" in window) {
|
||||
|
@ -942,10 +1100,16 @@ function mapMonitor(m) {
|
|||
return m === null ? null : {
|
||||
name: m.name,
|
||||
scaleFactor: m.scaleFactor,
|
||||
position: new PhysicalPosition(m.position.x, m.position.y),
|
||||
size: new PhysicalSize(m.size.width, m.size.height)
|
||||
position: mapPhysicalPosition(m.position),
|
||||
size: mapPhysicalSize(m.size)
|
||||
};
|
||||
}
|
||||
function mapPhysicalPosition(m) {
|
||||
return new PhysicalPosition(m.x, m.y);
|
||||
}
|
||||
function mapPhysicalSize(m) {
|
||||
return new PhysicalSize(m.width, m.height);
|
||||
}
|
||||
async function currentMonitor() {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: "Window",
|
||||
|
|
2
tauri
2
tauri
|
@ -1 +1 @@
|
|||
Subproject commit 19019e4eb627e1c2191a1f0455239c32d2248bf5
|
||||
Subproject commit f9c97b7e5b05dfdf79eae2cb9b63f55c9184d82f
|
Loading…
Add table
Reference in a new issue