@tauri-apps/plugin-clipboard-manager 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 -10
- package/dist-js/index.min.js +50 -5
- package/dist-js/index.mjs +11 -5
- package/package.json +2 -2
package/README.md
CHANGED
package/dist-js/index.d.ts
CHANGED
package/dist-js/index.min.js
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
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
|
|
45
|
+
/**
|
|
46
|
+
* Read and write to the system clipboard.
|
|
47
|
+
*
|
|
48
|
+
* @module
|
|
49
|
+
*/
|
|
4
50
|
/**
|
|
5
51
|
* Writes plain text to the clipboard.
|
|
6
52
|
* @example
|
|
@@ -15,10 +61,9 @@
|
|
|
15
61
|
* @since 2.0.0
|
|
16
62
|
*/
|
|
17
63
|
async function writeText(text, opts) {
|
|
18
|
-
return
|
|
64
|
+
return invoke("plugin:clipboard|write", {
|
|
19
65
|
data: {
|
|
20
|
-
|
|
21
|
-
options: {
|
|
66
|
+
plainText: {
|
|
22
67
|
label: opts === null || opts === void 0 ? void 0 : opts.label,
|
|
23
68
|
text,
|
|
24
69
|
},
|
|
@@ -35,8 +80,8 @@ async function writeText(text, opts) {
|
|
|
35
80
|
* @since 2.0.0
|
|
36
81
|
*/
|
|
37
82
|
async function readText() {
|
|
38
|
-
const kind = await
|
|
39
|
-
return kind.
|
|
83
|
+
const kind = await invoke("plugin:clipboard|read");
|
|
84
|
+
return kind.plainText.text;
|
|
40
85
|
}
|
|
41
86
|
|
|
42
87
|
export { readText, writeText };
|
package/dist-js/index.mjs
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
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
|
|
6
|
+
/**
|
|
7
|
+
* Read and write to the system clipboard.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
4
11
|
/**
|
|
5
12
|
* Writes plain text to the clipboard.
|
|
6
13
|
* @example
|
|
@@ -15,10 +22,9 @@
|
|
|
15
22
|
* @since 2.0.0
|
|
16
23
|
*/
|
|
17
24
|
async function writeText(text, opts) {
|
|
18
|
-
return
|
|
25
|
+
return invoke("plugin:clipboard|write", {
|
|
19
26
|
data: {
|
|
20
|
-
|
|
21
|
-
options: {
|
|
27
|
+
plainText: {
|
|
22
28
|
label: opts === null || opts === void 0 ? void 0 : opts.label,
|
|
23
29
|
text,
|
|
24
30
|
},
|
|
@@ -35,8 +41,8 @@ async function writeText(text, opts) {
|
|
|
35
41
|
* @since 2.0.0
|
|
36
42
|
*/
|
|
37
43
|
async function readText() {
|
|
38
|
-
const kind = await
|
|
39
|
-
return kind.
|
|
44
|
+
const kind = await invoke("plugin:clipboard|read");
|
|
45
|
+
return kind.plainText.text;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
export { readText, writeText };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-clipboard-manager",
|
|
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"
|