@mytools-all/mytools-demo 0.0.0-stage → 0.1.2

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MyTools Contributors
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 CHANGED
@@ -1,3 +1,33 @@
1
- # Temporary Holding Version
1
+ # mytools-demo
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MyTools 统一示例:复制和读取剪贴板、打开链接、读取系统路径、列出应用。
4
+
5
+ 版本:0.1.1;适用于 MyTools,不能作为独立网页调用宿主能力。
6
+
7
+ ## 安装
8
+
9
+ 在 MyTools 插件商店搜索 MyTools Demo,或在开发者页面的 npm 安装入口输入 `@mytools-all/mytools-demo@0.1.1`。源码开发可运行 `npm pack` 后安装生成的 tgz;也可将完整源码目录放到“打开插件目录”指向的根目录后“重新扫描”。
10
+
11
+ ## 开发
12
+
13
+ 直接编辑本目录的 HTML、JavaScript 和样式,无需依赖宿主源码或其他插件仓库。修改后重新安装本地目录。运行 `npm test` 检查包内契约和逻辑。插件 API 规范见 [mytools](https://github.com/mytools-all/mytools/tree/main/docs)。
14
+
15
+ ## 权限
16
+
17
+ 声明的宿主能力:clipboard.write、clipboard.read、shell.open、system.path、app.list。目录和危险操作仍需用户授权。
18
+
19
+ ## 许可
20
+
21
+ 项目代码使用 MIT;随附的第三方代码遵循各自随附的许可证。
22
+
23
+ 此插件已合并原 mytools-hello 的读取剪贴板和应用列表演示,统一维护五项示例功能。涉及权限的调用仍由宿主确认。
24
+
25
+ 发布状态以 [项目索引](https://github.com/mytools-all/mytools-home/blob/main/plugins/database.json) 的 published 字段为准;未发布时请先安装源码目录。
26
+
27
+ ## 作为开发案例
28
+
29
+ 完整入门见 [插件开发指南](https://github.com/mytools-all/mytools/blob/main/docs/plugin-development/README.md) 与 [Demo 逐步说明](https://github.com/mytools-all/mytools/blob/main/docs/plugin-development/demo-walkthrough.md)。源码中五个按钮共用 call/catch,不依赖宿主源码。浏览器预览没有桥接,不能使用系统能力;真实验证请安装到宿主。
30
+
31
+ ## MyTools 兼容范围
32
+
33
+ 版本 0.1.2 声明支持 MyTools >=0.2.0 <0.3.0(0.2.x 稳定版),插件 API 为 v1。主程序超出范围时应更新插件或使用受支持的主程序版本。旧版主程序可能不识别此声明,请先升级到提供兼容检查的 MyTools。
package/icon.svg ADDED
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <rect width="64" height="64" rx="12" fill="#4c6ef5"/>
3
+ <text x="32" y="42" font-size="30" text-anchor="middle" fill="#fff" font-family="sans-serif">◆</text>
4
+ </svg>
package/index.html ADDED
@@ -0,0 +1,85 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>mytools-demo</title>
7
+ <style>
8
+ html,
9
+ body {
10
+ margin: 0;
11
+ padding: 24px;
12
+ font-family: "Microsoft YaHei", system-ui, sans-serif;
13
+ background: #ffffff;
14
+ color: #1f2937;
15
+ }
16
+ h1 {
17
+ font-size: 18px;
18
+ margin: 0 0 4px;
19
+ }
20
+ p {
21
+ font-size: 13px;
22
+ color: #6b7280;
23
+ margin: 0 0 16px;
24
+ }
25
+ .row {
26
+ display: flex;
27
+ flex-wrap: wrap;
28
+ gap: 10px;
29
+ margin-bottom: 12px;
30
+ }
31
+ button {
32
+ border: 1px solid #e5e7eb;
33
+ background: #f9fafb;
34
+ border-radius: 6px;
35
+ padding: 7px 14px;
36
+ font-size: 13px;
37
+ cursor: pointer;
38
+ }
39
+ button:hover {
40
+ background: #f3f4f6;
41
+ }
42
+ pre {
43
+ background: #f3f4f6;
44
+ border-radius: 6px;
45
+ padding: 10px;
46
+ font-size: 12px;
47
+ min-height: 18px;
48
+ white-space: pre-wrap;
49
+ word-break: break-all;
50
+ }
51
+ </style>
52
+ </head>
53
+ <body>
54
+ <h1>mytools-demo</h1>
55
+ <p>演示 MyTools 能力调用;系统操作按宿主策略请求授权。</p>
56
+
57
+ <div class="row">
58
+ <button id="copy">复制文本</button>
59
+ <button id="read">读取剪贴板</button>
60
+ <button id="open">打开链接</button>
61
+ <button id="path">读取主目录</button>
62
+ <button id="apps">列出应用</button>
63
+ </div>
64
+
65
+ <pre id="output">等待操作…</pre>
66
+
67
+ <script>
68
+ const output = document.getElementById('output');
69
+ async function run(id, args) {
70
+ try {
71
+ if (!window.mytools) throw new Error('请从 MyTools 打开此插件');
72
+ const value = await window.mytools.call(id, args);
73
+ output.textContent = value === undefined || value === null ? '操作完成' : typeof value === 'string' ? value : JSON.stringify(value, null, 2);
74
+ } catch (error) {
75
+ output.textContent = '调用失败:' + error.message;
76
+ }
77
+ }
78
+ document.getElementById('copy').onclick = () => run('clipboard.write', { text: 'hello from mytools-demo' });
79
+ document.getElementById('read').onclick = () => run('clipboard.read', {});
80
+ document.getElementById('apps').onclick = () => run('app.list', {});
81
+ document.getElementById('open').onclick = () => run('shell.open', { url: 'https://github.com/mytools-all/mytools' });
82
+ document.getElementById('path').onclick = () => run('system.path', { name: 'home' });
83
+ </script>
84
+ </body>
85
+ </html>
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@mytools-all/mytools-demo",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.2",
4
+ "description": "MyTools 统一示例:复制和读取剪贴板、打开链接、读取系统路径、列出应用。",
5
+ "type": "module",
6
+ "main": "index.html",
7
+ "license": "MIT",
8
+ "author": "MyTools Contributors",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/mytools-all/mytools-demo.git"
12
+ },
13
+ "homepage": "https://github.com/mytools-all/mytools-demo#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/mytools-all/mytools-demo/issues"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "files": [
22
+ "plugin.json",
23
+ "*.html",
24
+ "*.css",
25
+ "*.svg",
26
+ "*.png",
27
+ "vendor/",
28
+ "LICENSE",
29
+ "THIRD_PARTY.md",
30
+ "README.md",
31
+ "*.js",
32
+ "*.LICENSE"
33
+ ],
34
+ "engines": {
35
+ "mytools": ">=0.2.0 <0.3.0"
36
+ },
37
+ "scripts": {
38
+ "test": "node --test"
39
+ }
6
40
  }
package/plugin.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "mytools-demo",
3
+ "pluginName": "MyTools Demo",
4
+ "description": "MyTools 统一示例:复制和读取剪贴板、打开链接、读取系统路径、列出应用。",
5
+ "author": "MyTools",
6
+ "version": "0.1.2",
7
+ "main": "index.html",
8
+ "icon": "icon.svg",
9
+ "pluginType": "app",
10
+ "features": [
11
+ {
12
+ "code": "demo",
13
+ "explain": "演示 MyTools bridge",
14
+ "cmds": [
15
+ "mytools-demo",
16
+ "demo",
17
+ "示例插件"
18
+ ]
19
+ }
20
+ ],
21
+ "apiVersion": 1,
22
+ "capabilities": [
23
+ "clipboard.write",
24
+ "clipboard.read",
25
+ "shell.open",
26
+ "system.path",
27
+ "app.list"
28
+ ],
29
+ "engines": {
30
+ "mytools": ">=0.2.0 <0.3.0"
31
+ }
32
+ }