@choochmeque/tauri-plugin-sharekit-api 0.1.2 → 0.1.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
@@ -1,3 +1,9 @@
1
+ [![npm](https://img.shields.io/npm/v/@choochmeque/tauri-plugin-sharekit-api.svg)](https://www.npmjs.com/package/@choochmeque/tauri-plugin-sharekit-api)
2
+ [![Crates.io](https://img.shields.io/crates/v/tauri-plugin-sharekit.svg)](https://crates.io/crates/tauri-plugin-sharekit)
3
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Choochmeque/tauri-plugin-sharekit/blob/main/LICENSE)
4
+
5
+ # Tauri Plugin ShareKit
6
+
1
7
  Share content to other apps via native Android and iOS sharing interfaces.
2
8
 
3
9
  ## Install
@@ -16,8 +22,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
16
22
 
17
23
  ```toml
18
24
  [dependencies]
19
- tauri-plugin-sharekit = "0.1.0"
20
- # alternatively with Git:
25
+ tauri-plugin-sharekit = "0.1"
26
+ # alternatively with Git:
21
27
  tauri-plugin-sharekit = { git = "https://github.com/Choochmeque/tauri-plugin-sharekit" }
22
28
  ```
23
29
 
@@ -51,7 +57,7 @@ First you need to register the core plugin with Tauri:
51
57
  ```rust
52
58
  fn main() {
53
59
  tauri::Builder::default()
54
- .plugin(tauri_plugin_sharesheet::init())
60
+ .plugin(tauri_plugin_sharekit::init())
55
61
  .run(tauri::generate_context!())
56
62
  .expect("error while running tauri application");
57
63
  }
@@ -78,4 +84,4 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
78
84
 
79
85
  ## License
80
86
 
81
- MIT or APACHE-2.0
87
+ MIT
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ var core = require('@tauri-apps/api/core');
4
+
5
+ /**
6
+ * Opens the native sharing interface to share the specified text.
7
+ *
8
+ * ```javascript
9
+ * import { shareText } from "@choochmeque/tauri-plugin-sharekit-api";
10
+ * await shareText('I am a shared message');
11
+ * ```
12
+ * @param text
13
+ * @param options
14
+ * @returns
15
+ */
16
+ async function shareText(text, options) {
17
+ await core.invoke("plugin:share|share_text", {
18
+ text,
19
+ ...options,
20
+ });
21
+ }
22
+ /**
23
+ * Opens the native sharing interface to share a file.
24
+ *
25
+ * ```javascript
26
+ * import { shareFile } from "@choochmeque/tauri-plugin-sharekit-api";
27
+ * await shareFile('file:///path/to/file.pdf', {
28
+ * mimeType: 'application/pdf',
29
+ * title: 'Document.pdf'
30
+ * });
31
+ * ```
32
+ * @param url - The file URL to share (must be a file:// URL)
33
+ * @param options - Optional settings including MIME type and title
34
+ * @returns
35
+ */
36
+ async function shareFile(url, options) {
37
+ await core.invoke("plugin:share|share_file", {
38
+ url,
39
+ ...options,
40
+ });
41
+ }
42
+
43
+ exports.shareFile = shareFile;
44
+ exports.shareText = shareText;
@@ -0,0 +1,34 @@
1
+ export interface ShareTextOptions {
2
+ mimeType?: string;
3
+ }
4
+ export interface ShareFileOptions {
5
+ mimeType?: string;
6
+ title?: string;
7
+ }
8
+ /**
9
+ * Opens the native sharing interface to share the specified text.
10
+ *
11
+ * ```javascript
12
+ * import { shareText } from "@choochmeque/tauri-plugin-sharekit-api";
13
+ * await shareText('I am a shared message');
14
+ * ```
15
+ * @param text
16
+ * @param options
17
+ * @returns
18
+ */
19
+ export declare function shareText(text: string, options?: ShareTextOptions): Promise<void>;
20
+ /**
21
+ * Opens the native sharing interface to share a file.
22
+ *
23
+ * ```javascript
24
+ * import { shareFile } from "@choochmeque/tauri-plugin-sharekit-api";
25
+ * await shareFile('file:///path/to/file.pdf', {
26
+ * mimeType: 'application/pdf',
27
+ * title: 'Document.pdf'
28
+ * });
29
+ * ```
30
+ * @param url - The file URL to share (must be a file:// URL)
31
+ * @param options - Optional settings including MIME type and title
32
+ * @returns
33
+ */
34
+ export declare function shareFile(url: string, options?: ShareFileOptions): Promise<void>;
@@ -0,0 +1,41 @@
1
+ import { invoke } from '@tauri-apps/api/core';
2
+
3
+ /**
4
+ * Opens the native sharing interface to share the specified text.
5
+ *
6
+ * ```javascript
7
+ * import { shareText } from "@choochmeque/tauri-plugin-sharekit-api";
8
+ * await shareText('I am a shared message');
9
+ * ```
10
+ * @param text
11
+ * @param options
12
+ * @returns
13
+ */
14
+ async function shareText(text, options) {
15
+ await invoke("plugin:share|share_text", {
16
+ text,
17
+ ...options,
18
+ });
19
+ }
20
+ /**
21
+ * Opens the native sharing interface to share a file.
22
+ *
23
+ * ```javascript
24
+ * import { shareFile } from "@choochmeque/tauri-plugin-sharekit-api";
25
+ * await shareFile('file:///path/to/file.pdf', {
26
+ * mimeType: 'application/pdf',
27
+ * title: 'Document.pdf'
28
+ * });
29
+ * ```
30
+ * @param url - The file URL to share (must be a file:// URL)
31
+ * @param options - Optional settings including MIME type and title
32
+ * @returns
33
+ */
34
+ async function shareFile(url, options) {
35
+ await invoke("plugin:share|share_file", {
36
+ url,
37
+ ...options,
38
+ });
39
+ }
40
+
41
+ export { shareFile, shareText };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-plugin-sharekit-api",
3
- "version": "0.1.2",
4
- "license": "MIT or APACHE-2.0",
5
- "authors": "you",
3
+ "version": "0.1.4",
4
+ "license": "MIT",
5
+ "author": "You",
6
6
  "description": "A Tauri v2 plugin that enables sharing content with the Android and iOS native sharing interfaces.",
7
7
  "type": "module",
8
8
  "types": "./dist-js/index.d.ts",
@@ -27,33 +27,31 @@
27
27
  "homepage": "https://github.com/Choochmeque/tauri-plugin-sharekit#readme",
28
28
  "files": [
29
29
  "dist-js",
30
- "!dist-js/**/*.map",
31
- "README.md",
32
- "LICENSE"
30
+ "README.md"
33
31
  ],
32
+ "directories": {
33
+ "example": "examples"
34
+ },
34
35
  "dependencies": {
35
36
  "@tauri-apps/api": "^2.6.0"
36
37
  },
37
38
  "devDependencies": {
38
- "@eslint/js": "9.9.0",
39
- "@rollup/plugin-node-resolve": "16.0.1",
40
- "@rollup/plugin-terser": "0.4.4",
41
- "@rollup/plugin-typescript": "12.1.4",
42
- "@types/eslint__js": "8.42.3",
43
- "covector": "^0.12.0",
44
- "eslint": "9.34.0",
45
- "eslint-config-prettier": "9.1.0",
46
- "eslint-plugin-security": "3.0.1",
39
+ "@eslint/js": "9.35.0",
40
+ "@rollup/plugin-typescript": "^12.1.4",
41
+ "rollup": "^4.9.6",
42
+ "tslib": "^2.6.2",
43
+ "typescript": "^5.3.3",
47
44
  "prettier": "3.6.2",
48
- "rollup": "4.21.0",
49
- "tslib": "2.6.3",
50
- "typescript": "5.9.2",
51
- "typescript-eslint": "8.41.0"
45
+ "eslint": "9.35.0",
46
+ "eslint-config-prettier": "10.1.8",
47
+ "eslint-plugin-security": "3.0.1",
48
+ "typescript-eslint": "8.43.0"
52
49
  },
53
50
  "scripts": {
54
51
  "build": "rollup -c",
52
+ "pretest": "pnpm build",
55
53
  "lint": "eslint .",
56
- "format": "prettier --write \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore",
57
- "format-check": "prettier --check \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore"
54
+ "format": "prettier --write \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\"",
55
+ "format-check": "prettier --check \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\""
58
56
  }
59
57
  }