@tauri-apps/plugin-dialog 2.0.0-beta.1 → 2.0.0-beta.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.cjs +8 -6
- package/dist-js/index.d.ts +4 -0
- package/dist-js/index.js +8 -6
- package/package.json +2 -2
package/dist-js/index.cjs
CHANGED
|
@@ -57,11 +57,13 @@ var core = require('@tauri-apps/api/core');
|
|
|
57
57
|
*
|
|
58
58
|
* @since 2.0.0
|
|
59
59
|
*/
|
|
60
|
-
async function open(
|
|
60
|
+
async function open(
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
62
|
+
options = {}) {
|
|
61
63
|
if (typeof options === "object") {
|
|
62
64
|
Object.freeze(options);
|
|
63
65
|
}
|
|
64
|
-
return core.invoke("plugin:dialog|open", { options });
|
|
66
|
+
return await core.invoke("plugin:dialog|open", { options });
|
|
65
67
|
}
|
|
66
68
|
/**
|
|
67
69
|
* Open a file/directory save dialog.
|
|
@@ -91,7 +93,7 @@ async function save(options = {}) {
|
|
|
91
93
|
if (typeof options === "object") {
|
|
92
94
|
Object.freeze(options);
|
|
93
95
|
}
|
|
94
|
-
return core.invoke("plugin:dialog|save", { options });
|
|
96
|
+
return await core.invoke("plugin:dialog|save", { options });
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -112,7 +114,7 @@ async function save(options = {}) {
|
|
|
112
114
|
*/
|
|
113
115
|
async function message(message, options) {
|
|
114
116
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
115
|
-
|
|
117
|
+
await core.invoke("plugin:dialog|message", {
|
|
116
118
|
message: message.toString(),
|
|
117
119
|
title: opts?.title?.toString(),
|
|
118
120
|
kind: opts?.kind,
|
|
@@ -137,7 +139,7 @@ async function message(message, options) {
|
|
|
137
139
|
*/
|
|
138
140
|
async function ask(message, options) {
|
|
139
141
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
140
|
-
return core.invoke("plugin:dialog|ask", {
|
|
142
|
+
return await core.invoke("plugin:dialog|ask", {
|
|
141
143
|
message: message.toString(),
|
|
142
144
|
title: opts?.title?.toString(),
|
|
143
145
|
kind: opts?.kind,
|
|
@@ -163,7 +165,7 @@ async function ask(message, options) {
|
|
|
163
165
|
*/
|
|
164
166
|
async function confirm(message, options) {
|
|
165
167
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
166
|
-
return core.invoke("plugin:dialog|confirm", {
|
|
168
|
+
return await core.invoke("plugin:dialog|confirm", {
|
|
167
169
|
message: message.toString(),
|
|
168
170
|
title: opts?.title?.toString(),
|
|
169
171
|
kind: opts?.kind,
|
package/dist-js/index.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ interface OpenDialogOptions {
|
|
|
47
47
|
* Defines whether subdirectories will be allowed on the scope or not.
|
|
48
48
|
*/
|
|
49
49
|
recursive?: boolean;
|
|
50
|
+
/** Whether to allow creating directories in the dialog. Enabled by default. **macOS Only** */
|
|
51
|
+
canCreateDirectories?: boolean;
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* Options for the save dialog.
|
|
@@ -64,6 +66,8 @@ interface SaveDialogOptions {
|
|
|
64
66
|
* If it's not an existing directory, the file name will be set to the dialog's file name input and the dialog will be set to the parent folder.
|
|
65
67
|
*/
|
|
66
68
|
defaultPath?: string;
|
|
69
|
+
/** Whether to allow creating directories in the dialog. Enabled by default. **macOS Only** */
|
|
70
|
+
canCreateDirectories?: boolean;
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
73
|
* @since 2.0.0
|
package/dist-js/index.js
CHANGED
|
@@ -55,11 +55,13 @@ import { invoke } from '@tauri-apps/api/core';
|
|
|
55
55
|
*
|
|
56
56
|
* @since 2.0.0
|
|
57
57
|
*/
|
|
58
|
-
async function open(
|
|
58
|
+
async function open(
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
60
|
+
options = {}) {
|
|
59
61
|
if (typeof options === "object") {
|
|
60
62
|
Object.freeze(options);
|
|
61
63
|
}
|
|
62
|
-
return invoke("plugin:dialog|open", { options });
|
|
64
|
+
return await invoke("plugin:dialog|open", { options });
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
67
|
* Open a file/directory save dialog.
|
|
@@ -89,7 +91,7 @@ async function save(options = {}) {
|
|
|
89
91
|
if (typeof options === "object") {
|
|
90
92
|
Object.freeze(options);
|
|
91
93
|
}
|
|
92
|
-
return invoke("plugin:dialog|save", { options });
|
|
94
|
+
return await invoke("plugin:dialog|save", { options });
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
95
97
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -110,7 +112,7 @@ async function save(options = {}) {
|
|
|
110
112
|
*/
|
|
111
113
|
async function message(message, options) {
|
|
112
114
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
113
|
-
|
|
115
|
+
await invoke("plugin:dialog|message", {
|
|
114
116
|
message: message.toString(),
|
|
115
117
|
title: opts?.title?.toString(),
|
|
116
118
|
kind: opts?.kind,
|
|
@@ -135,7 +137,7 @@ async function message(message, options) {
|
|
|
135
137
|
*/
|
|
136
138
|
async function ask(message, options) {
|
|
137
139
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
138
|
-
return invoke("plugin:dialog|ask", {
|
|
140
|
+
return await invoke("plugin:dialog|ask", {
|
|
139
141
|
message: message.toString(),
|
|
140
142
|
title: opts?.title?.toString(),
|
|
141
143
|
kind: opts?.kind,
|
|
@@ -161,7 +163,7 @@ async function ask(message, options) {
|
|
|
161
163
|
*/
|
|
162
164
|
async function confirm(message, options) {
|
|
163
165
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
164
|
-
return invoke("plugin:dialog|confirm", {
|
|
166
|
+
return await invoke("plugin:dialog|confirm", {
|
|
165
167
|
message: message.toString(),
|
|
166
168
|
title: opts?.title?.toString(),
|
|
167
169
|
kind: opts?.kind,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-dialog",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"license": "MIT or APACHE-2.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Tauri Programme within The Commons Conservancy"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"LICENSE"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@tauri-apps/api": "2.0.0-beta.
|
|
23
|
+
"@tauri-apps/api": "2.0.0-beta.11"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "rollup -c"
|