@choochmeque/tauri-plugin-sharekit-api 0.1.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 +21 -0
- package/README.md +81 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Matt Gabrenya
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Share content to other apps via native Android and iOS sharing interfaces.
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
_This plugin requires a Rust version of at least **1.65**_
|
|
6
|
+
|
|
7
|
+
There are three general methods of installation that we can recommend.
|
|
8
|
+
|
|
9
|
+
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
|
10
|
+
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
|
11
|
+
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)
|
|
12
|
+
|
|
13
|
+
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
|
14
|
+
|
|
15
|
+
`src-tauri/Cargo.toml`
|
|
16
|
+
|
|
17
|
+
```toml
|
|
18
|
+
[dependencies]
|
|
19
|
+
tauri-plugin-sharekit = "0.1.0"
|
|
20
|
+
# alternatively with Git:
|
|
21
|
+
tauri-plugin-sharekit = { git = "https://github.com/Choochmeque/tauri-plugin-sharekit" }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
|
25
|
+
|
|
26
|
+
> 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.
|
|
27
|
+
|
|
28
|
+
<!-- Add the branch for installations using git! -->
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pnpm add @choochmeque/tauri-plugin-sharekit-api
|
|
32
|
+
# or
|
|
33
|
+
npm add @choochmeque/tauri-plugin-sharekit-api
|
|
34
|
+
# or
|
|
35
|
+
yarn add @choochmeque/tauri-plugin-sharekit-api
|
|
36
|
+
|
|
37
|
+
# alternatively with Git:
|
|
38
|
+
pnpm add https://github.com/Choochmeque/tauri-plugin-sharekit
|
|
39
|
+
# or
|
|
40
|
+
npm add https://github.com/Choochmeque/tauri-plugin-sharekit
|
|
41
|
+
# or
|
|
42
|
+
yarn add https://github.com/Choochmeque/tauri-plugin-sharekit
|
|
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_sharesheet::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 { shareText, shareFile } from "@choochmeque/tauri-plugin-sharekit-api";
|
|
64
|
+
|
|
65
|
+
// Share text
|
|
66
|
+
await shareText('Tauri is great!');
|
|
67
|
+
|
|
68
|
+
// Share a file
|
|
69
|
+
await shareFile('file:///path/to/document.pdf', {
|
|
70
|
+
mimeType: 'application/pdf',
|
|
71
|
+
title: 'My Document'
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Contributing
|
|
76
|
+
|
|
77
|
+
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT or APACHE-2.0
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@choochmeque/tauri-plugin-sharekit-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT or APACHE-2.0",
|
|
5
|
+
"authors": "you",
|
|
6
|
+
"description": "A Tauri v2 plugin that enables sharing content with the Android and iOS native sharing interfaces.",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"types": "./dist-js/index.d.ts",
|
|
9
|
+
"main": "./dist-js/index.cjs",
|
|
10
|
+
"module": "./dist-js/index.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
"types": "./dist-js/index.d.ts",
|
|
13
|
+
"import": "./dist-js/index.js",
|
|
14
|
+
"require": "./dist-js/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/Choochmeque/tauri-plugin-sharekit.git"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"tauri",
|
|
22
|
+
"share"
|
|
23
|
+
],
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Choochmeque/tauri-plugin-sharekit/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/Choochmeque/tauri-plugin-sharekit#readme",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist-js",
|
|
30
|
+
"!dist-js/**/*.map",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@tauri-apps/api": "^2.6.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@eslint/js": "9.9.0",
|
|
39
|
+
"@rollup/plugin-node-resolve": "15.2.3",
|
|
40
|
+
"@rollup/plugin-terser": "0.4.4",
|
|
41
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
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",
|
|
47
|
+
"prettier": "3.6.2",
|
|
48
|
+
"rollup": "4.21.0",
|
|
49
|
+
"tslib": "2.6.3",
|
|
50
|
+
"typescript": "5.9.2",
|
|
51
|
+
"typescript-eslint": "8.1.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "rollup -c",
|
|
55
|
+
"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"
|
|
58
|
+
}
|
|
59
|
+
}
|