Socket
Socket
Sign inDemoInstall

@tauri-apps/api

Package Overview
Dependencies
0
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 2.0.0-alpha.3

app-5190a154.d.ts

36

app.d.ts

@@ -1,35 +0,1 @@

/**
* Gets the application version.
* @example
* ```typescript
* import { getVersion } from '@tauri-apps/api/app';
* const appVersion = await getVersion();
* ```
*
* @returns A promise resolving to the application version.
*/
declare function getVersion(): Promise<string>;
/**
* Gets the application name.
* @example
* ```typescript
* import { getName } from '@tauri-apps/api/app';
* const appName = await getName();
* ```
*
* @returns A promise resolving to application name.
*/
declare function getName(): Promise<string>;
/**
* Gets the tauri version.
*
* @example
* ```typescript
* import { getTauriVersion } from '@tauri-apps/api/app';
* const tauriVersion = await getTauriVersion();
* ```
*
* @returns A promise resolving to tauri version.
*/
declare function getTauriVersion(): Promise<string>;
export { getName, getVersion, getTauriVersion };
export { g as getName, c as getTauriVersion, b as getVersion, h as hide, s as show } from './app-5190a154.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{g as getName,c as getTauriVersion,b as getVersion}from"./app-ea395091.js";import"./tauri-fa8f44bd.js";
import{a,b,c,d,e}from"./chunk-DIFM6EX4.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{b as getName,c as getTauriVersion,a as getVersion,e as hide,d as show};
# Changelog
## \[2.0.0-alpha.3]
- Overload the dialog `open` function to have better TS result types.
- [1eacd51d](https://www.github.com/tauri-apps/tauri/commit/1eacd51d185ba69a3c3cb2cc93c792e2d5929843) overloaded the open function for convenient type inference ([#5619](https://www.github.com/tauri-apps/tauri/pull/5619)) on 2023-04-07
## \[2.0.0-alpha.2]
- Added `raw` encoding option to read stdout and stderr raw bytes.
- [f992e7f5](https://www.github.com/tauri-apps/tauri/commit/f992e7f58bf975c654a3daf36780b31a32bac064) chore(changes): readd change file on 2023-04-03
- Removed shell's `Command` constructor and added the `Command.create` static function instead.
- [509d4678](https://www.github.com/tauri-apps/tauri/commit/509d4678b12816c1dd08a9a5efa71ba556d91c27) Support sending raw byte data to the "data" event for child command's stdout and stderr ([#5789](https://www.github.com/tauri-apps/tauri/pull/5789)) on 2023-03-31
## \[2.0.0-alpha.1]
- Added the `shadow` option when creating a window and `setShadow` function.
- [a81750d7](https://www.github.com/tauri-apps/tauri/commit/a81750d779bc72f0fdb7de90b7fbddfd8049b328) feat(core): add shadow APIs ([#6206](https://www.github.com/tauri-apps/tauri/pull/6206)) on 2023-02-08
## \[2.0.0-alpha.0]
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.2.0]
- Added the `acceptFirstMouse` window option.
- [95f467ad](https://www.github.com/tauri-apps/tauri/commit/95f467add51448319983c54e2f382c7c09fb72d6) feat(core): add window `accept_first_mouse` option, closes [#5347](https://www.github.com/tauri-apps/tauri/pull/5347) ([#5374](https://www.github.com/tauri-apps/tauri/pull/5374)) on 2022-10-17
- Fix incorrect return type on `fs/exists`
- [ca3cd8b3](https://www.github.com/tauri-apps/tauri/commit/ca3cd8b3d11beb9b6102da40b7d27f6dbe6cd2d0) fix(api): fs/exists return type previously set to void when it should be boolean ([#5252](https://www.github.com/tauri-apps/tauri/pull/5252)) on 2022-09-29
- Initialize `Monitor` instances with the correct classes for `position` and `size` fields instead of plain object.
- [6f41a271](https://www.github.com/tauri-apps/tauri/commit/6f41a2712445ac41a5ed84bbcd40af3b76c8b1d8) fix(api.js): fix `Monitor` initialization, closes [#4672](https://www.github.com/tauri-apps/tauri/pull/4672) ([#5314](https://www.github.com/tauri-apps/tauri/pull/5314)) on 2022-09-30
- **Breaking change:** Node.js v12 is no longer supported.
- [1129f4f5](https://www.github.com/tauri-apps/tauri/commit/1129f4f575dd02f746abe8e66472c88c8f9fe63d) refactor: simplify api.js bundling ([#4277](https://www.github.com/tauri-apps/tauri/pull/4277)) on 2022-10-04
- Add new app-specific `BaseDirectory` enum variants `AppConfig`, `AppData`, `AppLocalData`, `AppCache` and `AppLog` along with equivalent functions in `path` module and deprecated ambiguous variants `Log` and `App` along with their equivalent functions in `path` module.
- [5d89905e](https://www.github.com/tauri-apps/tauri/commit/5d89905e39ce0e6eaaec50a693679335449edb32) feat(api): add app-specific directory APIs, closes [#5263](https://www.github.com/tauri-apps/tauri/pull/5263) ([#5272](https://www.github.com/tauri-apps/tauri/pull/5272)) on 2022-09-28
- Fix `dialog.save` return type
- [8357ce5b](https://www.github.com/tauri-apps/tauri/commit/8357ce5b2efdd6f92c7944822542e48ba0e303ce) Fix dialog.save return type ([#5373](https://www.github.com/tauri-apps/tauri/pull/5373)) on 2022-10-08
- Added support to `FormData` on the `Body.form` function.
- [aa119f28](https://www.github.com/tauri-apps/tauri/commit/aa119f28364f8ffbc64c6bcdfc77483613076a20) feat(api): add FormData support on Body.form, closes [#5545](https://www.github.com/tauri-apps/tauri/pull/5545) ([#5546](https://www.github.com/tauri-apps/tauri/pull/5546)) on 2022-11-04
- Added `show` and `hide` methods on the `app` module.
- [39bf895b](https://www.github.com/tauri-apps/tauri/commit/39bf895b73ec6b53f5758815396ba85dda6b9c67) feat(macOS): Add application `show` and `hide` methods ([#3689](https://www.github.com/tauri-apps/tauri/pull/3689)) on 2022-10-03
- Added `tabbingIdentifier` window option for macOS.
- [4137ab44](https://www.github.com/tauri-apps/tauri/commit/4137ab44a81d739556cbc7583485887e78952bf1) feat(macos): add `tabbing_identifier` option, closes [#2804](https://www.github.com/tauri-apps/tauri/pull/2804), [#3912](https://www.github.com/tauri-apps/tauri/pull/3912) ([#5399](https://www.github.com/tauri-apps/tauri/pull/5399)) on 2022-10-19
- Added `tabbing_identifier` to the window builder on macOS.
- [4137ab44](https://www.github.com/tauri-apps/tauri/commit/4137ab44a81d739556cbc7583485887e78952bf1) feat(macos): add `tabbing_identifier` option, closes [#2804](https://www.github.com/tauri-apps/tauri/pull/2804), [#3912](https://www.github.com/tauri-apps/tauri/pull/3912) ([#5399](https://www.github.com/tauri-apps/tauri/pull/5399)) on 2022-10-19
- Added the `user_agent` option when creating a window.
- [a6c94119](https://www.github.com/tauri-apps/tauri/commit/a6c94119d8545d509723b147c273ca5edfe3729f) feat(core): expose user_agent to window config ([#5317](https://www.github.com/tauri-apps/tauri/pull/5317)) on 2022-10-02
## \[1.1.0]
- Update `mockIPC()` handler signature to allow async handler functions.
- [4fa968dc](https://www.github.com/tauri-apps/tauri/commit/4fa968dc0e74b5206bfcd54e704d180c16b67b08) fix(api): add async `mockIPC()` handler signature ([#5056](https://www.github.com/tauri-apps/tauri/pull/5056)) on 2022-08-26
- Improve shell's `Command`, `Command.stdout` and `Command.stderr` events with new `once`, `off`, `listenerCount`, `prependListener`, `prependOnceListener` and `removeAllListeners` functions.
- [aa9f1243](https://www.github.com/tauri-apps/tauri/commit/aa9f1243e6c1629972a82e469f20c8399741740e) Improved EventEmitter for tauri api shell ([#4697](https://www.github.com/tauri-apps/tauri/pull/4697)) on 2022-07-26
- Added the `encoding` option to the `Command` options.
- [d8cf9f9f](https://www.github.com/tauri-apps/tauri/commit/d8cf9f9fcd617ac24fa418952fd4a32c08804f5c) Command support for specified character encoding, closes [#4644](https://www.github.com/tauri-apps/tauri/pull/4644) ([#4772](https://www.github.com/tauri-apps/tauri/pull/4772)) on 2022-07-28
- Add `exists` function to the fs module.
- [3c62dbc9](https://www.github.com/tauri-apps/tauri/commit/3c62dbc902c904d35a7472ce72a969084c95fbbe) feat(api): Add `exists` function to the fs module. ([#5060](https://www.github.com/tauri-apps/tauri/pull/5060)) on 2022-09-15
## \[1.0.2]

@@ -4,0 +62,0 @@

@@ -1,45 +0,1 @@

interface ArgMatch {
/**
* string if takes value
* boolean if flag
* string[] or null if takes multiple values
*/
value: string | boolean | string[] | null;
/**
* Number of occurrences
*/
occurrences: number;
}
interface SubcommandMatch {
name: string;
matches: CliMatches;
}
interface CliMatches {
args: {
[name: string]: ArgMatch;
};
subcommand: SubcommandMatch | null;
}
/**
* Parse the arguments provided to the current process and get the matches using the configuration defined `tauri.conf.json > tauri > cli`.
* @example
* ```typescript
* import { getMatches } from '@tauri-apps/api/cli';
* const matches = await getMatches();
* if (matches.subcommand?.name === 'run') {
* // `./your-app run $ARGS` was executed
* const args = matches.subcommand?.matches.args
* if ('debug' in args) {
* // `./your-app run --debug` was executed
* }
* } else {
* const args = matches.args
* // `./your-app $ARGS` was executed
* }
* ```
*
* @returns A promise resolving to the parsed arguments.
*/
declare function getMatches(): Promise<CliMatches>;
export type { ArgMatch, SubcommandMatch, CliMatches };
export { getMatches };
export { A as ArgMatch, C as CliMatches, S as SubcommandMatch, g as getMatches } from './cli-373e13ed.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{g as getMatches}from"./cli-0a14b129.js";import"./tauri-fa8f44bd.js";
import{a}from"./chunk-6IDLE7HB.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{a as getMatches};

@@ -1,24 +0,1 @@

/**
* Writes a plain text to the clipboard.
* @example
* ```typescript
* import { writeText, readText } from '@tauri-apps/api/clipboard';
* await writeText('Tauri is awesome!');
* assert(await readText(), 'Tauri is awesome!');
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
declare function writeText(text: string): Promise<void>;
/**
* Gets the clipboard content as plain text.
* @example
* ```typescript
* import { readText } from '@tauri-apps/api/clipboard';
* const clipboardText = await readText();
* ```
*
* @returns A promise resolving to the clipboard content as plain text.
*/
declare function readText(): Promise<string | null>;
export { writeText, readText };
export { r as readText, w as writeText } from './clipboard-79413165.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{r as readText,w as writeText}from"./clipboard-6ac7f168.js";import"./tauri-fa8f44bd.js";
import{a,b}from"./chunk-6PDK3LJA.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{b as readText,a as writeText};

@@ -1,172 +0,1 @@

/** Extension filters for the file dialog. */
interface DialogFilter {
/** Filter name. */
name: string;
/**
* Extensions to filter, without a `.` prefix.
* @example
* ```typescript
* extensions: ['svg', 'png']
* ```
*/
extensions: string[];
}
/** Options for the open dialog. */
interface OpenDialogOptions {
/** The title of the dialog window. */
title?: string;
/** The filters of the dialog. */
filters?: DialogFilter[];
/** Initial directory or file path. */
defaultPath?: string;
/** Whether the dialog allows multiple selection or not. */
multiple?: boolean;
/** Whether the dialog is a directory selection or not. */
directory?: boolean;
/**
* If `directory` is true, indicates that it will be read recursively later.
* Defines whether subdirectories will be allowed on the scope or not.
*/
recursive?: boolean;
}
/** Options for the save dialog. */
interface SaveDialogOptions {
/** The title of the dialog window. */
title?: string;
/** The filters of the dialog. */
filters?: DialogFilter[];
/**
* Initial directory or file path.
* If it's a directory path, the dialog interface will change to that folder.
* If it's not an existing directory, the file name will be set to the dialog's file name input and the dialog will be set to the parent folder.
*/
defaultPath?: string;
}
interface MessageDialogOptions {
/** The title of the dialog. Defaults to the app name. */
title?: string;
/** The type of the dialog. Defaults to `info`. */
type?: 'info' | 'warning' | 'error';
}
/**
* Open a file/directory selection dialog.
*
* The selected paths are added to the filesystem and asset protocol allowlist scopes.
* When security is more important than the easy of use of this API,
* prefer writing a dedicated command instead.
*
* Note that the allowlist scope change is not persisted, so the values are cleared when the application is restarted.
* You can save it to the filesystem using [tauri-plugin-persisted-scope](https://github.com/tauri-apps/tauri-plugin-persisted-scope).
* @example
* ```typescript
* import { open } from '@tauri-apps/api/dialog';
* // Open a selection dialog for image files
* const selected = await open({
* multiple: true,
* filters: [{
* name: 'Image',
* extensions: ['png', 'jpeg']
* }]
* });
* if (Array.isArray(selected)) {
* // user selected multiple files
* } else if (selected === null) {
* // user cancelled the selection
* } else {
* // user selected a single file
* }
* ```
*
* @example
* ```typescript
* import { open } from '@tauri-apps/api/dialog';
* import { appDir } from '@tauri-apps/api/path';
* // Open a selection dialog for directories
* const selected = await open({
* directory: true,
* multiple: true,
* defaultPath: await appDir(),
* });
* if (Array.isArray(selected)) {
* // user selected multiple directories
* } else if (selected === null) {
* // user cancelled the selection
* } else {
* // user selected a single directory
* }
* ```
*
* @returns A promise resolving to the selected path(s)
*/
declare function open(options?: OpenDialogOptions): Promise<null | string | string[]>;
/**
* Open a file/directory save dialog.
*
* The selected path is added to the filesystem and asset protocol allowlist scopes.
* When security is more important than the easy of use of this API,
* prefer writing a dedicated command instead.
*
* Note that the allowlist scope change is not persisted, so the values are cleared when the application is restarted.
* You can save it to the filesystem using [tauri-plugin-persisted-scope](https://github.com/tauri-apps/tauri-plugin-persisted-scope).
* @example
* ```typescript
* import { save } from '@tauri-apps/api/dialog';
* const filePath = await save({
* multiple: true,
* filters: [{
* name: 'Image',
* extensions: ['stronghold']
* }]
* });
* ```
*
* @returns A promise resolving to the selected path.
*/
declare function save(options?: SaveDialogOptions): Promise<string>;
/**
* Shows a message dialog with an `Ok` button.
* @example
* ```typescript
* import { message } from '@tauri-apps/api/dialog';
* await message('Tauri is awesome', 'Tauri');
* await message('File not found', { title: 'Tauri', type: 'error' });
* ```
*
* @param {string} message The message to show.
* @param {string|MessageDialogOptions|undefined} options The dialog's options. If a string, it represents the dialog title.
*
* @return {Promise<void>} A promise indicating the success or failure of the operation.
*/
declare function message(message: string, options?: string | MessageDialogOptions): Promise<void>;
/**
* Shows a question dialog with `Yes` and `No` buttons.
* @example
* ```typescript
* import { ask } from '@tauri-apps/api/dialog';
* const yes = await ask('Are you sure?', 'Tauri');
* const yes2 = await ask('This action cannot be reverted. Are you sure?', { title: 'Tauri', type: 'warning' });
* ```
*
* @param {string} message The message to show.
* @param {string|MessageDialogOptions|undefined} options The dialog's options. If a string, it represents the dialog title.
*
* @return {Promise<void>} A promise resolving to a boolean indicating whether `Yes` was clicked or not.
*/
declare function ask(message: string, options?: string | MessageDialogOptions): Promise<boolean>;
/**
* Shows a question dialog with `Ok` and `Cancel` buttons.
* @example
* ```typescript
* import { confirm } from '@tauri-apps/api/dialog';
* const confirmed = await confirm('Are you sure?', 'Tauri');
* const confirmed2 = await confirm('This action cannot be reverted. Are you sure?', { title: 'Tauri', type: 'warning' });
* ```
*
* @param {string} message The message to show.
* @param {string|MessageDialogOptions|undefined} options The dialog's options. If a string, it represents the dialog title.
*
* @return {Promise<void>} A promise resolving to a boolean indicating whether `Ok` was clicked or not.
*/
declare function confirm(message: string, options?: string | MessageDialogOptions): Promise<boolean>;
export type { DialogFilter, OpenDialogOptions, SaveDialogOptions, MessageDialogOptions };
export { open, save, message, ask, confirm };
export { C as ConfirmDialogOptions, D as DialogFilter, M as MessageDialogOptions, O as OpenDialogOptions, S as SaveDialogOptions, a as ask, c as confirm, m as message, o as open, s as save } from './dialog-c1baaa9b.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{a as ask,c as confirm,m as message,o as open,s as save}from"./dialog-37b7acba.js";import"./tauri-fa8f44bd.js";
import{a,b,c,d,e}from"./chunk-WJKH4UU7.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{d as ask,e as confirm,c as message,a as open,b as save};

@@ -1,60 +0,1 @@

import type { EventName, EventCallback, UnlistenFn, Event } from './helpers/event';
/**
* Listen to an event from the backend.
*
* @example
* ```typescript
* import { listen } from '@tauri-apps/api/event';
* const unlisten = await listen<string>('error', (event) => {
* console.log(`Got error in window ${event.windowLabel}, payload: ${payload}`);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
* @param handler Event handler callback.
* @return A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
declare function listen<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>;
/**
* Listen to an one-off event from the backend.
*
* @example
* ```typescript
* import { once } from '@tauri-apps/api/event';
* interface LoadedPayload {
* loggedIn: boolean,
* token: string
* }
* const unlisten = await once<LoadedPayload>('loaded', (event) => {
* console.log(`App is loaded, logggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
* @param handler Event handler callback.
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
declare function once<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>;
/**
* Emits an event to the backend.
* @example
* ```typescript
* import { emit } from '@tauri-apps/api/event';
* await emit('frontend-loaded', { loggedIn: true, token: 'authToken' });
* ```
*
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
* @param [payload] Event payload
* @returns
*/
declare function emit(event: string, payload?: unknown): Promise<void>;
export type { Event, EventName, EventCallback, UnlistenFn };
export { listen, once, emit };
export { E as Event, q as EventCallback, u as EventName, v as TauriEvent, U as UnlistenFn, t as emit, r as listen, s as once } from './event-b4efb052.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./event-aba177ae.js";export{a as emit,l as listen,o as once}from"./event-1823ec51.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js";
import{d as a,e as b,f as c,g as d}from"./chunk-M3Y6ZK7U.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{a as TauriEvent,d as emit,b as listen,c as once};

@@ -1,240 +0,1 @@

export declare enum BaseDirectory {
Audio = 1,
Cache = 2,
Config = 3,
Data = 4,
LocalData = 5,
Desktop = 6,
Document = 7,
Download = 8,
Executable = 9,
Font = 10,
Home = 11,
Picture = 12,
Public = 13,
Runtime = 14,
Template = 15,
Video = 16,
Resource = 17,
App = 18,
Log = 19,
Temp = 20
}
interface FsOptions {
dir?: BaseDirectory;
}
interface FsDirOptions {
dir?: BaseDirectory;
recursive?: boolean;
}
/** Options object used to write a UTF-8 string to a file. */
interface FsTextFileOption {
/** Path to the file to write. */
path: string;
/** The UTF-8 string to write to the file. */
contents: string;
}
declare type BinaryFileContents = Iterable<number> | ArrayLike<number> | ArrayBuffer;
/** Options object used to write a binary data to a file. */
interface FsBinaryFileOption {
/** Path to the file to write. */
path: string;
/** The byte array contents. */
contents: BinaryFileContents;
}
interface FileEntry {
path: string;
/**
* Name of the directory/file
* can be null if the path terminates with `..`
*/
name?: string;
/** Children of this entry if it's a directory; null otherwise */
children?: FileEntry[];
}
/**
* Reads a file as an UTF-8 encoded string.
* @example
* ```typescript
* import { readTextFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Read the text file in the `$APPDIR/app.conf` path
* const contents = await readTextFile('app.conf', { dir: BaseDirectory.App });
* ```
*
* @param filePath Path to the file.
* @param options Configuration object.
* @returns A promise resolving to the file content as a UTF-8 encoded string.
*/
declare function readTextFile(filePath: string, options?: FsOptions): Promise<string>;
/**
* Reads a file as byte array.
* @example
* ```typescript
* import { readBinaryFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Read the image file in the `$RESOURCEDIR/avatar.png` path
* const contents = await readBinaryFile('avatar.png', { dir: BaseDirectory.Resource });
* ```
*
* @param filePath Path to the file.
* @param options Configuration object.
* @returns A promise resolving to the file bytes array.
*/
declare function readBinaryFile(filePath: string, options?: FsOptions): Promise<Uint8Array>;
/**
* Writes a UTF-8 text file.
* @example
* ```typescript
* import { writeTextFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Write a text file to the `$APPDIR/app.conf` path
* await writeTextFile('app.conf', 'file contents', { dir: BaseDirectory.App });
* ```
*
* @param path The file path.
* @param contents The file contents.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function writeTextFile(path: string, contents: string, options?: FsOptions): Promise<void>;
/**
* Writes a UTF-8 text file.
* @example
* ```typescript
* import { writeTextFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Write a text file to the `$APPDIR/app.conf` path
* await writeTextFile({ path: 'app.conf', contents: 'file contents' }, { dir: BaseDirectory.App });
* ```
*
* @param file The object containing the file path and contents.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function writeTextFile(file: FsTextFileOption, options?: FsOptions): Promise<void>;
/**
* Writes a byte array content to a file.
* @example
* ```typescript
* import { writeBinaryFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Write a binary file to the `$APPDIR/avatar.png` path
* await writeBinaryFile('avatar.png', new Uint8Array([]), { dir: BaseDirectory.App });
* ```
*
* @param path The file path.
* @param contents The file contents.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function writeBinaryFile(path: string, contents: BinaryFileContents, options?: FsOptions): Promise<void>;
/**
* Writes a byte array content to a file.
* @example
* ```typescript
* import { writeBinaryFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Write a binary file to the `$APPDIR/avatar.png` path
* await writeBinaryFile({ path: 'avatar.png', contents: new Uint8Array([]) }, { dir: BaseDirectory.App });
* ```
*
* @param file The object containing the file path and contents.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function writeBinaryFile(file: FsBinaryFileOption, options?: FsOptions): Promise<void>;
/**
* List directory files.
* @example
* ```typescript
* import { readDir, BaseDirectory } from '@tauri-apps/api/fs';
* // Reads the `$APPDIR/users` directory recursively
* const entries = await readDir('users', { dir: BaseDirectory.App, recursive: true });
*
* function processEntries(entries) {
* for (const entry of entries) {
* console.log(`Entry: ${entry.path}`);
* if (entry.children) {
* processEntries(entry.children)
* }
* }
* }
* ```
*
* @param dir Path to the directory to read.
* @param options Configuration object.
* @returns A promise resolving to the directory entries.
*/
declare function readDir(dir: string, options?: FsDirOptions): Promise<FileEntry[]>;
/**
* Creates a directory.
* If one of the path's parent components doesn't exist
* and the `recursive` option isn't set to true, the promise will be rejected.
* @example
* ```typescript
* import { createDir, BaseDirectory } from '@tauri-apps/api/fs';
* // Create the `$APPDIR/users` directory
* await createDir('users', { dir: BaseDirectory.App, recursive: true });
* ```
*
* @param dir Path to the directory to create.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function createDir(dir: string, options?: FsDirOptions): Promise<void>;
/**
* Removes a directory.
* If the directory is not empty and the `recursive` option isn't set to true, the promise will be rejected.
* @example
* ```typescript
* import { removeDir, BaseDirectory } from '@tauri-apps/api/fs';
* // Remove the directory `$APPDIR/users`
* await removeDir('users', { dir: BaseDirectory.App });
* ```
*
* @param dir Path to the directory to remove.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function removeDir(dir: string, options?: FsDirOptions): Promise<void>;
/**
* Copys a file to a destination.
* @example
* ```typescript
* import { copyFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Copy the `$APPDIR/app.conf` file to `$APPDIR/app.conf.bk`
* await copyFile('app.conf', 'app.conf.bk', { dir: BaseDirectory.App });
* ```
*
* @param source A path of the file to copy.
* @param destination A path for the destination file.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function copyFile(source: string, destination: string, options?: FsOptions): Promise<void>;
/**
* Removes a file.
* @example
* ```typescript
* import { removeFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Remove the `$APPDIR/app.conf` file
* await removeFile('app.conf', { dir: BaseDirectory.App });
* ```
*
* @param file Path to the file to remove.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function removeFile(file: string, options?: FsOptions): Promise<void>;
/**
* Renames a file.
* @example
* ```typescript
* import { renameFile, BaseDirectory } from '@tauri-apps/api/fs';
* // Rename the `$APPDIR/avatar.png` file
* await renameFile('avatar.png', 'deleted.png', { dir: BaseDirectory.App });
* ```
*
* @param oldPath A path of the file to rename.
* @param newPath A path of the new file name.
* @param options Configuration object.
* @returns A promise indicating the success or failure of the operation.
*/
declare function renameFile(oldPath: string, newPath: string, options?: FsOptions): Promise<void>;
export type { FsOptions, FsDirOptions, FsTextFileOption, BinaryFileContents, FsBinaryFileOption, FileEntry };
export { BaseDirectory as Dir, readTextFile, readBinaryFile, writeTextFile, writeTextFile as writeFile, writeBinaryFile, readDir, createDir, removeDir, copyFile, removeFile, renameFile };
export { B as BaseDirectory, c as BinaryFileContents, B as Dir, e as FileEntry, d as FsBinaryFileOption, a as FsDirOptions, F as FsOptions, b as FsTextFileOption, l as copyFile, j as createDir, o as exists, g as readBinaryFile, i as readDir, r as readTextFile, k as removeDir, m as removeFile, n as renameFile, h as writeBinaryFile, w as writeFile, w as writeTextFile } from './fs-9b68920e.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{B as BaseDirectory,B as Dir,g as copyFile,d as createDir,a as readBinaryFile,c as readDir,r as readTextFile,e as removeDir,h as removeFile,i as renameFile,b as writeBinaryFile,w as writeFile,w as writeTextFile}from"./fs-c8f11a6d.js";import"./tauri-fa8f44bd.js";
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-SZXG763M.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{a as BaseDirectory,a as Dir,i as copyFile,g as createDir,l as exists,c as readBinaryFile,f as readDir,b as readTextFile,h as removeDir,j as removeFile,k as renameFile,e as writeBinaryFile,d as writeFile,d as writeTextFile};

@@ -1,67 +0,1 @@

export declare type ShortcutHandler = (shortcut: string) => void;
/**
* Register a global shortcut.
* @example
* ```typescript
* import { register } from '@tauri-apps/api/globalShortcut';
* await register('CommandOrControl+Shift+C', () => {
* console.log('Shortcut triggered');
* });
* ```
*
* @param shortcut Shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q
* @param handler Shortcut handler callback - takes the triggered shortcut as argument
* @returns
*/
declare function register(shortcut: string, handler: ShortcutHandler): Promise<void>;
/**
* Register a collection of global shortcuts.
* @example
* ```typescript
* import { registerAll } from '@tauri-apps/api/globalShortcut';
* await registerAll(['CommandOrControl+Shift+C', 'Ctrl+Alt+F12'], (shortcut) => {
* console.log(`Shortcut ${shortcut} triggered`);
* });
* ```
*
* @param shortcuts Array of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q
* @param handler Shortcut handler callback - takes the triggered shortcut as argument
* @returns
*/
declare function registerAll(shortcuts: string[], handler: ShortcutHandler): Promise<void>;
/**
* Determines whether the given shortcut is registered by this application or not.
* @example
* ```typescript
* import { isRegistered } from '@tauri-apps/api/globalShortcut';
* const isRegistered = await isRegistered('CommandOrControl+P');
* ```
*
* @param shortcut Array of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q
* @returns A promise resolving to the state.
*/
declare function isRegistered(shortcut: string): Promise<boolean>;
/**
* Unregister a global shortcut.
* @example
* ```typescript
* import { unregister } from '@tauri-apps/api/globalShortcut';
* await unregister('CmdOrControl+Space');
* ```
*
* @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q
* @returns
*/
declare function unregister(shortcut: string): Promise<void>;
/**
* Unregisters all shortcuts registered by the application.
* @example
* ```typescript
* import { unregisterAll } from '@tauri-apps/api/globalShortcut';
* await unregisterAll();
* ```
*
* @returns
*/
declare function unregisterAll(): Promise<void>;
export { register, registerAll, isRegistered, unregister, unregisterAll };
export { S as ShortcutHandler, i as isRegistered, r as register, a as registerAll, u as unregister, b as unregisterAll } from './globalShortcut-003b7421.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js";export{i as isRegistered,r as register,a as registerAll,u as unregister,b as unregisterAll}from"./globalShortcut-37a16ba5.js";
import{a,b,c,d,e}from"./chunk-ITP3W3MJ.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{c as isRegistered,a as register,b as registerAll,d as unregister,e as unregisterAll};

@@ -1,292 +0,1 @@

interface Duration {
secs: number;
nanos: number;
}
interface ClientOptions {
maxRedirections?: number;
connectTimeout?: number | Duration;
}
declare enum ResponseType {
JSON = 1,
Text = 2,
Binary = 3
}
interface FilePart<T> {
file: string | T;
mime?: string;
fileName?: string;
}
declare type Part = string | Uint8Array | FilePart<Uint8Array>;
/** The body object to be used on POST and PUT requests. */
declare class Body {
type: string;
payload: unknown;
/** @ignore */
private constructor();
/**
* Creates a new form data body. The form data is an object where each key is the entry name,
* and the value is either a string or a file object.
*
* By default it sets the `application/x-www-form-urlencoded` Content-Type header,
* but you can set it to `multipart/form-data` if the Cargo feature `http-multipart` is enabled.
*
* Note that a file path must be allowed in the `fs` allowlist scope.
* @example
* ```typescript
* import { Body } from "@tauri-apps/api/http"
* Body.form({
* key: 'value',
* image: {
* file: '/path/to/file', // either a path or an array buffer of the file contents
* mime: 'image/jpeg', // optional
* fileName: 'image.jpg' // optional
* }
* });
* ```
*
* @param data The body data.
*
* @return The body object ready to be used on the POST and PUT requests.
*/
static form(data: Record<string, Part>): Body;
/**
* Creates a new JSON body.
* @example
* ```typescript
* import { Body } from "@tauri-apps/api/http"
* Body.json({
* registered: true,
* name: 'tauri'
* });
* ```
*
* @param data The body JSON object.
*
* @return The body object ready to be used on the POST and PUT requests.
*/
static json(data: Record<any, any>): Body;
/**
* Creates a new UTF-8 string body.
* @example
* ```typescript
* import { Body } from "@tauri-apps/api/http"
* Body.text('The body content as a string');
* ```
*
* @param data The body string.
*
* @return The body object ready to be used on the POST and PUT requests.
*/
static text(value: string): Body;
/**
* Creates a new byte array body.
* @example
* ```typescript
* import { Body } from "@tauri-apps/api/http"
* Body.bytes(new Uint8Array([1, 2, 3]));
* ```
*
* @param data The body byte array.
*
* @return The body object ready to be used on the POST and PUT requests.
*/
static bytes(bytes: Iterable<number> | ArrayLike<number> | ArrayBuffer): Body;
}
/** The request HTTP verb. */
declare type HttpVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE';
/** Options object sent to the backend. */
interface HttpOptions {
method: HttpVerb;
url: string;
headers?: Record<string, any>;
query?: Record<string, any>;
body?: Body;
timeout?: number | Duration;
responseType?: ResponseType;
}
/** Request options. */
declare type RequestOptions = Omit<HttpOptions, 'method' | 'url'>;
/** Options for the `fetch` API. */
declare type FetchOptions = Omit<HttpOptions, 'url'>;
/** @ignore */
interface IResponse<T> {
url: string;
status: number;
headers: Record<string, string>;
rawHeaders: Record<string, string[]>;
data: T;
}
/** Response object. */
declare class Response<T> {
/** The request URL. */
url: string;
/** The response status code. */
status: number;
/** A boolean indicating whether the response was successful (status in the range 200–299) or not. */
ok: boolean;
/** The response headers. */
headers: Record<string, string>;
/** The response raw headers. */
rawHeaders: Record<string, string[]>;
/** The response data. */
data: T;
/** @ignore */
constructor(response: IResponse<T>);
}
declare class Client {
id: number;
/** @ignore */
constructor(id: number);
/**
* Drops the client instance.
* @example
* ```typescript
* import { getClient } from '@tauri-apps/api/http';
* const client = await getClient();
* await client.drop();
* ```
*
* @returns
*/
drop(): Promise<void>;
/**
* Makes an HTTP request.
* @example
* ```typescript
* import { getClient } from '@tauri-apps/api/http';
* const client = await getClient();
* const response = await client.request({
* method: 'GET',
* url: 'http://localhost:3003/users',
* });
* ```
*
* @param options The request options.
* @returns A promise resolving to the response.
*/
request<T>(options: HttpOptions): Promise<Response<T>>;
/**
* Makes a GET request.
* @example
* ```typescript
* import { getClient, ResponseType } from '@tauri-apps/api/http';
* const client = await getClient();
* const response = await client.get('http://localhost:3003/users', {
* timeout: 30,
* // the expected response type
* responseType: ResponseType.JSON
* });
* ```
*
* @param url The request URL.
* @param options The request options.
* @returns A promise resolving to the response.
*/
get<T>(url: string, options?: RequestOptions): Promise<Response<T>>;
/**
* Makes a POST request.
* @example
* ```typescript
* import { getClient, Body, ResponseType } from '@tauri-apps/api/http';
* const client = await getClient();
* const response = await client.post('http://localhost:3003/users', {
* body: Body.json({
* name: 'tauri',
* password: 'awesome'
* }),
* // in this case the server returns a simple string
* responseType: ResponseType.Text,
* });
* ```
*
* @param url The request URL.
* @param body The body of the request.
* @param options The request options.
* @returns A promise resolving to the response.
*/
post<T>(url: string, body?: Body, options?: RequestOptions): Promise<Response<T>>;
/**
* Makes a PUT request.
* @example
* ```typescript
* import { getClient, Body } from '@tauri-apps/api/http';
* const client = await getClient();
* const response = await client.put('http://localhost:3003/users/1', {
* body: Body.form({
* file: {
* file: '/home/tauri/avatar.png',
* mime: 'image/png',
* fileName: 'avatar.png'
* }
* })
* });
* ```
*
* @param url The request URL.
* @param body The body of the request.
* @param options Request options.
* @returns A promise resolving to the response.
*/
put<T>(url: string, body?: Body, options?: RequestOptions): Promise<Response<T>>;
/**
* Makes a PATCH request.
* @example
* ```typescript
* import { getClient, Body } from '@tauri-apps/api/http';
* const client = await getClient();
* const response = await client.patch('http://localhost:3003/users/1', {
* body: Body.json({ email: 'contact@tauri.app' })
* });
* ```
*
* @param url The request URL.
* @param options The request options.
* @returns A promise resolving to the response.
*/
patch<T>(url: string, options?: RequestOptions): Promise<Response<T>>;
/**
* Makes a DELETE request.
* @example
* ```typescript
* import { getClient } from '@tauri-apps/api/http';
* const client = await getClient();
* const response = await client.delete('http://localhost:3003/users/1');
* ```
*
* @param url The request URL.
* @param options The request options.
* @returns A promise resolving to the response.
*/
delete<T>(url: string, options?: RequestOptions): Promise<Response<T>>;
}
/**
* Creates a new client using the specified options.
* @example
* ```typescript
* import { getClient } from '@tauri-apps/api/http';
* const client = await getClient();
* ```
*
* @param options Client configuration.
*
* @return A promise resolving to the client instance.
*/
declare function getClient(options?: ClientOptions): Promise<Client>;
/**
* Perform an HTTP request using the default client.
* @example
* ```typescript
* import { fetch } from '@tauri-apps/api/http';
* const response = await fetch('http://localhost:3003/users/2', {
* method: 'GET',
* timeout: 30,
* });
* ```
*
* @param url The request URL.
* @param options The fetch options.
* @return The response object.
*/
declare function fetch<T>(url: string, options?: FetchOptions): Promise<Response<T>>;
export type { Duration, ClientOptions, Part, HttpVerb, HttpOptions, RequestOptions, FetchOptions };
export { getClient, fetch, Body, Client, Response, ResponseType, FilePart };
export { B as Body, b as Client, C as ClientOptions, D as Duration, F as FetchOptions, e as FilePart, a as HttpOptions, H as HttpVerb, P as Part, R as RequestOptions, c as Response, d as ResponseType, f as fetch, g as getClient } from './http-43c39402.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{B as Body,C as Client,R as Response,a as ResponseType,f as fetch,g as getClient}from"./http-db5e353e.js";import"./tauri-fa8f44bd.js";
import{a,b,c,d,e,f}from"./chunk-XH7VLPQH.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{b as Body,d as Client,c as Response,a as ResponseType,f as fetch,e as getClient};

@@ -0,1 +1,18 @@

export { a as app } from './app-5190a154.js';
export { c as cli } from './cli-373e13ed.js';
export { c as clipboard } from './clipboard-79413165.js';
export { d as dialog } from './dialog-c1baaa9b.js';
export { e as event, w as window } from './event-b4efb052.js';
export { f as fs } from './fs-9b68920e.js';
export { g as globalShortcut } from './globalShortcut-003b7421.js';
export { h as http } from './http-43c39402.js';
export { n as notification } from './notification-6cd45c32.js';
export { p as path } from './path-680a5f31.js';
export { p as process } from './process-63838be1.js';
export { s as shell } from './shell-301c4e4d.js';
import { i as invoke$1 } from './tauri-605fa63e.js';
export { t as tauri } from './tauri-605fa63e.js';
export { u as updater } from './updater-ade3058d.js';
export { o as os } from './os-0303c6d6.js';
/**

@@ -11,2 +28,6 @@ * The Tauri API allows you to interface with the backend layer.

*/
export * from './bundle';
/** @ignore */
declare const invoke: typeof invoke$1;
export { invoke };

@@ -1,1 +0,1 @@

import{i as t}from"./tauri-fa8f44bd.js";export{a as tauri}from"./tauri-fa8f44bd.js";export{f as fs}from"./fs-c8f11a6d.js";export{h as http}from"./http-db5e353e.js";export{p as path}from"./path-9581ef45.js";export{s as shell}from"./shell-0d054540.js";export{w as window}from"./window-5b72c451.js";export{o as os}from"./os-568baf9e.js";export{a as app}from"./app-ea395091.js";export{c as cli}from"./cli-0a14b129.js";export{c as clipboard}from"./clipboard-6ac7f168.js";export{d as dialog}from"./dialog-37b7acba.js";export{e as event}from"./event-1823ec51.js";export{g as globalShortcut}from"./globalShortcut-37a16ba5.js";export{n as notification}from"./notification-1da296a1.js";export{p as process}from"./process-67cf9ac3.js";export{u as updater}from"./updater-235abf4a.js";import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./os-check-094ffe86.js";import"./event-aba177ae.js";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t){var e=function(t){var e,o=Object.prototype,n=o.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function f(t,r,e,o){var n=r&&r.prototype instanceof v?r:v,i=Object.create(n.prototype),a=new G(o||[]);return i._invoke=function(t,r,e){var o=l;return function(n,i){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===n)throw i;return T()}for(e.method=n,e.arg=i;;){var a=e.delegate;if(a){var c=S(a,e);if(c){if(c===m)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(o===l)throw o=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);o=y;var u=h(t,r,e);if("normal"===u.type){if(o=e.done?d:p,u.arg===m)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(o=d,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var l="suspendedStart",p="suspendedYield",y="executing",d="completed",m={};function v(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(N([])));j&&j!==o&&n.call(j,a)&&(w=j);var L=b.prototype=v.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function _(t,e){function o(i,a,c,u){var s=h(t[i],t,a);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"===r(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(l).then((function(t){f.value=t,c(f)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}}function S(t,r){var o=t.iterator[r.method];if(o===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var n=h(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,m;var i=n.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:T}}function T(){return{value:e,done:!0}}return g.prototype=b,s(L,"constructor",b),s(b,"constructor",g),g.displayName=s(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},t.awrap=function(t){return{__await:t}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(r,e,o,n,i){void 0===i&&(i=Promise);var a=new _(f(r,e,o,n),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),s(L,u,"Generator"),s(L,a,(function(){return this})),s(L,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var o=r.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(o,n){return c.type="throw",c.arg=t,r.next=o,n&&(r.method="next",r.arg=e),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var o=e.completion;if("throw"===o.type){var n=o.arg;k(e)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,o){return this.delegate={iterator:N(t),resultName:r,nextLoc:o},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}({exports:{}});var i=t;export{i as invoke};
import{d as h}from"./chunk-4NZJJ336.js";import{p as u}from"./chunk-HSJSXYDL.js";import{d as l}from"./chunk-CICBN6X2.js";import{g as v}from"./chunk-4CXLGJ6R.js";import{G as n}from"./chunk-F5B3GZW2.js";import"./chunk-V5J25SYE.js";import{c}from"./chunk-3O263AOJ.js";import{e as d}from"./chunk-JI3ACNQ5.js";import{f as m}from"./chunk-DIFM6EX4.js";import{b as t}from"./chunk-6IDLE7HB.js";import{c as i}from"./chunk-6PDK3LJA.js";import{f as a}from"./chunk-WJKH4UU7.js";import{h as p}from"./chunk-M3Y6ZK7U.js";import{m as s}from"./chunk-SZXG763M.js";import{f}from"./chunk-ITP3W3MJ.js";import{g as e}from"./chunk-XH7VLPQH.js";import"./chunk-RKMHWDGH.js";import{b as o,d as r}from"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";var b=o;export{m as app,t as cli,i as clipboard,a as dialog,p as event,s as fs,f as globalShortcut,e as http,b as invoke,l as notification,v as os,n as path,c as process,d as shell,r as tauri,h as updater,u as window};

@@ -31,5 +31,26 @@ /**

*
* @param cb
* The callback function can also return a Promise:
* ```js
* import { mockIPC, clearMocks } from "@tauri-apps/api/mocks"
* import { invoke } from "@tauri-apps/api/tauri"
*
* afterEach(() => {
* clearMocks()
* })
*
* test("mocked command", () => {
* mockIPC((cmd, args) => {
* if(cmd === "get_data") {
* return fetch("https://example.com/data.json")
* .then((response) => response.json())
* }
* });
*
* expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });
* })
* ```
*
* @since 1.0.0
*/
export declare function mockIPC(cb: (cmd: string, args: Record<string, unknown>) => any): void;
declare function mockIPC(cb: (cmd: string, args: Record<string, unknown>) => any | Promise<any>): void;
/**

@@ -80,4 +101,6 @@ * Mocks one or many window labels.

* @param additionalWindows Label of additional windows the app has.
*
* @since 1.0.0
*/
export declare function mockWindows(current: string, ...additionalWindows: string[]): void;
declare function mockWindows(current: string, ...additionalWindows: string[]): void;
/**

@@ -106,3 +129,7 @@ * Clears mocked functions/data injected by the other functions in this module.

* ```
*
* @since 1.0.0
*/
export declare function clearMocks(): void;
declare function clearMocks(): void;
export { clearMocks, mockIPC, mockWindows };

@@ -1,1 +0,1 @@

import{_ as n,d as r,a as e,e as t}from"./tslib.es6-9bc0804d.js";function _(t){var _=this;window.__TAURI_IPC__=function(o){return n(_,void 0,void 0,(function(){var n,_,c,a=o.cmd,i=o.callback,s=o.error,d=r(o,["cmd","callback","error"]);return e(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),_=(n=window)["_".concat(i)],[4,t(a,d)];case 1:return _.apply(n,[r.sent()]),[3,3];case 2:return c=r.sent(),window["_".concat(s)](c),[3,3];case 3:return[2]}}))}))}}function o(n){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];window.__TAURI_METADATA__={__windows:t([n],r,!0).map((function(n){return{label:n}})),__currentWindow:{label:n}}}function c(){delete window.__TAURI_IPC__,delete window.__TAURI_METADATA__}export{c as clearMocks,_ as mockIPC,o as mockWindows};
import"./chunk-FEIY7W7S.js";function w(n){window.__TAURI_IPC__=async({cmd:o,callback:_,error:e,...i})=>{try{window[`_${_}`](await n(o,i))}catch(r){window[`_${e}`](r)}}}function t(n,...o){window.__TAURI_METADATA__={__windows:[n,...o].map(_=>({label:_})),__currentWindow:{label:n}}}function d(){delete window.__TAURI_IPC__,delete window.__TAURI_METADATA__}export{d as clearMocks,w as mockIPC,t as mockWindows};

@@ -1,60 +0,1 @@

/**
* Options to send a notification.
*/
interface Options {
/** Notification title. */
title: string;
/** Optional notification body. */
body?: string;
/** Optional notification icon. */
icon?: string;
}
/** Possible permission values. */
declare type Permission = 'granted' | 'denied' | 'default';
/**
* Checks if the permission to send notifications is granted.
* @example
* ```typescript
* import { isPermissionGranted } from '@tauri-apps/api/notification';
* const permissionGranted = await isPermissionGranted();
* ```
*
* @returns
*/
declare function isPermissionGranted(): Promise<boolean>;
/**
* Requests the permission to send notifications.
* @example
* ```typescript
* import { isPermissionGranted, requestPermission } from '@tauri-apps/api/notification';
* let permissionGranted = await isPermissionGranted();
* if (!permissionGranted) {
* const permission = await requestPermission();
* permissionGranted = permission === 'granted';
* }
* ```
*
* @returns A promise resolving to whether the user granted the permission or not.
*/
declare function requestPermission(): Promise<Permission>;
/**
* Sends a notification to the user.
* @example
* ```typescript
* import { isPermissionGranted, requestPermission, sendNotification } from '@tauri-apps/api/notification';
* let permissionGranted = await isPermissionGranted();
* if (!permissionGranted) {
* const permission = await requestPermission();
* permissionGranted = permission === 'granted';
* }
* if (permissionGranted) {
* sendNotification('Tauri is awesome!');
* sendNotification({ title: 'TAURI', body: 'Tauri is awesome!' });
* }
* ```
*
* @param options Notification options.
*/
declare function sendNotification(options: Options | string): void;
export type { Options, Permission };
export { sendNotification, requestPermission, isPermissionGranted };
export { O as Options, P as Permission, i as isPermissionGranted, r as requestPermission, s as sendNotification } from './notification-6cd45c32.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{i as isPermissionGranted,r as requestPermission,s as sendNotification}from"./notification-1da296a1.js";import"./tauri-fa8f44bd.js";
import{a,b,c}from"./chunk-CICBN6X2.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{a as isPermissionGranted,b as requestPermission,c as sendNotification};

@@ -1,58 +0,1 @@

declare type Platform = 'linux' | 'darwin' | 'ios' | 'freebsd' | 'dragonfly' | 'netbsd' | 'openbsd' | 'solaris' | 'android' | 'win32';
declare type OsType = 'Linux' | 'Darwin' | 'Windows_NT';
declare type Arch = 'x86' | 'x86_64' | 'arm' | 'aarch64' | 'mips' | 'mips64' | 'powerpc' | 'powerpc64' | 'riscv64' | 's390x' | 'sparc64';
/**
* The operating system-specific end-of-line marker.
* - `\n` on POSIX
* - `\r\n` on Windows
* */
declare const EOL: string;
/**
* Returns a string identifying the operating system platform.
* The value is set at compile time. Possible values are `'linux'`, `'darwin'`, `'ios'`, `'freebsd'`, `'dragonfly'`, `'netbsd'`, `'openbsd'`, `'solaris'`, `'android'`, `'win32'`
* @example
* ```typescript
* import { platform } from '@tauri-apps/api/os';
* const platformName = await platform();
* ```
*/
declare function platform(): Promise<Platform>;
/**
* Returns a string identifying the kernel version.
* @example
* ```typescript
* import { version } from '@tauri-apps/api/os';
* const osVersion = await version();
* ```
*/
declare function version(): Promise<string>;
/**
* Returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
* @example
* ```typescript
* import { type } from '@tauri-apps/api/os';
* const osType = await type();
* ```
*/
declare function type(): Promise<OsType>;
/**
* Returns the operating system CPU architecture for which the tauri app was compiled.
* Possible values are `'x86'`, `'x86_64'`, `'arm'`, `'aarch64'`, `'mips'`, `'mips64'`, `'powerpc'`, `'powerpc64'`, `'riscv64'`, `'s390x'`, `'sparc64'`.
* @example
* ```typescript
* import { arch } from '@tauri-apps/api/os';
* const archName = await arch();
* ```
*/
declare function arch(): Promise<Arch>;
/**
* Returns the operating system's default directory for temporary files as a string.
* @example
* ```typescript
* import { tempdir } from '@tauri-apps/api/os';
* const tempdirPath = await tempdir();
* ```
*/
declare function tempdir(): Promise<string>;
export { EOL, platform, version, type, arch, tempdir };
export type { Platform, OsType, Arch };
export { A as Arch, E as EOL, O as OsType, P as Platform, a as arch, p as platform, b as tempdir, t as type, v as version } from './os-0303c6d6.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./os-check-094ffe86.js";import"./tauri-7cafdaf8.js";export{E as EOL,a as arch,p as platform,b as tempdir,t as type,v as version}from"./os-568baf9e.js";import"./tauri-fa8f44bd.js";
import{a,b,c,d,e,f}from"./chunk-4CXLGJ6R.js";import"./chunk-V5J25SYE.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{a as EOL,e as arch,b as platform,f as tempdir,d as type,c as version};
{
"name": "@tauri-apps/api",
"version": "1.0.2",
"version": "2.0.0-alpha.3",
"description": "Tauri API definitions",

@@ -15,6 +15,2 @@ "type": "module",

},
"./bundle": {
"import": "./bundle.js",
"require": "./bundle.cjs"
},
"./cli": {

@@ -91,9 +87,9 @@ "import": "./cli.js",

"scripts": {
"build": "rimraf ./dist && rollup -c --silent && node ./scripts/after-build.cjs",
"build": "yarn tsup && node ./scripts/after-build.cjs && yarn generate-docs",
"npm-pack": "yarn build && cd ./dist && npm pack",
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly",
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly --tag next",
"lint": "eslint --ext ts \"./src/**/*.ts\"",
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path ../../.prettierignore",
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path ../../.prettierignore",
"generate-docs": "typedoc"

@@ -117,34 +113,7 @@ },

"engines": {
"node": ">= 12.22.0",
"node": ">= 14.6.0",
"npm": ">= 6.6.0",
"yarn": ">= 1.19.1"
},
"devDependencies": {
"@babel/core": "7.18.6",
"@babel/preset-env": "7.18.6",
"@babel/preset-typescript": "7.18.6",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-commonjs": "22.0.1",
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-sucrase": "4.0.4",
"@rollup/plugin-typescript": "8.3.3",
"@typescript-eslint/eslint-plugin": "5.30.5",
"@typescript-eslint/parser": "5.30.5",
"eslint": "8.19.0",
"eslint-config-prettier": "8.5.0",
"eslint-config-standard-with-typescript": "21.0.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.0.0",
"eslint-plugin-security": "1.5.0",
"prettier": "2.7.1",
"regenerator-runtime": "0.13.9",
"rimraf": "3.0.2",
"rollup": "2.75.7",
"rollup-plugin-terser": "7.0.2",
"tslib": "2.4.0",
"typedoc": "0.23.5",
"typedoc-plugin-markdown": "3.13.3",
"typescript": "4.7.4"
}
"devDependencies": {}
}

@@ -1,417 +0,2 @@

import { BaseDirectory } from './fs';
/**
* Returns the path to the suggested directory for your app config files.
* Resolves to `${configDir}/${bundleIdentifier}`, where `bundleIdentifier` is the value configured on `tauri.conf.json > tauri > bundle > identifier`.
* @example
* ```typescript
* import { appDir } from '@tauri-apps/api/path';
* const appDirPath = await appDir();
* ```
*
* @returns
*/
declare function appDir(): Promise<string>;
/**
* Returns the path to the user's audio directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_MUSIC_DIR`.
* - **macOS:** Resolves to `$HOME/Music`.
* - **Windows:** Resolves to `{FOLDERID_Music}`.
* @example
* ```typescript
* import { audioDir } from '@tauri-apps/api/path';
* const audioDirPath = await audioDir();
* ```
*
* @returns
*/
declare function audioDir(): Promise<string>;
/**
* Returns the path to the user's cache directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$XDG_CACHE_HOME` or `$HOME/.cache`.
* - **macOS:** Resolves to `$HOME/Library/Caches`.
* - **Windows:** Resolves to `{FOLDERID_LocalAppData}`.
* @example
* ```typescript
* import { cacheDir } from '@tauri-apps/api/path';
* const cacheDirPath = await cacheDir();
* ```
*
* @returns
*/
declare function cacheDir(): Promise<string>;
/**
* Returns the path to the user's config directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$XDG_CONFIG_HOME` or `$HOME/.config`.
* - **macOS:** Resolves to `$HOME/Library/Application Support`.
* - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`.
* @example
* ```typescript
* import { configDir } from '@tauri-apps/api/path';
* const configDirPath = await configDir();
* ```
*
* @returns
*/
declare function configDir(): Promise<string>;
/**
* Returns the path to the user's data directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`.
* - **macOS:** Resolves to `$HOME/Library/Application Support`.
* - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`.
* @example
* ```typescript
* import { dataDir } from '@tauri-apps/api/path';
* const dataDirPath = await dataDir();
* ```
*
* @returns
*/
declare function dataDir(): Promise<string>;
/**
* Returns the path to the user's desktop directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DESKTOP_DIR`.
* - **macOS:** Resolves to `$HOME/Library/Desktop`.
* - **Windows:** Resolves to `{FOLDERID_Desktop}`.
* @example
* ```typescript
* import { desktopDir } from '@tauri-apps/api/path';
* const desktopPath = await desktopDir();
* ```
* @returns
*/
declare function desktopDir(): Promise<string>;
/**
* Returns the path to the user's document directory.
* @example
* ```typescript
* import { documentDir } from '@tauri-apps/api/path';
* const documentDirPath = await documentDir();
* ```
*
* #### Platform-specific
*
* - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOCUMENTS_DIR`.
* - **macOS:** Resolves to `$HOME/Documents`.
* - **Windows:** Resolves to `{FOLDERID_Documents}`.
*
* @returns
*/
declare function documentDir(): Promise<string>;
/**
* Returns the path to the user's download directory.
*
* #### Platform-specific
*
* - **Linux**: Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_DOWNLOAD_DIR`.
* - **macOS**: Resolves to `$HOME/Downloads`.
* - **Windows**: Resolves to `{FOLDERID_Downloads}`.
* @example
* ```typescript
* import { downloadDir } from '@tauri-apps/api/path';
* const downloadDirPath = await downloadDir();
* ```
*
* @returns
*/
declare function downloadDir(): Promise<string>;
/**
* Returns the path to the user's executable directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$XDG_BIN_HOME/../bin` or `$XDG_DATA_HOME/../bin` or `$HOME/.local/bin`.
* - **macOS:** Not supported.
* - **Windows:** Not supported.
* @example
* ```typescript
* import { executableDir } from '@tauri-apps/api/path';
* const executableDirPath = await executableDir();
* ```
*
* @returns
*/
declare function executableDir(): Promise<string>;
/**
* Returns the path to the user's font directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$XDG_DATA_HOME/fonts` or `$HOME/.local/share/fonts`.
* - **macOS:** Resolves to `$HOME/Library/Fonts`.
* - **Windows:** Not supported.
* @example
* ```typescript
* import { fontDir } from '@tauri-apps/api/path';
* const fontDirPath = await fontDir();
* ```
*
* @returns
*/
declare function fontDir(): Promise<string>;
/**
* Returns the path to the user's home directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$HOME`.
* - **macOS:** Resolves to `$HOME`.
* - **Windows:** Resolves to `{FOLDERID_Profile}`.
* @example
* ```typescript
* import { homeDir } from '@tauri-apps/api/path';
* const homeDirPath = await homeDir();
* ```
*
* @returns
*/
declare function homeDir(): Promise<string>;
/**
* Returns the path to the user's local data directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`.
* - **macOS:** Resolves to `$HOME/Library/Application Support`.
* - **Windows:** Resolves to `{FOLDERID_LocalAppData}`.
* @example
* ```typescript
* import { localDataDir } from '@tauri-apps/api/path';
* const localDataDirPath = await localDataDir();
* ```
*
* @returns
*/
declare function localDataDir(): Promise<string>;
/**
* Returns the path to the user's picture directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PICTURES_DIR`.
* - **macOS:** Resolves to `$HOME/Pictures`.
* - **Windows:** Resolves to `{FOLDERID_Pictures}`.
* @example
* ```typescript
* import { pictureDir } from '@tauri-apps/api/path';
* const pictureDirPath = await pictureDir();
* ```
*
* @returns
*/
declare function pictureDir(): Promise<string>;
/**
* Returns the path to the user's public directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_PUBLICSHARE_DIR`.
* - **macOS:** Resolves to `$HOME/Public`.
* - **Windows:** Resolves to `{FOLDERID_Public}`.
* @example
* ```typescript
* import { publicDir } from '@tauri-apps/api/path';
* const publicDirPath = await publicDir();
* ```
*
* @returns
*/
declare function publicDir(): Promise<string>;
/**
* Returns the path to the application's resource directory.
* To resolve a resource path, see the [[resolveResource | `resolveResource API`]].
* @example
* ```typescript
* import { resourceDir } from '@tauri-apps/api/path';
* const resourceDirPath = await resourceDir();
* ```
*
* @returns
*/
declare function resourceDir(): Promise<string>;
/**
* Resolve the path to a resource file.
* @example
* ```typescript
* import { resolveResource } from '@tauri-apps/api/path';
* const resourcePath = await resolveResource('script.sh');
* ```
*
* @param resourcePath The path to the resource.
* Must follow the same syntax as defined in `tauri.conf.json > tauri > bundle > resources`, i.e. keeping subfolders and parent dir components (`../`).
* @returns The full path to the resource.
*/
declare function resolveResource(resourcePath: string): Promise<string>;
/**
* Returns the path to the user's runtime directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to `$XDG_RUNTIME_DIR`.
* - **macOS:** Not supported.
* - **Windows:** Not supported.
* @example
* ```typescript
* import { runtimeDir } from '@tauri-apps/api/path';
* const runtimeDirPath = await runtimeDir();
* ```
*
* @returns
*/
declare function runtimeDir(): Promise<string>;
/**
* Returns the path to the user's template directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_TEMPLATES_DIR`.
* - **macOS:** Not supported.
* - **Windows:** Resolves to `{FOLDERID_Templates}`.
* @example
* ```typescript
* import { templateDir } from '@tauri-apps/api/path';
* const templateDirPath = await templateDir();
* ```
*
* @returns
*/
declare function templateDir(): Promise<string>;
/**
* Returns the path to the user's video directory.
*
* #### Platform-specific
*
* - **Linux:** Resolves to [`xdg-user-dirs`](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' `XDG_VIDEOS_DIR`.
* - **macOS:** Resolves to `$HOME/Movies`.
* - **Windows:** Resolves to `{FOLDERID_Videos}`.
* @example
* ```typescript
* import { videoDir } from '@tauri-apps/api/path';
* const videoDirPath = await videoDir();
* ```
*
* @returns
*/
declare function videoDir(): Promise<string>;
/**
* Returns the path to the suggested log directory.
*
* ### Platform-specific
*
* - **Linux:** Resolves to `${configDir}/${bundleIdentifier}`.
* - **macOS:** Resolves to `${homeDir}//Library/Logs/{bundleIdentifier}`
* - **Windows:** Resolves to `${configDir}/${bundleIdentifier}`.
* @example
* ```typescript
* import { logDir } from '@tauri-apps/api/path';
* const logDirPath = await logDir();
* ```
*
* @returns
*/
declare function logDir(): Promise<string>;
/**
* Provides the platform-specific path segment separator:
* - `\` on Windows
* - `/` on POSIX
*/
declare const sep: string;
/**
* Provides the platform-specific path segment delimiter:
* - `;` on Windows
* - `:` on POSIX
*/
declare const delimiter: string;
/**
* Resolves a sequence of `paths` or `path` segments into an absolute path.
* @example
* ```typescript
* import { resolve, appDir } from '@tauri-apps/api/path';
* const appDirPath = await appDir();
* const path = await resolve(appDirPath, '..', 'users', 'tauri', 'avatar.png');
* ```
*
* @param paths A sequence of paths or path segments.
*/
declare function resolve(...paths: string[]): Promise<string>;
/**
* Normalizes the given `path`, resolving `'..'` and `'.'` segments and resolve symolic links.
* @example
* ```typescript
* import { normalize, appDir } from '@tauri-apps/api/path';
* const appDirPath = await appDir();
* const path = await normalize(appDirPath, '..', 'users', 'tauri', 'avatar.png');
* ```
*/
declare function normalize(path: string): Promise<string>;
/**
* Joins all given `path` segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.
* @example
* ```typescript
* import { join, appDir } from '@tauri-apps/api/path';
* const appDirPath = await appDir();
* const path = await join(appDirPath, 'users', 'tauri', 'avatar.png');
* ```
*
* @param paths A sequence of path segments.
*/
declare function join(...paths: string[]): Promise<string>;
/**
* Returns the directory name of a `path`. Trailing directory separators are ignored.
* @example
* ```typescript
* import { dirname, appDir } from '@tauri-apps/api/path';
* const appDirPath = await appDir();
* const dir = await dirname(appDirPath);
* ```
*/
declare function dirname(path: string): Promise<string>;
/**
* Returns the extension of the `path`.
* @example
* ```typescript
* import { extname, resolveResource } from '@tauri-apps/api/path';
* const resourcePath = await resolveResource('app.conf');
* const ext = await extname(resourcePath);
* assert(ext === 'conf');
* ```
*/
declare function extname(path: string): Promise<string>;
/**
* Returns the last portion of a `path`. Trailing directory separators are ignored.
* @example
* ```typescript
* import { basename, resolveResource } from '@tauri-apps/api/path';
* const resourcePath = await resolveResource('app.conf');
* const base = await basename(resourcePath);
* assert(base === 'app');
* ```
*
* @param ext An optional file extension to be removed from the returned path.
*/
declare function basename(path: string, ext?: string): Promise<string>;
/**
* Returns whether the path is absolute or not.
* @example
* ```typescript
* import { isAbsolute } from '@tauri-apps/api/path';
* assert(await isAbsolute('/home/tauri'));
* ```
*/
declare function isAbsolute(path: string): Promise<boolean>;
export { appDir, audioDir, cacheDir, configDir, dataDir, desktopDir, documentDir, downloadDir, executableDir, fontDir, homeDir, localDataDir, pictureDir, publicDir, resourceDir, resolveResource, runtimeDir, templateDir, videoDir, logDir, BaseDirectory, sep, delimiter, resolve, normalize, join, dirname, extname, basename, isAbsolute };
export { B as BaseDirectory } from './fs-9b68920e.js';
export { d as appCacheDir, a as appConfigDir, b as appDataDir, c as appLocalDataDir, e as appLogDir, f as audioDir, F as basename, g as cacheDir, h as configDir, i as dataDir, z as delimiter, j as desktopDir, D as dirname, k as documentDir, l as downloadDir, m as executableDir, E as extname, n as fontDir, o as homeDir, G as isAbsolute, C as join, q as localDataDir, B as normalize, r as pictureDir, s as publicDir, A as resolve, u as resolveResource, t as resourceDir, v as runtimeDir, y as sep, w as templateDir, x as videoDir } from './path-680a5f31.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{B as BaseDirectory}from"./fs-c8f11a6d.js";import"./os-check-094ffe86.js";export{a as appDir,b as audioDir,C as basename,c as cacheDir,d as configDir,e as dataDir,w as delimiter,f as desktopDir,A as dirname,g as documentDir,h as downloadDir,i as executableDir,B as extname,j as fontDir,k as homeDir,D as isAbsolute,z as join,l as localDataDir,s as logDir,y as normalize,m as pictureDir,n as publicDir,x as resolve,o as resolveResource,r as resourceDir,q as runtimeDir,u as sep,t as templateDir,v as videoDir}from"./path-9581ef45.js";import"./tauri-fa8f44bd.js";
import{A as B,B as C,C as D,D as E,E as F,F as G,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"./chunk-F5B3GZW2.js";import"./chunk-V5J25SYE.js";import{a}from"./chunk-SZXG763M.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{a as BaseDirectory,e as appCacheDir,b as appConfigDir,c as appDataDir,d as appLocalDataDir,x as appLogDir,f as audioDir,F as basename,g as cacheDir,h as configDir,i as dataDir,z as delimiter,j as desktopDir,D as dirname,k as documentDir,l as downloadDir,m as executableDir,E as extname,n as fontDir,o as homeDir,G as isAbsolute,C as join,p as localDataDir,B as normalize,q as pictureDir,r as publicDir,A as resolve,t as resolveResource,s as resourceDir,u as runtimeDir,y as sep,v as templateDir,w as videoDir};

@@ -1,24 +0,1 @@

/**
* Exits immediately with the given `exitCode`.
* @example
* ```typescript
* import { exit } from '@tauri-apps/api/process';
* await exit(1);
* ```
*
* @param exitCode The exit code to use.
* @returns A promise indicating the success or failure of the operation.
*/
declare function exit(exitCode?: number): Promise<void>;
/**
* Exits the current instance of the app then relaunches it.
* @example
* ```typescript
* import { relaunch } from '@tauri-apps/api/process';
* await relaunch();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
declare function relaunch(): Promise<void>;
export { exit, relaunch };
export { e as exit, r as relaunch } from './process-63838be1.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{e as exit,r as relaunch}from"./process-67cf9ac3.js";import"./tauri-fa8f44bd.js";
import{a,b}from"./chunk-3O263AOJ.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{a as exit,b as relaunch};

@@ -5,11 +5,10 @@ # @tauri-apps/api

[![status](https://img.shields.io/badge/Status-Stable-green.svg)](https://github.com/tauri-apps/tauri)
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.app)
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
[![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri)
[![support](https://img.shields.io/badge/sponsor-Open%20Collective-blue.svg)](https://opencollective.com/tauri)

@@ -28,3 +27,3 @@ | Component | Version |

This is a typescript library that creates `cjs` and `esm` Javascript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure typescript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts.
This is a typescript library that creates `cjs` and `esm` JavaScript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure typescript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts.

@@ -31,0 +30,0 @@ To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.

@@ -1,166 +0,1 @@

interface SpawnOptions {
/** Current working directory. */
cwd?: string;
/** Environment variables. set to `null` to clear the process env. */
env?: {
[name: string]: string;
};
}
interface ChildProcess {
/** Exit code of the process. `null` if the process was terminated by a signal on Unix. */
code: number | null;
/** If the process was terminated by a signal, represents that signal. */
signal: number | null;
/** The data that the process wrote to `stdout`. */
stdout: string;
/** The data that the process wrote to `stderr`. */
stderr: string;
}
declare class EventEmitter<E extends string> {
/** @ignore */
private eventListeners;
/** @ignore */
private addEventListener;
/** @ignore */
_emit(event: E, payload: any): void;
/**
* Listen to an event from the child process.
*
* @param event The event name.
* @param handler The event handler.
*
* @return The `this` instance for chained calls.
*/
on(event: E, handler: (arg: any) => void): EventEmitter<E>;
}
declare class Child {
/** The child process `pid`. */
pid: number;
constructor(pid: number);
/**
* Writes `data` to the `stdin`.
*
* @param data The message to write, either a string or a byte array.
* @example
* ```typescript
* import { Command } from '@tauri-apps/api/shell';
* const command = new Command('node');
* const child = await command.spawn();
* await child.write('message');
* await child.write([0, 1, 2, 3, 4, 5]);
* ```
*
* @return A promise indicating the success or failure of the operation.
*/
write(data: string | Uint8Array): Promise<void>;
/**
* Kills the child process.
*
* @return A promise indicating the success or failure of the operation.
*/
kill(): Promise<void>;
}
/**
* The entry point for spawning child processes.
* It emits the `close` and `error` events.
* @example
* ```typescript
* import { Command } from '@tauri-apps/api/shell';
* const command = new Command('node');
* command.on('close', data => {
* console.log(`command finished with code ${data.code} and signal ${data.signal}`)
* });
* command.on('error', error => console.error(`command error: "${error}"`));
* command.stdout.on('data', line => console.log(`command stdout: "${line}"`));
* command.stderr.on('data', line => console.log(`command stderr: "${line}"`));
*
* const child = await command.spawn();
* console.log('pid:', child.pid);
* ```
*/
declare class Command extends EventEmitter<'close' | 'error'> {
/** @ignore Program to execute. */
private readonly program;
/** @ignore Program arguments */
private readonly args;
/** @ignore Spawn options. */
private readonly options;
/** Event emitter for the `stdout`. Emits the `data` event. */
readonly stdout: EventEmitter<"data">;
/** Event emitter for the `stderr`. Emits the `data` event. */
readonly stderr: EventEmitter<"data">;
/**
* Creates a new `Command` instance.
*
* @param program The program name to execute.
* It must be configured on `tauri.conf.json > tauri > allowlist > shell > scope`.
* @param args Program arguments.
* @param options Spawn options.
*/
constructor(program: string, args?: string | string[], options?: SpawnOptions);
/**
* Creates a command to execute the given sidecar program.
* @example
* ```typescript
* import { Command } from '@tauri-apps/api/shell';
* const command = Command.sidecar('my-sidecar');
* const output = await command.execute();
* ```
*
* @param program The program to execute.
* It must be configured on `tauri.conf.json > tauri > allowlist > shell > scope`.
* @param args Program arguments.
* @param options Spawn options.
* @returns
*/
static sidecar(program: string, args?: string | string[], options?: SpawnOptions): Command;
/**
* Executes the command as a child process, returning a handle to it.
*
* @return A promise resolving to the child process handle.
*/
spawn(): Promise<Child>;
/**
* Executes the command as a child process, waiting for it to finish and collecting all of its output.
* @example
* ```typescript
* import { Command } from '@tauri-apps/api/shell';
* const output = await new Command('echo', 'message').execute();
* assert(output.code === 0);
* assert(output.signal === null);
* assert(output.stdout === 'message');
* assert(output.stderr === '');
* ```
*
* @return A promise resolving to the child process output.
*/
execute(): Promise<ChildProcess>;
}
/**
* Opens a path or URL with the system's default app,
* or the one specified with `openWith`.
*
* The `openWith` value must be one of `firefox`, `google chrome`, `chromium` `safari`,
* `open`, `start`, `xdg-open`, `gio`, `gnome-open`, `kde-open` or `wslview`.
*
* @example
* ```typescript
* import { open } from '@tauri-apps/api/shell';
* // opens the given URL on the default browser:
* await open('https://github.com/tauri-apps/tauri');
* // opens the given URL using `firefox`:
* await open('https://github.com/tauri-apps/tauri', 'firefox');
* // opens a file using the default program:
* await open('/path/to/file');
* ```
*
* @param path The path or URL to open.
* This value is matched against the string regex defined on `tauri.conf.json > tauri > allowlist > shell > open`,
* which defaults to `^https?://`.
* @param openWith The app to open the file or URL with.
* Defaults to the system default application for the specified path type.
* @returns
*/
declare function open(path: string, openWith?: string): Promise<void>;
export { Command, Child, EventEmitter, open };
export type { ChildProcess, SpawnOptions };
export { a as Child, c as ChildProcess, C as Command, b as CommandEvents, E as EventEmitter, I as IOPayload, O as OutputEvents, S as SpawnOptions, T as TerminatedPayload, o as open } from './shell-301c4e4d.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js";export{a as Child,C as Command,E as EventEmitter,o as open}from"./shell-0d054540.js";
import{a,b,c,d}from"./chunk-JI3ACNQ5.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{b as Child,c as Command,a as EventEmitter,d as open};

@@ -1,70 +0,1 @@

/**
* Invoke your custom commands.
*
* This package is also accessible with `window.__TAURI__.tauri` when `tauri.conf.json > build > withGlobalTauri` is set to true.
* @module
*/
/** @ignore */
declare global {
interface Window {
__TAURI_IPC__: (message: any) => void;
ipc: {
postMessage: (args: string) => void;
};
}
}
/**
* Transforms a callback function to a string identifier that can be passed to the backend.
* The backend uses the identifier to `eval()` the callback.
*
* @return A unique identifier associated with the callback function.
*/
declare function transformCallback(callback?: (response: any) => void, once?: boolean): number;
/** Command arguments. */
interface InvokeArgs {
[key: string]: unknown;
}
/**
* Sends a message to the backend.
* @example
* ```typescript
* import { invoke } from '@tauri-apps/api/tauri';
* await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });
* ```
*
* @param cmd The command name.
* @param args The optional arguments to pass to the command.
* @return A promise resolving or rejecting to the backend response.
*/
declare function invoke<T>(cmd: string, args?: InvokeArgs): Promise<T>;
/**
* Convert a device file path to an URL that can be loaded by the webview.
* Note that `asset:` and `https://asset.localhost` must be allowed on the `csp` value configured on `tauri.conf.json > tauri > security`.
* Example CSP value: `"csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost"` to use the asset protocol on image sources.
*
* Additionally, the `asset` must be allowlisted under `tauri.conf.json > tauri > allowlist > protocol`,
* and its access scope must be defined on the `assetScope` array on the same `protocol` object.
*
* @param filePath The file path.
* @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol.
* @example
* ```typescript
* import { appDir, join } from '@tauri-apps/api/path';
* import { convertFileSrc } from '@tauri-apps/api/tauri';
* const appDirPath = await appDir();
* const filePath = await join(appDir, 'assets/video.mp4');
* const assetUrl = convertFileSrc(filePath);
*
* const video = document.getElementById('my-video');
* const source = document.createElement('source');
* source.type = 'video/mp4';
* source.src = assetUrl;
* video.appendChild(source);
* video.load();
* ```
*
* @return the URL that can be used as source on the webview.
*/
declare function convertFileSrc(filePath: string, protocol?: string): string;
export type { InvokeArgs };
export { transformCallback, invoke, convertFileSrc };
export { I as InvokeArgs, c as convertFileSrc, i as invoke, a as transformCallback } from './tauri-605fa63e.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";export{c as convertFileSrc,i as invoke,t as transformCallback}from"./tauri-fa8f44bd.js";
import{a,b,c}from"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{c as convertFileSrc,b as invoke,a as transformCallback};

@@ -1,68 +0,2 @@

/**
* Customize the auto updater flow.
*
* This package is also accessible with `window.__TAURI__.updater` when `tauri.conf.json > build > withGlobalTauri` is set to true.
* @module
*/
import { UnlistenFn } from './event';
declare type UpdateStatus = 'PENDING' | 'ERROR' | 'DONE' | 'UPTODATE';
interface UpdateStatusResult {
error?: string;
status: UpdateStatus;
}
interface UpdateManifest {
version: string;
date: string;
body: string;
}
interface UpdateResult {
manifest?: UpdateManifest;
shouldUpdate: boolean;
}
/**
* Listen to an updater event.
* @example
* ```typescript
* import { onUpdaterEvent } from "@tauri-apps/api/updater";
* const unlisten = await onUpdaterEvent(({ error, status }) => {
* console.log('Updater event', error, status);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
declare function onUpdaterEvent(handler: (status: UpdateStatusResult) => void): Promise<UnlistenFn>;
/**
* Install the update if there's one available.
* @example
* ```typescript
* import { checkUpdate, installUpdate } from '@tauri-apps/api/updater';
* const update = await checkUpdate();
* if (update.shouldUpdate) {
* console.log(`Installing update ${update.manifest?.version}, ${update.manifest?.date}, ${update.manifest.body}`);
* await installUpdate();
* }
* ```
*
* @return A promise indicating the success or failure of the operation.
*/
declare function installUpdate(): Promise<void>;
/**
* Checks if an update is available.
* @example
* ```typescript
* import { checkUpdate } from '@tauri-apps/api/updater';
* const update = await checkUpdate();
* // now run installUpdate() if needed
* ```
*
* @return Promise resolving to the update status.
*/
declare function checkUpdate(): Promise<UpdateResult>;
export type { UpdateStatus, UpdateStatusResult, UpdateManifest, UpdateResult };
export { onUpdaterEvent, installUpdate, checkUpdate };
import './event-b4efb052.js';
export { b as UpdateManifest, c as UpdateResult, U as UpdateStatus, a as UpdateStatusResult, d as checkUpdate, i as installUpdate, o as onUpdaterEvent } from './updater-ade3058d.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./event-1823ec51.js";export{c as checkUpdate,i as installUpdate,o as onUpdaterEvent}from"./updater-235abf4a.js";import"./event-aba177ae.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js";
import{a,b,c}from"./chunk-4NZJJ336.js";import"./chunk-M3Y6ZK7U.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{c as checkUpdate,b as installUpdate,a as onUpdaterEvent};

@@ -1,1012 +0,1 @@

import type { EventName, EventCallback, UnlistenFn } from './event';
import { Event } from './helpers/event';
declare type Theme = 'light' | 'dark';
/** Allows you to retrieve information about a given monitor. */
interface Monitor {
/** Human-readable name of the monitor */
name: string | null;
/** The monitor's resolution. */
size: PhysicalSize;
/** the Top-left corner position of the monitor relative to the larger full screen area. */
position: PhysicalPosition;
/** The scale factor that can be used to map physical pixels to logical pixels. */
scaleFactor: number;
}
/** The payload for the `scaleChange` event. */
interface ScaleFactorChanged {
/** The new window scale factor. */
scaleFactor: number;
/** The new window size */
size: PhysicalSize;
}
/** The file drop event types. */
declare type FileDropEvent = {
type: 'hover';
paths: string[];
} | {
type: 'drop';
paths: string[];
} | {
type: 'cancel';
};
/** A size represented in logical pixels. */
declare class LogicalSize {
type: string;
width: number;
height: number;
constructor(width: number, height: number);
}
/** A size represented in physical pixels. */
declare class PhysicalSize {
type: string;
width: number;
height: number;
constructor(width: number, height: number);
/**
* Converts the physical size to a logical one.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const factor = await appWindow.scaleFactor();
* const size = await appWindow.innerSize();
* const logical = size.toLogical(factor);
* ```
* */
toLogical(scaleFactor: number): LogicalSize;
}
/** A position represented in logical pixels. */
declare class LogicalPosition {
type: string;
x: number;
y: number;
constructor(x: number, y: number);
}
/** A position represented in physical pixels. */
declare class PhysicalPosition {
type: string;
x: number;
y: number;
constructor(x: number, y: number);
/**
* Converts the physical position to a logical one.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const factor = await appWindow.scaleFactor();
* const position = await appWindow.innerPosition();
* const logical = position.toLogical(factor);
* ```
* */
toLogical(scaleFactor: number): LogicalPosition;
}
/** @ignore */
interface WindowDef {
label: string;
}
/** @ignore */
declare global {
interface Window {
__TAURI_METADATA__: {
__windows: WindowDef[];
__currentWindow: WindowDef;
};
}
}
/** Attention type to request on a window. */
declare enum UserAttentionType {
/**
* #### Platform-specific
* - **macOS:** Bounces the dock icon until the application is in focus.
* - **Windows:** Flashes both the window and the taskbar button until the application is in focus.
*/
Critical = 1,
/**
* #### Platform-specific
* - **macOS:** Bounces the dock icon once.
* - **Windows:** Flashes the taskbar button until the application is in focus.
*/
Informational = 2
}
export declare type CursorIcon = 'default' | 'crosshair' | 'hand' | 'arrow' | 'move' | 'text' | 'wait' | 'help' | 'progress' | 'notAllowed' | 'contextMenu' | 'cell' | 'verticalText' | 'alias' | 'copy' | 'noDrop' | 'grab' | 'grabbing' | 'allScroll' | 'zoomIn' | 'zoomOut' | 'eResize' | 'nResize' | 'neResize' | 'nwResize' | 'sResize' | 'seResize' | 'swResize' | 'wResize' | 'ewResize' | 'nsResize' | 'neswResize' | 'nwseResize' | 'colResize' | 'rowResize';
/**
* Get an instance of `WebviewWindow` for the current webview window.
*
* @return The current WebviewWindow.
*/
declare function getCurrent(): WebviewWindow;
/**
* Gets an instance of `WebviewWindow` for all available webview windows.
*
* @return The list of WebviewWindow.
*/
declare function getAll(): WebviewWindow[];
/** @ignore */
export declare type WindowLabel = string;
/**
* A webview window handle allows emitting and listening to events from the backend that are tied to the window.
*/
declare class WebviewWindowHandle {
/** The window label. It is a unique identifier for the window, can be used to reference it later. */
label: WindowLabel;
/** Local event listeners. */
listeners: {
[key: string]: Array<EventCallback<any>>;
};
constructor(label: WindowLabel);
/**
* Listen to an event emitted by the backend that is tied to the webview window.
*
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const unlisten = await appWindow.listen<string>('state-changed', (event) => {
* console.log(`Got error: ${payload}`);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
* @param handler Event handler.
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
listen<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>;
/**
* Listen to an one-off event emitted by the backend that is tied to the webview window.
*
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const unlisten = await appWindow.once<null>('initialized', (event) => {
* console.log(`Window initialized!`);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
* @param handler Event handler.
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
once<T>(event: string, handler: EventCallback<T>): Promise<UnlistenFn>;
/**
* Emits an event to the backend, tied to the webview window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.emit('window-loaded', { loggedIn: true, token: 'authToken' });
* ```
*
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
* @param payload Event payload.
*/
emit(event: string, payload?: unknown): Promise<void>;
_handleTauriEvent<T>(event: string, handler: EventCallback<T>): boolean;
}
/**
* Manage the current window object.
*/
declare class WindowManager extends WebviewWindowHandle {
/**
* The scale factor that can be used to map physical pixels to logical pixels.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const factor = await appWindow.scaleFactor();
* ```
*
* @returns The window's monitor scale factor.
* */
scaleFactor(): Promise<number>;
/**
* The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const position = await appWindow.innerPosition();
* ```
*
* @returns The window's inner position.
* */
innerPosition(): Promise<PhysicalPosition>;
/**
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const position = await appWindow.outerPosition();
* ```
*
* @returns The window's outer position.
* */
outerPosition(): Promise<PhysicalPosition>;
/**
* The physical size of the window's client area.
* The client area is the content of the window, excluding the title bar and borders.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const size = await appWindow.innerSize();
* ```
*
* @returns The window's inner size.
*/
innerSize(): Promise<PhysicalSize>;
/**
* The physical size of the entire window.
* These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const size = await appWindow.outerSize();
* ```
*
* @returns The window's outer size.
*/
outerSize(): Promise<PhysicalSize>;
/**
* Gets the window's current fullscreen state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const fullscreen = await appWindow.isFullscreen();
* ```
*
* @returns Whether the window is in fullscreen mode or not.
* */
isFullscreen(): Promise<boolean>;
/**
* Gets the window's current maximized state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const maximized = await appWindow.isMaximized();
* ```
*
* @returns Whether the window is maximized or not.
* */
isMaximized(): Promise<boolean>;
/**
* Gets the window's current decorated state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const decorated = await appWindow.isDecorated();
* ```
*
* @returns Whether the window is decorated or not.
* */
isDecorated(): Promise<boolean>;
/**
* Gets the window's current resizable state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const resizable = await appWindow.isResizable();
* ```
*
* @returns Whether the window is resizable or not.
* */
isResizable(): Promise<boolean>;
/**
* Gets the window's current visible state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const visible = await appWindow.isVisible();
* ```
*
* @returns Whether the window is visible or not.
* */
isVisible(): Promise<boolean>;
/**
* Gets the window's current theme.
*
* #### Platform-specific
*
* - **Linux:** Not implemented, always returns `light`.
* - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below.
*
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const theme = await appWindow.theme();
* ```
*
* @returns The window theme.
* */
theme(): Promise<Theme | null>;
/**
* Centers the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.center();
* ```
*
* @param resizable
* @returns A promise indicating the success or failure of the operation.
*/
center(): Promise<void>;
/**
* Requests user attention to the window, this has no effect if the application
* is already focused. How requesting for user attention manifests is platform dependent,
* see `UserAttentionType` for details.
*
* Providing `null` will unset the request for user attention. Unsetting the request for
* user attention might not be done automatically by the WM when the window receives input.
*
* #### Platform-specific
*
* - **macOS:** `null` has no effect.
* - **Linux:** Urgency levels have the same effect.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.requestUserAttention();
* ```
*
* @param resizable
* @returns A promise indicating the success or failure of the operation.
*/
requestUserAttention(requestType: UserAttentionType | null): Promise<void>;
/**
* Updates the window resizable flag.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setResizable(false);
* ```
*
* @param resizable
* @returns A promise indicating the success or failure of the operation.
*/
setResizable(resizable: boolean): Promise<void>;
/**
* Sets the window title.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setTitle('Tauri');
* ```
*
* @param title The new title
* @returns A promise indicating the success or failure of the operation.
*/
setTitle(title: string): Promise<void>;
/**
* Maximizes the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.maximize();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
maximize(): Promise<void>;
/**
* Unmaximizes the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.unmaximize();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
unmaximize(): Promise<void>;
/**
* Toggles the window maximized state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.toggleMaximize();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
toggleMaximize(): Promise<void>;
/**
* Minimizes the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.minimize();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
minimize(): Promise<void>;
/**
* Unminimizes the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.unminimize();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
unminimize(): Promise<void>;
/**
* Sets the window visibility to true.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.show();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
show(): Promise<void>;
/**
* Sets the window visibility to false.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.hide();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
hide(): Promise<void>;
/**
* Closes the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.close();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
close(): Promise<void>;
/**
* Whether the window should have borders and bars.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setDecorations(false);
* ```
*
* @param decorations Whether the window should have borders and bars.
* @returns A promise indicating the success or failure of the operation.
*/
setDecorations(decorations: boolean): Promise<void>;
/**
* Whether the window should always be on top of other windows.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setAlwaysOnTop(true);
* ```
*
* @param alwaysOnTop Whether the window should always be on top of other windows or not.
* @returns A promise indicating the success or failure of the operation.
*/
setAlwaysOnTop(alwaysOnTop: boolean): Promise<void>;
/**
* Resizes the window with a new inner size.
* @example
* ```typescript
* import { appWindow, LogicalSize } from '@tauri-apps/api/window';
* await appWindow.setSize(new LogicalSize(600, 500));
* ```
*
* @param size The logical or physical inner size.
* @returns A promise indicating the success or failure of the operation.
*/
setSize(size: LogicalSize | PhysicalSize): Promise<void>;
/**
* Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset.
* @example
* ```typescript
* import { appWindow, PhysicalSize } from '@tauri-apps/api/window';
* await appWindow.setMinSize(new PhysicalSize(600, 500));
* ```
*
* @param size The logical or physical inner size, or `null` to unset the constraint.
* @returns A promise indicating the success or failure of the operation.
*/
setMinSize(size: LogicalSize | PhysicalSize | null | undefined): Promise<void>;
/**
* Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset.
* @example
* ```typescript
* import { appWindow, LogicalSize } from '@tauri-apps/api/window';
* await appWindow.setMaxSize(new LogicalSize(600, 500));
* ```
*
* @param size The logical or physical inner size, or `null` to unset the constraint.
* @returns A promise indicating the success or failure of the operation.
*/
setMaxSize(size: LogicalSize | PhysicalSize | null | undefined): Promise<void>;
/**
* Sets the window outer position.
* @example
* ```typescript
* import { appWindow, LogicalPosition } from '@tauri-apps/api/window';
* await appWindow.setPosition(new LogicalPosition(600, 500));
* ```
*
* @param position The new position, in logical or physical pixels.
* @returns A promise indicating the success or failure of the operation.
*/
setPosition(position: LogicalPosition | PhysicalPosition): Promise<void>;
/**
* Sets the window fullscreen state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setFullscreen(true);
* ```
*
* @param fullscreen Whether the window should go to fullscreen or not.
* @returns A promise indicating the success or failure of the operation.
*/
setFullscreen(fullscreen: boolean): Promise<void>;
/**
* Bring the window to front and focus.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setFocus();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*/
setFocus(): Promise<void>;
/**
* Sets the window icon.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setIcon('/tauri/awesome.png');
* ```
*
* Note that you need the `icon-ico` or `icon-png` Cargo features to use this API.
* To enable it, change your Cargo.toml file:
* ```toml
* [dependencies]
* tauri = { version = "...", features = ["...", "icon-png"] }
* ```
*
* @param icon Icon bytes or path to the icon file.
* @returns A promise indicating the success or failure of the operation.
*/
setIcon(icon: string | Uint8Array): Promise<void>;
/**
* Whether to show the window icon in the task bar or not.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setSkipTaskbar(true);
* ```
*
* @param skip true to hide window icon, false to show it.
* @returns A promise indicating the success or failure of the operation.
*/
setSkipTaskbar(skip: boolean): Promise<void>;
/**
* Grabs the cursor, preventing it from leaving the window.
*
* There's no guarantee that the cursor will be hidden. You should
* hide it by yourself if you want so.
*
* #### Platform-specific
*
* - **Linux:** Unsupported.
* - **macOS:** This locks the cursor in a fixed location, which looks visually awkward.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setCursorGrab(true);
* ```
*
* @param grab `true` to grab the cursor icon, `false` to release it.
* @returns A promise indicating the success or failure of the operation.
*/
setCursorGrab(grab: boolean): Promise<void>;
/**
* Modifies the cursor's visibility.
*
* #### Platform-specific
*
* - **Windows:** The cursor is only hidden within the confines of the window.
* - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is
* outside of the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setCursorVisible(false);
* ```
*
* @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor.
* @returns A promise indicating the success or failure of the operation.
*/
setCursorVisible(visible: boolean): Promise<void>;
/**
* Modifies the cursor icon of the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setCursorIcon('help');
* ```
*
* @param icon The new cursor icon.
* @returns A promise indicating the success or failure of the operation.
*/
setCursorIcon(icon: CursorIcon): Promise<void>;
/**
* Changes the position of the cursor in window coordinates.
* @example
* ```typescript
* import { appWindow, LogicalPosition } from '@tauri-apps/api/window';
* await appWindow.setCursorPosition(new LogicalPosition(600, 300));
* ```
*
* @param position The new cursor position.
* @returns A promise indicating the success or failure of the operation.
*/
setCursorPosition(position: LogicalPosition | PhysicalPosition): Promise<void>;
/**
* Starts dragging the window.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.startDragging();
* ```
*
* @return A promise indicating the success or failure of the operation.
*/
startDragging(): Promise<void>;
/**
* Listen to window resize.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* const unlisten = await appWindow.onResized(({ payload: size }) => {
* console.log('Window resized', size);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onResized(handler: EventCallback<PhysicalSize>): Promise<UnlistenFn>;
/**
* Listen to window move.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* const unlisten = await appWindow.onMoved(({ payload: position }) => {
* console.log('Window moved', position);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onMoved(handler: EventCallback<PhysicalPosition>): Promise<UnlistenFn>;
/**
* Listen to window close requested. Emitted when the user requests to closes the window.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* import { confirm } from '@tauri-apps/api/dialog';
* const unlisten = await appWindow.onCloseRequested(async (event) => {
* const confirmed = await confirm('Are you sure?');
* if (!confirmed) {
* // user did not confirm closing the window; let's prevent it
* event.preventDefault();
* }
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onCloseRequested(handler: (event: CloseRequestedEvent) => void): Promise<UnlistenFn>;
/**
* Listen to window focus change.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* const unlisten = await appWindow.onFocusChanged(({ payload: focused }) => {
* console.log('Focus changed, window is focused? ' + focused);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onFocusChanged(handler: EventCallback<boolean>): Promise<UnlistenFn>;
/**
* Listen to window scale change. Emitted when the window's scale factor has changed.
* The following user actions can cause DPI changes:
* - Changing the display's resolution.
* - Changing the display's scale factor (e.g. in Control Panel on Windows).
* - Moving the window to a display with a different scale factor.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* const unlisten = await appWindow.onScaleChanged(({ payload }) => {
* console.log('Scale changed', payload.scaleFactor, payload.size);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onScaleChanged(handler: EventCallback<ScaleFactorChanged>): Promise<UnlistenFn>;
/**
* Listen to the window menu item click. The payload is the item id.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* const unlisten = await appWindow.onMenuClicked(({ payload: menuId }) => {
* console.log('Menu clicked: ' + menuId);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onMenuClicked(handler: EventCallback<string>): Promise<UnlistenFn>;
/**
* Listen to a file drop event.
* The listener is triggered when the user hovers the selected files on the window,
* drops the files or cancels the operation.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* const unlisten = await appWindow.onFileDropEvent((event) => {
* if (event.payload.type === 'hover') {
* console.log('User hovering', event.payload.paths);
* } else if (event.payload.type === 'drop') {
* console.log('User dropped', event.payload.paths);
* } else {
* console.log('File drop cancelled');
* }
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onFileDropEvent(handler: EventCallback<FileDropEvent>): Promise<UnlistenFn>;
/**
* Listen to the system theme change.
*
* @example
* ```typescript
* import { appWindow } from "@tauri-apps/api/window";
* const unlisten = await appWindow.onThemeChanged(({ payload: theme }) => {
* console.log('New theme: ' + theme);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @param handler
* @returns A promise resolving to a function to unlisten to the event.
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
*/
onThemeChanged(handler: EventCallback<Theme>): Promise<UnlistenFn>;
}
declare class CloseRequestedEvent {
/** Event name */
event: EventName;
/** The label of the window that emitted this event. */
windowLabel: string;
/** Event identifier used to unlisten */
id: number;
private _preventDefault;
constructor(event: Event<null>);
preventDefault(): void;
isPreventDefault(): boolean;
}
/**
* Create new webview windows and get a handle to existing ones.
*
* Windows are identified by a *label* a unique identifier that can be used to reference it later.
* It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`.
*
* @example
* ```typescript
* // loading embedded asset:
* const webview = new WebviewWindow('theUniqueLabel', {
* url: 'path/to/page.html'
* });
* // alternatively, load a remote URL:
* const webview = new WebviewWindow('theUniqueLabel', {
* url: 'https://github.com/tauri-apps/tauri'
* });
*
* webview.once('tauri://created', function () {
* // webview window successfully created
* });
* webview.once('tauri://error', function (e) {
* // an error happened creating the webview window
* });
*
* // emit an event to the backend
* await webview.emit("some event", "data");
* // listen to an event from the backend
* const unlisten = await webview.listen("event name", e => {});
* unlisten();
* ```
*/
declare class WebviewWindow extends WindowManager {
/**
* Creates a new WebviewWindow.
* @example
* ```typescript
* import { WebviewWindow } from '@tauri-apps/api/window';
* const webview = new WebviewWindow('my-label', {
* url: 'https://github.com/tauri-apps/tauri'
* });
* webview.once('tauri://created', function () {
* // webview window successfully created
* });
* webview.once('tauri://error', function (e) {
* // an error happened creating the webview window
* });
* ```
*
* * @param label The unique webview window label. Must be alphanumeric: `a-zA-Z-/:_`.
* @returns The WebviewWindow instance to communicate with the webview.
*/
constructor(label: WindowLabel, options?: WindowOptions);
/**
* Gets the WebviewWindow for the webview associated with the given label.
* @example
* ```typescript
* import { WebviewWindow } from '@tauri-apps/api/window';
* const mainWindow = WebviewWindow.getByLabel('main');
* ```
*
* @param label The webview window label.
* @returns The WebviewWindow instance to communicate with the webview or null if the webview doesn't exist.
*/
static getByLabel(label: string): WebviewWindow | null;
}
/** The WebviewWindow for the current window. */
declare let appWindow: WebviewWindow;
/** Configuration for the window to create. */
interface WindowOptions {
/**
* Remote URL or local file path to open.
*
* - URL such as `https://github.com/tauri-apps` is opened directly on a Tauri window.
* - data: URL such as `data:text/html,<html>...` is only supported with the `window-data-url` Cargo feature for the `tauri` dependency.
* - local file path or route such as `/path/to/page.html` or `/users` is appended to the application URL (the devServer URL on development, or `tauri://localhost/` and `https://tauri.localhost/` on production).
*/
url?: string;
/** Show window in the center of the screen.. */
center?: boolean;
/** The initial vertical position. Only applies if `y` is also set. */
x?: number;
/** The initial horizontal position. Only applies if `x` is also set. */
y?: number;
/** The initial width. */
width?: number;
/** The initial height. */
height?: number;
/** The minimum width. Only applies if `minHeight` is also set. */
minWidth?: number;
/** The minimum height. Only applies if `minWidth` is also set. */
minHeight?: number;
/** The maximum width. Only applies if `maxHeight` is also set. */
maxWidth?: number;
/** The maximum height. Only applies if `maxWidth` is also set. */
maxHeight?: number;
/** Whether the window is resizable or not. */
resizable?: boolean;
/** Window title. */
title?: string;
/** Whether the window is in fullscreen mode or not. */
fullscreen?: boolean;
/** Whether the window will be initially hidden or focused. */
focus?: boolean;
/**
* Whether the window is transparent or not.
* Note that on `macOS` this requires the `macos-private-api` feature flag, enabled under `tauri.conf.json > tauri > macOSPrivateApi`.
* WARNING: Using private APIs on `macOS` prevents your application from being accepted to the `App Store`.
*/
transparent?: boolean;
/** Whether the window should be maximized upon creation or not. */
maximized?: boolean;
/** Whether the window should be immediately visible upon creation or not. */
visible?: boolean;
/** Whether the window should have borders and bars or not. */
decorations?: boolean;
/** Whether the window should always be on top of other windows or not. */
alwaysOnTop?: boolean;
/** Whether or not the window icon should be added to the taskbar. */
skipTaskbar?: boolean;
/**
* Whether the file drop is enabled or not on the webview. By default it is enabled.
*
* Disabling it is required to use drag and drop on the frontend on Windows.
*/
fileDropEnabled?: boolean;
/**
* The initial window theme. Defaults to the system theme.
*
* Only implemented on Windows and macOS 10.14+.
*/
theme?: Theme;
}
/**
* Returns the monitor on which the window currently resides.
* Returns `null` if current monitor can't be detected.
* @example
* ```typescript
* import { currentMonitor } from '@tauri-apps/api/window';
* const monitor = currentMonitor();
* ```
*/
declare function currentMonitor(): Promise<Monitor | null>;
/**
* Returns the primary monitor of the system.
* Returns `null` if it can't identify any monitor as a primary one.
* @example
* ```typescript
* import { primaryMonitor } from '@tauri-apps/api/window';
* const monitor = primaryMonitor();
* ```
*/
declare function primaryMonitor(): Promise<Monitor | null>;
/**
* Returns the list of all the monitors available on the system.
* @example
* ```typescript
* import { availableMonitors } from '@tauri-apps/api/window';
* const monitors = availableMonitors();
* ```
* */
declare function availableMonitors(): Promise<Monitor[]>;
export { WebviewWindow, WebviewWindowHandle, WindowManager, CloseRequestedEvent, getCurrent, getAll, appWindow, LogicalSize, PhysicalSize, LogicalPosition, PhysicalPosition, UserAttentionType, currentMonitor, primaryMonitor, availableMonitors };
export type { Theme, Monitor, ScaleFactorChanged, FileDropEvent, WindowOptions };
export { C as CloseRequestedEvent, n as CursorIcon, F as FileDropEvent, f as LogicalPosition, L as LogicalSize, M as Monitor, h as PhysicalPosition, P as PhysicalSize, S as ScaleFactorChanged, T as Theme, l as TitleBarStyle, i as UserAttentionType, W as WebviewWindow, a as WebviewWindowHandle, o as WindowLabel, b as WindowManager, m as WindowOptions, d as appWindow, k as availableMonitors, j as currentMonitor, c as getAll, g as getCurrent, p as primaryMonitor } from './event-b4efb052.js';

@@ -1,1 +0,1 @@

import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./event-aba177ae.js";export{C as CloseRequestedEvent,e as LogicalPosition,L as LogicalSize,f as PhysicalPosition,P as PhysicalSize,U as UserAttentionType,W as WebviewWindow,a as WebviewWindowHandle,b as WindowManager,d as appWindow,i as availableMonitors,h as currentMonitor,c as getAll,g as getCurrent,p as primaryMonitor}from"./window-5b72c451.js";import"./tauri-fa8f44bd.js";
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-HSJSXYDL.js";import"./chunk-M3Y6ZK7U.js";import"./chunk-RKMHWDGH.js";import"./chunk-5UWJICAP.js";import"./chunk-FEIY7W7S.js";export{j as CloseRequestedEvent,c as LogicalPosition,a as LogicalSize,d as PhysicalPosition,b as PhysicalSize,e as UserAttentionType,k as WebviewWindow,h as WebviewWindowHandle,i as WindowManager,l as appWindow,o as availableMonitors,m as currentMonitor,g as getAll,f as getCurrent,n as primaryMonitor};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc