@tauri-apps/plugin-dialog 2.0.0-alpha.2 → 2.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-js/index.min.js +44 -7
- package/package.json +2 -2
package/dist-js/index.min.js
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
19
|
+
var e = new Error(message);
|
|
20
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
21
|
+
};
|
|
2
22
|
|
|
3
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Sends a message to the backend.
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { invoke } from '@tauri-apps/api/primitives';
|
|
28
|
+
* await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param cmd The command name.
|
|
32
|
+
* @param args The optional arguments to pass to the command.
|
|
33
|
+
* @param options The request options.
|
|
34
|
+
* @return A promise resolving or rejecting to the backend response.
|
|
35
|
+
*
|
|
36
|
+
* @since 1.0.0
|
|
37
|
+
*/
|
|
38
|
+
async function invoke(cmd, args = {}, options) {
|
|
39
|
+
return window.__TAURI_INTERNALS__.invoke(cmd, args, options);
|
|
40
|
+
}
|
|
4
41
|
|
|
5
42
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
6
43
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -61,7 +98,7 @@ async function open(options = {}) {
|
|
|
61
98
|
if (typeof options === "object") {
|
|
62
99
|
Object.freeze(options);
|
|
63
100
|
}
|
|
64
|
-
return
|
|
101
|
+
return invoke("plugin:dialog|open", { options });
|
|
65
102
|
}
|
|
66
103
|
/**
|
|
67
104
|
* Open a file/directory save dialog.
|
|
@@ -91,7 +128,7 @@ async function save(options = {}) {
|
|
|
91
128
|
if (typeof options === "object") {
|
|
92
129
|
Object.freeze(options);
|
|
93
130
|
}
|
|
94
|
-
return
|
|
131
|
+
return invoke("plugin:dialog|save", { options });
|
|
95
132
|
}
|
|
96
133
|
/**
|
|
97
134
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -113,7 +150,7 @@ async function save(options = {}) {
|
|
|
113
150
|
async function message(message, options) {
|
|
114
151
|
var _a, _b;
|
|
115
152
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
116
|
-
return
|
|
153
|
+
return invoke("plugin:dialog|message", {
|
|
117
154
|
message: message.toString(),
|
|
118
155
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
119
156
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -139,7 +176,7 @@ async function message(message, options) {
|
|
|
139
176
|
async function ask(message, options) {
|
|
140
177
|
var _a, _b, _c, _d, _e;
|
|
141
178
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
142
|
-
return
|
|
179
|
+
return invoke("plugin:dialog|ask", {
|
|
143
180
|
message: message.toString(),
|
|
144
181
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
145
182
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -166,7 +203,7 @@ async function ask(message, options) {
|
|
|
166
203
|
async function confirm(message, options) {
|
|
167
204
|
var _a, _b, _c, _d, _e;
|
|
168
205
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
169
|
-
return
|
|
206
|
+
return invoke("plugin:dialog|confirm", {
|
|
170
207
|
message: message.toString(),
|
|
171
208
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
172
209
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-dialog",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"license": "MIT or APACHE-2.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Tauri Programme within The Commons Conservancy"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"tslib": "^2.4.1"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tauri-apps/api": "2.0.0-alpha.
|
|
27
|
+
"@tauri-apps/api": "2.0.0-alpha.11"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "rollup -c"
|