@tauri-apps/plugin-clipboard-manager 2.0.0-alpha.0

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/LICENSE.spdx ADDED
@@ -0,0 +1,20 @@
1
+ SPDXVersion: SPDX-2.1
2
+ DataLicense: CC0-1.0
3
+ PackageName: tauri
4
+ DataFormat: SPDXRef-1
5
+ PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
6
+ PackageHomePage: https://tauri.app
7
+ PackageLicenseDeclared: Apache-2.0
8
+ PackageLicenseDeclared: MIT
9
+ PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy
10
+ PackageSummary: <text>Tauri is a rust project that enables developers to make secure
11
+ and small desktop applications using a web frontend.
12
+ </text>
13
+ PackageComment: <text>The package includes the following libraries; see
14
+ Relationship information.
15
+ </text>
16
+ Created: 2019-05-20T09:00:00Z
17
+ PackageDownloadLocation: git://github.com/tauri-apps/tauri
18
+ PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git
19
+ PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git
20
+ Creator: Person: Daniel Thompson-Yvetot
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # Clipboard Manager
2
+
3
+ Read and write to the system clipboard.
4
+
5
+ ## Install
6
+
7
+ _This plugin requires a Rust version of at least **1.65**_
8
+
9
+ There are three general methods of installation that we can recommend.
10
+
11
+ 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
12
+ 2. Pull sources directly from Github using git tags / revision hashes (most secure)
13
+ 3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
14
+
15
+ Install the Core plugin by adding the following to your `Cargo.toml` file:
16
+
17
+ `src-tauri/Cargo.toml`
18
+
19
+ ```toml
20
+ [dependencies]
21
+ tauri-plugin-clipboard-manager = "2.0.0-alpha"
22
+ # alternatively with Git:
23
+ tauri-plugin-clipboard-manager = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
24
+ ```
25
+
26
+ You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
27
+
28
+ > Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
29
+
30
+ ```sh
31
+ pnpm add @tauri-apps/plugin-clipboard-manager
32
+ # or
33
+ npm add @tauri-apps/plugin-clipboard-manager
34
+ # or
35
+ yarn add @tauri-apps/plugin-clipboard-manager
36
+
37
+ # alternatively with Git:
38
+ pnpm add https://github.com/tauri-apps/tauri-plugin-clipboard-manager#v2
39
+ # or
40
+ npm add https://github.com/tauri-apps/tauri-plugin-clipboard-manager#v2
41
+ # or
42
+ yarn add https://github.com/tauri-apps/tauri-plugin-clipboard-manager#v2
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ First you need to register the core plugin with Tauri:
48
+
49
+ `src-tauri/src/main.rs`
50
+
51
+ ```rust
52
+ fn main() {
53
+ tauri::Builder::default()
54
+ .plugin(tauri_plugin_clipboard_manager::init())
55
+ .run(tauri::generate_context!())
56
+ .expect("error while running tauri application");
57
+ }
58
+ ```
59
+
60
+ Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
61
+
62
+ ```javascript
63
+ import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
64
+ await writeText("Tauri is awesome!");
65
+ assert(await readText(), "Tauri is awesome!");
66
+ ```
67
+
68
+ ## Contributing
69
+
70
+ PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
71
+
72
+ ## License
73
+
74
+ Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
75
+
76
+ MIT or MIT/Apache 2.0 where applicable.
@@ -0,0 +1,37 @@
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
+ /**
12
+ * Writes plain text to the clipboard.
13
+ * @example
14
+ * ```typescript
15
+ * import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
16
+ * await writeText('Tauri is awesome!');
17
+ * assert(await readText(), 'Tauri is awesome!');
18
+ * ```
19
+ *
20
+ * @returns A promise indicating the success or failure of the operation.
21
+ *
22
+ * @since 2.0.0
23
+ */
24
+ declare function writeText(text: string, opts?: {
25
+ label?: string;
26
+ }): Promise<void>;
27
+ /**
28
+ * Gets the clipboard content as plain text.
29
+ * @example
30
+ * ```typescript
31
+ * import { readText } from '@tauri-apps/plugin-clipboard-manager';
32
+ * const clipboardText = await readText();
33
+ * ```
34
+ * @since 2.0.0
35
+ */
36
+ declare function readText(): Promise<string>;
37
+ export { writeText, readText };
@@ -0,0 +1,43 @@
1
+ // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-License-Identifier: MIT
4
+ /**
5
+ * Writes plain text to the clipboard.
6
+ * @example
7
+ * ```typescript
8
+ * import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
9
+ * await writeText('Tauri is awesome!');
10
+ * assert(await readText(), 'Tauri is awesome!');
11
+ * ```
12
+ *
13
+ * @returns A promise indicating the success or failure of the operation.
14
+ *
15
+ * @since 2.0.0
16
+ */
17
+ async function writeText(text, opts) {
18
+ return window.__TAURI_INVOKE__("plugin:clipboard|write", {
19
+ data: {
20
+ kind: "PlainText",
21
+ options: {
22
+ label: opts === null || opts === void 0 ? void 0 : opts.label,
23
+ text,
24
+ },
25
+ },
26
+ });
27
+ }
28
+ /**
29
+ * Gets the clipboard content as plain text.
30
+ * @example
31
+ * ```typescript
32
+ * import { readText } from '@tauri-apps/plugin-clipboard-manager';
33
+ * const clipboardText = await readText();
34
+ * ```
35
+ * @since 2.0.0
36
+ */
37
+ async function readText() {
38
+ const kind = await window.__TAURI_INVOKE__("plugin:clipboard|read");
39
+ return kind.options;
40
+ }
41
+
42
+ export { readText, writeText };
43
+ //# sourceMappingURL=index.min.js.map
@@ -0,0 +1,43 @@
1
+ // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-License-Identifier: MIT
4
+ /**
5
+ * Writes plain text to the clipboard.
6
+ * @example
7
+ * ```typescript
8
+ * import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
9
+ * await writeText('Tauri is awesome!');
10
+ * assert(await readText(), 'Tauri is awesome!');
11
+ * ```
12
+ *
13
+ * @returns A promise indicating the success or failure of the operation.
14
+ *
15
+ * @since 2.0.0
16
+ */
17
+ async function writeText(text, opts) {
18
+ return window.__TAURI_INVOKE__("plugin:clipboard|write", {
19
+ data: {
20
+ kind: "PlainText",
21
+ options: {
22
+ label: opts === null || opts === void 0 ? void 0 : opts.label,
23
+ text,
24
+ },
25
+ },
26
+ });
27
+ }
28
+ /**
29
+ * Gets the clipboard content as plain text.
30
+ * @example
31
+ * ```typescript
32
+ * import { readText } from '@tauri-apps/plugin-clipboard-manager';
33
+ * const clipboardText = await readText();
34
+ * ```
35
+ * @since 2.0.0
36
+ */
37
+ async function readText() {
38
+ const kind = await window.__TAURI_INVOKE__("plugin:clipboard|read");
39
+ return kind.options;
40
+ }
41
+
42
+ export { readText, writeText };
43
+ //# sourceMappingURL=index.mjs.map
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@tauri-apps/plugin-clipboard-manager",
3
+ "version": "2.0.0-alpha.0",
4
+ "license": "MIT or APACHE-2.0",
5
+ "authors": [
6
+ "Tauri Programme within The Commons Conservancy"
7
+ ],
8
+ "type": "module",
9
+ "browser": "dist-js/index.min.js",
10
+ "module": "dist-js/index.mjs",
11
+ "types": "dist-js/index.d.ts",
12
+ "exports": {
13
+ "import": "./dist-js/index.mjs",
14
+ "types": "./dist-js/index.d.ts",
15
+ "browser": "./dist-js/index.min.js"
16
+ },
17
+ "files": [
18
+ "dist-js",
19
+ "!dist-js/**/*.map",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "devDependencies": {
24
+ "tslib": "^2.4.1"
25
+ },
26
+ "dependencies": {
27
+ "@tauri-apps/api": "2.0.0-alpha.4"
28
+ },
29
+ "scripts": {
30
+ "build": "rollup -c"
31
+ }
32
+ }