@tauri-apps/plugin-dialog 2.0.0-alpha.3 → 2.0.0-alpha.4
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/README.md +16 -0
- package/dist-js/{index.min.js → index.cjs} +23 -60
- package/dist-js/{index.mjs → index.js} +11 -15
- package/package.json +7 -11
package/README.md
CHANGED
|
@@ -67,6 +67,22 @@ Afterwards all the plugin's APIs are available through the JavaScript guest bind
|
|
|
67
67
|
|
|
68
68
|
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
|
69
69
|
|
|
70
|
+
## Partners
|
|
71
|
+
|
|
72
|
+
<table>
|
|
73
|
+
<tbody>
|
|
74
|
+
<tr>
|
|
75
|
+
<td align="center" valign="middle">
|
|
76
|
+
<a href="https://crabnebula.dev" target="_blank">
|
|
77
|
+
<img src="https://github.com/tauri-apps/plugins-workspace/raw/v2/.github/sponsors/crabnebula.svg" alt="CrabNebula" width="283">
|
|
78
|
+
</a>
|
|
79
|
+
</td>
|
|
80
|
+
</tr>
|
|
81
|
+
</tbody>
|
|
82
|
+
</table>
|
|
83
|
+
|
|
84
|
+
For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri).
|
|
85
|
+
|
|
70
86
|
## License
|
|
71
87
|
|
|
72
88
|
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
|
@@ -1,43 +1,6 @@
|
|
|
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
|
-
};
|
|
1
|
+
'use strict';
|
|
22
2
|
|
|
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
|
-
}
|
|
3
|
+
var primitives = require('@tauri-apps/api/primitives');
|
|
41
4
|
|
|
42
5
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
43
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -98,7 +61,7 @@ async function open(options = {}) {
|
|
|
98
61
|
if (typeof options === "object") {
|
|
99
62
|
Object.freeze(options);
|
|
100
63
|
}
|
|
101
|
-
return invoke("plugin:dialog|open", { options });
|
|
64
|
+
return primitives.invoke("plugin:dialog|open", { options });
|
|
102
65
|
}
|
|
103
66
|
/**
|
|
104
67
|
* Open a file/directory save dialog.
|
|
@@ -128,7 +91,7 @@ async function save(options = {}) {
|
|
|
128
91
|
if (typeof options === "object") {
|
|
129
92
|
Object.freeze(options);
|
|
130
93
|
}
|
|
131
|
-
return invoke("plugin:dialog|save", { options });
|
|
94
|
+
return primitives.invoke("plugin:dialog|save", { options });
|
|
132
95
|
}
|
|
133
96
|
/**
|
|
134
97
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -148,13 +111,12 @@ async function save(options = {}) {
|
|
|
148
111
|
*
|
|
149
112
|
*/
|
|
150
113
|
async function message(message, options) {
|
|
151
|
-
var _a, _b;
|
|
152
114
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
153
|
-
return invoke("plugin:dialog|message", {
|
|
115
|
+
return primitives.invoke("plugin:dialog|message", {
|
|
154
116
|
message: message.toString(),
|
|
155
|
-
title:
|
|
156
|
-
type_: opts
|
|
157
|
-
okButtonLabel:
|
|
117
|
+
title: opts?.title?.toString(),
|
|
118
|
+
type_: opts?.type,
|
|
119
|
+
okButtonLabel: opts?.okLabel?.toString(),
|
|
158
120
|
});
|
|
159
121
|
}
|
|
160
122
|
/**
|
|
@@ -174,14 +136,13 @@ async function message(message, options) {
|
|
|
174
136
|
* @since 2.0.0
|
|
175
137
|
*/
|
|
176
138
|
async function ask(message, options) {
|
|
177
|
-
var _a, _b, _c, _d, _e;
|
|
178
139
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
179
|
-
return invoke("plugin:dialog|ask", {
|
|
140
|
+
return primitives.invoke("plugin:dialog|ask", {
|
|
180
141
|
message: message.toString(),
|
|
181
|
-
title:
|
|
182
|
-
type_: opts
|
|
183
|
-
okButtonLabel:
|
|
184
|
-
cancelButtonLabel:
|
|
142
|
+
title: opts?.title?.toString(),
|
|
143
|
+
type_: opts?.type,
|
|
144
|
+
okButtonLabel: opts?.okLabel?.toString() ?? "Yes",
|
|
145
|
+
cancelButtonLabel: opts?.cancelLabel?.toString() ?? "No",
|
|
185
146
|
});
|
|
186
147
|
}
|
|
187
148
|
/**
|
|
@@ -201,16 +162,18 @@ async function ask(message, options) {
|
|
|
201
162
|
* @since 2.0.0
|
|
202
163
|
*/
|
|
203
164
|
async function confirm(message, options) {
|
|
204
|
-
var _a, _b, _c, _d, _e;
|
|
205
165
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
206
|
-
return invoke("plugin:dialog|confirm", {
|
|
166
|
+
return primitives.invoke("plugin:dialog|confirm", {
|
|
207
167
|
message: message.toString(),
|
|
208
|
-
title:
|
|
209
|
-
type_: opts
|
|
210
|
-
okButtonLabel:
|
|
211
|
-
cancelButtonLabel:
|
|
168
|
+
title: opts?.title?.toString(),
|
|
169
|
+
type_: opts?.type,
|
|
170
|
+
okButtonLabel: opts?.okLabel?.toString() ?? "Ok",
|
|
171
|
+
cancelButtonLabel: opts?.cancelLabel?.toString() ?? "Cancel",
|
|
212
172
|
});
|
|
213
173
|
}
|
|
214
174
|
|
|
215
|
-
|
|
216
|
-
|
|
175
|
+
exports.ask = ask;
|
|
176
|
+
exports.confirm = confirm;
|
|
177
|
+
exports.message = message;
|
|
178
|
+
exports.open = open;
|
|
179
|
+
exports.save = save;
|
|
@@ -109,13 +109,12 @@ async function save(options = {}) {
|
|
|
109
109
|
*
|
|
110
110
|
*/
|
|
111
111
|
async function message(message, options) {
|
|
112
|
-
var _a, _b;
|
|
113
112
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
114
113
|
return invoke("plugin:dialog|message", {
|
|
115
114
|
message: message.toString(),
|
|
116
|
-
title:
|
|
117
|
-
type_: opts
|
|
118
|
-
okButtonLabel:
|
|
115
|
+
title: opts?.title?.toString(),
|
|
116
|
+
type_: opts?.type,
|
|
117
|
+
okButtonLabel: opts?.okLabel?.toString(),
|
|
119
118
|
});
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
@@ -135,14 +134,13 @@ async function message(message, options) {
|
|
|
135
134
|
* @since 2.0.0
|
|
136
135
|
*/
|
|
137
136
|
async function ask(message, options) {
|
|
138
|
-
var _a, _b, _c, _d, _e;
|
|
139
137
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
140
138
|
return invoke("plugin:dialog|ask", {
|
|
141
139
|
message: message.toString(),
|
|
142
|
-
title:
|
|
143
|
-
type_: opts
|
|
144
|
-
okButtonLabel:
|
|
145
|
-
cancelButtonLabel:
|
|
140
|
+
title: opts?.title?.toString(),
|
|
141
|
+
type_: opts?.type,
|
|
142
|
+
okButtonLabel: opts?.okLabel?.toString() ?? "Yes",
|
|
143
|
+
cancelButtonLabel: opts?.cancelLabel?.toString() ?? "No",
|
|
146
144
|
});
|
|
147
145
|
}
|
|
148
146
|
/**
|
|
@@ -162,16 +160,14 @@ async function ask(message, options) {
|
|
|
162
160
|
* @since 2.0.0
|
|
163
161
|
*/
|
|
164
162
|
async function confirm(message, options) {
|
|
165
|
-
var _a, _b, _c, _d, _e;
|
|
166
163
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
167
164
|
return invoke("plugin:dialog|confirm", {
|
|
168
165
|
message: message.toString(),
|
|
169
|
-
title:
|
|
170
|
-
type_: opts
|
|
171
|
-
okButtonLabel:
|
|
172
|
-
cancelButtonLabel:
|
|
166
|
+
title: opts?.title?.toString(),
|
|
167
|
+
type_: opts?.type,
|
|
168
|
+
okButtonLabel: opts?.okLabel?.toString() ?? "Ok",
|
|
169
|
+
cancelButtonLabel: opts?.cancelLabel?.toString() ?? "Cancel",
|
|
173
170
|
});
|
|
174
171
|
}
|
|
175
172
|
|
|
176
173
|
export { ask, confirm, message, open, save };
|
|
177
|
-
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-dialog",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
4
|
"license": "MIT or APACHE-2.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Tauri Programme within The Commons Conservancy"
|
|
7
7
|
],
|
|
8
8
|
"type": "module",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
9
|
+
"types": "./dist-js/index.d.ts",
|
|
10
|
+
"main": "./dist-js/index.cjs",
|
|
11
|
+
"module": "./dist-js/index.js",
|
|
12
12
|
"exports": {
|
|
13
|
-
"import": "./dist-js/index.mjs",
|
|
14
13
|
"types": "./dist-js/index.d.ts",
|
|
15
|
-
"
|
|
14
|
+
"import": "./dist-js/index.js",
|
|
15
|
+
"require": "./dist-js/index.cjs"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist-js",
|
|
19
|
-
"!dist-js/**/*.map",
|
|
20
19
|
"README.md",
|
|
21
20
|
"LICENSE"
|
|
22
21
|
],
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"tslib": "^2.4.1"
|
|
25
|
-
},
|
|
26
22
|
"dependencies": {
|
|
27
|
-
"@tauri-apps/api": "2.0.0-alpha.
|
|
23
|
+
"@tauri-apps/api": "2.0.0-alpha.12"
|
|
28
24
|
},
|
|
29
25
|
"scripts": {
|
|
30
26
|
"build": "rollup -c"
|