From 9bf98f68e704ed6ad955a5aafb56690cd36d7370 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Tue, 23 May 2023 19:44:05 -0700 Subject: [PATCH] chore(api): update @since tag to 2.0.0 (#395) --- plugins/app/guest-js/index.ts | 10 +- plugins/cli/guest-js/index.ts | 8 +- plugins/clipboard/guest-js/index.ts | 4 +- plugins/dialog/guest-js/index.ts | 18 +-- plugins/fs/guest-js/index.ts | 42 +++---- plugins/global-shortcut/guest-js/index.ts | 10 +- plugins/http/guest-js/index.ts | 26 ++-- plugins/notification/guest-js/index.ts | 8 +- plugins/os/guest-js/index.ts | 12 +- plugins/process/guest-js/index.ts | 4 +- plugins/shell/guest-js/index.ts | 44 ++++--- plugins/store/guest-js/index.ts | 4 + plugins/stronghold/guest-js/index.ts | 4 + plugins/window/guest-js/index.ts | 146 +++++++++++++++++----- 14 files changed, 227 insertions(+), 113 deletions(-) diff --git a/plugins/app/guest-js/index.ts b/plugins/app/guest-js/index.ts index 111a7ef7..b2420ad7 100644 --- a/plugins/app/guest-js/index.ts +++ b/plugins/app/guest-js/index.ts @@ -22,7 +22,7 @@ declare global { * const appVersion = await getVersion(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function getVersion(): Promise { return window.__TAURI_INVOKE__("plugin:app|version"); @@ -36,7 +36,7 @@ async function getVersion(): Promise { * const appName = await getName(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function getName(): Promise { return window.__TAURI_INVOKE__("plugin:app|name"); @@ -51,7 +51,7 @@ async function getName(): Promise { * const tauriVersion = await getTauriVersion(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function getTauriVersion(): Promise { return window.__TAURI_INVOKE__("plugin:app|tauri_version"); @@ -66,7 +66,7 @@ async function getTauriVersion(): Promise { * await show(); * ``` * - * @since 1.2.0 + * @since 2.0.0 */ async function show(): Promise { return window.__TAURI_INVOKE__("plugin:app|show"); @@ -81,7 +81,7 @@ async function show(): Promise { * await hide(); * ``` * - * @since 1.2.0 + * @since 2.0.0 */ async function hide(): Promise { return window.__TAURI_INVOKE__("plugin:app|hide"); diff --git a/plugins/cli/guest-js/index.ts b/plugins/cli/guest-js/index.ts index ea6ce67a..87c1a97e 100644 --- a/plugins/cli/guest-js/index.ts +++ b/plugins/cli/guest-js/index.ts @@ -15,7 +15,7 @@ declare global { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface ArgMatch { /** @@ -31,7 +31,7 @@ interface ArgMatch { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface SubcommandMatch { name: string; @@ -39,7 +39,7 @@ interface SubcommandMatch { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface CliMatches { args: Record; @@ -65,7 +65,7 @@ interface CliMatches { * } * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function getMatches(): Promise { return await window.__TAURI_INVOKE__("plugin:cli|cli_matches"); diff --git a/plugins/clipboard/guest-js/index.ts b/plugins/clipboard/guest-js/index.ts index 495371bc..fb8b38e1 100644 --- a/plugins/clipboard/guest-js/index.ts +++ b/plugins/clipboard/guest-js/index.ts @@ -32,7 +32,7 @@ type ClipResponse = Clip<"PlainText", string>; * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0. + * @since 2.0.0 */ async function writeText( text: string, @@ -56,7 +56,7 @@ async function writeText( * import { readText } from '@tauri-apps/plugin-clipboard'; * const clipboardText = await readText(); * ``` - * @since 1.0.0. + * @since 2.0.0 */ async function readText(): Promise { const kind: ClipResponse = await window.__TAURI_INVOKE__( diff --git a/plugins/dialog/guest-js/index.ts b/plugins/dialog/guest-js/index.ts index 5300b7cc..de74217f 100644 --- a/plugins/dialog/guest-js/index.ts +++ b/plugins/dialog/guest-js/index.ts @@ -23,7 +23,7 @@ interface FileResponse { /** * Extension filters for the file dialog. * - * @since 1.0.0 + * @since 2.0.0 */ interface DialogFilter { /** Filter name. */ @@ -41,7 +41,7 @@ interface DialogFilter { /** * Options for the open dialog. * - * @since 1.0.0 + * @since 2.0.0 */ interface OpenDialogOptions { /** The title of the dialog window. */ @@ -64,7 +64,7 @@ interface OpenDialogOptions { /** * Options for the save dialog. * - * @since 1.0.0 + * @since 2.0.0 */ interface SaveDialogOptions { /** The title of the dialog window. */ @@ -80,7 +80,7 @@ interface SaveDialogOptions { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface MessageDialogOptions { /** The title of the dialog. Defaults to the app name. */ @@ -164,7 +164,7 @@ async function open( * * @returns A promise resolving to the selected path(s) * - * @since 1.0.0 + * @since 2.0.0 */ async function open( options: OpenDialogOptions = {} @@ -198,7 +198,7 @@ async function open( * * @returns A promise resolving to the selected path. * - * @since 1.0.0 + * @since 2.0.0 */ async function save(options: SaveDialogOptions = {}): Promise { if (typeof options === "object") { @@ -222,7 +222,7 @@ async function save(options: SaveDialogOptions = {}): Promise { * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 * */ async function message( @@ -252,7 +252,7 @@ async function message( * * @returns A promise resolving to a boolean indicating whether `Yes` was clicked or not. * - * @since 1.0.0 + * @since 2.0.0 */ async function ask( message: string, @@ -282,7 +282,7 @@ async function ask( * * @returns A promise resolving to a boolean indicating whether `Ok` was clicked or not. * - * @since 1.0.0 + * @since 2.0.0 */ async function confirm( message: string, diff --git a/plugins/fs/guest-js/index.ts b/plugins/fs/guest-js/index.ts index 2d1ecf37..af4d2e84 100644 --- a/plugins/fs/guest-js/index.ts +++ b/plugins/fs/guest-js/index.ts @@ -161,7 +161,7 @@ interface BackendMetadata { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface FsOptions { dir?: BaseDirectory; @@ -169,7 +169,7 @@ interface FsOptions { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface FsDirOptions { dir?: BaseDirectory; @@ -179,7 +179,7 @@ interface FsDirOptions { /** * Options object used to write a UTF-8 string to a file. * - * @since 1.0.0 + * @since 2.0.0 */ interface FsTextFileOption { /** Path to the file to write. */ @@ -193,7 +193,7 @@ type BinaryFileContents = Iterable | ArrayLike | ArrayBuffer; /** * Options object used to write a binary data to a file. * - * @since 1.0.0 + * @since 2.0.0 */ interface FsBinaryFileOption { /** Path to the file to write. */ @@ -203,7 +203,7 @@ interface FsBinaryFileOption { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface FileEntry { path: string; @@ -225,7 +225,7 @@ interface FileEntry { * const contents = await readTextFile('app.conf', { dir: BaseDirectory.AppConfig }); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function readTextFile( filePath: string, @@ -246,7 +246,7 @@ async function readTextFile( * const contents = await readBinaryFile('avatar.png', { dir: BaseDirectory.Resource }); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function readBinaryFile( filePath: string, @@ -269,7 +269,7 @@ async function readBinaryFile( * await writeTextFile('app.conf', 'file contents', { dir: BaseDirectory.AppConfig }); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function writeTextFile( path: string, @@ -287,7 +287,7 @@ async function writeTextFile( * ``` * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function writeTextFile( file: FsTextFileOption, @@ -299,7 +299,7 @@ async function writeTextFile( * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function writeTextFile( path: string | FsTextFileOption, @@ -347,7 +347,7 @@ async function writeTextFile( * @param options Configuration object. * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function writeBinaryFile( path: string, @@ -368,7 +368,7 @@ async function writeBinaryFile( * @param options Configuration object. * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function writeBinaryFile( file: FsBinaryFileOption, @@ -380,7 +380,7 @@ async function writeBinaryFile( * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function writeBinaryFile( path: string | FsBinaryFileOption, @@ -439,7 +439,7 @@ async function writeBinaryFile( * } * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function readDir( dir: string, @@ -464,7 +464,7 @@ async function readDir( * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function createDir( dir: string, @@ -488,7 +488,7 @@ async function createDir( * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function removeDir( dir: string, @@ -511,7 +511,7 @@ async function removeDir( * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function copyFile( source: string, @@ -536,7 +536,7 @@ async function copyFile( * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function removeFile( file: string, @@ -559,7 +559,7 @@ async function removeFile( * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function renameFile( oldPath: string, @@ -582,7 +582,7 @@ async function renameFile( * await exists('avatar.png', { dir: BaseDirectory.AppData }); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function exists(path: string): Promise { return await window.__TAURI_INVOKE__("plugin:fs|exists", { path }); @@ -591,7 +591,7 @@ async function exists(path: string): Promise { /** * Returns the metadata for the given path. * - * @since 1.0.0 + * @since 2.0.0 */ async function metadata(path: string): Promise { return await window diff --git a/plugins/global-shortcut/guest-js/index.ts b/plugins/global-shortcut/guest-js/index.ts index 4c1c02c8..16ef0055 100644 --- a/plugins/global-shortcut/guest-js/index.ts +++ b/plugins/global-shortcut/guest-js/index.ts @@ -32,7 +32,7 @@ export type ShortcutHandler = (shortcut: string) => void; * @param shortcut Shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q * @param handler Shortcut handler callback - takes the triggered shortcut as argument * - * @since 1.0.0 + * @since 2.0.0 */ async function register( shortcut: string, @@ -57,7 +57,7 @@ async function register( * @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 * - * @since 1.0.0 + * @since 2.0.0 */ async function registerAll( shortcuts: string[], @@ -82,7 +82,7 @@ async function registerAll( * * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q * - * @since 1.0.0 + * @since 2.0.0 */ async function isRegistered(shortcut: string): Promise { return await window.__TAURI_INVOKE__("plugin:globalShortcut|is_registered", { @@ -100,7 +100,7 @@ async function isRegistered(shortcut: string): Promise { * * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q * - * @since 1.0.0 + * @since 2.0.0 */ async function unregister(shortcut: string): Promise { return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister", { @@ -116,7 +116,7 @@ async function unregister(shortcut: string): Promise { * await unregisterAll(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function unregisterAll(): Promise { return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister_all"); diff --git a/plugins/http/guest-js/index.ts b/plugins/http/guest-js/index.ts index 9cc07ac1..60378402 100644 --- a/plugins/http/guest-js/index.ts +++ b/plugins/http/guest-js/index.ts @@ -31,7 +31,7 @@ declare global { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface Duration { secs: number; @@ -39,7 +39,7 @@ interface Duration { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface ClientOptions { /** @@ -51,7 +51,7 @@ interface ClientOptions { } /** - * @since 1.0.0 + * @since 2.0.0 */ enum ResponseType { JSON = 1, @@ -60,7 +60,7 @@ enum ResponseType { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface FilePart { file: string | T; @@ -73,7 +73,7 @@ type Part = string | Uint8Array | FilePart; /** * The body object to be used on POST and PUT requests. * - * @since 1.0.0 + * @since 2.0.0 */ class Body { type: string; @@ -115,6 +115,8 @@ class Body { * @param data The body data. * * @returns The body object ready to be used on the POST and PUT requests. + * + * @since 2.0.0 */ static form(data: Record | FormData): Body { const form: Record> = {}; @@ -166,6 +168,8 @@ class Body { * @param data The body JSON object. * * @returns The body object ready to be used on the POST and PUT requests. + * + * @since 2.0.0 */ static json(data: Record): Body { return new Body("Json", data); @@ -182,6 +186,8 @@ class Body { * @param value The body string. * * @returns The body object ready to be used on the POST and PUT requests. + * + * @since 2.0.0 */ static text(value: string): Body { return new Body("Text", value); @@ -198,6 +204,8 @@ class Body { * @param bytes The body byte array. * * @returns The body object ready to be used on the POST and PUT requests. + * + * @since 2.0.0 */ static bytes( bytes: Iterable | ArrayLike | ArrayBuffer @@ -225,7 +233,7 @@ type HttpVerb = /** * Options object sent to the backend. * - * @since 1.0.0 + * @since 2.0.0 */ interface HttpOptions { method: HttpVerb; @@ -254,7 +262,7 @@ interface IResponse { /** * Response object. * - * @since 1.0.0 + * @since 2.0.0 * */ class Response { /** The request URL. */ @@ -282,7 +290,7 @@ class Response { } /** - * @since 1.0.0 + * @since 2.0.0 */ class Client { id: number; @@ -481,7 +489,7 @@ class Client { * * @returns A promise resolving to the client instance. * - * @since 1.0.0 + * @since 2.0.0 */ async function getClient(options?: ClientOptions): Promise { return window diff --git a/plugins/notification/guest-js/index.ts b/plugins/notification/guest-js/index.ts index ee157ecc..7de70375 100644 --- a/plugins/notification/guest-js/index.ts +++ b/plugins/notification/guest-js/index.ts @@ -18,7 +18,7 @@ import { /** * Options to send a notification. * - * @since 1.0.0 + * @since 2.0.0 */ interface Options { /** @@ -300,7 +300,7 @@ type Permission = "granted" | "denied" | "default"; * const permissionGranted = await isPermissionGranted(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function isPermissionGranted(): Promise { if (window.Notification.permission !== "default") { @@ -323,7 +323,7 @@ async function isPermissionGranted(): Promise { * * @returns A promise resolving to whether the user granted the permission or not. * - * @since 1.0.0 + * @since 2.0.0 */ async function requestPermission(): Promise { return window.Notification.requestPermission(); @@ -345,7 +345,7 @@ async function requestPermission(): Promise { * } * ``` * - * @since 1.0.0 + * @since 2.0.0 */ function sendNotification(options: Options | string): void { if (typeof options === "string") { diff --git a/plugins/os/guest-js/index.ts b/plugins/os/guest-js/index.ts index b35813c9..2b4806b2 100644 --- a/plugins/os/guest-js/index.ts +++ b/plugins/os/guest-js/index.ts @@ -50,7 +50,7 @@ function isWindows(): boolean { * - `\n` on POSIX * - `\r\n` on Windows * - * @since 1.0.0 + * @since 2.0.0 * */ const EOL = isWindows() ? "\r\n" : "\n"; @@ -63,7 +63,7 @@ const EOL = isWindows() ? "\r\n" : "\n"; * const platformName = await platform(); * ``` * - * @since 1.0.0 + * @since 2.0.0 * */ async function platform(): Promise { @@ -78,7 +78,7 @@ async function platform(): Promise { * const osVersion = await version(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function version(): Promise { return window.__TAURI_INVOKE__("plugin:os|version"); @@ -92,7 +92,7 @@ async function version(): Promise { * const osType = await type(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function type(): Promise { return window.__TAURI_INVOKE__("plugin:os|kind"); @@ -107,7 +107,7 @@ async function type(): Promise { * const archName = await arch(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function arch(): Promise { return window.__TAURI_INVOKE__("plugin:os|arch"); @@ -121,7 +121,7 @@ async function arch(): Promise { * const tempdirPath = await tempdir(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function tempdir(): Promise { return window.__TAURI_INVOKE__("plugin:os|tempdir"); diff --git a/plugins/process/guest-js/index.ts b/plugins/process/guest-js/index.ts index b66ad837..853e0d29 100644 --- a/plugins/process/guest-js/index.ts +++ b/plugins/process/guest-js/index.ts @@ -24,7 +24,7 @@ declare global { * @param code The exit code to use. * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function exit(code = 0): Promise { return window.__TAURI_INVOKE__("plugin:process|exit", { code }); @@ -40,7 +40,7 @@ async function exit(code = 0): Promise { * * @returns A promise indicating the success or failure of the operation. * - * @since 1.0.0 + * @since 2.0.0 */ async function relaunch(): Promise { return window.__TAURI_INVOKE__("plugin:process|restart"); diff --git a/plugins/shell/guest-js/index.ts b/plugins/shell/guest-js/index.ts index da964f9d..32c34f6e 100644 --- a/plugins/shell/guest-js/index.ts +++ b/plugins/shell/guest-js/index.ts @@ -72,7 +72,7 @@ declare global { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface SpawnOptions { /** Current working directory. */ @@ -82,7 +82,7 @@ interface SpawnOptions { /** * Character encoding for stdout/stderr * - * @since 1.1.0 + * @since 2.0.0 * */ encoding?: string; } @@ -93,7 +93,7 @@ interface InternalSpawnOptions extends SpawnOptions { } /** - * @since 1.0.0 + * @since 2.0.0 */ interface ChildProcess { /** Exit code of the process. `null` if the process was terminated by a signal on Unix. */ @@ -115,6 +115,8 @@ interface ChildProcess { * @param args Program arguments. * @param options Configuration for the process spawn. * @returns A promise resolving to the process id. + * + * @since 2.0.0 */ async function execute( onEvent: (event: CommandEvent) => void, @@ -135,7 +137,7 @@ async function execute( } /** - * @since 1.0.0 + * @since 2.0.0 */ // eslint-disable-next-line @typescript-eslint/no-explicit-any class EventEmitter> { @@ -147,7 +149,7 @@ class EventEmitter> { /** * Alias for `emitter.on(eventName, listener)`. * - * @since 1.1.0 + * @since 2.0.0 */ addListener( eventName: N, @@ -159,7 +161,7 @@ class EventEmitter> { /** * Alias for `emitter.off(eventName, listener)`. * - * @since 1.1.0 + * @since 2.0.0 */ removeListener( eventName: N, @@ -176,7 +178,7 @@ class EventEmitter> { * * Returns a reference to the `EventEmitter`, so that calls can be chained. * - * @since 1.0.0 + * @since 2.0.0 */ on( eventName: N, @@ -198,7 +200,7 @@ class EventEmitter> { * * Returns a reference to the `EventEmitter`, so that calls can be chained. * - * @since 1.1.0 + * @since 2.0.0 */ once( eventName: N, @@ -216,7 +218,7 @@ class EventEmitter> { * Removes the all specified listener from the listener array for the event eventName * Returns a reference to the `EventEmitter`, so that calls can be chained. * - * @since 1.1.0 + * @since 2.0.0 */ off( eventName: N, @@ -236,7 +238,7 @@ class EventEmitter> { * * Returns a reference to the `EventEmitter`, so that calls can be chained. * - * @since 1.1.0 + * @since 2.0.0 */ removeAllListeners(event?: N): this { if (event) { @@ -255,6 +257,8 @@ class EventEmitter> { * to each. * * @returns `true` if the event had listeners, `false` otherwise. + * + * @since 2.0.0 */ emit(eventName: N, arg: E[typeof eventName]): boolean { if (eventName in this.eventListeners) { @@ -270,7 +274,7 @@ class EventEmitter> { /** * Returns the number of listeners listening to the event named `eventName`. * - * @since 1.1.0 + * @since 2.0.0 */ listenerCount(eventName: N): number { if (eventName in this.eventListeners) @@ -287,7 +291,7 @@ class EventEmitter> { * * Returns a reference to the `EventEmitter`, so that calls can be chained. * - * @since 1.1.0 + * @since 2.0.0 */ prependListener( eventName: N, @@ -309,7 +313,7 @@ class EventEmitter> { * * Returns a reference to the `EventEmitter`, so that calls can be chained. * - * @since 1.1.0 + * @since 2.0.0 */ prependOnceListener( eventName: N, @@ -326,7 +330,7 @@ class EventEmitter> { } /** - * @since 1.1.0 + * @since 2.0.0 */ class Child { /** The child process `pid`. */ @@ -350,6 +354,8 @@ class Child { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async write(data: IOPayload): Promise { return window.__TAURI_INVOKE__("plugin:shell|stdin_write", { @@ -363,6 +369,8 @@ class Child { * Kills the child process. * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async kill(): Promise { return window.__TAURI_INVOKE__("plugin:shell|kill", { @@ -399,7 +407,7 @@ interface OutputEvents { * console.log('pid:', child.pid); * ``` * - * @since 1.1.0 + * @since 2.0.0 * */ class Command extends EventEmitter { @@ -504,6 +512,8 @@ class Command extends EventEmitter { * Executes the command as a child process, returning a handle to it. * * @returns A promise resolving to the child process handle. + * + * @since 2.0.0 */ async spawn(): Promise { return execute( @@ -542,6 +552,8 @@ class Command extends EventEmitter { * ``` * * @returns A promise resolving to the child process output. + * + * @since 2.0.0 */ async execute(): Promise> { return new Promise((resolve, reject) => { @@ -633,7 +645,7 @@ type CommandEvent = * @param openWith The app to open the file or URL with. * Defaults to the system default application for the specified path type. * - * @since 1.0.0 + * @since 2.0.0 */ async function open(path: string, openWith?: string): Promise { return window.__TAURI_INVOKE__("plugin:shell|open", { diff --git a/plugins/store/guest-js/index.ts b/plugins/store/guest-js/index.ts index 49c452ca..4df455f8 100644 --- a/plugins/store/guest-js/index.ts +++ b/plugins/store/guest-js/index.ts @@ -179,6 +179,8 @@ export class Store { * @param key * @param cb * @returns A promise resolving to a function to unlisten to the event. + * + * @since 2.0.0 */ async onKeyChange( key: string, @@ -195,6 +197,8 @@ export class Store { * Listen to changes on the store. * @param cb * @returns A promise resolving to a function to unlisten to the event. + * + * @since 2.0.0 */ async onChange( cb: (key: string, value: T | null) => void diff --git a/plugins/stronghold/guest-js/index.ts b/plugins/stronghold/guest-js/index.ts index 568a281b..1a87a4b0 100644 --- a/plugins/stronghold/guest-js/index.ts +++ b/plugins/stronghold/guest-js/index.ts @@ -239,6 +239,8 @@ class ProcedureExecutor { * Gets the Ed25519 public key of a SLIP10 private key. * @param privateKeyLocation The location of the private key. Must be the `outputLocation` of a previous call to `deriveSLIP10`. * @returns A promise resolving to the public key hex string. + * + * @since 2.0.0 */ async getEd25519PublicKey(privateKeyLocation: Location): Promise { return await window @@ -260,6 +262,8 @@ class ProcedureExecutor { * @param privateKeyLocation The location of the record where the private key is stored. Must be the `outputLocation` of a previous call to `deriveSLIP10`. * @param msg The message to sign. * @returns A promise resolving to the signature hex string. + * + * @since 2.0.0 */ async signEd25519( privateKeyLocation: Location, diff --git a/plugins/window/guest-js/index.ts b/plugins/window/guest-js/index.ts index 2cf7eb8f..4b88f194 100644 --- a/plugins/window/guest-js/index.ts +++ b/plugins/window/guest-js/index.ts @@ -38,7 +38,7 @@ type TitleBarStyle = "visible" | "transparent" | "overlay"; /** * Allows you to retrieve information about a given monitor. * - * @since 1.0.0 + * @since 2.0.0 */ interface Monitor { /** Human-readable name of the monitor */ @@ -54,7 +54,7 @@ interface Monitor { /** * The payload for the `scaleChange` event. * - * @since 1.0.2 + * @since 2.0.0 */ interface ScaleFactorChanged { /** The new window scale factor. */ @@ -72,7 +72,7 @@ type FileDropEvent = /** * A size represented in logical pixels. * - * @since 1.0.0 + * @since 2.0.0 */ class LogicalSize { type = "Logical"; @@ -88,7 +88,7 @@ class LogicalSize { /** * A size represented in physical pixels. * - * @since 1.0.0 + * @since 2.0.0 */ class PhysicalSize { type = "Physical"; @@ -118,7 +118,7 @@ class PhysicalSize { /** * A position represented in logical pixels. * - * @since 1.0.0 + * @since 2.0.0 */ class LogicalPosition { type = "Logical"; @@ -134,7 +134,7 @@ class LogicalPosition { /** * A position represented in physical pixels. * - * @since 1.0.0 + * @since 2.0.0 */ class PhysicalPosition { type = "Physical"; @@ -179,7 +179,7 @@ declare global { /** * Attention type to request on a window. * - * @since 1.0.0 + * @since 2.0.0 */ enum UserAttentionType { /** @@ -240,7 +240,7 @@ export type CursorIcon = /** * Get an instance of `WebviewWindow` for the current webview window. * - * @since 1.0.0 + * @since 2.0.0 */ function getCurrent(): WebviewWindow { return new WebviewWindow(window.__TAURI_METADATA__.__currentWindow.label, { @@ -252,7 +252,7 @@ function getCurrent(): WebviewWindow { /** * Gets a list of instances of `WebviewWindow` for all available webview windows. * - * @since 1.0.0 + * @since 2.0.0 */ function getAll(): WebviewWindow[] { return window.__TAURI_METADATA__.__windows.map( @@ -273,7 +273,7 @@ export type WindowLabel = string; * A webview window handle allows emitting and listening to events from the backend that are tied to the window. * * @ignore - * @since 1.0.0 + * @since 2.0.0 */ class WebviewWindowHandle { /** The window label. It is a unique identifier for the window, can be used to reference it later. */ @@ -306,6 +306,8 @@ class WebviewWindowHandle { * @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. + * + * @since 2.0.0 */ async listen( event: EventName, @@ -339,6 +341,8 @@ class WebviewWindowHandle { * @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. + * + * @since 2.0.0 */ async once(event: string, handler: EventCallback): Promise { if (this._handleTauriEvent(event, handler)) { @@ -393,7 +397,7 @@ class WebviewWindowHandle { * Manage the current window object. * * @ignore - * @since 1.0.0 + * @since 2.0.0 */ class WindowManager extends WebviewWindowHandle { // Getters @@ -406,6 +410,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns The window's monitor scale factor. + * + * @since 2.0.0 * */ async scaleFactor(): Promise { return window.__TAURI_INVOKE__("plugin:window|scale_factor", { @@ -422,6 +428,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns The window's inner position. + * + * @since 2.0.0 * */ async innerPosition(): Promise { return window @@ -443,6 +451,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns The window's outer position. + * + * @since 2.0.0 * */ async outerPosition(): Promise { return window @@ -465,6 +475,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns The window's inner size. + * + * @since 2.0.0 */ async innerSize(): Promise { return window @@ -487,6 +499,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns The window's outer size. + * + * @since 2.0.0 */ async outerSize(): Promise { return window @@ -508,6 +522,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns Whether the window is in fullscreen mode or not. + * + * @since 2.0.0 * */ async isFullscreen(): Promise { return window.__TAURI_INVOKE__("plugin:window|is_fullscreen", { @@ -523,7 +539,7 @@ class WindowManager extends WebviewWindowHandle { * const minimized = await appWindow.isMinimized(); * ``` * - * @since 1.3.0 + * @since 2.0.0 * */ async isMinimized(): Promise { return window.__TAURI_INVOKE__("plugin:window|is_minimized", { @@ -540,6 +556,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns Whether the window is maximized or not. + * + * @since 2.0.0 * */ async isMaximized(): Promise { return window.__TAURI_INVOKE__("plugin:window|is_maximized", { @@ -556,6 +574,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns Whether the window is decorated or not. + * + * @since 2.0.0 * */ async isDecorated(): Promise { return window.__TAURI_INVOKE__("plugin:window|is_decorated", { @@ -572,6 +592,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns Whether the window is resizable or not. + * + * @since 2.0.0 * */ async isResizable(): Promise { return window.__TAURI_INVOKE__("plugin:window|is_resizable", { @@ -588,6 +610,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns Whether the window is visible or not. + * + * @since 2.0.0 * */ async isVisible(): Promise { return window.__TAURI_INVOKE__("plugin:window|is_visible", { @@ -603,7 +627,7 @@ class WindowManager extends WebviewWindowHandle { * const title = await appWindow.title(); * ``` * - * @since 1.3.0 + * @since 2.0.0 * */ async title(): Promise { return window.__TAURI_INVOKE__("plugin:window|title", { @@ -625,6 +649,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns The window theme. + * + * @since 2.0.0 * */ async theme(): Promise { return window.__TAURI_INVOKE__("plugin:window|theme", { @@ -644,6 +670,8 @@ class WindowManager extends WebviewWindowHandle { * * @param resizable * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async center(): Promise { return window.__TAURI_INVOKE__("plugin:window|center", { @@ -671,6 +699,8 @@ class WindowManager extends WebviewWindowHandle { * * @param resizable * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async requestUserAttention( requestType: UserAttentionType | null @@ -700,6 +730,8 @@ class WindowManager extends WebviewWindowHandle { * * @param resizable * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setResizable(resizable: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_resizable", { @@ -718,6 +750,8 @@ class WindowManager extends WebviewWindowHandle { * * @param title The new title * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setTitle(title: string): Promise { return window.__TAURI_INVOKE__("plugin:window|set_title", { @@ -735,6 +769,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async maximize(): Promise { return window.__TAURI_INVOKE__("plugin:window|maximize", { @@ -751,6 +787,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async unmaximize(): Promise { return window.__TAURI_INVOKE__("plugin:window|unmaximize", { @@ -767,6 +805,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async toggleMaximize(): Promise { return window.__TAURI_INVOKE__("plugin:window|toggle_maximize", { @@ -783,6 +823,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async minimize(): Promise { return window.__TAURI_INVOKE__("plugin:window|minimize", { @@ -799,6 +841,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async unminimize(): Promise { return window.__TAURI_INVOKE__("plugin:window|unminimize", { @@ -815,6 +859,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async show(): Promise { return window.__TAURI_INVOKE__("plugin:window|show", { @@ -831,6 +877,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async hide(): Promise { return window.__TAURI_INVOKE__("plugin:window|hide", { @@ -847,6 +895,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async close(): Promise { return window.__TAURI_INVOKE__("plugin:window|close", { @@ -864,6 +914,8 @@ class WindowManager extends WebviewWindowHandle { * * @param decorations Whether the window should have borders and bars. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setDecorations(decorations: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_decorations", { @@ -891,7 +943,7 @@ class WindowManager extends WebviewWindowHandle { * * @returns A promise indicating the success or failure of the operation. * - * @since 2.0 + * @since 2.0.0 */ async setShadow(enable: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_shadow", { @@ -910,6 +962,8 @@ class WindowManager extends WebviewWindowHandle { * * @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. + * + * @since 2.0.0 */ async setAlwaysOnTop(alwaysOnTop: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_always_on_top", { @@ -928,7 +982,7 @@ class WindowManager extends WebviewWindowHandle { * * @returns A promise indicating the success or failure of the operation. * - * @since 1.2.0 + * @since 2.0.0 */ async setContentProtected(protected_: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_content_protected", { @@ -947,6 +1001,8 @@ class WindowManager extends WebviewWindowHandle { * * @param size The logical or physical inner size. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setSize(size: LogicalSize | PhysicalSize): Promise { if (!size || (size.type !== "Logical" && size.type !== "Physical")) { @@ -977,6 +1033,8 @@ class WindowManager extends WebviewWindowHandle { * * @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. + * + * @since 2.0.0 */ async setMinSize( size: LogicalSize | PhysicalSize | null | undefined @@ -1011,6 +1069,8 @@ class WindowManager extends WebviewWindowHandle { * * @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. + * + * @since 2.0.0 */ async setMaxSize( size: LogicalSize | PhysicalSize | null | undefined @@ -1045,6 +1105,8 @@ class WindowManager extends WebviewWindowHandle { * * @param position The new position, in logical or physical pixels. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setPosition( position: LogicalPosition | PhysicalPosition @@ -1080,6 +1142,8 @@ class WindowManager extends WebviewWindowHandle { * * @param fullscreen Whether the window should go to fullscreen or not. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setFullscreen(fullscreen: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_fullscreen", { @@ -1097,6 +1161,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setFocus(): Promise { return window.__TAURI_INVOKE__("plugin:window|set_focus", { @@ -1121,6 +1187,8 @@ class WindowManager extends WebviewWindowHandle { * * @param icon Icon bytes or path to the icon file. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setIcon(icon: string | Uint8Array): Promise { return window.__TAURI_INVOKE__("plugin:window|set_icon", { @@ -1143,6 +1211,8 @@ class WindowManager extends WebviewWindowHandle { * * @param skip true to hide window icon, false to show it. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setSkipTaskbar(skip: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_skip_taskbar", { @@ -1169,6 +1239,8 @@ class WindowManager extends WebviewWindowHandle { * * @param grab `true` to grab the cursor icon, `false` to release it. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setCursorGrab(grab: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_cursor_grab", { @@ -1193,6 +1265,8 @@ class WindowManager extends WebviewWindowHandle { * * @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. + * + * @since 2.0.0 */ async setCursorVisible(visible: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_cursor_visible", { @@ -1211,6 +1285,8 @@ class WindowManager extends WebviewWindowHandle { * * @param icon The new cursor icon. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setCursorIcon(icon: CursorIcon): Promise { return window.__TAURI_INVOKE__("plugin:window|set_cursor_icon", { @@ -1229,6 +1305,8 @@ class WindowManager extends WebviewWindowHandle { * * @param position The new cursor position. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setCursorPosition( position: LogicalPosition | PhysicalPosition @@ -1265,6 +1343,8 @@ class WindowManager extends WebviewWindowHandle { * * @param ignore `true` to ignore the cursor events; `false` to process them as usual. * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async setIgnoreCursorEvents(ignore: boolean): Promise { return window.__TAURI_INVOKE__("plugin:window|set_ignore_cursor_events", { @@ -1282,6 +1362,8 @@ class WindowManager extends WebviewWindowHandle { * ``` * * @return A promise indicating the success or failure of the operation. + * + * @since 2.0.0 */ async startDragging(): Promise { return window.__TAURI_INVOKE__("plugin:window|start_dragging", { @@ -1308,7 +1390,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ async onResized(handler: EventCallback): Promise { return this.listen(TauriEvent.WINDOW_RESIZED, (e) => { @@ -1334,7 +1416,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ async onMoved(handler: EventCallback): Promise { return this.listen(TauriEvent.WINDOW_MOVED, (e) => { @@ -1365,7 +1447,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ /* eslint-disable @typescript-eslint/promise-function-async */ async onCloseRequested( @@ -1399,7 +1481,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ async onFocusChanged(handler: EventCallback): Promise { const unlistenFocus = await this.listen( @@ -1441,7 +1523,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ async onScaleChanged( handler: EventCallback @@ -1469,7 +1551,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ async onMenuClicked(handler: EventCallback): Promise { return this.listen(TauriEvent.MENU, handler); @@ -1500,7 +1582,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ async onFileDropEvent( handler: EventCallback @@ -1550,7 +1632,7 @@ class WindowManager extends WebviewWindowHandle { * @returns A promise resolving to a function to unlisten to the event. * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. * - * @since 1.0.2 + * @since 2.0.0 */ async onThemeChanged(handler: EventCallback): Promise { return this.listen(TauriEvent.WINDOW_THEME_CHANGED, handler); @@ -1558,7 +1640,7 @@ class WindowManager extends WebviewWindowHandle { } /** - * @since 1.0.2 + * @since 2.0.0 */ class CloseRequestedEvent { /** Event name */ @@ -1615,7 +1697,7 @@ class CloseRequestedEvent { * unlisten(); * ``` * - * @since 1.0.2 + * @since 2.0.0 */ class WebviewWindow extends WindowManager { /** @@ -1636,6 +1718,8 @@ class WebviewWindow extends WindowManager { * * * @param label The unique webview window label. Must be alphanumeric: `a-zA-Z-/:_`. * @returns The WebviewWindow instance to communicate with the webview. + * + * @since 2.0.0 */ constructor(label: WindowLabel, options: WindowOptions = {}) { super(label); @@ -1663,6 +1747,8 @@ class WebviewWindow extends WindowManager { * * @param label The webview window label. * @returns The WebviewWindow instance to communicate with the webview or null if the webview doesn't exist. + * + * @since 2.0.0 */ static getByLabel(label: string): WebviewWindow | null { if (getAll().some((w) => w.label === label)) { @@ -1696,7 +1782,7 @@ if ("__TAURI_METADATA__" in window) { /** * Configuration for the window to create. * - * @since 1.0.0 + * @since 2.0.0 */ interface WindowOptions { /** @@ -1762,7 +1848,7 @@ interface WindowOptions { * and on Windows 11, it will have a rounded corners. * - **Linux:** Unsupported. * - * @since 2.0 + * @since 2.0.0 */ shadow?: boolean; /** @@ -1830,7 +1916,7 @@ function mapPhysicalSize(m: PhysicalSize): PhysicalSize { * const monitor = currentMonitor(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function currentMonitor(): Promise { return window @@ -1847,7 +1933,7 @@ async function currentMonitor(): Promise { * const monitor = primaryMonitor(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function primaryMonitor(): Promise { return window @@ -1863,7 +1949,7 @@ async function primaryMonitor(): Promise { * const monitors = availableMonitors(); * ``` * - * @since 1.0.0 + * @since 2.0.0 */ async function availableMonitors(): Promise { return window