@tauri-apps/plugin-clipboard-manager 2.1.0-beta.0 → 2.1.0-beta.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/dist-js/index.cjs CHANGED
@@ -25,13 +25,9 @@ var image = require('@tauri-apps/api/image');
25
25
  * @since 2.0.0
26
26
  */
27
27
  async function writeText(text, opts) {
28
- return core.invoke("plugin:clipboard-manager|write_text", {
29
- data: {
30
- plainText: {
31
- label: opts?.label,
32
- text,
33
- },
34
- },
28
+ await core.invoke("plugin:clipboard-manager|write_text", {
29
+ label: opts?.label,
30
+ text,
35
31
  });
36
32
  }
37
33
  /**
@@ -44,23 +40,7 @@ async function writeText(text, opts) {
44
40
  * @since 2.0.0
45
41
  */
46
42
  async function readText() {
47
- const kind = await core.invoke("plugin:clipboard-manager|read_text");
48
- return kind.plainText.text;
49
- }
50
- /**
51
- * Gets the clipboard content as Uint8Array image.
52
- * @example
53
- * ```typescript
54
- * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
55
- *
56
- * const clipboardImage = await readImage();
57
- * const blob = new Blob([clipboardImage.bytes], { type: 'image' })
58
- * const url = URL.createObjectURL(blob)
59
- * ```
60
- * @since 2.0.0
61
- */
62
- async function readImage() {
63
- return await core.invoke("plugin:clipboard-manager|read_image").then((rid) => new image.Image(rid));
43
+ return await core.invoke("plugin:clipboard-manager|read_text");
64
44
  }
65
45
  /**
66
46
  * Writes image buffer to the clipboard.
@@ -81,14 +61,25 @@ async function readImage() {
81
61
  * @since 2.0.0
82
62
  */
83
63
  async function writeImage(image$1) {
84
- return core.invoke("plugin:clipboard-manager|write_image", {
85
- data: {
86
- image: {
87
- image: image.transformImage(image$1),
88
- },
89
- },
64
+ await core.invoke("plugin:clipboard-manager|write_image", {
65
+ image: image.transformImage(image$1),
90
66
  });
91
67
  }
68
+ /**
69
+ * Gets the clipboard content as Uint8Array image.
70
+ * @example
71
+ * ```typescript
72
+ * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
73
+ *
74
+ * const clipboardImage = await readImage();
75
+ * const blob = new Blob([clipboardImage.bytes], { type: 'image' })
76
+ * const url = URL.createObjectURL(blob)
77
+ * ```
78
+ * @since 2.0.0
79
+ */
80
+ async function readImage() {
81
+ return await core.invoke("plugin:clipboard-manager|read_image").then((rid) => new image.Image(rid));
82
+ }
92
83
  /**
93
84
  * * Writes HTML or fallbacks to write provided plain text to the clipboard.
94
85
  * @example
@@ -104,13 +95,9 @@ async function writeImage(image$1) {
104
95
  * @since 2.0.0
105
96
  */
106
97
  async function writeHtml(html, altHtml) {
107
- return core.invoke("plugin:clipboard-manager|write_html", {
108
- data: {
109
- html: {
110
- html,
111
- altHtml,
112
- },
113
- },
98
+ await core.invoke("plugin:clipboard-manager|write_html", {
99
+ html,
100
+ altHtml,
114
101
  });
115
102
  }
116
103
  /**
@@ -124,7 +111,6 @@ async function writeHtml(html, altHtml) {
124
111
  */
125
112
  async function clear() {
126
113
  await core.invoke("plugin:clipboard-manager|clear");
127
- return;
128
114
  }
129
115
 
130
116
  exports.clear = clear;
@@ -25,19 +25,6 @@ declare function writeText(text: string, opts?: {
25
25
  * @since 2.0.0
26
26
  */
27
27
  declare function readText(): Promise<string>;
28
- /**
29
- * Gets the clipboard content as Uint8Array image.
30
- * @example
31
- * ```typescript
32
- * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
33
- *
34
- * const clipboardImage = await readImage();
35
- * const blob = new Blob([clipboardImage.bytes], { type: 'image' })
36
- * const url = URL.createObjectURL(blob)
37
- * ```
38
- * @since 2.0.0
39
- */
40
- declare function readImage(): Promise<Image>;
41
28
  /**
42
29
  * Writes image buffer to the clipboard.
43
30
  * @example
@@ -57,6 +44,19 @@ declare function readImage(): Promise<Image>;
57
44
  * @since 2.0.0
58
45
  */
59
46
  declare function writeImage(image: string | Image | Uint8Array | ArrayBuffer | number[]): Promise<void>;
47
+ /**
48
+ * Gets the clipboard content as Uint8Array image.
49
+ * @example
50
+ * ```typescript
51
+ * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
52
+ *
53
+ * const clipboardImage = await readImage();
54
+ * const blob = new Blob([clipboardImage.bytes], { type: 'image' })
55
+ * const url = URL.createObjectURL(blob)
56
+ * ```
57
+ * @since 2.0.0
58
+ */
59
+ declare function readImage(): Promise<Image>;
60
60
  /**
61
61
  * * Writes HTML or fallbacks to write provided plain text to the clipboard.
62
62
  * @example
package/dist-js/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { invoke } from '@tauri-apps/api/core';
2
- import { Image, transformImage } from '@tauri-apps/api/image';
2
+ import { transformImage, Image } from '@tauri-apps/api/image';
3
3
 
4
4
  // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
5
5
  // SPDX-License-Identifier: Apache-2.0
@@ -23,13 +23,9 @@ import { Image, transformImage } from '@tauri-apps/api/image';
23
23
  * @since 2.0.0
24
24
  */
25
25
  async function writeText(text, opts) {
26
- return invoke("plugin:clipboard-manager|write_text", {
27
- data: {
28
- plainText: {
29
- label: opts?.label,
30
- text,
31
- },
32
- },
26
+ await invoke("plugin:clipboard-manager|write_text", {
27
+ label: opts?.label,
28
+ text,
33
29
  });
34
30
  }
35
31
  /**
@@ -42,23 +38,7 @@ async function writeText(text, opts) {
42
38
  * @since 2.0.0
43
39
  */
44
40
  async function readText() {
45
- const kind = await invoke("plugin:clipboard-manager|read_text");
46
- return kind.plainText.text;
47
- }
48
- /**
49
- * Gets the clipboard content as Uint8Array image.
50
- * @example
51
- * ```typescript
52
- * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
53
- *
54
- * const clipboardImage = await readImage();
55
- * const blob = new Blob([clipboardImage.bytes], { type: 'image' })
56
- * const url = URL.createObjectURL(blob)
57
- * ```
58
- * @since 2.0.0
59
- */
60
- async function readImage() {
61
- return await invoke("plugin:clipboard-manager|read_image").then((rid) => new Image(rid));
41
+ return await invoke("plugin:clipboard-manager|read_text");
62
42
  }
63
43
  /**
64
44
  * Writes image buffer to the clipboard.
@@ -79,14 +59,25 @@ async function readImage() {
79
59
  * @since 2.0.0
80
60
  */
81
61
  async function writeImage(image) {
82
- return invoke("plugin:clipboard-manager|write_image", {
83
- data: {
84
- image: {
85
- image: transformImage(image),
86
- },
87
- },
62
+ await invoke("plugin:clipboard-manager|write_image", {
63
+ image: transformImage(image),
88
64
  });
89
65
  }
66
+ /**
67
+ * Gets the clipboard content as Uint8Array image.
68
+ * @example
69
+ * ```typescript
70
+ * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
71
+ *
72
+ * const clipboardImage = await readImage();
73
+ * const blob = new Blob([clipboardImage.bytes], { type: 'image' })
74
+ * const url = URL.createObjectURL(blob)
75
+ * ```
76
+ * @since 2.0.0
77
+ */
78
+ async function readImage() {
79
+ return await invoke("plugin:clipboard-manager|read_image").then((rid) => new Image(rid));
80
+ }
90
81
  /**
91
82
  * * Writes HTML or fallbacks to write provided plain text to the clipboard.
92
83
  * @example
@@ -102,13 +93,9 @@ async function writeImage(image) {
102
93
  * @since 2.0.0
103
94
  */
104
95
  async function writeHtml(html, altHtml) {
105
- return invoke("plugin:clipboard-manager|write_html", {
106
- data: {
107
- html: {
108
- html,
109
- altHtml,
110
- },
111
- },
96
+ await invoke("plugin:clipboard-manager|write_html", {
97
+ html,
98
+ altHtml,
112
99
  });
113
100
  }
114
101
  /**
@@ -122,7 +109,6 @@ async function writeHtml(html, altHtml) {
122
109
  */
123
110
  async function clear() {
124
111
  await invoke("plugin:clipboard-manager|clear");
125
- return;
126
112
  }
127
113
 
128
114
  export { clear, readImage, readText, writeHtml, writeImage, writeText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-clipboard-manager",
3
- "version": "2.1.0-beta.0",
3
+ "version": "2.1.0-beta.2",
4
4
  "license": "MIT or APACHE-2.0",
5
5
  "authors": [
6
6
  "Tauri Programme within The Commons Conservancy"
@@ -20,7 +20,7 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "dependencies": {
23
- "@tauri-apps/api": "2.0.0-beta.6"
23
+ "@tauri-apps/api": "2.0.0-beta.12"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "rollup -c"