@tauri-apps/plugin-clipboard-manager 3.0.0-alpha.1 → 3.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 CHANGED
@@ -12,7 +12,7 @@ Read and write to the system clipboard.
12
12
 
13
13
  ## Install
14
14
 
15
- _This plugin requires a Rust version of at least **1.77.2**_
15
+ _This plugin requires a Rust version of at least **1.95**_
16
16
 
17
17
  There are three general methods of installation that we can recommend.
18
18
 
package/dist-js/index.cjs CHANGED
@@ -20,6 +20,9 @@ var image = require('@tauri-apps/api/image');
20
20
  * assert(await readText(), 'Tauri is awesome!');
21
21
  * ```
22
22
  *
23
+ * @param text The plain text to write to the clipboard.
24
+ * @param opts Additional configuration for the write operation.
25
+ * @param opts.label A label describing the copied content. **Android only**, ignored on other platforms.
23
26
  * @returns A promise indicating the success or failure of the operation.
24
27
  *
25
28
  * @since 2.0.0
@@ -37,6 +40,7 @@ async function writeText(text, opts) {
37
40
  * import { readText } from '@tauri-apps/plugin-clipboard-manager';
38
41
  * const clipboardText = await readText();
39
42
  * ```
43
+ * @returns A promise resolving to the clipboard contents as plain text.
40
44
  * @since 2.0.0
41
45
  */
42
46
  async function readText() {
@@ -62,6 +66,7 @@ async function readText() {
62
66
  * await writeImage(buffer);
63
67
  * ```
64
68
  *
69
+ * @param image The image to write, as a path, raw RGBA bytes, or an existing {@link Image}.
65
70
  * @returns A promise indicating the success or failure of the operation.
66
71
  *
67
72
  * @since 2.0.0
@@ -86,6 +91,7 @@ async function writeImage(image$1) {
86
91
  * const blob = new Blob([await clipboardImage.rgba()], { type: 'image' })
87
92
  * const url = URL.createObjectURL(blob)
88
93
  * ```
94
+ * @returns A promise resolving to the clipboard contents as an {@link Image}.
89
95
  * @since 2.0.0
90
96
  */
91
97
  async function readImage() {
@@ -108,6 +114,8 @@ async function readImage() {
108
114
  * assert(await readText(), '<h1>Tauri is awesome!</h1>');
109
115
  * ```
110
116
  *
117
+ * @param html The HTML markup to write to the clipboard.
118
+ * @param altText The plain text fallback written alongside the HTML, used by targets that cannot render it.
111
119
  * @returns A promise indicating the success or failure of the operation.
112
120
  *
113
121
  * @since 2.0.0
@@ -135,10 +143,33 @@ async function writeHtml(html, altText) {
135
143
  async function clear() {
136
144
  await core.invoke('plugin:clipboard-manager|clear');
137
145
  }
146
+ /**
147
+ * Writes sensitive plain text, such as a password, to the clipboard.
148
+ *
149
+ * The text is marked so the system doesn't keep or share it: on Windows it is excluded from
150
+ * clipboard history and cloud sync, on macOS and Linux clipboard managers are asked to skip it,
151
+ * on Android it is flagged as sensitive so the clipboard preview hides it,
152
+ * and on iOS it is not synced to other devices.
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * import { writeSecret } from '@tauri-apps/plugin-clipboard-manager';
157
+ * await writeSecret('my-password');
158
+ * ```
159
+ *
160
+ * @param text The plain text to write to the clipboard.
161
+ * @returns A promise indicating the success or failure of the operation.
162
+ *
163
+ * @since 2.5.0
164
+ */
165
+ async function writeSecret(text) {
166
+ await core.invoke('plugin:clipboard-manager|write_secret', { text });
167
+ }
138
168
 
139
169
  exports.clear = clear;
140
170
  exports.readImage = readImage;
141
171
  exports.readText = readText;
142
172
  exports.writeHtml = writeHtml;
143
173
  exports.writeImage = writeImage;
174
+ exports.writeSecret = writeSecret;
144
175
  exports.writeText = writeText;
@@ -8,6 +8,9 @@ import { Image } from '@tauri-apps/api/image';
8
8
  * assert(await readText(), 'Tauri is awesome!');
9
9
  * ```
10
10
  *
11
+ * @param text The plain text to write to the clipboard.
12
+ * @param opts Additional configuration for the write operation.
13
+ * @param opts.label A label describing the copied content. **Android only**, ignored on other platforms.
11
14
  * @returns A promise indicating the success or failure of the operation.
12
15
  *
13
16
  * @since 2.0.0
@@ -22,6 +25,7 @@ declare function writeText(text: string, opts?: {
22
25
  * import { readText } from '@tauri-apps/plugin-clipboard-manager';
23
26
  * const clipboardText = await readText();
24
27
  * ```
28
+ * @returns A promise resolving to the clipboard contents as plain text.
25
29
  * @since 2.0.0
26
30
  */
27
31
  declare function readText(): Promise<string>;
@@ -45,6 +49,7 @@ declare function readText(): Promise<string>;
45
49
  * await writeImage(buffer);
46
50
  * ```
47
51
  *
52
+ * @param image The image to write, as a path, raw RGBA bytes, or an existing {@link Image}.
48
53
  * @returns A promise indicating the success or failure of the operation.
49
54
  *
50
55
  * @since 2.0.0
@@ -65,6 +70,7 @@ declare function writeImage(image: string | Image | Uint8Array | ArrayBuffer | n
65
70
  * const blob = new Blob([await clipboardImage.rgba()], { type: 'image' })
66
71
  * const url = URL.createObjectURL(blob)
67
72
  * ```
73
+ * @returns A promise resolving to the clipboard contents as an {@link Image}.
68
74
  * @since 2.0.0
69
75
  */
70
76
  declare function readImage(): Promise<Image>;
@@ -85,6 +91,8 @@ declare function readImage(): Promise<Image>;
85
91
  * assert(await readText(), '<h1>Tauri is awesome!</h1>');
86
92
  * ```
87
93
  *
94
+ * @param html The HTML markup to write to the clipboard.
95
+ * @param altText The plain text fallback written alongside the HTML, used by targets that cannot render it.
88
96
  * @returns A promise indicating the success or failure of the operation.
89
97
  *
90
98
  * @since 2.0.0
@@ -105,4 +113,24 @@ declare function writeHtml(html: string, altText?: string): Promise<void>;
105
113
  * @since 2.0.0
106
114
  */
107
115
  declare function clear(): Promise<void>;
108
- export { writeText, readText, writeHtml, clear, readImage, writeImage };
116
+ /**
117
+ * Writes sensitive plain text, such as a password, to the clipboard.
118
+ *
119
+ * The text is marked so the system doesn't keep or share it: on Windows it is excluded from
120
+ * clipboard history and cloud sync, on macOS and Linux clipboard managers are asked to skip it,
121
+ * on Android it is flagged as sensitive so the clipboard preview hides it,
122
+ * and on iOS it is not synced to other devices.
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * import { writeSecret } from '@tauri-apps/plugin-clipboard-manager';
127
+ * await writeSecret('my-password');
128
+ * ```
129
+ *
130
+ * @param text The plain text to write to the clipboard.
131
+ * @returns A promise indicating the success or failure of the operation.
132
+ *
133
+ * @since 2.5.0
134
+ */
135
+ declare function writeSecret(text: string): Promise<void>;
136
+ export { writeText, readText, writeHtml, clear, readImage, writeImage, writeSecret };
package/dist-js/index.js CHANGED
@@ -18,6 +18,9 @@ import { transformImage, Image } from '@tauri-apps/api/image';
18
18
  * assert(await readText(), 'Tauri is awesome!');
19
19
  * ```
20
20
  *
21
+ * @param text The plain text to write to the clipboard.
22
+ * @param opts Additional configuration for the write operation.
23
+ * @param opts.label A label describing the copied content. **Android only**, ignored on other platforms.
21
24
  * @returns A promise indicating the success or failure of the operation.
22
25
  *
23
26
  * @since 2.0.0
@@ -35,6 +38,7 @@ async function writeText(text, opts) {
35
38
  * import { readText } from '@tauri-apps/plugin-clipboard-manager';
36
39
  * const clipboardText = await readText();
37
40
  * ```
41
+ * @returns A promise resolving to the clipboard contents as plain text.
38
42
  * @since 2.0.0
39
43
  */
40
44
  async function readText() {
@@ -60,6 +64,7 @@ async function readText() {
60
64
  * await writeImage(buffer);
61
65
  * ```
62
66
  *
67
+ * @param image The image to write, as a path, raw RGBA bytes, or an existing {@link Image}.
63
68
  * @returns A promise indicating the success or failure of the operation.
64
69
  *
65
70
  * @since 2.0.0
@@ -84,6 +89,7 @@ async function writeImage(image) {
84
89
  * const blob = new Blob([await clipboardImage.rgba()], { type: 'image' })
85
90
  * const url = URL.createObjectURL(blob)
86
91
  * ```
92
+ * @returns A promise resolving to the clipboard contents as an {@link Image}.
87
93
  * @since 2.0.0
88
94
  */
89
95
  async function readImage() {
@@ -106,6 +112,8 @@ async function readImage() {
106
112
  * assert(await readText(), '<h1>Tauri is awesome!</h1>');
107
113
  * ```
108
114
  *
115
+ * @param html The HTML markup to write to the clipboard.
116
+ * @param altText The plain text fallback written alongside the HTML, used by targets that cannot render it.
109
117
  * @returns A promise indicating the success or failure of the operation.
110
118
  *
111
119
  * @since 2.0.0
@@ -133,5 +141,27 @@ async function writeHtml(html, altText) {
133
141
  async function clear() {
134
142
  await invoke('plugin:clipboard-manager|clear');
135
143
  }
144
+ /**
145
+ * Writes sensitive plain text, such as a password, to the clipboard.
146
+ *
147
+ * The text is marked so the system doesn't keep or share it: on Windows it is excluded from
148
+ * clipboard history and cloud sync, on macOS and Linux clipboard managers are asked to skip it,
149
+ * on Android it is flagged as sensitive so the clipboard preview hides it,
150
+ * and on iOS it is not synced to other devices.
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * import { writeSecret } from '@tauri-apps/plugin-clipboard-manager';
155
+ * await writeSecret('my-password');
156
+ * ```
157
+ *
158
+ * @param text The plain text to write to the clipboard.
159
+ * @returns A promise indicating the success or failure of the operation.
160
+ *
161
+ * @since 2.5.0
162
+ */
163
+ async function writeSecret(text) {
164
+ await invoke('plugin:clipboard-manager|write_secret', { text });
165
+ }
136
166
 
137
- export { clear, readImage, readText, writeHtml, writeImage, writeText };
167
+ export { clear, readImage, readText, writeHtml, writeImage, writeSecret, writeText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-clipboard-manager",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "license": "MIT OR Apache-2.0",
5
5
  "authors": [
6
6
  "Tauri Programme within The Commons Conservancy"
@@ -24,6 +24,6 @@
24
24
  "LICENSE"
25
25
  ],
26
26
  "dependencies": {
27
- "@tauri-apps/api": "^3.0.0-alpha.1"
27
+ "@tauri-apps/api": "^3.0.0-alpha.2"
28
28
  }
29
29
  }