@tauri-apps/plugin-clipboard-manager 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.cjs +51 -0
- package/dist-js/{index.mjs → index.js} +3 -5
- package/package.json +7 -11
- package/dist-js/index.min.js +0 -52
package/README.md
CHANGED
|
@@ -69,6 +69,22 @@ assert(await readText(), "Tauri is awesome!");
|
|
|
69
69
|
|
|
70
70
|
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
|
71
71
|
|
|
72
|
+
## Partners
|
|
73
|
+
|
|
74
|
+
<table>
|
|
75
|
+
<tbody>
|
|
76
|
+
<tr>
|
|
77
|
+
<td align="center" valign="middle">
|
|
78
|
+
<a href="https://crabnebula.dev" target="_blank">
|
|
79
|
+
<img src="https://github.com/tauri-apps/plugins-workspace/raw/v2/.github/sponsors/crabnebula.svg" alt="CrabNebula" width="283">
|
|
80
|
+
</a>
|
|
81
|
+
</td>
|
|
82
|
+
</tr>
|
|
83
|
+
</tbody>
|
|
84
|
+
</table>
|
|
85
|
+
|
|
86
|
+
For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri).
|
|
87
|
+
|
|
72
88
|
## License
|
|
73
89
|
|
|
74
90
|
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var primitives = require('@tauri-apps/api/primitives');
|
|
4
|
+
|
|
5
|
+
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
// SPDX-License-Identifier: MIT
|
|
8
|
+
/**
|
|
9
|
+
* Read and write to the system clipboard.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Writes plain text to the clipboard.
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
|
|
18
|
+
* await writeText('Tauri is awesome!');
|
|
19
|
+
* assert(await readText(), 'Tauri is awesome!');
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @returns A promise indicating the success or failure of the operation.
|
|
23
|
+
*
|
|
24
|
+
* @since 2.0.0
|
|
25
|
+
*/
|
|
26
|
+
async function writeText(text, opts) {
|
|
27
|
+
return primitives.invoke("plugin:clipboard|write", {
|
|
28
|
+
data: {
|
|
29
|
+
plainText: {
|
|
30
|
+
label: opts?.label,
|
|
31
|
+
text,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the clipboard content as plain text.
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { readText } from '@tauri-apps/plugin-clipboard-manager';
|
|
41
|
+
* const clipboardText = await readText();
|
|
42
|
+
* ```
|
|
43
|
+
* @since 2.0.0
|
|
44
|
+
*/
|
|
45
|
+
async function readText() {
|
|
46
|
+
const kind = await primitives.invoke("plugin:clipboard|read");
|
|
47
|
+
return kind.plainText.text;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.readText = readText;
|
|
51
|
+
exports.writeText = writeText;
|
|
@@ -24,9 +24,8 @@ import { invoke } from '@tauri-apps/api/primitives';
|
|
|
24
24
|
async function writeText(text, opts) {
|
|
25
25
|
return invoke("plugin:clipboard|write", {
|
|
26
26
|
data: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
label: opts === null || opts === void 0 ? void 0 : opts.label,
|
|
27
|
+
plainText: {
|
|
28
|
+
label: opts?.label,
|
|
30
29
|
text,
|
|
31
30
|
},
|
|
32
31
|
},
|
|
@@ -43,8 +42,7 @@ async function writeText(text, opts) {
|
|
|
43
42
|
*/
|
|
44
43
|
async function readText() {
|
|
45
44
|
const kind = await invoke("plugin:clipboard|read");
|
|
46
|
-
return kind.
|
|
45
|
+
return kind.plainText.text;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
export { readText, writeText };
|
|
50
|
-
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-clipboard-manager",
|
|
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"
|
package/dist-js/index.min.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
|
|
5
|
-
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
6
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
// SPDX-License-Identifier: MIT
|
|
8
|
-
/**
|
|
9
|
-
* Read and write to the system clipboard.
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Writes plain text to the clipboard.
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
|
|
18
|
-
* await writeText('Tauri is awesome!');
|
|
19
|
-
* assert(await readText(), 'Tauri is awesome!');
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
23
|
-
*
|
|
24
|
-
* @since 2.0.0
|
|
25
|
-
*/
|
|
26
|
-
async function writeText(text, opts) {
|
|
27
|
-
return u("plugin:clipboard|write", {
|
|
28
|
-
data: {
|
|
29
|
-
kind: "PlainText",
|
|
30
|
-
options: {
|
|
31
|
-
label: opts === null || opts === void 0 ? void 0 : opts.label,
|
|
32
|
-
text,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Gets the clipboard content as plain text.
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import { readText } from '@tauri-apps/plugin-clipboard-manager';
|
|
42
|
-
* const clipboardText = await readText();
|
|
43
|
-
* ```
|
|
44
|
-
* @since 2.0.0
|
|
45
|
-
*/
|
|
46
|
-
async function readText() {
|
|
47
|
-
const kind = await u("plugin:clipboard|read");
|
|
48
|
-
return kind.options;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { readText, writeText };
|
|
52
|
-
//# sourceMappingURL=index.min.js.map
|