@tauri-apps/plugin-dialog 2.0.0-alpha.2 → 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 -23
- 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,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var primitives = require('@tauri-apps/api/primitives');
|
|
4
4
|
|
|
5
5
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
6
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -61,7 +61,7 @@ async function open(options = {}) {
|
|
|
61
61
|
if (typeof options === "object") {
|
|
62
62
|
Object.freeze(options);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return primitives.invoke("plugin:dialog|open", { options });
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Open a file/directory save dialog.
|
|
@@ -91,7 +91,7 @@ async function save(options = {}) {
|
|
|
91
91
|
if (typeof options === "object") {
|
|
92
92
|
Object.freeze(options);
|
|
93
93
|
}
|
|
94
|
-
return
|
|
94
|
+
return primitives.invoke("plugin:dialog|save", { options });
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -111,13 +111,12 @@ async function save(options = {}) {
|
|
|
111
111
|
*
|
|
112
112
|
*/
|
|
113
113
|
async function message(message, options) {
|
|
114
|
-
var _a, _b;
|
|
115
114
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
116
|
-
return
|
|
115
|
+
return primitives.invoke("plugin:dialog|message", {
|
|
117
116
|
message: message.toString(),
|
|
118
|
-
title:
|
|
119
|
-
type_: opts
|
|
120
|
-
okButtonLabel:
|
|
117
|
+
title: opts?.title?.toString(),
|
|
118
|
+
type_: opts?.type,
|
|
119
|
+
okButtonLabel: opts?.okLabel?.toString(),
|
|
121
120
|
});
|
|
122
121
|
}
|
|
123
122
|
/**
|
|
@@ -137,14 +136,13 @@ async function message(message, options) {
|
|
|
137
136
|
* @since 2.0.0
|
|
138
137
|
*/
|
|
139
138
|
async function ask(message, options) {
|
|
140
|
-
var _a, _b, _c, _d, _e;
|
|
141
139
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
142
|
-
return
|
|
140
|
+
return primitives.invoke("plugin:dialog|ask", {
|
|
143
141
|
message: message.toString(),
|
|
144
|
-
title:
|
|
145
|
-
type_: opts
|
|
146
|
-
okButtonLabel:
|
|
147
|
-
cancelButtonLabel:
|
|
142
|
+
title: opts?.title?.toString(),
|
|
143
|
+
type_: opts?.type,
|
|
144
|
+
okButtonLabel: opts?.okLabel?.toString() ?? "Yes",
|
|
145
|
+
cancelButtonLabel: opts?.cancelLabel?.toString() ?? "No",
|
|
148
146
|
});
|
|
149
147
|
}
|
|
150
148
|
/**
|
|
@@ -164,16 +162,18 @@ async function ask(message, options) {
|
|
|
164
162
|
* @since 2.0.0
|
|
165
163
|
*/
|
|
166
164
|
async function confirm(message, options) {
|
|
167
|
-
var _a, _b, _c, _d, _e;
|
|
168
165
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
169
|
-
return
|
|
166
|
+
return primitives.invoke("plugin:dialog|confirm", {
|
|
170
167
|
message: message.toString(),
|
|
171
|
-
title:
|
|
172
|
-
type_: opts
|
|
173
|
-
okButtonLabel:
|
|
174
|
-
cancelButtonLabel:
|
|
168
|
+
title: opts?.title?.toString(),
|
|
169
|
+
type_: opts?.type,
|
|
170
|
+
okButtonLabel: opts?.okLabel?.toString() ?? "Ok",
|
|
171
|
+
cancelButtonLabel: opts?.cancelLabel?.toString() ?? "Cancel",
|
|
175
172
|
});
|
|
176
173
|
}
|
|
177
174
|
|
|
178
|
-
|
|
179
|
-
|
|
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"
|