@choochmeque/tauri-plugin-sharekit-api 0.1.3 → 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/dist-js/index.cjs +44 -0
- package/dist-js/index.d.ts +34 -0
- package/dist-js/index.js +41 -0
- package/package.json +14 -15
|
@@ -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>;
|
package/dist-js/index.js
ADDED
|
@@ -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.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"
|
|
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,32 +27,31 @@
|
|
|
27
27
|
"homepage": "https://github.com/Choochmeque/tauri-plugin-sharekit#readme",
|
|
28
28
|
"files": [
|
|
29
29
|
"dist-js",
|
|
30
|
-
"
|
|
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
39
|
"@eslint/js": "9.35.0",
|
|
39
|
-
"@rollup/plugin-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
40
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
41
|
+
"rollup": "^4.9.6",
|
|
42
|
+
"tslib": "^2.6.2",
|
|
43
|
+
"typescript": "^5.3.3",
|
|
44
|
+
"prettier": "3.6.2",
|
|
43
45
|
"eslint": "9.35.0",
|
|
44
46
|
"eslint-config-prettier": "10.1.8",
|
|
45
47
|
"eslint-plugin-security": "3.0.1",
|
|
46
|
-
"prettier": "3.6.2",
|
|
47
|
-
"rollup": "4.50.1",
|
|
48
|
-
"tslib": "2.8.1",
|
|
49
|
-
"typescript": "5.9.2",
|
|
50
48
|
"typescript-eslint": "8.43.0"
|
|
51
49
|
},
|
|
52
50
|
"scripts": {
|
|
53
51
|
"build": "rollup -c",
|
|
52
|
+
"pretest": "pnpm build",
|
|
54
53
|
"lint": "eslint .",
|
|
55
|
-
"format": "prettier --write \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\"
|
|
56
|
-
"format-check": "prettier --check \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\"
|
|
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}\""
|
|
57
56
|
}
|
|
58
57
|
}
|