@tauri-apps/plugin-clipboard-manager 2.0.0-alpha.3 → 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 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;
@@ -25,7 +25,7 @@ async function writeText(text, opts) {
25
25
  return invoke("plugin:clipboard|write", {
26
26
  data: {
27
27
  plainText: {
28
- label: opts === null || opts === void 0 ? void 0 : opts.label,
28
+ label: opts?.label,
29
29
  text,
30
30
  },
31
31
  },
@@ -46,4 +46,3 @@ async function readText() {
46
46
  }
47
47
 
48
48
  export { readText, writeText };
49
- //# 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",
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
- "browser": "dist-js/index.min.js",
10
- "module": "dist-js/index.mjs",
11
- "types": "dist-js/index.d.ts",
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
- "browser": "./dist-js/index.min.js"
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.11"
23
+ "@tauri-apps/api": "2.0.0-alpha.12"
28
24
  },
29
25
  "scripts": {
30
26
  "build": "rollup -c"
@@ -1,88 +0,0 @@
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
-
42
- // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
43
- // SPDX-License-Identifier: Apache-2.0
44
- // SPDX-License-Identifier: MIT
45
- /**
46
- * Read and write to the system clipboard.
47
- *
48
- * @module
49
- */
50
- /**
51
- * Writes plain text to the clipboard.
52
- * @example
53
- * ```typescript
54
- * import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
55
- * await writeText('Tauri is awesome!');
56
- * assert(await readText(), 'Tauri is awesome!');
57
- * ```
58
- *
59
- * @returns A promise indicating the success or failure of the operation.
60
- *
61
- * @since 2.0.0
62
- */
63
- async function writeText(text, opts) {
64
- return invoke("plugin:clipboard|write", {
65
- data: {
66
- plainText: {
67
- label: opts === null || opts === void 0 ? void 0 : opts.label,
68
- text,
69
- },
70
- },
71
- });
72
- }
73
- /**
74
- * Gets the clipboard content as plain text.
75
- * @example
76
- * ```typescript
77
- * import { readText } from '@tauri-apps/plugin-clipboard-manager';
78
- * const clipboardText = await readText();
79
- * ```
80
- * @since 2.0.0
81
- */
82
- async function readText() {
83
- const kind = await invoke("plugin:clipboard|read");
84
- return kind.plainText.text;
85
- }
86
-
87
- export { readText, writeText };
88
- //# sourceMappingURL=index.min.js.map