feat(plugins): use `@tauri-apps` namespace on NPM (#368)

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
pull/369/head
Lucas Fernandes Nogueira 2 years ago committed by GitHub
parent caf8456864
commit 22991af9f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,19 +11,19 @@
"@tauri-apps/api": "2.0.0-alpha.3", "@tauri-apps/api": "2.0.0-alpha.3",
"@tauri-apps/cli": "2.0.0-alpha.8", "@tauri-apps/cli": "2.0.0-alpha.8",
"@zerodevx/svelte-json-view": "0.2.1", "@zerodevx/svelte-json-view": "0.2.1",
"tauri-plugin-app-api": "0.0.0", "@tauri-apps/plugin-app": "0.0.0",
"tauri-plugin-cli-api": "0.0.0", "@tauri-apps/plugin-cli": "0.0.0",
"tauri-plugin-clipboard-api": "0.0.0", "@tauri-apps/plugin-clipboard": "0.0.0",
"tauri-plugin-dialog-api": "0.0.0", "@tauri-apps/plugin-dialog": "0.0.0",
"tauri-plugin-fs-api": "0.0.0", "@tauri-apps/plugin-fs": "0.0.0",
"tauri-plugin-global-shortcut-api": "0.0.0", "@tauri-apps/plugin-global-shortcut": "0.0.0",
"tauri-plugin-http-api": "0.0.0", "@tauri-apps/plugin-http": "0.0.0",
"tauri-plugin-notification-api": "0.0.0", "@tauri-apps/plugin-notification": "0.0.0",
"tauri-plugin-os-api": "0.0.0", "@tauri-apps/plugin-os": "0.0.0",
"tauri-plugin-process-api": "0.0.0", "@tauri-apps/plugin-process": "0.0.0",
"tauri-plugin-shell-api": "0.0.0", "@tauri-apps/plugin-shell": "0.0.0",
"tauri-plugin-updater-api": "0.0.0", "@tauri-apps/plugin-updater": "0.0.0",
"tauri-plugin-window-api": "0.0.0" "@tauri-apps/plugin-window": "0.0.0"
}, },
"devDependencies": { "devDependencies": {
"@iconify-json/codicon": "^1.1.10", "@iconify-json/codicon": "^1.1.10",

@ -1,8 +1,8 @@
<script> <script>
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import { open } from "tauri-plugin-shell-api"; import { open } from "@tauri-apps/plugin-shell";
import { appWindow, getCurrent } from "tauri-plugin-window-api"; import { appWindow, getCurrent } from "@tauri-apps/plugin-window";
import * as os from "tauri-plugin-os-api"; import * as os from "@tauri-apps/plugin-os";
import Welcome from "./views/Welcome.svelte"; import Welcome from "./views/Welcome.svelte";
import Cli from "./views/Cli.svelte"; import Cli from "./views/Cli.svelte";
@ -20,7 +20,7 @@
import App from "./views/App.svelte"; import App from "./views/App.svelte";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { ask } from "tauri-plugin-dialog-api"; import { ask } from "@tauri-apps/plugin-dialog";
if (appWindow.label !== "main") { if (appWindow.label !== "main") {
appWindow.onCloseRequested(async (event) => { appWindow.onCloseRequested(async (event) => {

@ -1,5 +1,5 @@
<script> <script>
import { show, hide } from "tauri-plugin-app-api"; import { show, hide } from "@tauri-apps/plugin-app";
export let onMessage; export let onMessage;

@ -1,5 +1,5 @@
<script> <script>
import { getMatches } from "tauri-plugin-cli-api"; import { getMatches } from "@tauri-apps/plugin-cli";
export let onMessage; export let onMessage;

@ -1,23 +1,23 @@
<script> <script>
import { writeText, readText } from 'tauri-plugin-clipboard-api' import { writeText, readText } from "@tauri-apps/plugin-clipboard";
export let onMessage export let onMessage;
let text = 'clipboard message' let text = "clipboard message";
function write() { function write() {
writeText(text) writeText(text)
.then(() => { .then(() => {
onMessage('Wrote to the clipboard') onMessage("Wrote to the clipboard");
}) })
.catch(onMessage) .catch(onMessage);
} }
function read() { function read() {
readText() readText()
.then((contents) => { .then((contents) => {
onMessage(`Clipboard contents: ${contents}`) onMessage(`Clipboard contents: ${contents}`);
}) })
.catch(onMessage) .catch(onMessage);
} }
</script> </script>

@ -1,5 +1,5 @@
<script> <script>
import { appWindow } from "tauri-plugin-window-api"; import { appWindow } from "@tauri-apps/plugin-window";
import { invoke } from "@tauri-apps/api/tauri"; import { invoke } from "@tauri-apps/api/tauri";
import { onMount, onDestroy } from "svelte"; import { onMount, onDestroy } from "svelte";

@ -1,99 +1,102 @@
<script> <script>
import { open, save, confirm } from 'tauri-plugin-dialog-api' import { open, save, confirm } from "@tauri-apps/plugin-dialog";
import { readBinaryFile } from 'tauri-plugin-fs-api' import { readBinaryFile } from "@tauri-apps/plugin-fs";
export let onMessage export let onMessage;
export let insecureRenderHtml export let insecureRenderHtml;
let defaultPath = null let defaultPath = null;
let filter = null let filter = null;
let multiple = false let multiple = false;
let directory = false let directory = false;
function arrayBufferToBase64(buffer, callback) { function arrayBufferToBase64(buffer, callback) {
var blob = new Blob([buffer], { var blob = new Blob([buffer], {
type: 'application/octet-binary' type: "application/octet-binary",
}) });
var reader = new FileReader() var reader = new FileReader();
reader.onload = function (evt) { reader.onload = function (evt) {
var dataurl = evt.target.result var dataurl = evt.target.result;
callback(dataurl.substr(dataurl.indexOf(',') + 1)) callback(dataurl.substr(dataurl.indexOf(",") + 1));
} };
reader.readAsDataURL(blob) reader.readAsDataURL(blob);
} }
async function prompt() { async function prompt() {
confirm('Is Tauri awesome?', { confirm("Is Tauri awesome?", {
okLabel: 'Absolutely', okLabel: "Absolutely",
cancelLabel: 'Totally', cancelLabel: "Totally",
}).then(res => onMessage(res })
? "Tauri is absolutely awesome" .then((res) =>
: "Tauri is totally awesome" onMessage(
)).catch(onMessage) res ? "Tauri is absolutely awesome" : "Tauri is totally awesome"
)
)
.catch(onMessage);
} }
function openDialog() { function openDialog() {
open({ open({
title: 'My wonderful open dialog', title: "My wonderful open dialog",
defaultPath, defaultPath,
filters: filter filters: filter
? [ ? [
{ {
name: 'Tauri Example', name: "Tauri Example",
extensions: filter.split(',').map((f) => f.trim()) extensions: filter.split(",").map((f) => f.trim()),
} },
] ]
: [], : [],
multiple, multiple,
directory directory,
}) })
.then(function (res) { .then(function (res) {
if (Array.isArray(res)) { if (Array.isArray(res)) {
onMessage(res) onMessage(res);
} else { } else {
var pathToRead = typeof res === 'string' ? res : res.path var pathToRead = typeof res === "string" ? res : res.path;
var isFile = pathToRead.match(/\S+\.\S+$/g) var isFile = pathToRead.match(/\S+\.\S+$/g);
readBinaryFile(pathToRead) readBinaryFile(pathToRead)
.then(function (response) { .then(function (response) {
if (isFile) { if (isFile) {
if ( if (
pathToRead.includes('.png') || pathToRead.includes(".png") ||
pathToRead.includes('.jpg') pathToRead.includes(".jpg")
) { ) {
arrayBufferToBase64( arrayBufferToBase64(
new Uint8Array(response), new Uint8Array(response),
function (base64) { function (base64) {
var src = 'data:image/png;base64,' + base64 var src = "data:image/png;base64," + base64;
insecureRenderHtml('<img src="' + src + '"></img>') insecureRenderHtml('<img src="' + src + '"></img>');
} }
) );
} else { } else {
onMessage(res) onMessage(res);
} }
} else { } else {
onMessage(res) onMessage(res);
} }
}) })
.catch(onMessage(res)) .catch(onMessage(res));
} }
}) })
.catch(onMessage) .catch(onMessage);
} }
function saveDialog() { function saveDialog() {
save({ save({
title: 'My wonderful save dialog', title: "My wonderful save dialog",
defaultPath, defaultPath,
filters: filter filters: filter
? [ ? [
{ {
name: 'Tauri Example', name: "Tauri Example",
extensions: filter.split(',').map((f) => f.trim()) extensions: filter.split(",").map((f) => f.trim()),
} },
] ]
: [] : [],
}) })
.then(onMessage) .then(onMessage)
.catch(onMessage) .catch(onMessage);
} }
</script> </script>

@ -3,79 +3,79 @@
readBinaryFile, readBinaryFile,
writeTextFile, writeTextFile,
readDir, readDir,
Dir Dir,
} from 'tauri-plugin-fs-api' } from "@tauri-apps/plugin-fs";
import { convertFileSrc } from '@tauri-apps/api/tauri' import { convertFileSrc } from "@tauri-apps/api/tauri";
export let onMessage export let onMessage;
export let insecureRenderHtml export let insecureRenderHtml;
let pathToRead = '' let pathToRead = "";
let img let img;
function getDir() { function getDir() {
const dirSelect = document.getElementById('dir') const dirSelect = document.getElementById("dir");
return dirSelect.value ? parseInt(dir.value) : null return dirSelect.value ? parseInt(dir.value) : null;
} }
function arrayBufferToBase64(buffer, callback) { function arrayBufferToBase64(buffer, callback) {
const blob = new Blob([buffer], { const blob = new Blob([buffer], {
type: 'application/octet-binary' type: "application/octet-binary",
}) });
const reader = new FileReader() const reader = new FileReader();
reader.onload = function (evt) { reader.onload = function (evt) {
const dataurl = evt.target.result const dataurl = evt.target.result;
callback(dataurl.substr(dataurl.indexOf(',') + 1)) callback(dataurl.substr(dataurl.indexOf(",") + 1));
} };
reader.readAsDataURL(blob) reader.readAsDataURL(blob);
} }
const DirOptions = Object.keys(Dir) const DirOptions = Object.keys(Dir)
.filter((key) => isNaN(parseInt(key))) .filter((key) => isNaN(parseInt(key)))
.map((dir) => [dir, Dir[dir]]) .map((dir) => [dir, Dir[dir]]);
function read() { function read() {
const isFile = pathToRead.match(/\S+\.\S+$/g) const isFile = pathToRead.match(/\S+\.\S+$/g);
const opts = { const opts = {
dir: getDir() dir: getDir(),
} };
const promise = isFile const promise = isFile
? readBinaryFile(pathToRead, opts) ? readBinaryFile(pathToRead, opts)
: readDir(pathToRead, opts) : readDir(pathToRead, opts);
promise promise
.then(function (response) { .then(function (response) {
if (isFile) { if (isFile) {
if (pathToRead.includes('.png') || pathToRead.includes('.jpg')) { if (pathToRead.includes(".png") || pathToRead.includes(".jpg")) {
arrayBufferToBase64(new Uint8Array(response), function (base64) { arrayBufferToBase64(new Uint8Array(response), function (base64) {
const src = 'data:image/png;base64,' + base64 const src = "data:image/png;base64," + base64;
insecureRenderHtml('<img src="' + src + '"></img>') insecureRenderHtml('<img src="' + src + '"></img>');
}) });
} else { } else {
const value = String.fromCharCode.apply(null, response) const value = String.fromCharCode.apply(null, response);
insecureRenderHtml( insecureRenderHtml(
'<textarea id="file-response"></textarea><button id="file-save">Save</button>' '<textarea id="file-response"></textarea><button id="file-save">Save</button>'
) );
setTimeout(() => { setTimeout(() => {
const fileInput = document.getElementById('file-response') const fileInput = document.getElementById("file-response");
fileInput.value = value fileInput.value = value;
document document
.getElementById('file-save') .getElementById("file-save")
.addEventListener('click', function () { .addEventListener("click", function () {
writeTextFile(pathToRead, fileInput.value, { writeTextFile(pathToRead, fileInput.value, {
dir: getDir() dir: getDir(),
}).catch(onMessage) }).catch(onMessage);
}) });
}) });
} }
} else { } else {
onMessage(response) onMessage(response);
} }
}) })
.catch(onMessage) .catch(onMessage);
} }
function setSrc() { function setSrc() {
img.src = convertFileSrc(pathToRead) img.src = convertFileSrc(pathToRead);
} }
</script> </script>

@ -1,60 +1,60 @@
<script> <script>
import { getClient, Body, ResponseType } from 'tauri-plugin-http-api' import { getClient, Body, ResponseType } from "@tauri-apps/plugin-http";
import { JsonView } from '@zerodevx/svelte-json-view' import { JsonView } from "@zerodevx/svelte-json-view";
let httpMethod = 'GET' let httpMethod = "GET";
let httpBody = '' let httpBody = "";
export let onMessage export let onMessage;
async function makeHttpRequest() { async function makeHttpRequest() {
const client = await getClient().catch((e) => { const client = await getClient().catch((e) => {
onMessage(e) onMessage(e);
throw e throw e;
}) });
let method = httpMethod || 'GET' let method = httpMethod || "GET";
const options = { const options = {
url: 'http://localhost:3003', url: "http://localhost:3003",
method: method || 'GET' method: method || "GET",
} };
if ( if (
(httpBody.startsWith('{') && httpBody.endsWith('}')) || (httpBody.startsWith("{") && httpBody.endsWith("}")) ||
(httpBody.startsWith('[') && httpBody.endsWith(']')) (httpBody.startsWith("[") && httpBody.endsWith("]"))
) { ) {
options.body = Body.json(JSON.parse(httpBody)) options.body = Body.json(JSON.parse(httpBody));
} else if (httpBody !== '') { } else if (httpBody !== "") {
options.body = Body.text(httpBody) options.body = Body.text(httpBody);
} }
client.request(options).then(onMessage).catch(onMessage) client.request(options).then(onMessage).catch(onMessage);
} }
/// http form /// http form
let foo = 'baz' let foo = "baz";
let bar = 'qux' let bar = "qux";
let result = null let result = null;
let multipart = true let multipart = true;
async function doPost() { async function doPost() {
const client = await getClient().catch((e) => { const client = await getClient().catch((e) => {
onMessage(e) onMessage(e);
throw e throw e;
}) });
result = await client.request({ result = await client.request({
url: 'http://localhost:3003', url: "http://localhost:3003",
method: 'POST', method: "POST",
body: Body.form({ body: Body.form({
foo, foo,
bar bar,
}), }),
headers: multipart headers: multipart
? { 'Content-Type': 'multipart/form-data' } ? { "Content-Type": "multipart/form-data" }
: undefined, : undefined,
responseType: ResponseType.Text responseType: ResponseType.Text,
}) });
} }
</script> </script>

@ -1,65 +1,65 @@
<script> <script>
import { Command } from 'tauri-plugin-shell-api' import { Command } from "@tauri-apps/plugin-shell";
const windows = navigator.userAgent.includes('Windows') const windows = navigator.userAgent.includes("Windows");
let cmd = windows ? 'cmd' : 'sh' let cmd = windows ? "cmd" : "sh";
let args = windows ? ['/C'] : ['-c'] let args = windows ? ["/C"] : ["-c"];
export let onMessage export let onMessage;
let script = 'echo "hello world"' let script = 'echo "hello world"';
let cwd = null let cwd = null;
let env = 'SOMETHING=value ANOTHER=2' let env = "SOMETHING=value ANOTHER=2";
let encoding = '' let encoding = "";
let stdin = '' let stdin = "";
let child let child;
function _getEnv() { function _getEnv() {
return env.split(' ').reduce((env, clause) => { return env.split(" ").reduce((env, clause) => {
let [key, value] = clause.split('=') let [key, value] = clause.split("=");
return { return {
...env, ...env,
[key]: value [key]: value,
} };
}, {}) }, {});
} }
function spawn() { function spawn() {
child = null child = null;
const command = Command.create(cmd, [...args, script], { const command = Command.create(cmd, [...args, script], {
cwd: cwd || null, cwd: cwd || null,
env: _getEnv(), env: _getEnv(),
encoding: encoding || undefined, encoding: encoding || undefined,
}) });
command.on('close', (data) => { command.on("close", (data) => {
onMessage( onMessage(
`command finished with code ${data.code} and signal ${data.signal}` `command finished with code ${data.code} and signal ${data.signal}`
) );
child = null child = null;
}) });
command.on('error', (error) => onMessage(`command error: "${error}"`)) command.on("error", (error) => onMessage(`command error: "${error}"`));
command.stdout.on('data', (line) => onMessage(`command stdout: "${line}"`)) command.stdout.on("data", (line) => onMessage(`command stdout: "${line}"`));
command.stderr.on('data', (line) => onMessage(`command stderr: "${line}"`)) command.stderr.on("data", (line) => onMessage(`command stderr: "${line}"`));
command command
.spawn() .spawn()
.then((c) => { .then((c) => {
child = c child = c;
}) })
.catch(onMessage) .catch(onMessage);
} }
function kill() { function kill() {
child child
.kill() .kill()
.then(() => onMessage('killed child process')) .then(() => onMessage("killed child process"))
.catch(onMessage) .catch(onMessage);
} }
function writeToStdin() { function writeToStdin() {
child.write(stdin).catch(onMessage) child.write(stdin).catch(onMessage);
} }
</script> </script>

@ -1,46 +1,46 @@
<script> <script>
import { writable } from 'svelte/store' import { writable } from "svelte/store";
import { import {
register as registerShortcut, register as registerShortcut,
unregister as unregisterShortcut, unregister as unregisterShortcut,
unregisterAll as unregisterAllShortcuts unregisterAll as unregisterAllShortcuts,
} from 'tauri-plugin-global-shortcut-api' } from "@tauri-apps/plugin-global-shortcut";
export let onMessage export let onMessage;
const shortcuts = writable([]) const shortcuts = writable([]);
let shortcut = 'CmdOrControl+X' let shortcut = "CmdOrControl+X";
function register() { function register() {
const shortcut_ = shortcut const shortcut_ = shortcut;
registerShortcut(shortcut_, () => { registerShortcut(shortcut_, () => {
onMessage(`Shortcut ${shortcut_} triggered`) onMessage(`Shortcut ${shortcut_} triggered`);
}) })
.then(() => { .then(() => {
shortcuts.update((shortcuts_) => [...shortcuts_, shortcut_]) shortcuts.update((shortcuts_) => [...shortcuts_, shortcut_]);
onMessage(`Shortcut ${shortcut_} registered successfully`) onMessage(`Shortcut ${shortcut_} registered successfully`);
}) })
.catch(onMessage) .catch(onMessage);
} }
function unregister(shortcut) { function unregister(shortcut) {
const shortcut_ = shortcut const shortcut_ = shortcut;
unregisterShortcut(shortcut_) unregisterShortcut(shortcut_)
.then(() => { .then(() => {
shortcuts.update((shortcuts_) => shortcuts.update((shortcuts_) =>
shortcuts_.filter((s) => s !== shortcut_) shortcuts_.filter((s) => s !== shortcut_)
) );
onMessage(`Shortcut ${shortcut_} unregistered`) onMessage(`Shortcut ${shortcut_} unregistered`);
}) })
.catch(onMessage) .catch(onMessage);
} }
function unregisterAll() { function unregisterAll() {
unregisterAllShortcuts() unregisterAllShortcuts()
.then(() => { .then(() => {
shortcuts.update(() => []) shortcuts.update(() => []);
onMessage(`Unregistered all shortcuts`) onMessage(`Unregistered all shortcuts`);
}) })
.catch(onMessage) .catch(onMessage);
} }
</script> </script>

@ -1,6 +1,6 @@
<script> <script>
import { check } from "tauri-plugin-updater-api"; import { check } from "@tauri-apps/plugin-updater";
import { relaunch } from "tauri-plugin-process-api"; import { relaunch } from "@tauri-apps/plugin-process";
export let onMessage; export let onMessage;

@ -1,27 +1,27 @@
<script> <script>
import { getName, getVersion, getTauriVersion } from 'tauri-plugin-app-api' import { getName, getVersion, getTauriVersion } from "@tauri-apps/plugin-app";
import { relaunch, exit } from 'tauri-plugin-process-api' import { relaunch, exit } from "@tauri-apps/plugin-process";
let version = '0.0.0' let version = "0.0.0";
let tauriVersion = '0.0.0' let tauriVersion = "0.0.0";
let appName = 'Unknown' let appName = "Unknown";
getName().then((n) => { getName().then((n) => {
appName = n appName = n;
}) });
getVersion().then((v) => { getVersion().then((v) => {
version = v version = v;
}) });
getTauriVersion().then((v) => { getTauriVersion().then((v) => {
tauriVersion = v tauriVersion = v;
}) });
async function closeApp() { async function closeApp() {
await exit() await exit();
} }
async function relaunchApp() { async function relaunchApp() {
await relaunch() await relaunch();
} }
</script> </script>

@ -6,9 +6,9 @@
UserAttentionType, UserAttentionType,
PhysicalSize, PhysicalSize,
PhysicalPosition, PhysicalPosition,
} from "tauri-plugin-window-api"; } from "@tauri-apps/plugin-window";
import { open as openDialog } from "tauri-plugin-dialog-api"; import { open as openDialog } from "@tauri-apps/plugin-dialog";
import { open } from "tauri-plugin-shell-api"; import { open } from "@tauri-apps/plugin-shell";
let selectedWindow = appWindow.label; let selectedWindow = appWindow.label;
const windowMap = { const windowMap = {

@ -40,7 +40,7 @@ npm manifest:
"dependencies": { "dependencies": {
"@tauri-apps/api": "../../tooling/api/dist", "@tauri-apps/api": "../../tooling/api/dist",
"@zerodevx/svelte-json-view": "0.2.1", "@zerodevx/svelte-json-view": "0.2.1",
"tauri-plugin-fs-api": "https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/fs?feat/fs-plugin&scripts.build=build" "@tauri-apps/plugin-fs": "https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/fs?feat/fs-plugin&scripts.build=build"
}, },
"devDependencies": { "devDependencies": {
"@iconify-json/codicon": "^1.1.10", "@iconify-json/codicon": "^1.1.10",
@ -1009,7 +1009,7 @@ Lockfile:
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.49.0.tgz#5baee3c672306de1070c3b7888fc2204e36a4029" resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.49.0.tgz#5baee3c672306de1070c3b7888fc2204e36a4029"
integrity sha512-+lmjic1pApJWDfPCpUUTc1m8azDqYCG1JN9YEngrx/hUyIcFJo6VZhj0A1Ai0wqoHcEIuQy+e9tk+4uDgdtsFA== integrity sha512-+lmjic1pApJWDfPCpUUTc1m8azDqYCG1JN9YEngrx/hUyIcFJo6VZhj0A1Ai0wqoHcEIuQy+e9tk+4uDgdtsFA==
"tauri-plugin-fs-api@https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/fs?feat/fs-plugin": "@tauri-apps/plugin-fs@https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/fs?feat/fs-plugin":
version "0.0.0" version "0.0.0"
resolved "https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/fs?feat/fs-plugin#a4b37d92c5fd3e638ad21d4ccf0132e07acc0136" resolved "https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/fs?feat/fs-plugin#a4b37d92c5fd3e638ad21d4ccf0132e07acc0136"
dependencies: dependencies:

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import * as app from "tauri-plugin-app-api"; import * as app from "@tauri-apps/plugin-app";
``` ```
## Contributing ## Contributing

@ -30,7 +30,7 @@ import { invoke } from "@tauri-apps/api/tauri";
* Gets the application version. * Gets the application version.
* @example * @example
* ```typescript * ```typescript
* import { getVersion } from 'tauri-plugin-app-api'; * import { getVersion } from '@tauri-apps/plugin-app';
* const appVersion = await getVersion(); * const appVersion = await getVersion();
* ``` * ```
* *
@ -44,7 +44,7 @@ async function getVersion(): Promise<string> {
* Gets the application name. * Gets the application name.
* @example * @example
* ```typescript * ```typescript
* import { getName } from 'tauri-plugin-app-api'; * import { getName } from '@tauri-apps/plugin-app';
* const appName = await getName(); * const appName = await getName();
* ``` * ```
* *
@ -59,7 +59,7 @@ async function getName(): Promise<string> {
* *
* @example * @example
* ```typescript * ```typescript
* import { getTauriVersion } from 'tauri-plugin-app-api'; * import { getTauriVersion } from '@tauri-apps/plugin-app';
* const tauriVersion = await getTauriVersion(); * const tauriVersion = await getTauriVersion();
* ``` * ```
* *
@ -74,7 +74,7 @@ async function getTauriVersion(): Promise<string> {
* *
* @example * @example
* ```typescript * ```typescript
* import { show } from 'tauri-plugin-app-api'; * import { show } from '@tauri-apps/plugin-app';
* await show(); * await show();
* ``` * ```
* *
@ -89,7 +89,7 @@ async function show(): Promise<void> {
* *
* @example * @example
* ```typescript * ```typescript
* import { hide } from 'tauri-plugin-app-api'; * import { hide } from '@tauri-apps/plugin-app';
* await hide(); * await hide();
* ``` * ```
* *

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-app-api", "name": "@tauri-apps/plugin-app",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -53,7 +53,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { Authenticator } from "tauri-plugin-authenticator-api"; import { Authenticator } from "@tauri-apps/plugin-authenticator";
const auth = new Authenticator(); const auth = new Authenticator();
auth.init(); // initialize transports auth.init(); // initialize transports

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-authenticator-api", "name": "@tauri-apps/plugin-authenticator",
"version": "0.0.0", "version": "0.0.0",
"description": "Use hardware security-keys in your Tauri App.", "description": "Use hardware security-keys in your Tauri App.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -53,7 +53,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { enable, isEnabled, disable } from "tauri-plugin-autostart-api"; import { enable, isEnabled, disable } from "@tauri-apps/plugin-autostart";
await enable(); await enable();

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-autostart-api", "name": "@tauri-apps/plugin-autostart",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -47,7 +47,7 @@ interface CliMatches {
* *
* @example * @example
* ```typescript * ```typescript
* import { getMatches } from 'tauri-plugin-cli-api'; * import { getMatches } from '@tauri-apps/plugin-cli';
* const matches = await getMatches(); * const matches = await getMatches();
* if (matches.subcommand?.name === 'run') { * if (matches.subcommand?.name === 'run') {
* // `./your-app run $ARGS` was executed * // `./your-app run $ARGS` was executed

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-cli-api", "name": "@tauri-apps/plugin-cli",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -37,7 +37,7 @@ type ClipResponse = Clip<"PlainText", string>;
* Writes plain text to the clipboard. * Writes plain text to the clipboard.
* @example * @example
* ```typescript * ```typescript
* import { writeText, readText } from 'tauri-plugin-clipboard-api'; * import { writeText, readText } from '@tauri-apps/plugin-clipboard';
* await writeText('Tauri is awesome!'); * await writeText('Tauri is awesome!');
* assert(await readText(), 'Tauri is awesome!'); * assert(await readText(), 'Tauri is awesome!');
* ``` * ```
@ -65,7 +65,7 @@ async function writeText(
* Gets the clipboard content as plain text. * Gets the clipboard content as plain text.
* @example * @example
* ```typescript * ```typescript
* import { readText } from 'tauri-plugin-clipboard-api'; * import { readText } from '@tauri-apps/plugin-clipboard';
* const clipboardText = await readText(); * const clipboardText = await readText();
* ``` * ```
* @since 1.0.0. * @since 1.0.0.

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-clipboard-api", "name": "@tauri-apps/plugin-clipboard",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -18,7 +18,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-dialog-api = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-dialog = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
``` ```
You can install the JavaScript Guest bindings using your preferred JavaScript package manager: You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. > Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh ```sh
pnpm add tauri-plugin-dialog-api pnpm add @tauri-apps/plugin-dialog
# or # or
npm add tauri-plugin-dialog-api npm add @tauri-apps/plugin-dialog
# or # or
yarn add tauri-plugin-dialog-api yarn add @tauri-apps/plugin-dialog
``` ```
## Usage ## Usage

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-dialog-api", "name": "@tauri-apps/plugin-dialog",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { watch, watchImmediate } from "tauri-plugin-fs-watch-api"; import { watch, watchImmediate } from "@tauri-apps/plugin-fs-watch";
// can also watch an array of paths // can also watch an array of paths
const stopWatching = await watch( const stopWatching = await watch(

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-fs-watch-api", "name": "@tauri-apps/plugin-fs-watch",
"version": "0.0.0", "version": "0.0.0",
"description": "Watch files and directories for changes.", "description": "Watch files and directories for changes.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { metadata } from "tauri-plugin-fs-api"; import { metadata } from "@tauri-apps/plugin-fs";
await metadata("/path/to/file"); await metadata("/path/to/file");
``` ```

@ -273,7 +273,7 @@ interface FileEntry {
* Reads a file as an UTF-8 encoded string. * Reads a file as an UTF-8 encoded string.
* @example * @example
* ```typescript * ```typescript
* import { readTextFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Read the text file in the `$APPCONFIG/app.conf` path * // Read the text file in the `$APPCONFIG/app.conf` path
* const contents = await readTextFile('app.conf', { dir: BaseDirectory.AppConfig }); * const contents = await readTextFile('app.conf', { dir: BaseDirectory.AppConfig });
* ``` * ```
@ -294,7 +294,7 @@ async function readTextFile(
* Reads a file as byte array. * Reads a file as byte array.
* @example * @example
* ```typescript * ```typescript
* import { readBinaryFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { readBinaryFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Read the image file in the `$RESOURCEDIR/avatar.png` path * // Read the image file in the `$RESOURCEDIR/avatar.png` path
* const contents = await readBinaryFile('avatar.png', { dir: BaseDirectory.Resource }); * const contents = await readBinaryFile('avatar.png', { dir: BaseDirectory.Resource });
* ``` * ```
@ -317,7 +317,7 @@ async function readBinaryFile(
* Writes a UTF-8 text file. * Writes a UTF-8 text file.
* @example * @example
* ```typescript * ```typescript
* import { writeTextFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { writeTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Write a text file to the `$APPCONFIG/app.conf` path * // Write a text file to the `$APPCONFIG/app.conf` path
* await writeTextFile('app.conf', 'file contents', { dir: BaseDirectory.AppConfig }); * await writeTextFile('app.conf', 'file contents', { dir: BaseDirectory.AppConfig });
* ``` * ```
@ -334,7 +334,7 @@ async function writeTextFile(
* Writes a UTF-8 text file. * Writes a UTF-8 text file.
* @example * @example
* ```typescript * ```typescript
* import { writeTextFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { writeTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Write a text file to the `$APPCONFIG/app.conf` path * // Write a text file to the `$APPCONFIG/app.conf` path
* await writeTextFile({ path: 'app.conf', contents: 'file contents' }, { dir: BaseDirectory.AppConfig }); * await writeTextFile({ path: 'app.conf', contents: 'file contents' }, { dir: BaseDirectory.AppConfig });
* ``` * ```
@ -392,7 +392,7 @@ async function writeTextFile(
* Writes a byte array content to a file. * Writes a byte array content to a file.
* @example * @example
* ```typescript * ```typescript
* import { writeBinaryFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { writeBinaryFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Write a binary file to the `$APPDATA/avatar.png` path * // Write a binary file to the `$APPDATA/avatar.png` path
* await writeBinaryFile('avatar.png', new Uint8Array([]), { dir: BaseDirectory.AppData }); * await writeBinaryFile('avatar.png', new Uint8Array([]), { dir: BaseDirectory.AppData });
* ``` * ```
@ -412,7 +412,7 @@ async function writeBinaryFile(
* Writes a byte array content to a file. * Writes a byte array content to a file.
* @example * @example
* ```typescript * ```typescript
* import { writeBinaryFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { writeBinaryFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Write a binary file to the `$APPDATA/avatar.png` path * // Write a binary file to the `$APPDATA/avatar.png` path
* await writeBinaryFile({ path: 'avatar.png', contents: new Uint8Array([]) }, { dir: BaseDirectory.AppData }); * await writeBinaryFile({ path: 'avatar.png', contents: new Uint8Array([]) }, { dir: BaseDirectory.AppData });
* ``` * ```
@ -478,7 +478,7 @@ async function writeBinaryFile(
* List directory files. * List directory files.
* @example * @example
* ```typescript * ```typescript
* import { readDir, BaseDirectory } from 'tauri-plugin-fs-api'; * import { readDir, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Reads the `$APPDATA/users` directory recursively * // Reads the `$APPDATA/users` directory recursively
* const entries = await readDir('users', { dir: BaseDirectory.AppData, recursive: true }); * const entries = await readDir('users', { dir: BaseDirectory.AppData, recursive: true });
* *
@ -510,7 +510,7 @@ async function readDir(
* and the `recursive` option isn't set to true, the promise will be rejected. * and the `recursive` option isn't set to true, the promise will be rejected.
* @example * @example
* ```typescript * ```typescript
* import { createDir, BaseDirectory } from 'tauri-plugin-fs-api'; * import { createDir, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Create the `$APPDATA/users` directory * // Create the `$APPDATA/users` directory
* await createDir('users', { dir: BaseDirectory.AppData, recursive: true }); * await createDir('users', { dir: BaseDirectory.AppData, recursive: true });
* ``` * ```
@ -534,7 +534,7 @@ async function createDir(
* If the directory is not empty and the `recursive` option isn't set to true, the promise will be rejected. * If the directory is not empty and the `recursive` option isn't set to true, the promise will be rejected.
* @example * @example
* ```typescript * ```typescript
* import { removeDir, BaseDirectory } from 'tauri-plugin-fs-api'; * import { removeDir, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Remove the directory `$APPDATA/users` * // Remove the directory `$APPDATA/users`
* await removeDir('users', { dir: BaseDirectory.AppData }); * await removeDir('users', { dir: BaseDirectory.AppData });
* ``` * ```
@ -557,7 +557,7 @@ async function removeDir(
* Copies a file to a destination. * Copies a file to a destination.
* @example * @example
* ```typescript * ```typescript
* import { copyFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { copyFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Copy the `$APPCONFIG/app.conf` file to `$APPCONFIG/app.conf.bk` * // Copy the `$APPCONFIG/app.conf` file to `$APPCONFIG/app.conf.bk`
* await copyFile('app.conf', 'app.conf.bk', { dir: BaseDirectory.AppConfig }); * await copyFile('app.conf', 'app.conf.bk', { dir: BaseDirectory.AppConfig });
* ``` * ```
@ -582,7 +582,7 @@ async function copyFile(
* Removes a file. * Removes a file.
* @example * @example
* ```typescript * ```typescript
* import { removeFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { removeFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Remove the `$APPConfig/app.conf` file * // Remove the `$APPConfig/app.conf` file
* await removeFile('app.conf', { dir: BaseDirectory.AppConfig }); * await removeFile('app.conf', { dir: BaseDirectory.AppConfig });
* ``` * ```
@ -605,7 +605,7 @@ async function removeFile(
* Renames a file. * Renames a file.
* @example * @example
* ```typescript * ```typescript
* import { renameFile, BaseDirectory } from 'tauri-plugin-fs-api'; * import { renameFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Rename the `$APPDATA/avatar.png` file * // Rename the `$APPDATA/avatar.png` file
* await renameFile('avatar.png', 'deleted.png', { dir: BaseDirectory.AppData }); * await renameFile('avatar.png', 'deleted.png', { dir: BaseDirectory.AppData });
* ``` * ```
@ -630,7 +630,7 @@ async function renameFile(
* Check if a path exists. * Check if a path exists.
* @example * @example
* ```typescript * ```typescript
* import { exists, BaseDirectory } from 'tauri-plugin-fs-api'; * import { exists, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Check if the `$APPDATA/avatar.png` file exists * // Check if the `$APPDATA/avatar.png` file exists
* await exists('avatar.png', { dir: BaseDirectory.AppData }); * await exists('avatar.png', { dir: BaseDirectory.AppData });
* ``` * ```

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-fs-api", "name": "@tauri-apps/plugin-fs",
"version": "0.0.0", "version": "0.0.0",
"description": "Access the file system.", "description": "Access the file system.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -29,7 +29,7 @@ export type ShortcutHandler = (shortcut: string) => void;
* Register a global shortcut. * Register a global shortcut.
* @example * @example
* ```typescript * ```typescript
* import { register } from 'tauri-plugin-global-shortcut-api'; * import { register } from '@tauri-apps/plugin-global-shortcut';
* await register('CommandOrControl+Shift+C', () => { * await register('CommandOrControl+Shift+C', () => {
* console.log('Shortcut triggered'); * console.log('Shortcut triggered');
* }); * });
@ -54,7 +54,7 @@ async function register(
* Register a collection of global shortcuts. * Register a collection of global shortcuts.
* @example * @example
* ```typescript * ```typescript
* import { registerAll } from 'tauri-plugin-global-shortcut-api'; * import { registerAll } from '@tauri-apps/plugin-global-shortcut';
* await registerAll(['CommandOrControl+Shift+C', 'Ctrl+Alt+F12'], (shortcut) => { * await registerAll(['CommandOrControl+Shift+C', 'Ctrl+Alt+F12'], (shortcut) => {
* console.log(`Shortcut ${shortcut} triggered`); * console.log(`Shortcut ${shortcut} triggered`);
* }); * });
@ -82,7 +82,7 @@ async function registerAll(
* *
* @example * @example
* ```typescript * ```typescript
* import { isRegistered } from 'tauri-plugin-global-shortcut-api'; * import { isRegistered } from '@tauri-apps/plugin-global-shortcut';
* const isRegistered = await isRegistered('CommandOrControl+P'); * const isRegistered = await isRegistered('CommandOrControl+P');
* ``` * ```
* *
@ -100,7 +100,7 @@ async function isRegistered(shortcut: string): Promise<boolean> {
* Unregister a global shortcut. * Unregister a global shortcut.
* @example * @example
* ```typescript * ```typescript
* import { unregister } from 'tauri-plugin-global-shortcut-api'; * import { unregister } from '@tauri-apps/plugin-global-shortcut';
* await unregister('CmdOrControl+Space'); * await unregister('CmdOrControl+Space');
* ``` * ```
* *
@ -118,7 +118,7 @@ async function unregister(shortcut: string): Promise<void> {
* Unregisters all shortcuts registered by the application. * Unregisters all shortcuts registered by the application.
* @example * @example
* ```typescript * ```typescript
* import { unregisterAll } from 'tauri-plugin-global-shortcut-api'; * import { unregisterAll } from '@tauri-apps/plugin-global-shortcut';
* await unregisterAll(); * await unregisterAll();
* ``` * ```
* *

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-global-shortcut-api", "name": "@tauri-apps/plugin-global-shortcut",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -108,7 +108,7 @@ class Body {
* Note that a file path must be allowed in the `fs` allowlist scope. * Note that a file path must be allowed in the `fs` allowlist scope.
* @example * @example
* ```typescript * ```typescript
* import { Body } from "tauri-plugin-http-api" * import { Body } from "@tauri-apps/plugin-http"
* const body = Body.form({ * const body = Body.form({
* key: 'value', * key: 'value',
* image: { * image: {
@ -169,7 +169,7 @@ class Body {
* Creates a new JSON body. * Creates a new JSON body.
* @example * @example
* ```typescript * ```typescript
* import { Body } from "tauri-plugin-http-api" * import { Body } from "@tauri-apps/plugin-http"
* Body.json({ * Body.json({
* registered: true, * registered: true,
* name: 'tauri' * name: 'tauri'
@ -188,7 +188,7 @@ class Body {
* Creates a new UTF-8 string body. * Creates a new UTF-8 string body.
* @example * @example
* ```typescript * ```typescript
* import { Body } from "tauri-plugin-http-api" * import { Body } from "@tauri-apps/plugin-http"
* Body.text('The body content as a string'); * Body.text('The body content as a string');
* ``` * ```
* *
@ -204,7 +204,7 @@ class Body {
* Creates a new byte array body. * Creates a new byte array body.
* @example * @example
* ```typescript * ```typescript
* import { Body } from "tauri-plugin-http-api" * import { Body } from "@tauri-apps/plugin-http"
* Body.bytes(new Uint8Array([1, 2, 3])); * Body.bytes(new Uint8Array([1, 2, 3]));
* ``` * ```
* *
@ -308,7 +308,7 @@ class Client {
* Drops the client instance. * Drops the client instance.
* @example * @example
* ```typescript * ```typescript
* import { getClient } from 'tauri-plugin-http-api'; * import { getClient } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* await client.drop(); * await client.drop();
* ``` * ```
@ -323,7 +323,7 @@ class Client {
* Makes an HTTP request. * Makes an HTTP request.
* @example * @example
* ```typescript * ```typescript
* import { getClient } from 'tauri-plugin-http-api'; * import { getClient } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* const response = await client.request({ * const response = await client.request({
* method: 'GET', * method: 'GET',
@ -367,7 +367,7 @@ class Client {
* Makes a GET request. * Makes a GET request.
* @example * @example
* ```typescript * ```typescript
* import { getClient, ResponseType } from 'tauri-plugin-http-api'; * import { getClient, ResponseType } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* const response = await client.get('http://localhost:3003/users', { * const response = await client.get('http://localhost:3003/users', {
* timeout: 30, * timeout: 30,
@ -388,7 +388,7 @@ class Client {
* Makes a POST request. * Makes a POST request.
* @example * @example
* ```typescript * ```typescript
* import { getClient, Body, ResponseType } from 'tauri-plugin-http-api'; * import { getClient, Body, ResponseType } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* const response = await client.post('http://localhost:3003/users', { * const response = await client.post('http://localhost:3003/users', {
* body: Body.json({ * body: Body.json({
@ -417,7 +417,7 @@ class Client {
* Makes a PUT request. * Makes a PUT request.
* @example * @example
* ```typescript * ```typescript
* import { getClient, Body } from 'tauri-plugin-http-api'; * import { getClient, Body } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* const response = await client.put('http://localhost:3003/users/1', { * const response = await client.put('http://localhost:3003/users/1', {
* body: Body.form({ * body: Body.form({
@ -447,7 +447,7 @@ class Client {
* Makes a PATCH request. * Makes a PATCH request.
* @example * @example
* ```typescript * ```typescript
* import { getClient, Body } from 'tauri-plugin-http-api'; * import { getClient, Body } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* const response = await client.patch('http://localhost:3003/users/1', { * const response = await client.patch('http://localhost:3003/users/1', {
* body: Body.json({ email: 'contact@tauri.app' }) * body: Body.json({ email: 'contact@tauri.app' })
@ -466,7 +466,7 @@ class Client {
* Makes a DELETE request. * Makes a DELETE request.
* @example * @example
* ```typescript * ```typescript
* import { getClient } from 'tauri-plugin-http-api'; * import { getClient } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* const response = await client.delete('http://localhost:3003/users/1'); * const response = await client.delete('http://localhost:3003/users/1');
* ``` * ```
@ -484,7 +484,7 @@ class Client {
* Creates a new client using the specified options. * Creates a new client using the specified options.
* @example * @example
* ```typescript * ```typescript
* import { getClient } from 'tauri-plugin-http-api'; * import { getClient } from '@tauri-apps/plugin-http';
* const client = await getClient(); * const client = await getClient();
* ``` * ```
* *
@ -507,7 +507,7 @@ let defaultClient: Client | null = null;
* Perform an HTTP request using the default client. * Perform an HTTP request using the default client.
* @example * @example
* ```typescript * ```typescript
* import { fetch } from 'tauri-plugin-http-api'; * import { fetch } from '@tauri-apps/plugin-http';
* const response = await fetch('http://localhost:3003/users/2', { * const response = await fetch('http://localhost:3003/users/2', {
* method: 'GET', * method: 'GET',
* timeout: 30, * timeout: 30,

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-http-api", "name": "@tauri-apps/plugin-http",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -57,7 +57,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { trace, info, error, attachConsole } from "tauri-plugin-log-api"; import { trace, info, error, attachConsole } from "@tauri-apps/plugin-log";
// with LogTarget::Webview enabled this function will print logs to the browser console // with LogTarget::Webview enabled this function will print logs to the browser console
const detach = await attachConsole(); const detach = await attachConsole();

@ -75,7 +75,7 @@ async function log(
* # Examples * # Examples
* *
* ```js * ```js
* import { error } from 'tauri-plugin-log-api'; * import { error } from '@tauri-apps/plugin-log';
* *
* const err_info = "No connection"; * const err_info = "No connection";
* const port = 22; * const port = 22;
@ -98,7 +98,7 @@ export async function error(
* # Examples * # Examples
* *
* ```js * ```js
* import { warn } from 'tauri-plugin-log-api'; * import { warn } from '@tauri-apps/plugin-log';
* *
* const warn_description = "Invalid Input"; * const warn_description = "Invalid Input";
* *
@ -120,7 +120,7 @@ export async function warn(
* # Examples * # Examples
* *
* ```js * ```js
* import { info } from 'tauri-plugin-log-api'; * import { info } from '@tauri-apps/plugin-log';
* *
* const conn_info = { port: 40, speed: 3.20 }; * const conn_info = { port: 40, speed: 3.20 };
* *
@ -142,7 +142,7 @@ export async function info(
* # Examples * # Examples
* *
* ```js * ```js
* import { debug } from 'tauri-plugin-log-api'; * import { debug } from '@tauri-apps/plugin-log';
* *
* const pos = { x: 3.234, y: -1.223 }; * const pos = { x: 3.234, y: -1.223 };
* *
@ -164,7 +164,7 @@ export async function debug(
* # Examples * # Examples
* *
* ```js * ```js
* import { trace } from 'tauri-plugin-log-api'; * import { trace } from '@tauri-apps/plugin-log';
* *
* let pos = { x: 3.234, y: -1.223 }; * let pos = { x: 3.234, y: -1.223 };
* *

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-log-api", "name": "@tauri-apps/plugin-log",
"version": "0.0.0", "version": "0.0.0",
"description": "Configurable logging for your Tauri app.", "description": "Configurable logging for your Tauri app.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-notification-api", "name": "@tauri-apps/plugin-notification",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import * as os from "tauri-plugin-os-api"; import * as os from "@tauri-apps/plugin-os";
``` ```
## Contributing ## Contributing

@ -68,7 +68,7 @@ const EOL = isWindows() ? "\r\n" : "\n";
* The value is set at compile time. Possible values are `'linux'`, `'darwin'`, `'ios'`, `'freebsd'`, `'dragonfly'`, `'netbsd'`, `'openbsd'`, `'solaris'`, `'android'`, `'win32'` * The value is set at compile time. Possible values are `'linux'`, `'darwin'`, `'ios'`, `'freebsd'`, `'dragonfly'`, `'netbsd'`, `'openbsd'`, `'solaris'`, `'android'`, `'win32'`
* @example * @example
* ```typescript * ```typescript
* import { platform } from 'tauri-plugin-os-api'; * import { platform } from '@tauri-apps/plugin-os';
* const platformName = await platform(); * const platformName = await platform();
* ``` * ```
* *
@ -83,7 +83,7 @@ async function platform(): Promise<Platform> {
* Returns a string identifying the kernel version. * Returns a string identifying the kernel version.
* @example * @example
* ```typescript * ```typescript
* import { version } from 'tauri-plugin-os-api'; * import { version } from '@tauri-apps/plugin-os';
* const osVersion = await version(); * const osVersion = await version();
* ``` * ```
* *
@ -97,7 +97,7 @@ async function version(): Promise<string> {
* Returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows. * Returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
* @example * @example
* ```typescript * ```typescript
* import { type } from 'tauri-plugin-os-api'; * import { type } from '@tauri-apps/plugin-os';
* const osType = await type(); * const osType = await type();
* ``` * ```
* *
@ -112,7 +112,7 @@ async function type(): Promise<OsType> {
* Possible values are `'x86'`, `'x86_64'`, `'arm'`, `'aarch64'`, `'mips'`, `'mips64'`, `'powerpc'`, `'powerpc64'`, `'riscv64'`, `'s390x'`, `'sparc64'`. * Possible values are `'x86'`, `'x86_64'`, `'arm'`, `'aarch64'`, `'mips'`, `'mips64'`, `'powerpc'`, `'powerpc64'`, `'riscv64'`, `'s390x'`, `'sparc64'`.
* @example * @example
* ```typescript * ```typescript
* import { arch } from 'tauri-plugin-os-api'; * import { arch } from '@tauri-apps/plugin-os';
* const archName = await arch(); * const archName = await arch();
* ``` * ```
* *
@ -126,7 +126,7 @@ async function arch(): Promise<Arch> {
* Returns the operating system's default directory for temporary files as a string. * Returns the operating system's default directory for temporary files as a string.
* @example * @example
* ```typescript * ```typescript
* import { tempdir } from 'tauri-plugin-os-api'; * import { tempdir } from '@tauri-apps/plugin-os';
* const tempdirPath = await tempdir(); * const tempdirPath = await tempdir();
* ``` * ```
* *

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-os-api", "name": "@tauri-apps/plugin-os",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -30,11 +30,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. > Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh ```sh
pnpm add tauri-plugin-positioner-api pnpm add @tauri-apps/plugin-positioner
# or # or
npm add tauri-plugin-positioner-api npm add @tauri-apps/plugin-positioner
# or # or
yarn add tauri-plugin-positioner-api yarn add @tauri-apps/plugin-positioner
``` ```
Or through git: Or through git:
@ -69,7 +69,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { move_window, Position } from "tauri-plugin-positioner-api"; import { move_window, Position } from "@tauri-apps/plugin-positioner";
move_window(Position.TopRight); move_window(Position.TopRight);
``` ```

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-positioner-api", "name": "@tauri-apps/plugin-positioner",
"version": "0.2.7", "version": "0.2.7",
"description": "Position your windows at well-known locations.", "description": "Position your windows at well-known locations.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import * as process from "tauri-plugin-process-api"; import * as process from "@tauri-apps/plugin-process";
``` ```
## Contributing ## Contributing

@ -13,7 +13,7 @@ import { invoke } from "@tauri-apps/api/tauri";
* Exits immediately with the given `exitCode`. * Exits immediately with the given `exitCode`.
* @example * @example
* ```typescript * ```typescript
* import { exit } from 'tauri-plugin-process-api'; * import { exit } from '@tauri-apps/plugin-process';
* await exit(1); * await exit(1);
* ``` * ```
* *
@ -30,7 +30,7 @@ async function exit(code = 0): Promise<void> {
* Exits the current instance of the app then relaunches it. * Exits the current instance of the app then relaunches it.
* @example * @example
* ```typescript * ```typescript
* import { relaunch } from 'tauri-plugin-process-api'; * import { relaunch } from '@tauri-apps/plugin-process';
* await relaunch(); * await relaunch();
* ``` * ```
* *

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-process-api", "name": "@tauri-apps/plugin-process",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -66,7 +66,7 @@
* ``` * ```
* Usage: * Usage:
* ```typescript * ```typescript
* import { Command } from 'tauri-plugin-shell-api' * import { Command } from '@tauri-apps/plugin-shell'
* Command.create('run-git-commit', ['commit', '-m', 'the commit message']) * Command.create('run-git-commit', ['commit', '-m', 'the commit message'])
* ``` * ```
* *
@ -348,7 +348,7 @@ class Child {
* @param data The message to write, either a string or a byte array. * @param data The message to write, either a string or a byte array.
* @example * @example
* ```typescript * ```typescript
* import { Command } from 'tauri-plugin-shell-api'; * import { Command } from '@tauri-apps/plugin-shell';
* const command = Command.create('node'); * const command = Command.create('node');
* const child = await command.spawn(); * const child = await command.spawn();
* await child.write('message'); * await child.write('message');
@ -392,7 +392,7 @@ interface OutputEvents<O extends IOPayload> {
* It emits the `close` and `error` events. * It emits the `close` and `error` events.
* @example * @example
* ```typescript * ```typescript
* import { Command } from 'tauri-plugin-shell-api'; * import { Command } from '@tauri-apps/plugin-shell';
* const command = Command.create('node'); * const command = Command.create('node');
* command.on('close', data => { * command.on('close', data => {
* console.log(`command finished with code ${data.code} and signal ${data.signal}`) * console.log(`command finished with code ${data.code} and signal ${data.signal}`)
@ -456,7 +456,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
* Creates a command to execute the given program. * Creates a command to execute the given program.
* @example * @example
* ```typescript * ```typescript
* import { Command } from 'tauri-plugin-shell-api'; * import { Command } from '@tauri-apps/plugin-shell';
* const command = Command.create('my-app', ['run', 'tauri']); * const command = Command.create('my-app', ['run', 'tauri']);
* const output = await command.execute(); * const output = await command.execute();
* ``` * ```
@ -488,7 +488,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
* Creates a command to execute the given sidecar program. * Creates a command to execute the given sidecar program.
* @example * @example
* ```typescript * ```typescript
* import { Command } from 'tauri-plugin-shell-api'; * import { Command } from '@tauri-apps/plugin-shell';
* const command = Command.sidecar('my-sidecar'); * const command = Command.sidecar('my-sidecar');
* const output = await command.execute(); * const output = await command.execute();
* ``` * ```
@ -539,7 +539,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
* Executes the command as a child process, waiting for it to finish and collecting all of its output. * Executes the command as a child process, waiting for it to finish and collecting all of its output.
* @example * @example
* ```typescript * ```typescript
* import { Command } from 'tauri-plugin-shell-api'; * import { Command } from '@tauri-apps/plugin-shell';
* const output = await Command.create('echo', 'message').execute(); * const output = await Command.create('echo', 'message').execute();
* assert(output.code === 0); * assert(output.code === 0);
* assert(output.signal === null); * assert(output.signal === null);
@ -624,7 +624,7 @@ type CommandEvent<O extends IOPayload> =
* *
* @example * @example
* ```typescript * ```typescript
* import { open } from 'tauri-plugin-shell-api'; * import { open } from '@tauri-apps/plugin-shell';
* // opens the given URL on the default browser: * // opens the given URL on the default browser:
* await open('https://github.com/tauri-apps/tauri'); * await open('https://github.com/tauri-apps/tauri');
* // opens the given URL using `firefox`: * // opens the given URL using `firefox`:

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-shell-api", "name": "@tauri-apps/plugin-shell",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -53,7 +53,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import Database from "tauri-plugin-sql-api"; import Database from "@tauri-apps/plugin-sql";
// sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`. // sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`.
const db = await Database.load("sqlite:test.db"); const db = await Database.load("sqlite:test.db");

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-sql-api", "name": "@tauri-apps/plugin-sql",
"version": "0.0.0", "version": "0.0.0",
"description": "Interface with SQL databases", "description": "Interface with SQL databases",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { Store } from "tauri-plugin-store-api"; import { Store } from "@tauri-apps/plugin-store";
const store = new Store(".settings.dat"); const store = new Store(".settings.dat");

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-store-api", "name": "@tauri-apps/plugin-store",
"version": "0.0.0", "version": "0.0.0",
"description": "Simple, persistent key-value store.", "description": "Simple, persistent key-value store.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -55,7 +55,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { Stronghold, Location } from "tauri-plugin-stronghold-api"; import { Stronghold, Location } from "@tauri-apps/plugin-stronghold";
// TODO // TODO
``` ```

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-stronghold-api", "name": "@tauri-apps/plugin-stronghold",
"version": "0.0.0", "version": "0.0.0",
"description": "Store secrets and keys using the IOTA Stronghold encrypted database.", "description": "Store secrets and keys using the IOTA Stronghold encrypted database.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import * as updater from "tauri-plugin-updater-api"; import * as updater from "@tauri-apps/plugin-updater";
``` ```
## Contributing ## Contributing

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-updater-api", "name": "@tauri-apps/plugin-updater",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { upload } from 'tauri-plugin-upload-api' import { upload } from '@tauri-apps/plugin-upload'
upload( upload(
'https://example.com/file-upload' 'https://example.com/file-upload'

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-upload-api", "name": "@tauri-apps/plugin-upload",
"version": "0.0.0", "version": "0.0.0",
"description": "Upload files from disk to a remote server over HTTP.", "description": "Upload files from disk to a remote server over HTTP.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { WebSocket } from "tauri-plugin-websocket-api"; import { WebSocket } from "@tauri-apps/plugin-websocket";
const ws = await WebSocket.connect("wss://example.com"); const ws = await WebSocket.connect("wss://example.com");

@ -22,7 +22,7 @@
}, },
"dependencies": { "dependencies": {
"@tauri-apps/cli": "^2.0.0-alpha.8", "@tauri-apps/cli": "^2.0.0-alpha.8",
"tauri-plugin-websocket-api": "link:../../" "@tauri-apps/plugin-websocket": "link:../../"
}, },
"type": "module" "type": "module"
} }

@ -1,35 +1,44 @@
<script lang="ts"> <script lang="ts">
import WebSocket from 'tauri-plugin-websocket-api' import WebSocket from "@tauri-apps/plugin-websocket";
import { onMount } from 'svelte' import { onMount } from "svelte";
let ws let ws;
let response = '' let response = "";
let message = '' let message = "";
onMount(async () => { onMount(async () => {
ws = await WebSocket.connect('ws://127.0.0.1:8080').then(r => { ws = await WebSocket.connect("ws://127.0.0.1:8080")
_updateResponse('Connected') .then((r) => {
return r _updateResponse("Connected");
}).catch(_updateResponse) return r;
ws.addListener(_updateResponse) })
}) .catch(_updateResponse);
ws.addListener(_updateResponse);
});
function _updateResponse(returnValue) { function _updateResponse(returnValue) {
response += (typeof returnValue === 'string' ? returnValue : JSON.stringify(returnValue)) + '<br>' response +=
} (typeof returnValue === "string"
? returnValue
: JSON.stringify(returnValue)) + "<br>";
}
function send() { function send() {
ws.send(message).then(() => _updateResponse('Message sent')).catch(_updateResponse) ws.send(message)
} .then(() => _updateResponse("Message sent"))
.catch(_updateResponse);
}
function disconnect() { function disconnect() {
ws.disconnect().then(() => _updateResponse('Disconnected')).catch(_updateResponse) ws.disconnect()
} .then(() => _updateResponse("Disconnected"))
.catch(_updateResponse);
}
</script> </script>
<div> <div>
<input bind:value={message}> <input bind:value={message} />
<button on:click={send}>Send</button> <button on:click={send}>Send</button>
<button on:click={disconnect}>Disconnect</button> <button on:click={disconnect}>Disconnect</button>
</div> </div>
<div>{@html response}</div> <div>{@html response}</div>

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-websocket-api", "name": "@tauri-apps/plugin-websocket",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -62,7 +62,7 @@ app.save_window_state(StateFlags::all()); // will save the state of all open win
or through Javascript or through Javascript
```javascript ```javascript
import { saveWindowState, StateFlags } from "tauri-plugin-window-state-api"; import { saveWindowState, StateFlags } from "@tauri-apps/plugin-window-state";
saveWindowState(StateFlags.ALL); saveWindowState(StateFlags.ALL);
``` ```
@ -79,7 +79,10 @@ window.restore_state(StateFlags::all()); // will restore the windows state from
or through Javascript or through Javascript
```javascript ```javascript
import { restoreStateCurrent, StateFlags } from "tauri-plugin-window-state-api"; import {
restoreStateCurrent,
StateFlags,
} from "@tauri-apps/plugin-window-state";
restoreStateCurrent(StateFlags.ALL); restoreStateCurrent(StateFlags.ALL);
``` ```

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-window-state-api", "name": "@tauri-apps/plugin-window-state",
"version": "0.0.0", "version": "0.0.0",
"description": "Save window positions and sizes and restore them when the app is reopened.", "description": "Save window positions and sizes and restore them when the app is reopened.",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import * as tauriWindow from "tauri-plugin-window-api"; import * as tauriWindow from "@tauri-apps/plugin-window";
``` ```
## Contributing ## Contributing

@ -54,7 +54,7 @@
* *
* Events can be listened to using `appWindow.listen`: * Events can be listened to using `appWindow.listen`:
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* appWindow.listen("my-window-event", ({ event, payload }) => { }); * appWindow.listen("my-window-event", ({ event, payload }) => { });
* ``` * ```
* *
@ -144,7 +144,7 @@ class PhysicalSize {
* Converts the physical size to a logical one. * Converts the physical size to a logical one.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const factor = await appWindow.scaleFactor(); * const factor = await appWindow.scaleFactor();
* const size = await appWindow.innerSize(); * const size = await appWindow.innerSize();
* const logical = size.toLogical(factor); * const logical = size.toLogical(factor);
@ -190,7 +190,7 @@ class PhysicalPosition {
* Converts the physical position to a logical one. * Converts the physical position to a logical one.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const factor = await appWindow.scaleFactor(); * const factor = await appWindow.scaleFactor();
* const position = await appWindow.innerPosition(); * const position = await appWindow.innerPosition();
* const logical = position.toLogical(factor); * const logical = position.toLogical(factor);
@ -319,7 +319,8 @@ class WebviewWindowHandle {
/** The window label. It is a unique identifier for the window, can be used to reference it later. */ /** The window label. It is a unique identifier for the window, can be used to reference it later. */
label: WindowLabel; label: WindowLabel;
/** Local event listeners. */ /** Local event listeners. */
listeners: Record<string, Array<EventCallback<unknown>>>; // eslint-disable-next-line @typescript-eslint/no-explicit-any
listeners: Record<string, Array<EventCallback<any>>>;
constructor(label: WindowLabel) { constructor(label: WindowLabel) {
this.label = label; this.label = label;
@ -332,7 +333,7 @@ class WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const unlisten = await appWindow.listen<string>('state-changed', (event) => { * const unlisten = await appWindow.listen<string>('state-changed', (event) => {
* console.log(`Got error: ${payload}`); * console.log(`Got error: ${payload}`);
* }); * });
@ -365,7 +366,7 @@ class WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const unlisten = await appWindow.once<null>('initialized', (event) => { * const unlisten = await appWindow.once<null>('initialized', (event) => {
* console.log(`Window initialized!`); * console.log(`Window initialized!`);
* }); * });
@ -394,7 +395,7 @@ class WebviewWindowHandle {
* Emits an event to the backend, tied to the webview window. * Emits an event to the backend, tied to the webview window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.emit('window-loaded', { loggedIn: true, token: 'authToken' }); * await appWindow.emit('window-loaded', { loggedIn: true, token: 'authToken' });
* ``` * ```
* *
@ -440,7 +441,7 @@ class WindowManager extends WebviewWindowHandle {
* The scale factor that can be used to map physical pixels to logical pixels. * The scale factor that can be used to map physical pixels to logical pixels.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const factor = await appWindow.scaleFactor(); * const factor = await appWindow.scaleFactor();
* ``` * ```
* *
@ -456,7 +457,7 @@ class WindowManager extends WebviewWindowHandle {
* The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop. * 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 * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const position = await appWindow.innerPosition(); * const position = await appWindow.innerPosition();
* ``` * ```
* *
@ -472,7 +473,7 @@ class WindowManager extends WebviewWindowHandle {
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop. * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const position = await appWindow.outerPosition(); * const position = await appWindow.outerPosition();
* ``` * ```
* *
@ -489,7 +490,7 @@ class WindowManager extends WebviewWindowHandle {
* The client area is the content of the window, excluding the title bar and borders. * The client area is the content of the window, excluding the title bar and borders.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const size = await appWindow.innerSize(); * const size = await appWindow.innerSize();
* ``` * ```
* *
@ -509,7 +510,7 @@ class WindowManager extends WebviewWindowHandle {
* These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead. * These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const size = await appWindow.outerSize(); * const size = await appWindow.outerSize();
* ``` * ```
* *
@ -528,7 +529,7 @@ class WindowManager extends WebviewWindowHandle {
* Gets the window's current fullscreen state. * Gets the window's current fullscreen state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const fullscreen = await appWindow.isFullscreen(); * const fullscreen = await appWindow.isFullscreen();
* ``` * ```
* *
@ -544,7 +545,7 @@ class WindowManager extends WebviewWindowHandle {
* Gets the window's current minimized state. * Gets the window's current minimized state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const minimized = await appWindow.isMinimized(); * const minimized = await appWindow.isMinimized();
* ``` * ```
* *
@ -560,7 +561,7 @@ class WindowManager extends WebviewWindowHandle {
* Gets the window's current maximized state. * Gets the window's current maximized state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const maximized = await appWindow.isMaximized(); * const maximized = await appWindow.isMaximized();
* ``` * ```
* *
@ -576,7 +577,7 @@ class WindowManager extends WebviewWindowHandle {
* Gets the window's current decorated state. * Gets the window's current decorated state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const decorated = await appWindow.isDecorated(); * const decorated = await appWindow.isDecorated();
* ``` * ```
* *
@ -592,7 +593,7 @@ class WindowManager extends WebviewWindowHandle {
* Gets the window's current resizable state. * Gets the window's current resizable state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const resizable = await appWindow.isResizable(); * const resizable = await appWindow.isResizable();
* ``` * ```
* *
@ -608,7 +609,7 @@ class WindowManager extends WebviewWindowHandle {
* Gets the window's current visible state. * Gets the window's current visible state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const visible = await appWindow.isVisible(); * const visible = await appWindow.isVisible();
* ``` * ```
* *
@ -624,7 +625,7 @@ class WindowManager extends WebviewWindowHandle {
* Gets the window's current title. * Gets the window's current title.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const title = await appWindow.title(); * const title = await appWindow.title();
* ``` * ```
* *
@ -645,7 +646,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* const theme = await appWindow.theme(); * const theme = await appWindow.theme();
* ``` * ```
* *
@ -663,7 +664,7 @@ class WindowManager extends WebviewWindowHandle {
* Centers the window. * Centers the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.center(); * await appWindow.center();
* ``` * ```
* *
@ -690,7 +691,7 @@ class WindowManager extends WebviewWindowHandle {
* - **Linux:** Urgency levels have the same effect. * - **Linux:** Urgency levels have the same effect.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.requestUserAttention(); * await appWindow.requestUserAttention();
* ``` * ```
* *
@ -719,7 +720,7 @@ class WindowManager extends WebviewWindowHandle {
* Updates the window resizable flag. * Updates the window resizable flag.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setResizable(false); * await appWindow.setResizable(false);
* ``` * ```
* *
@ -737,7 +738,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window title. * Sets the window title.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setTitle('Tauri'); * await appWindow.setTitle('Tauri');
* ``` * ```
* *
@ -755,7 +756,7 @@ class WindowManager extends WebviewWindowHandle {
* Maximizes the window. * Maximizes the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.maximize(); * await appWindow.maximize();
* ``` * ```
* *
@ -771,7 +772,7 @@ class WindowManager extends WebviewWindowHandle {
* Unmaximizes the window. * Unmaximizes the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.unmaximize(); * await appWindow.unmaximize();
* ``` * ```
* *
@ -787,7 +788,7 @@ class WindowManager extends WebviewWindowHandle {
* Toggles the window maximized state. * Toggles the window maximized state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.toggleMaximize(); * await appWindow.toggleMaximize();
* ``` * ```
* *
@ -803,7 +804,7 @@ class WindowManager extends WebviewWindowHandle {
* Minimizes the window. * Minimizes the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.minimize(); * await appWindow.minimize();
* ``` * ```
* *
@ -819,7 +820,7 @@ class WindowManager extends WebviewWindowHandle {
* Unminimizes the window. * Unminimizes the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.unminimize(); * await appWindow.unminimize();
* ``` * ```
* *
@ -835,7 +836,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window visibility to true. * Sets the window visibility to true.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.show(); * await appWindow.show();
* ``` * ```
* *
@ -851,7 +852,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window visibility to false. * Sets the window visibility to false.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.hide(); * await appWindow.hide();
* ``` * ```
* *
@ -867,7 +868,7 @@ class WindowManager extends WebviewWindowHandle {
* Closes the window. * Closes the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.close(); * await appWindow.close();
* ``` * ```
* *
@ -883,7 +884,7 @@ class WindowManager extends WebviewWindowHandle {
* Whether the window should have borders and bars. * Whether the window should have borders and bars.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setDecorations(false); * await appWindow.setDecorations(false);
* ``` * ```
* *
@ -910,7 +911,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setShadow(false); * await appWindow.setShadow(false);
* ``` * ```
* *
@ -929,7 +930,7 @@ class WindowManager extends WebviewWindowHandle {
* Whether the window should always be on top of other windows. * Whether the window should always be on top of other windows.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setAlwaysOnTop(true); * await appWindow.setAlwaysOnTop(true);
* ``` * ```
* *
@ -947,7 +948,7 @@ class WindowManager extends WebviewWindowHandle {
* Prevents the window contents from being captured by other apps. * Prevents the window contents from being captured by other apps.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setContentProtected(true); * await appWindow.setContentProtected(true);
* ``` * ```
* *
@ -966,7 +967,7 @@ class WindowManager extends WebviewWindowHandle {
* Resizes the window with a new inner size. * Resizes the window with a new inner size.
* @example * @example
* ```typescript * ```typescript
* import { appWindow, LogicalSize } from 'tauri-plugin-window-api'; * import { appWindow, LogicalSize } from '@tauri-apps/window';
* await appWindow.setSize(new LogicalSize(600, 500)); * await appWindow.setSize(new LogicalSize(600, 500));
* ``` * ```
* *
@ -996,7 +997,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset. * Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset.
* @example * @example
* ```typescript * ```typescript
* import { appWindow, PhysicalSize } from 'tauri-plugin-window-api'; * import { appWindow, PhysicalSize } from '@tauri-apps/window';
* await appWindow.setMinSize(new PhysicalSize(600, 500)); * await appWindow.setMinSize(new PhysicalSize(600, 500));
* ``` * ```
* *
@ -1030,7 +1031,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset. * Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset.
* @example * @example
* ```typescript * ```typescript
* import { appWindow, LogicalSize } from 'tauri-plugin-window-api'; * import { appWindow, LogicalSize } from '@tauri-apps/window';
* await appWindow.setMaxSize(new LogicalSize(600, 500)); * await appWindow.setMaxSize(new LogicalSize(600, 500));
* ``` * ```
* *
@ -1064,7 +1065,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window outer position. * Sets the window outer position.
* @example * @example
* ```typescript * ```typescript
* import { appWindow, LogicalPosition } from 'tauri-plugin-window-api'; * import { appWindow, LogicalPosition } from '@tauri-apps/window';
* await appWindow.setPosition(new LogicalPosition(600, 500)); * await appWindow.setPosition(new LogicalPosition(600, 500));
* ``` * ```
* *
@ -1099,7 +1100,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window fullscreen state. * Sets the window fullscreen state.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setFullscreen(true); * await appWindow.setFullscreen(true);
* ``` * ```
* *
@ -1117,7 +1118,7 @@ class WindowManager extends WebviewWindowHandle {
* Bring the window to front and focus. * Bring the window to front and focus.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setFocus(); * await appWindow.setFocus();
* ``` * ```
* *
@ -1133,7 +1134,7 @@ class WindowManager extends WebviewWindowHandle {
* Sets the window icon. * Sets the window icon.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setIcon('/tauri/awesome.png'); * await appWindow.setIcon('/tauri/awesome.png');
* ``` * ```
* *
@ -1162,7 +1163,7 @@ class WindowManager extends WebviewWindowHandle {
* - **macOS:** Unsupported. * - **macOS:** Unsupported.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setSkipTaskbar(true); * await appWindow.setSkipTaskbar(true);
* ``` * ```
* *
@ -1188,7 +1189,7 @@ class WindowManager extends WebviewWindowHandle {
* - **macOS:** This locks the cursor in a fixed location, which looks visually awkward. * - **macOS:** This locks the cursor in a fixed location, which looks visually awkward.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setCursorGrab(true); * await appWindow.setCursorGrab(true);
* ``` * ```
* *
@ -1212,7 +1213,7 @@ class WindowManager extends WebviewWindowHandle {
* outside of the window. * outside of the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setCursorVisible(false); * await appWindow.setCursorVisible(false);
* ``` * ```
* *
@ -1230,7 +1231,7 @@ class WindowManager extends WebviewWindowHandle {
* Modifies the cursor icon of the window. * Modifies the cursor icon of the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setCursorIcon('help'); * await appWindow.setCursorIcon('help');
* ``` * ```
* *
@ -1248,7 +1249,7 @@ class WindowManager extends WebviewWindowHandle {
* Changes the position of the cursor in window coordinates. * Changes the position of the cursor in window coordinates.
* @example * @example
* ```typescript * ```typescript
* import { appWindow, LogicalPosition } from 'tauri-plugin-window-api'; * import { appWindow, LogicalPosition } from '@tauri-apps/window';
* await appWindow.setCursorPosition(new LogicalPosition(600, 300)); * await appWindow.setCursorPosition(new LogicalPosition(600, 300));
* ``` * ```
* *
@ -1284,7 +1285,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.setIgnoreCursorEvents(true); * await appWindow.setIgnoreCursorEvents(true);
* ``` * ```
* *
@ -1302,7 +1303,7 @@ class WindowManager extends WebviewWindowHandle {
* Starts dragging the window. * Starts dragging the window.
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from 'tauri-plugin-window-api'; * import { appWindow } from '@tauri-apps/window';
* await appWindow.startDragging(); * await appWindow.startDragging();
* ``` * ```
* *
@ -1321,7 +1322,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* const unlisten = await appWindow.onResized(({ payload: size }) => { * const unlisten = await appWindow.onResized(({ payload: size }) => {
* console.log('Window resized', size); * console.log('Window resized', size);
* }); * });
@ -1347,7 +1348,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* const unlisten = await appWindow.onMoved(({ payload: position }) => { * const unlisten = await appWindow.onMoved(({ payload: position }) => {
* console.log('Window moved', position); * console.log('Window moved', position);
* }); * });
@ -1373,7 +1374,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* import { confirm } from '@tauri-apps/api/dialog'; * import { confirm } from '@tauri-apps/api/dialog';
* const unlisten = await appWindow.onCloseRequested(async (event) => { * const unlisten = await appWindow.onCloseRequested(async (event) => {
* const confirmed = await confirm('Are you sure?'); * const confirmed = await confirm('Are you sure?');
@ -1412,7 +1413,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* const unlisten = await appWindow.onFocusChanged(({ payload: focused }) => { * const unlisten = await appWindow.onFocusChanged(({ payload: focused }) => {
* console.log('Focus changed, window is focused? ' + focused); * console.log('Focus changed, window is focused? ' + focused);
* }); * });
@ -1454,7 +1455,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* const unlisten = await appWindow.onScaleChanged(({ payload }) => { * const unlisten = await appWindow.onScaleChanged(({ payload }) => {
* console.log('Scale changed', payload.scaleFactor, payload.size); * console.log('Scale changed', payload.scaleFactor, payload.size);
* }); * });
@ -1482,7 +1483,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* const unlisten = await appWindow.onMenuClicked(({ payload: menuId }) => { * const unlisten = await appWindow.onMenuClicked(({ payload: menuId }) => {
* console.log('Menu clicked: ' + menuId); * console.log('Menu clicked: ' + menuId);
* }); * });
@ -1507,7 +1508,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* const unlisten = await appWindow.onFileDropEvent((event) => { * const unlisten = await appWindow.onFileDropEvent((event) => {
* if (event.payload.type === 'hover') { * if (event.payload.type === 'hover') {
* console.log('User hovering', event.payload.paths); * console.log('User hovering', event.payload.paths);
@ -1563,7 +1564,7 @@ class WindowManager extends WebviewWindowHandle {
* *
* @example * @example
* ```typescript * ```typescript
* import { appWindow } from "tauri-plugin-window-api"; * import { appWindow } from "@tauri-apps/window";
* const unlisten = await appWindow.onThemeChanged(({ payload: theme }) => { * const unlisten = await appWindow.onThemeChanged(({ payload: theme }) => {
* console.log('New theme: ' + theme); * console.log('New theme: ' + theme);
* }); * });
@ -1647,7 +1648,7 @@ class WebviewWindow extends WindowManager {
* Creates a new WebviewWindow. * Creates a new WebviewWindow.
* @example * @example
* ```typescript * ```typescript
* import { WebviewWindow } from 'tauri-plugin-window-api'; * import { WebviewWindow } from '@tauri-apps/window';
* const webview = new WebviewWindow('my-label', { * const webview = new WebviewWindow('my-label', {
* url: 'https://github.com/tauri-apps/tauri' * url: 'https://github.com/tauri-apps/tauri'
* }); * });
@ -1681,7 +1682,7 @@ class WebviewWindow extends WindowManager {
* Gets the WebviewWindow for the webview associated with the given label. * Gets the WebviewWindow for the webview associated with the given label.
* @example * @example
* ```typescript * ```typescript
* import { WebviewWindow } from 'tauri-plugin-window-api'; * import { WebviewWindow } from '@tauri-apps/window';
* const mainWindow = WebviewWindow.getByLabel('main'); * const mainWindow = WebviewWindow.getByLabel('main');
* ``` * ```
* *
@ -1850,7 +1851,7 @@ function mapPhysicalSize(m: PhysicalSize): PhysicalSize {
* Returns `null` if current monitor can't be detected. * Returns `null` if current monitor can't be detected.
* @example * @example
* ```typescript * ```typescript
* import { currentMonitor } from 'tauri-plugin-window-api'; * import { currentMonitor } from '@tauri-apps/window';
* const monitor = currentMonitor(); * const monitor = currentMonitor();
* ``` * ```
* *
@ -1867,7 +1868,7 @@ async function currentMonitor(): Promise<Monitor | null> {
* Returns `null` if it can't identify any monitor as a primary one. * Returns `null` if it can't identify any monitor as a primary one.
* @example * @example
* ```typescript * ```typescript
* import { primaryMonitor } from 'tauri-plugin-window-api'; * import { primaryMonitor } from '@tauri-apps/window';
* const monitor = primaryMonitor(); * const monitor = primaryMonitor();
* ``` * ```
* *
@ -1883,7 +1884,7 @@ async function primaryMonitor(): Promise<Monitor | null> {
* Returns the list of all the monitors available on the system. * Returns the list of all the monitors available on the system.
* @example * @example
* ```typescript * ```typescript
* import { availableMonitors } from 'tauri-plugin-window-api'; * import { availableMonitors } from '@tauri-apps/window';
* const monitors = availableMonitors(); * const monitors = availableMonitors();
* ``` * ```
* *

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-window-api", "name": "@tauri-apps/plugin-window",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

@ -61,43 +61,43 @@ importers:
'@zerodevx/svelte-json-view': '@zerodevx/svelte-json-view':
specifier: 0.2.1 specifier: 0.2.1
version: 0.2.1 version: 0.2.1
tauri-plugin-app-api: '@tauri-apps/plugin-app':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/app version: link:../../plugins/app
tauri-plugin-cli-api: '@tauri-apps/plugin-cli':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/cli version: link:../../plugins/cli
tauri-plugin-clipboard-api: '@tauri-apps/plugin-clipboard':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/clipboard version: link:../../plugins/clipboard
tauri-plugin-dialog-api: '@tauri-apps/plugin-dialog':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/dialog version: link:../../plugins/dialog
tauri-plugin-fs-api: '@tauri-apps/plugin-fs':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/fs version: link:../../plugins/fs
tauri-plugin-global-shortcut-api: '@tauri-apps/plugin-global-shortcut':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/global-shortcut version: link:../../plugins/global-shortcut
tauri-plugin-http-api: '@tauri-apps/plugin-http':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/http version: link:../../plugins/http
tauri-plugin-notification-api: '@tauri-apps/plugin-notification':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/notification version: link:../../plugins/notification
tauri-plugin-os-api: '@tauri-apps/plugin-os':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/os version: link:../../plugins/os
tauri-plugin-process-api: '@tauri-apps/plugin-process':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/process version: link:../../plugins/process
tauri-plugin-shell-api: '@tauri-apps/plugin-shell':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/shell version: link:../../plugins/shell
tauri-plugin-updater-api: '@tauri-apps/plugin-updater':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/updater version: link:../../plugins/updater
tauri-plugin-window-api: '@tauri-apps/plugin-window':
specifier: 0.0.0 specifier: 0.0.0
version: link:../../plugins/window version: link:../../plugins/window
devDependencies: devDependencies:
@ -354,7 +354,7 @@ importers:
'@tauri-apps/cli': '@tauri-apps/cli':
specifier: ^2.0.0-alpha.8 specifier: ^2.0.0-alpha.8
version: 2.0.0-alpha.8 version: 2.0.0-alpha.8
tauri-plugin-websocket-api: '@tauri-apps/plugin-websocket':
specifier: link:../../ specifier: link:../../
version: link:../.. version: link:../..
devDependencies: devDependencies:

@ -1,5 +1,5 @@
{ {
"name": "tauri-plugin-{{name}}-api", "name": "@tauri-apps/plugin-{{name}}",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT or APACHE-2.0", "license": "MIT or APACHE-2.0",
"authors": [ "authors": [

Loading…
Cancel
Save