@tauri-apps/plugin-clipboard-manager 2.0.0-alpha.0 → 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 CHANGED
@@ -1,10 +1,10 @@
1
- # Clipboard Manager
1
+ ![plugin-clipboard-manager](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/clipboard-manager/banner.png)
2
2
 
3
3
  Read and write to the system clipboard.
4
4
 
5
5
  ## Install
6
6
 
7
- _This plugin requires a Rust version of at least **1.65**_
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
 
@@ -1,13 +1,3 @@
1
- /**
2
- * Read and write to the system clipboard.
3
- *
4
- * @module
5
- */
6
- declare global {
7
- interface Window {
8
- __TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
9
- }
10
- }
11
1
  /**
12
2
  * Writes plain text to the clipboard.
13
3
  * @example
@@ -1,6 +1,15 @@
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
8
+ /**
9
+ * Read and write to the system clipboard.
10
+ *
11
+ * @module
12
+ */
4
13
  /**
5
14
  * Writes plain text to the clipboard.
6
15
  * @example
@@ -15,7 +24,7 @@
15
24
  * @since 2.0.0
16
25
  */
17
26
  async function writeText(text, opts) {
18
- return window.__TAURI_INVOKE__("plugin:clipboard|write", {
27
+ return u("plugin:clipboard|write", {
19
28
  data: {
20
29
  kind: "PlainText",
21
30
  options: {
@@ -35,7 +44,7 @@ async function writeText(text, opts) {
35
44
  * @since 2.0.0
36
45
  */
37
46
  async function readText() {
38
- const kind = await window.__TAURI_INVOKE__("plugin:clipboard|read");
47
+ const kind = await u("plugin:clipboard|read");
39
48
  return kind.options;
40
49
  }
41
50
 
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,7 +22,7 @@
15
22
  * @since 2.0.0
16
23
  */
17
24
  async function writeText(text, opts) {
18
- return window.__TAURI_INVOKE__("plugin:clipboard|write", {
25
+ return invoke("plugin:clipboard|write", {
19
26
  data: {
20
27
  kind: "PlainText",
21
28
  options: {
@@ -35,7 +42,7 @@ async function writeText(text, opts) {
35
42
  * @since 2.0.0
36
43
  */
37
44
  async function readText() {
38
- const kind = await window.__TAURI_INVOKE__("plugin:clipboard|read");
45
+ const kind = await invoke("plugin:clipboard|read");
39
46
  return kind.options;
40
47
  }
41
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-clipboard-manager",
3
- "version": "2.0.0-alpha.0",
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.4"
27
+ "@tauri-apps/api": "2.0.0-alpha.9"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "rollup -c"