@tauri-apps/plugin-dialog 2.0.0-alpha.1 → 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/README.md +1 -1
- package/dist-js/index.d.ts +0 -5
- package/dist-js/index.min.js +46 -5
- package/dist-js/index.mjs +7 -5
- package/dist-js/init.d.ts +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Native system dialogs for opening and saving files along with message dialogs.
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
_This plugin requires a Rust version of at least **1.
|
|
7
|
+
_This plugin requires a Rust version of at least **1.70**_
|
|
8
8
|
|
|
9
9
|
There are three general methods of installation that we can recommend.
|
|
10
10
|
|
package/dist-js/index.d.ts
CHANGED
package/dist-js/index.min.js
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
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
|
+
};
|
|
22
|
+
|
|
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
|
+
}
|
|
41
|
+
|
|
1
42
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
2
43
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
44
|
// SPDX-License-Identifier: MIT
|
|
@@ -57,7 +98,7 @@ async function open(options = {}) {
|
|
|
57
98
|
if (typeof options === "object") {
|
|
58
99
|
Object.freeze(options);
|
|
59
100
|
}
|
|
60
|
-
return
|
|
101
|
+
return invoke("plugin:dialog|open", { options });
|
|
61
102
|
}
|
|
62
103
|
/**
|
|
63
104
|
* Open a file/directory save dialog.
|
|
@@ -87,7 +128,7 @@ async function save(options = {}) {
|
|
|
87
128
|
if (typeof options === "object") {
|
|
88
129
|
Object.freeze(options);
|
|
89
130
|
}
|
|
90
|
-
return
|
|
131
|
+
return invoke("plugin:dialog|save", { options });
|
|
91
132
|
}
|
|
92
133
|
/**
|
|
93
134
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -109,7 +150,7 @@ async function save(options = {}) {
|
|
|
109
150
|
async function message(message, options) {
|
|
110
151
|
var _a, _b;
|
|
111
152
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
112
|
-
return
|
|
153
|
+
return invoke("plugin:dialog|message", {
|
|
113
154
|
message: message.toString(),
|
|
114
155
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
115
156
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -135,7 +176,7 @@ async function message(message, options) {
|
|
|
135
176
|
async function ask(message, options) {
|
|
136
177
|
var _a, _b, _c, _d, _e;
|
|
137
178
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
138
|
-
return
|
|
179
|
+
return invoke("plugin:dialog|ask", {
|
|
139
180
|
message: message.toString(),
|
|
140
181
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
141
182
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -162,7 +203,7 @@ async function ask(message, options) {
|
|
|
162
203
|
async function confirm(message, options) {
|
|
163
204
|
var _a, _b, _c, _d, _e;
|
|
164
205
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
165
|
-
return
|
|
206
|
+
return invoke("plugin:dialog|confirm", {
|
|
166
207
|
message: message.toString(),
|
|
167
208
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
168
209
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
package/dist-js/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { invoke } from '@tauri-apps/api/primitives';
|
|
2
|
+
|
|
1
3
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
2
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
5
|
// SPDX-License-Identifier: MIT
|
|
@@ -57,7 +59,7 @@ async function open(options = {}) {
|
|
|
57
59
|
if (typeof options === "object") {
|
|
58
60
|
Object.freeze(options);
|
|
59
61
|
}
|
|
60
|
-
return
|
|
62
|
+
return invoke("plugin:dialog|open", { options });
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
65
|
* Open a file/directory save dialog.
|
|
@@ -87,7 +89,7 @@ async function save(options = {}) {
|
|
|
87
89
|
if (typeof options === "object") {
|
|
88
90
|
Object.freeze(options);
|
|
89
91
|
}
|
|
90
|
-
return
|
|
92
|
+
return invoke("plugin:dialog|save", { options });
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
93
95
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -109,7 +111,7 @@ async function save(options = {}) {
|
|
|
109
111
|
async function message(message, options) {
|
|
110
112
|
var _a, _b;
|
|
111
113
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
112
|
-
return
|
|
114
|
+
return invoke("plugin:dialog|message", {
|
|
113
115
|
message: message.toString(),
|
|
114
116
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
115
117
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -135,7 +137,7 @@ async function message(message, options) {
|
|
|
135
137
|
async function ask(message, options) {
|
|
136
138
|
var _a, _b, _c, _d, _e;
|
|
137
139
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
138
|
-
return
|
|
140
|
+
return invoke("plugin:dialog|ask", {
|
|
139
141
|
message: message.toString(),
|
|
140
142
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
141
143
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -162,7 +164,7 @@ async function ask(message, options) {
|
|
|
162
164
|
async function confirm(message, options) {
|
|
163
165
|
var _a, _b, _c, _d, _e;
|
|
164
166
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
165
|
-
return
|
|
167
|
+
return invoke("plugin:dialog|confirm", {
|
|
166
168
|
message: message.toString(),
|
|
167
169
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
168
170
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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"
|