@tauri-apps/plugin-dialog 2.0.0-alpha.1 → 2.0.0-alpha.2
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 +9 -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,7 @@
|
|
|
1
|
+
var f=Object.defineProperty;var g=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0});};var e=(a,b,c)=>{if(!b.has(a))throw TypeError("Cannot "+c)};var h=(a,b,c)=>(e(a,b,"read from private field"),c?c.call(a):b.get(a)),i$1=(a,b,c)=>{if(b.has(a))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(a):b.set(a,c);},j=(a,b,c,d)=>(e(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c);
|
|
2
|
+
|
|
3
|
+
var T={};g(T,{Channel:()=>i,PluginListener:()=>o,addPluginListener:()=>l,convertFileSrc:()=>v,invoke:()=>u,transformCallback:()=>_});function _(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}var r,i=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;i$1(this,r,()=>{});this.id=_(n=>{h(this,r).call(this,n);});}set onmessage(n){j(this,r,n);}get onmessage(){return h(this,r)}toJSON(){return `__CHANNEL__:${this.id}`}};r=new WeakMap;var o=class{constructor(n,s,t){this.plugin=n,this.event=s,this.channelId=t;}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l(e,n,s){let t=new i;return t.onmessage=s,u(`plugin:${e}|register_listener`,{event:n,handler:t}).then(()=>new o(e,n,t.id))}async function u(e,n={},s){return window.__TAURI_INTERNALS__.invoke(e,n,s)}function v(e,n="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,n)}
|
|
4
|
+
|
|
1
5
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
2
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
7
|
// SPDX-License-Identifier: MIT
|
|
@@ -57,7 +61,7 @@ async function open(options = {}) {
|
|
|
57
61
|
if (typeof options === "object") {
|
|
58
62
|
Object.freeze(options);
|
|
59
63
|
}
|
|
60
|
-
return
|
|
64
|
+
return u("plugin:dialog|open", { options });
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
67
|
* Open a file/directory save dialog.
|
|
@@ -87,7 +91,7 @@ async function save(options = {}) {
|
|
|
87
91
|
if (typeof options === "object") {
|
|
88
92
|
Object.freeze(options);
|
|
89
93
|
}
|
|
90
|
-
return
|
|
94
|
+
return u("plugin:dialog|save", { options });
|
|
91
95
|
}
|
|
92
96
|
/**
|
|
93
97
|
* Shows a message dialog with an `Ok` button.
|
|
@@ -109,7 +113,7 @@ async function save(options = {}) {
|
|
|
109
113
|
async function message(message, options) {
|
|
110
114
|
var _a, _b;
|
|
111
115
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
112
|
-
return
|
|
116
|
+
return u("plugin:dialog|message", {
|
|
113
117
|
message: message.toString(),
|
|
114
118
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
115
119
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -135,7 +139,7 @@ async function message(message, options) {
|
|
|
135
139
|
async function ask(message, options) {
|
|
136
140
|
var _a, _b, _c, _d, _e;
|
|
137
141
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
138
|
-
return
|
|
142
|
+
return u("plugin:dialog|ask", {
|
|
139
143
|
message: message.toString(),
|
|
140
144
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
141
145
|
type_: opts === null || opts === void 0 ? void 0 : opts.type,
|
|
@@ -162,7 +166,7 @@ async function ask(message, options) {
|
|
|
162
166
|
async function confirm(message, options) {
|
|
163
167
|
var _a, _b, _c, _d, _e;
|
|
164
168
|
const opts = typeof options === "string" ? { title: options } : options;
|
|
165
|
-
return
|
|
169
|
+
return u("plugin:dialog|confirm", {
|
|
166
170
|
message: message.toString(),
|
|
167
171
|
title: (_a = opts === null || opts === void 0 ? void 0 : opts.title) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
168
172
|
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.2",
|
|
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.9"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "rollup -c"
|