🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@tauri-apps/plugin-dialog

Package Overview
Dependencies
Maintainers
7
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tauri-apps/plugin-dialog - npm Package Compare versions

Comparing version
2.6.0
to
2.7.0
+34
-19
dist-js/index.cjs

@@ -119,2 +119,10 @@ 'use strict';

}
async function messageCommand(message, options) {
return await core.invoke('plugin:dialog|message', {
message,
title: options?.title,
kind: options?.kind,
buttons: buttonsToRust(options?.buttons)
});
}
/**

@@ -139,12 +147,12 @@ * Shows a message dialog with an `Ok` button.

const opts = typeof options === 'string' ? { title: options } : options;
return core.invoke('plugin:dialog|message', {
message: message.toString(),
title: opts?.title?.toString(),
kind: opts?.kind,
okButtonLabel: opts?.okLabel?.toString(),
buttons: buttonsToRust(opts?.buttons)
});
if (opts && !opts.buttons && opts.okLabel) {
opts.buttons = { ok: opts.okLabel };
}
return messageCommand(message, opts);
}
/**
* Shows a question dialog with `Yes` and `No` buttons.
*
* Convenient wrapper for `await message('msg', { buttons: 'YesNo' }) === 'Yes'`
*
* @example

@@ -166,12 +174,17 @@ * ```typescript

const opts = typeof options === 'string' ? { title: options } : options;
return await core.invoke('plugin:dialog|ask', {
message: message.toString(),
title: opts?.title?.toString(),
const customButtons = opts?.okLabel || opts?.cancelLabel;
const okLabel = opts?.okLabel ?? 'Yes';
return ((await messageCommand(message, {
title: opts?.title,
kind: opts?.kind,
yesButtonLabel: opts?.okLabel?.toString(),
noButtonLabel: opts?.cancelLabel?.toString()
});
buttons: customButtons
? { ok: okLabel, cancel: opts.cancelLabel ?? 'No' }
: 'YesNo'
})) === okLabel);
}
/**
* Shows a question dialog with `Ok` and `Cancel` buttons.
*
* Convenient wrapper for `await message('msg', { buttons: 'OkCancel' }) === 'Ok'`
*
* @example

@@ -193,9 +206,11 @@ * ```typescript

const opts = typeof options === 'string' ? { title: options } : options;
return await core.invoke('plugin:dialog|confirm', {
message: message.toString(),
title: opts?.title?.toString(),
const customButtons = opts?.okLabel || opts?.cancelLabel;
const okLabel = opts?.okLabel ?? 'Ok';
return ((await messageCommand(message, {
title: opts?.title,
kind: opts?.kind,
okButtonLabel: opts?.okLabel?.toString(),
cancelButtonLabel: opts?.cancelLabel?.toString()
});
buttons: customButtons
? { ok: okLabel, cancel: opts.cancelLabel ?? 'Cancel' }
: 'OkCancel'
})) === okLabel);
}

@@ -202,0 +217,0 @@

@@ -349,2 +349,5 @@ /**

* Shows a question dialog with `Yes` and `No` buttons.
*
* Convenient wrapper for `await message('msg', { buttons: 'YesNo' }) === 'Yes'`
*
* @example

@@ -367,2 +370,5 @@ * ```typescript

* Shows a question dialog with `Ok` and `Cancel` buttons.
*
* Convenient wrapper for `await message('msg', { buttons: 'OkCancel' }) === 'Ok'`
*
* @example

@@ -369,0 +375,0 @@ * ```typescript

@@ -117,2 +117,10 @@ import { invoke } from '@tauri-apps/api/core';

}
async function messageCommand(message, options) {
return await invoke('plugin:dialog|message', {
message,
title: options?.title,
kind: options?.kind,
buttons: buttonsToRust(options?.buttons)
});
}
/**

@@ -137,12 +145,12 @@ * Shows a message dialog with an `Ok` button.

const opts = typeof options === 'string' ? { title: options } : options;
return invoke('plugin:dialog|message', {
message: message.toString(),
title: opts?.title?.toString(),
kind: opts?.kind,
okButtonLabel: opts?.okLabel?.toString(),
buttons: buttonsToRust(opts?.buttons)
});
if (opts && !opts.buttons && opts.okLabel) {
opts.buttons = { ok: opts.okLabel };
}
return messageCommand(message, opts);
}
/**
* Shows a question dialog with `Yes` and `No` buttons.
*
* Convenient wrapper for `await message('msg', { buttons: 'YesNo' }) === 'Yes'`
*
* @example

@@ -164,12 +172,17 @@ * ```typescript

const opts = typeof options === 'string' ? { title: options } : options;
return await invoke('plugin:dialog|ask', {
message: message.toString(),
title: opts?.title?.toString(),
const customButtons = opts?.okLabel || opts?.cancelLabel;
const okLabel = opts?.okLabel ?? 'Yes';
return ((await messageCommand(message, {
title: opts?.title,
kind: opts?.kind,
yesButtonLabel: opts?.okLabel?.toString(),
noButtonLabel: opts?.cancelLabel?.toString()
});
buttons: customButtons
? { ok: okLabel, cancel: opts.cancelLabel ?? 'No' }
: 'YesNo'
})) === okLabel);
}
/**
* Shows a question dialog with `Ok` and `Cancel` buttons.
*
* Convenient wrapper for `await message('msg', { buttons: 'OkCancel' }) === 'Ok'`
*
* @example

@@ -191,11 +204,13 @@ * ```typescript

const opts = typeof options === 'string' ? { title: options } : options;
return await invoke('plugin:dialog|confirm', {
message: message.toString(),
title: opts?.title?.toString(),
const customButtons = opts?.okLabel || opts?.cancelLabel;
const okLabel = opts?.okLabel ?? 'Ok';
return ((await messageCommand(message, {
title: opts?.title,
kind: opts?.kind,
okButtonLabel: opts?.okLabel?.toString(),
cancelButtonLabel: opts?.cancelLabel?.toString()
});
buttons: customButtons
? { ok: okLabel, cancel: opts.cancelLabel ?? 'Cancel' }
: 'OkCancel'
})) === okLabel);
}
export { ask, confirm, message, open, save };
{
"name": "@tauri-apps/plugin-dialog",
"version": "2.6.0",
"version": "2.7.0",
"license": "MIT OR Apache-2.0",

@@ -27,4 +27,4 @@ "authors": [

"dependencies": {
"@tauri-apps/api": "^2.8.0"
"@tauri-apps/api": "^2.10.1"
}
}