translime-plugin-bangumi-logs 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/icon.svg +49 -0
  3. package/package.json +58 -0
  4. package/readme.md +88 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021-2025 slime7 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/icon.svg ADDED
@@ -0,0 +1,49 @@
1
+ <svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <!-- Gradient definitions -->
3
+ <defs>
4
+ <linearGradient id="tvPink" x1="0" y1="0" x2="256" y2="256" gradientUnits="userSpaceOnUse">
5
+ <stop stop-color="#FF7CAC"/>
6
+ <stop offset="1" stop-color="#F09199"/>
7
+ </linearGradient>
8
+ <filter id="softGlow" x="-20%" y="-20%" width="140%" height="140%">
9
+ <feGaussianBlur stdDeviation="6" result="blur" />
10
+ <feComposite in="SourceGraphic" in2="blur" operator="over" />
11
+ </filter>
12
+ </defs>
13
+
14
+ <!-- Background Base (Rounded Square) -->
15
+ <rect width="256" height="256" rx="64" fill="url(#tvPink)" />
16
+
17
+ <!-- Subtle Highlight -->
18
+ <rect x="20" y="20" width="216" height="216" rx="54" stroke="white" stroke-opacity="0.2" stroke-width="2" />
19
+
20
+ <!-- The TV Body -->
21
+ <g filter="url(#softGlow)" transform="translate(48, 70)">
22
+ <!-- Antennae -->
23
+ <path d="M50 0L70 30" stroke="white" stroke-width="12" stroke-linecap="round" />
24
+ <path d="M110 0L90 30" stroke="white" stroke-width="12" stroke-linecap="round" />
25
+ <circle cx="50" cy="0" r="10" fill="white" />
26
+ <circle cx="110" cy="0" r="10" fill="white" />
27
+
28
+ <!-- TV Box (Main) -->
29
+ <rect x="0" y="30" width="160" height="120" rx="24" fill="white" />
30
+
31
+ <!-- Screen / Face Area -->
32
+ <rect x="15" y="45" width="130" height="90" rx="16" fill="#F09199" fill-opacity="0.1" />
33
+
34
+ <!-- Face (The 'Little TV' Expression) -->
35
+ <!-- Eyes -->
36
+ <circle cx="55" cy="85" r="8" fill="#F09199" />
37
+ <circle cx="105" cy="85" r="8" fill="#F09199" />
38
+
39
+ <!-- Mouth (Cute curve) -->
40
+ <path d="M65 110C65 110 75 120 80 120C85 120 95 110 95 110" stroke="#F09199" stroke-width="8" stroke-linecap="round" />
41
+
42
+ <!-- TV Legs -->
43
+ <rect x="35" y="150" width="20" height="15" rx="8" fill="white" />
44
+ <rect x="105" y="150" width="20" height="15" rx="8" fill="white" />
45
+ </g>
46
+
47
+ <!-- Modern Glass Reflection -->
48
+ <path d="M192 48C216 48 240 72 240 96V64C240 32 224 16 192 16H160C184 16 192 32 192 48Z" fill="white" fill-opacity="0.15" />
49
+ </svg>
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "translime-plugin-bangumi-logs",
3
+ "version": "1.0.0",
4
+ "description": "Bangumi Logs plugin",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "translime",
8
+ "translime-plugin"
9
+ ],
10
+ "main": "./dist/index.cjs.js",
11
+ "exports": {
12
+ ".": {
13
+ "require": "./dist/index.cjs.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "icon.svg"
19
+ ],
20
+ "devDependencies": {
21
+ "@vitejs/plugin-vue": "^6.0.0",
22
+ "eslint": "~9.24.0",
23
+ "eslint-config-airbnb-extended": "^3.0.1",
24
+ "eslint-import-resolver-alias": "^1.1.2",
25
+ "eslint-plugin-vue": "^10.0.0",
26
+ "vite": "^8.0.0",
27
+ "vite-plugin-css-injected-by-js": "^3.4.0",
28
+ "vite-plugin-vuetify": "^2.1.1",
29
+ "vitest": "^4.0.17",
30
+ "vue": "^3.5.13",
31
+ "vuetify": "^3.11.6",
32
+ "translime-sdk": "1.0.2"
33
+ },
34
+ "peerDependencies": {
35
+ "vue": "^3.5.13",
36
+ "vuetify": "^3.11.6"
37
+ },
38
+ "plugin": {
39
+ "title": "Bangumi Logs",
40
+ "description": "Bangumi Logs",
41
+ "icon": "./icon.svg",
42
+ "//windowUrl": "dist/ui/index.html",
43
+ "ui": "dist/ui.esm.js"
44
+ },
45
+ "dependencies": {
46
+ "@tailwindcss/vite": "^4.1.18",
47
+ "axios": "^1.8.4",
48
+ "tailwindcss": "^4.2.2"
49
+ },
50
+ "scripts": {
51
+ "dev": "vite build -c ui.vite.config.mjs --watch",
52
+ "preview:ui": "vite -c ui.vite.config.mjs --mode preview",
53
+ "build:plugin": "vite build",
54
+ "build:ui": "vite build -c ui.vite.config.mjs",
55
+ "build": "pnpm run build:plugin && pnpm run build:ui",
56
+ "test": "pnpm exec vitest run -c vitest.config.mjs"
57
+ }
58
+ }
package/readme.md ADDED
@@ -0,0 +1,88 @@
1
+ # Translime 插件开发指北
2
+ 本指北将介绍如何开发和调试 Translime 插件。
3
+ ## 本地开发测试
4
+ 利用 `link` 命令将本地插件包添加到 Translime 的开发目录中进行测试。
5
+ > [!IMPORTANT]
6
+ > 请统一使用同一种包管理器(建议使用 `pnpm`),避免混用导致依赖冲突。
7
+ ### 方式一:直接链接本地路径(推荐)
8
+ 1. 在项目主目录下的 `plugins_dev` 目录中打开终端。
9
+ 2. 运行以下命令:
10
+ ```
11
+ pnpm link <插件包的绝对路径>
12
+ ```
13
+
14
+ ### 方式二:通过全局链接
15
+
16
+ 1. 在插件包根目录中运行:
17
+ ```
18
+ pnpm link --global
19
+ ```
20
+ 2. 在项目主目录的 `plugins_dev` 目录下运行:
21
+ ```
22
+ pnpm link --global <package.json 中的 name>
23
+ ```
24
+
25
+ ### 启用开发插件
26
+ 打开 Translime 客户端,在 **设置** 中开启 **"显示开发中插件"** 选项。完成后,在插件管理界面即可看到并启用你的本地插件。
27
+ ---
28
+
29
+ ## 插件元数据配置 (`package.json`)
30
+
31
+ 插件的入口信息和展示信息需要在 `package.json` 的 `plugin` 字段中定义。
32
+ ```json5
33
+ {
34
+ "name": "your-plugin-name",
35
+ "version": "1.0.0",
36
+ "main": "./dist/index.cjs.js",
37
+ "plugin": {
38
+ "title": "插件标题",
39
+ "description": "插件的功能描述",
40
+ "icon": "src/icon.svg",
41
+ "ui": "dist/ui.esm.js",
42
+ "windowUrl": "dist/index.html",
43
+ "windowUrl.dev": "http://localhost:3000"
44
+ }
45
+ }
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 插件后端逻辑 (`index.js`)
51
+
52
+ 插件的后端逻辑需通过 `export` 导出特定的配置和钩子。
53
+
54
+ ### 1. 设置菜单 (`settingMenu`)
55
+
56
+ 如果你希望在插件详情页提供配置项,可以导出 `settingMenu` 数组。
57
+
58
+ ### 2. 生命周期钩子
59
+
60
+ - `pluginDidLoad`: 插件启用或应用加载完成后执行。
61
+ - `pluginWillUnload`: 插件禁用或应用关闭前执行。
62
+ - `pluginSettingSaved`: 插件设置在 UI 界面保存后触发。
63
+
64
+ ### 3. IPC 通信 (`ipcHandlers`)
65
+
66
+ 插件可以通过 `ipcHandlers` 定义与前端 UI 交互的接口。
67
+
68
+ ### 4. 额外菜单 (`pluginMenu`)
69
+
70
+ 你可以在 Translime 的部分位置添加自定义菜单。
71
+
72
+ ---
73
+
74
+ ## 使用 Translime SDK
75
+
76
+ 推荐通过 `translime-sdk` 访问插件配置、IPC、窗口控制和 UI 组件能力。
77
+
78
+ ---
79
+
80
+ ## 初始化补充说明
81
+
82
+ 创建或接手一个插件包后,建议立刻补齐下面这些基础项:
83
+
84
+ 1. 首次可用发布默认从 `1.0.0` 开始;只有在明确延续旧版本线时才保留原版本号。
85
+ 2. 如果插件带 Web UI,需要同时补齐 `preview:ui` 的 mock 数据和交互,保证浏览器里可以直接调试主要流程。
86
+ 3. 把功能性逻辑拆到单独模块,避免全部堆在 `index.js` 或 `ui.vue` 中。
87
+ 4. 为包内补上 `test` 脚本和单元测试,至少覆盖关键的数据转换、请求参数构造和错误处理。
88
+ 5. 完成构建后,分别验证 `build`、`test` 和 `preview:ui` 三条链路。