translime-sdk 1.0.1
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 +153 -0
- package/dist/index.cjs +111 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +93 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -0
- package/dist/preview/settings.scss +86 -0
- package/dist/preview-mock.cjs +253 -0
- package/dist/preview-mock.cjs.map +1 -0
- package/dist/preview-mock.js +253 -0
- package/dist/preview-mock.js.map +1 -0
- package/dist/preview-template.html +13 -0
- package/dist/preview.cjs +3607 -0
- package/dist/preview.cjs.map +1 -0
- package/dist/preview.js +3589 -0
- package/dist/preview.js.map +1 -0
- package/dist/translime-sdk.css +1224 -0
- package/dist/vite-plugin.cjs +196 -0
- package/dist/vite-plugin.cjs.map +1 -0
- package/dist/vite-plugin.d.cts +22 -0
- package/dist/vite-plugin.d.ts +22 -0
- package/dist/vite-plugin.js +195 -0
- package/dist/vite-plugin.js.map +1 -0
- package/package.json +99 -0
package/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Translime SDK
|
|
2
|
+
|
|
3
|
+
这是 Translime 插件开发的官方 SDK。它提供了完善的类型提示 (.d.ts) 并简化了对主程序 API 的访问。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add translime-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用 Vite 插件
|
|
12
|
+
|
|
13
|
+
在插件的 `vite.config.js` 中使用内置插件,可以自动处理 `electron` 等依赖的外部化:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { defineConfig } from 'vite';
|
|
17
|
+
import { translimeSdk } from 'translime-sdk/vite';
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
plugins: [
|
|
21
|
+
translimeSdk(),
|
|
22
|
+
// ... 其他插件
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 代码示例
|
|
28
|
+
|
|
29
|
+
### 主进程逻辑 (src/index.js)
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
import { usePluginConfig } from 'translime-sdk';
|
|
33
|
+
|
|
34
|
+
const config = usePluginConfig('my-plugin-id');
|
|
35
|
+
const myValue = config.get('settingsKey', 'default');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 渲染进程 UI (src/ui/ui.vue)
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import { useIpc, useVuetifyComponents } from 'translime-sdk';
|
|
42
|
+
|
|
43
|
+
const ipc = useIpc();
|
|
44
|
+
const { VBtn, VCard } = useVuetifyComponents();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 核心 API
|
|
48
|
+
|
|
49
|
+
### 主进程 (Main Process)
|
|
50
|
+
|
|
51
|
+
- `getMainStore()`: 获取主程序的全局 Store。
|
|
52
|
+
- `usePluginConfig(pluginId)`: 获取针对特定插件的配置工具。
|
|
53
|
+
|
|
54
|
+
### 渲染进程 (Renderer Process)
|
|
55
|
+
|
|
56
|
+
- `useIpc()`: 获取 IPC 工具。
|
|
57
|
+
- `useVuetifyComponents()`: 获取所有 Vuetify 组件。
|
|
58
|
+
- `useVuetifyDirectives()`: 获取所有 Vuetify 指令。
|
|
59
|
+
- `useDialog()`: 获取 Electron 对话框 API。
|
|
60
|
+
- `useShell()`: 获取 Shell API。
|
|
61
|
+
- `getPluginSetting(...args)`: 获取插件设置。
|
|
62
|
+
- `setPluginSetting(...args)`: 设置插件设置。
|
|
63
|
+
- `useWindowControl()`: 获取窗口控制工具。
|
|
64
|
+
- `useClipboard()`: 获取剪贴板工具。
|
|
65
|
+
- `openLink(...args)`: 在浏览器中打开链接。
|
|
66
|
+
- `isPreviewMode()`: 检查当前是否为 Preview 模式。
|
|
67
|
+
|
|
68
|
+
### 通用 (Common)
|
|
69
|
+
|
|
70
|
+
- `useLogger()`: 获取标准日志工具,支持 `log`, `info`, `warn`, `error`, `debug`。在渲染进程中会自动通过 IPC 发送到主进程记录,在主进程中则直接写入日志文件。
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Preview 模式
|
|
75
|
+
|
|
76
|
+
Preview 模式允许你在普通浏览器中预览和调试插件 UI,无需依赖 Electron 环境。这使得开发过程中能够享受 Vite 的 HMR (热模块替换) 便利性。
|
|
77
|
+
|
|
78
|
+
### 特性
|
|
79
|
+
|
|
80
|
+
- ✅ **零配置**:插件代码无需任何修改,SDK 会自动检测 preview 模式并注入 mock 实现
|
|
81
|
+
- ✅ **完整的 Vuetify 支持**:Preview Shell 自动提供 Vuetify 组件和主题
|
|
82
|
+
- ✅ **API Mock**:所有 Electron 相关的 API (IPC, Dialog, Shell 等) 都有对应的 mock 实现
|
|
83
|
+
- ✅ **设置持久化**:插件设置使用 localStorage 存储,刷新页面后仍然保留
|
|
84
|
+
- ✅ **主题切换**:Preview 界面提供浅色/深色主题切换
|
|
85
|
+
|
|
86
|
+
### 快速开始
|
|
87
|
+
|
|
88
|
+
1. **在插件的 `package.json` 中添加 preview 脚本**:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"scripts": {
|
|
93
|
+
"preview:ui": "vite -c ui.vite.config.mjs --mode preview"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
2. **运行 preview 模式**:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm preview:ui
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
3. **访问预览页面**:在浏览器中打开 Vite 提供的地址 (通常是 `http://localhost:5173`)
|
|
105
|
+
|
|
106
|
+
### Vite 插件配置
|
|
107
|
+
|
|
108
|
+
`translimeSdk()` 插件会自动处理 preview 模式的配置。你可以通过 `previewComponent` 选项指定要预览的组件路径:
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
import { defineConfig } from 'vite';
|
|
112
|
+
import { translimeSdk } from 'translime-sdk/vite';
|
|
113
|
+
|
|
114
|
+
export default defineConfig(({ mode }) => ({
|
|
115
|
+
plugins: [
|
|
116
|
+
translimeSdk({
|
|
117
|
+
// 可选:指定要预览的组件路径,默认使用 lib.entry
|
|
118
|
+
previewComponent: './src/ui/ui.vue'
|
|
119
|
+
}),
|
|
120
|
+
],
|
|
121
|
+
// ... 其他配置
|
|
122
|
+
}));
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Mock API 行为
|
|
126
|
+
|
|
127
|
+
在 Preview 模式下,SDK 提供的 API 会有以下行为:
|
|
128
|
+
|
|
129
|
+
| API | Mock 行为 |
|
|
130
|
+
|-----|----------|
|
|
131
|
+
| `useIpc().invoke()` | 打印调用日志,返回 `null` |
|
|
132
|
+
| `useDialog().showOpenDialog()` | 使用浏览器原生文件选择器 |
|
|
133
|
+
| `getPluginSetting()` | 从 localStorage 读取 |
|
|
134
|
+
| `setPluginSetting()` | 保存到 localStorage |
|
|
135
|
+
| `useClipboard()` | 使用浏览器 Clipboard API |
|
|
136
|
+
| `openLink()` | 使用 `window.open()` 打开新窗口 |
|
|
137
|
+
|
|
138
|
+
### 条件代码
|
|
139
|
+
|
|
140
|
+
如果需要在 preview 模式下执行不同的逻辑,可以使用 `isPreviewMode()` 函数:
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
import { isPreviewMode, useIpc } from 'translime-sdk';
|
|
144
|
+
|
|
145
|
+
if (isPreviewMode()) {
|
|
146
|
+
console.log('当前运行在 Preview 模式');
|
|
147
|
+
// 执行替代逻辑
|
|
148
|
+
} else {
|
|
149
|
+
const ipc = useIpc();
|
|
150
|
+
await ipc.invoke('some-api@plugin-id');
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const previewMock = require("./preview-mock.cjs");
|
|
4
|
+
if (typeof window !== "undefined" && previewMock.isPreviewMode()) {
|
|
5
|
+
previewMock.initPreviewMock();
|
|
6
|
+
}
|
|
7
|
+
function isPreviewMode() {
|
|
8
|
+
return previewMock.isPreviewMode();
|
|
9
|
+
}
|
|
10
|
+
function getMainStore() {
|
|
11
|
+
if (typeof global !== "undefined" && global.mainStore) {
|
|
12
|
+
return global.mainStore;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
function usePluginConfig(pluginId) {
|
|
17
|
+
const store = getMainStore();
|
|
18
|
+
return {
|
|
19
|
+
get(key, defaultValue) {
|
|
20
|
+
return store?.config?.get(`plugin.${pluginId}.settings.${key}`, defaultValue);
|
|
21
|
+
},
|
|
22
|
+
set(key, value) {
|
|
23
|
+
store?.config?.set(`plugin.${pluginId}.settings.${key}`, value);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function useIpc() {
|
|
28
|
+
if (typeof window !== "undefined" && window.electron?.useIpc) {
|
|
29
|
+
return window.electron.useIpc();
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
function useVuetify() {
|
|
34
|
+
if (typeof window !== "undefined" && window.vuetify$) {
|
|
35
|
+
return window.vuetify$;
|
|
36
|
+
}
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
function useVuetifyComponents() {
|
|
40
|
+
return useVuetify().components || {};
|
|
41
|
+
}
|
|
42
|
+
function useVuetifyDirectives() {
|
|
43
|
+
return useVuetify().directives || {};
|
|
44
|
+
}
|
|
45
|
+
function useDialog() {
|
|
46
|
+
if (typeof window !== "undefined" && window.electron?.dialog) {
|
|
47
|
+
return window.electron.dialog;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function useShell() {
|
|
52
|
+
if (typeof window !== "undefined" && window.electron?.shell) {
|
|
53
|
+
return window.electron.shell;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
async function getPluginSetting(...args) {
|
|
58
|
+
if (typeof window !== "undefined" && window.ts?.getPluginSetting) {
|
|
59
|
+
return window.ts.getPluginSetting(...args);
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
async function setPluginSetting(...args) {
|
|
64
|
+
if (typeof window !== "undefined" && window.ts?.setPluginSetting) {
|
|
65
|
+
return window.ts.setPluginSetting(...args);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function useWindowControl() {
|
|
70
|
+
if (typeof window !== "undefined" && window.ts?.windowControl) {
|
|
71
|
+
return window.ts.windowControl;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
function useClipboard() {
|
|
76
|
+
if (typeof window !== "undefined" && window.electron?.clipboard) {
|
|
77
|
+
return window.electron.clipboard;
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
async function openLink(...args) {
|
|
82
|
+
if (typeof window !== "undefined" && window.electron?.openLink) {
|
|
83
|
+
return window.electron.openLink(...args);
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
function useLogger() {
|
|
88
|
+
if (typeof global !== "undefined" && global.mainStore) {
|
|
89
|
+
return global.mainStore?.logger || console;
|
|
90
|
+
}
|
|
91
|
+
if (typeof window !== "undefined") {
|
|
92
|
+
return window.ts?.logger || console;
|
|
93
|
+
}
|
|
94
|
+
return console;
|
|
95
|
+
}
|
|
96
|
+
exports.getMainStore = getMainStore;
|
|
97
|
+
exports.getPluginSetting = getPluginSetting;
|
|
98
|
+
exports.isPreviewMode = isPreviewMode;
|
|
99
|
+
exports.openLink = openLink;
|
|
100
|
+
exports.setPluginSetting = setPluginSetting;
|
|
101
|
+
exports.useClipboard = useClipboard;
|
|
102
|
+
exports.useDialog = useDialog;
|
|
103
|
+
exports.useIpc = useIpc;
|
|
104
|
+
exports.useLogger = useLogger;
|
|
105
|
+
exports.usePluginConfig = usePluginConfig;
|
|
106
|
+
exports.useShell = useShell;
|
|
107
|
+
exports.useVuetify = useVuetify;
|
|
108
|
+
exports.useVuetifyComponents = useVuetifyComponents;
|
|
109
|
+
exports.useVuetifyDirectives = useVuetifyDirectives;
|
|
110
|
+
exports.useWindowControl = useWindowControl;
|
|
111
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.js"],"sourcesContent":["/**\n * Translime SDK\n * 提供插件开发所需的标准 API 和类型提示。\n * 包含主进程 (Main Process) 和渲染进程 (Renderer Process) 的通用接口。\n */\n\nimport {\n isPreviewMode as checkPreviewMode,\n initPreviewMock,\n} from './preview-mock.js';\n\n// ----------------------------------------------------------------------\n// Initialization (Side Effect)\n// ----------------------------------------------------------------------\n\n// 在模块加载时检测并初始化 Preview Mock 环境\n// 确保在 Preview 模式下直接导入 SDK 也能获得 Mock 支持\nif (typeof window !== 'undefined' && checkPreviewMode()) {\n initPreviewMock();\n}\n\n// ----------------------------------------------------------------------\n// Core / Store APIs (Main Process Only)\n// ----------------------------------------------------------------------\n\n/**\n * 检查当前是否为 Preview 模式\n * @returns {boolean}\n */\nexport function isPreviewMode() {\n return checkPreviewMode();\n}\n\n/**\n * @typedef {Object} MainStore\n * @property {Object} config\n * @property {function(string, *): *} config.get\n * @property {function(string, *): void} config.set\n * @property {Object} [logger]\n */\n\n/**\n * 获取主程序 Store\n * @description 仅在 **主进程 (Main Process)** 环境可用\n * @returns {MainStore|null} 若在非主进程环境调用,返回 null\n */\nexport function getMainStore() {\n if (typeof global !== 'undefined' && global.mainStore) {\n return global.mainStore;\n }\n return null;\n}\n\n/**\n * 使用插件配置代理\n * @description 获取针对特定插件的配置读写对象\n * @param {string} pluginId 插件 ID (通常与 package.json 中的 name 一致)\n * @returns {{ get: function(string, *): *, set: function(string, *): void }}\n */\nexport function usePluginConfig(pluginId) {\n const store = getMainStore();\n return {\n get(key, defaultValue) {\n return store?.config?.get(`plugin.${pluginId}.settings.${key}`, defaultValue);\n },\n set(key, value) {\n store?.config?.set(`plugin.${pluginId}.settings.${key}`, value);\n },\n };\n}\n\n// ----------------------------------------------------------------------\n// UI & Renderer APIs (Renderer Process Only)\n// ----------------------------------------------------------------------\n\n/**\n * 获取 IPC 通信工具\n * @description 仅在 **渲染进程 (Renderer Process)** 环境可用\n * @returns {Object|null} 包含 invoke, send, on 等方法的对象\n */\nexport function useIpc() {\n if (typeof window !== 'undefined' && window.electron?.useIpc) {\n return window.electron.useIpc();\n }\n return null;\n}\n\n/**\n * 获取 Vuetify 实例\n * @description 仅在 **渲染进程** 环境可用,用于访问 Vuetify 的全局配置\n * @returns {Object} Vuetify 实例对象\n */\nexport function useVuetify() {\n if (typeof window !== 'undefined' && window.vuetify$) {\n return window.vuetify$;\n }\n return {};\n}\n\n/**\n * 获取全局注册的 Vuetify 组件\n * @returns {Record<string, any>}\n */\nexport function useVuetifyComponents() {\n return useVuetify().components || {};\n}\n\n/**\n * 获取全局注册的 Vuetify 指令\n * @returns {Record<string, any>}\n */\nexport function useVuetifyDirectives() {\n return useVuetify().directives || {};\n}\n\n/**\n * 获取 Dialog API\n * @description 类似于 Electron 的 dialog 模块 (showOpenDialog, showSaveDialog 等)\n * @returns {Object|null}\n */\nexport function useDialog() {\n if (typeof window !== 'undefined' && window.electron?.dialog) {\n return window.electron.dialog;\n }\n return null;\n}\n\n/**\n * 获取 Shell API\n * @description 类似于 Electron 的 shell 模块 (openExternal, showItemInFolder 等)\n * @returns {Object|null}\n */\nexport function useShell() {\n if (typeof window !== 'undefined' && window.electron?.shell) {\n return window.electron.shell;\n }\n return null;\n}\n\n/**\n * 获取插件自身设置 (IPC 封装)\n * @description 仅在 **渲染进程** 环境可用。这是 `plugin.settings` 的前端读取接口。\n * @param {...any} args\n * @returns {Promise<any>}\n */\nexport async function getPluginSetting(...args) {\n if (typeof window !== 'undefined' && window.ts?.getPluginSetting) {\n return window.ts.getPluginSetting(...args);\n }\n return null;\n}\n\n/**\n * 更新插件自身设置 (IPC 封装)\n * @description 仅在 **渲染进程** 环境可用。\n * @param {...any} args\n * @returns {Promise<any>}\n */\nexport async function setPluginSetting(...args) {\n if (typeof window !== 'undefined' && window.ts?.setPluginSetting) {\n return window.ts.setPluginSetting(...args);\n }\n return null;\n}\n\n/**\n * 获取窗口控制工具\n * @description 包含 minimize, maximize, close 等窗口操作\n * @returns {Object|null}\n */\nexport function useWindowControl() {\n if (typeof window !== 'undefined' && window.ts?.windowControl) {\n return window.ts.windowControl;\n }\n return null;\n}\n\n// ----------------------------------------------------------------------\n// Utilities (Shared)\n// ----------------------------------------------------------------------\n\n/**\n * 获取剪贴板工具\n * @returns {Object|null}\n */\nexport function useClipboard() {\n if (typeof window !== 'undefined' && window.electron?.clipboard) {\n return window.electron.clipboard;\n }\n return null;\n}\n\n/**\n * 在默认浏览器中打开链接\n * @param {string} url 要打开的链接\n * @returns {Promise<void>}\n */\nexport async function openLink(...args) {\n if (typeof window !== 'undefined' && window.electron?.openLink) {\n return window.electron.openLink(...args);\n }\n return null;\n}\n\n/**\n * 获取日志工具\n * @description 自动适配 Node.js 环境 (Main) 或浏览器环境 (Renderer)\n * @returns {Record<'log'|'info'|'warn'|'error'|'debug', Function>} Console-like logger\n */\nexport function useLogger() {\n if (typeof global !== 'undefined' && global.mainStore) {\n return global.mainStore?.logger || console;\n }\n if (typeof window !== 'undefined') {\n return window.ts?.logger || console;\n }\n return console;\n}\n\n"],"names":["checkPreviewMode","initPreviewMock"],"mappings":";;;AAiBA,IAAI,OAAO,WAAW,eAAeA,YAAAA,iBAAoB;AACvDC,8BAAe;AACjB;AAUO,SAAS,gBAAgB;AAC9B,SAAOD,0BAAgB;AACzB;AAeO,SAAS,eAAe;AAC7B,MAAI,OAAO,WAAW,eAAe,OAAO,WAAW;AACrD,WAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACT;AAQO,SAAS,gBAAgB,UAAU;AACxC,QAAM,QAAQ,aAAY;AAC1B,SAAO;AAAA,IACL,IAAI,KAAK,cAAc;AACrB,aAAO,OAAO,QAAQ,IAAI,UAAU,QAAQ,aAAa,GAAG,IAAI,YAAY;AAAA,IAC9E;AAAA,IACA,IAAI,KAAK,OAAO;AACd,aAAO,QAAQ,IAAI,UAAU,QAAQ,aAAa,GAAG,IAAI,KAAK;AAAA,IAChE;AAAA,EACJ;AACA;AAWO,SAAS,SAAS;AACvB,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,QAAQ;AAC5D,WAAO,OAAO,SAAS,OAAM;AAAA,EAC/B;AACA,SAAO;AACT;AAOO,SAAS,aAAa;AAC3B,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU;AACpD,WAAO,OAAO;AAAA,EAChB;AACA,SAAO,CAAA;AACT;AAMO,SAAS,uBAAuB;AACrC,SAAO,WAAU,EAAG,cAAc,CAAA;AACpC;AAMO,SAAS,uBAAuB;AACrC,SAAO,WAAU,EAAG,cAAc,CAAA;AACpC;AAOO,SAAS,YAAY;AAC1B,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,QAAQ;AAC5D,WAAO,OAAO,SAAS;AAAA,EACzB;AACA,SAAO;AACT;AAOO,SAAS,WAAW;AACzB,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,OAAO;AAC3D,WAAO,OAAO,SAAS;AAAA,EACzB;AACA,SAAO;AACT;AAQO,eAAe,oBAAoB,MAAM;AAC9C,MAAI,OAAO,WAAW,eAAe,OAAO,IAAI,kBAAkB;AAChE,WAAO,OAAO,GAAG,iBAAiB,GAAG,IAAI;AAAA,EAC3C;AACA,SAAO;AACT;AAQO,eAAe,oBAAoB,MAAM;AAC9C,MAAI,OAAO,WAAW,eAAe,OAAO,IAAI,kBAAkB;AAChE,WAAO,OAAO,GAAG,iBAAiB,GAAG,IAAI;AAAA,EAC3C;AACA,SAAO;AACT;AAOO,SAAS,mBAAmB;AACjC,MAAI,OAAO,WAAW,eAAe,OAAO,IAAI,eAAe;AAC7D,WAAO,OAAO,GAAG;AAAA,EACnB;AACA,SAAO;AACT;AAUO,SAAS,eAAe;AAC7B,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,WAAW;AAC/D,WAAO,OAAO,SAAS;AAAA,EACzB;AACA,SAAO;AACT;AAOO,eAAe,YAAY,MAAM;AACtC,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,UAAU;AAC9D,WAAO,OAAO,SAAS,SAAS,GAAG,IAAI;AAAA,EACzC;AACA,SAAO;AACT;AAOO,SAAS,YAAY;AAC1B,MAAI,OAAO,WAAW,eAAe,OAAO,WAAW;AACrD,WAAO,OAAO,WAAW,UAAU;AAAA,EACrC;AACA,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO,OAAO,IAAI,UAAU;AAAA,EAC9B;AACA,SAAO;AACT;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export interface Config {
|
|
2
|
+
get(key: string, defaultValue?: any): any;
|
|
3
|
+
set(key: string, value: any): void;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface MainStore {
|
|
7
|
+
config: Config;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 检查当前是否为 Preview 模式
|
|
12
|
+
*/
|
|
13
|
+
export function isPreviewMode(): boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 获取主程序 Store (仅在主进程环境可用)
|
|
17
|
+
*/
|
|
18
|
+
export function getMainStore(): MainStore | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 获取插件配置代理
|
|
22
|
+
* @param pluginId 插件 ID
|
|
23
|
+
*/
|
|
24
|
+
export function usePluginConfig(pluginId: string): Config;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 获取 IPC 工具 (仅在渲染进程环境可用)
|
|
28
|
+
*/
|
|
29
|
+
export function useIpc(): any;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 获取 Vuetify 实例
|
|
33
|
+
*/
|
|
34
|
+
export function useVuetify(): any;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 获取所有 Vuetify 组件
|
|
38
|
+
*/
|
|
39
|
+
export function useVuetifyComponents(): Record<string, any>;
|
|
40
|
+
export function useVuetifyDirectives(): Record<string, any>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 助手函数:获取 Electron 提供的对话框 API
|
|
44
|
+
*/
|
|
45
|
+
export function useDialog(): any;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 获取 Shell API
|
|
49
|
+
*/
|
|
50
|
+
export function useShell(): any;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 获取插件设置 (仅在渲染进程环境可用)
|
|
54
|
+
*/
|
|
55
|
+
export function getPluginSetting(...args: any[]): Promise<any>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 设置插件设置 (仅在渲染进程环境可用)
|
|
59
|
+
*/
|
|
60
|
+
export function setPluginSetting(...args: any[]): Promise<any>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 获取窗口控制工具 (仅在渲染进程环境可用)
|
|
64
|
+
*/
|
|
65
|
+
export function useWindowControl(): {
|
|
66
|
+
devtools(win?: any): Promise<any>;
|
|
67
|
+
maximize(win?: any): Promise<any>;
|
|
68
|
+
unmaximize(win?: any): Promise<any>;
|
|
69
|
+
minimize(win?: any): Promise<any>;
|
|
70
|
+
close(win?: any): Promise<any>;
|
|
71
|
+
} | null;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 获取剪贴板工具 (仅在渲染进程环境可用)
|
|
75
|
+
*/
|
|
76
|
+
export function useClipboard(): any;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 在浏览器中打开链接 (仅在渲染进程环境可用)
|
|
80
|
+
*/
|
|
81
|
+
export function openLink(...args: any[]): Promise<any>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 获取日志工具
|
|
85
|
+
*/
|
|
86
|
+
export function useLogger(): {
|
|
87
|
+
log(...args: any[]): void;
|
|
88
|
+
info(...args: any[]): void;
|
|
89
|
+
warn(...args: any[]): void;
|
|
90
|
+
error(...args: any[]): void;
|
|
91
|
+
debug(...args: any[]): void;
|
|
92
|
+
};
|
|
93
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export interface Config {
|
|
2
|
+
get(key: string, defaultValue?: any): any;
|
|
3
|
+
set(key: string, value: any): void;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface MainStore {
|
|
7
|
+
config: Config;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 检查当前是否为 Preview 模式
|
|
12
|
+
*/
|
|
13
|
+
export function isPreviewMode(): boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 获取主程序 Store (仅在主进程环境可用)
|
|
17
|
+
*/
|
|
18
|
+
export function getMainStore(): MainStore | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 获取插件配置代理
|
|
22
|
+
* @param pluginId 插件 ID
|
|
23
|
+
*/
|
|
24
|
+
export function usePluginConfig(pluginId: string): Config;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 获取 IPC 工具 (仅在渲染进程环境可用)
|
|
28
|
+
*/
|
|
29
|
+
export function useIpc(): any;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 获取 Vuetify 实例
|
|
33
|
+
*/
|
|
34
|
+
export function useVuetify(): any;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 获取所有 Vuetify 组件
|
|
38
|
+
*/
|
|
39
|
+
export function useVuetifyComponents(): Record<string, any>;
|
|
40
|
+
export function useVuetifyDirectives(): Record<string, any>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 助手函数:获取 Electron 提供的对话框 API
|
|
44
|
+
*/
|
|
45
|
+
export function useDialog(): any;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 获取 Shell API
|
|
49
|
+
*/
|
|
50
|
+
export function useShell(): any;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 获取插件设置 (仅在渲染进程环境可用)
|
|
54
|
+
*/
|
|
55
|
+
export function getPluginSetting(...args: any[]): Promise<any>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 设置插件设置 (仅在渲染进程环境可用)
|
|
59
|
+
*/
|
|
60
|
+
export function setPluginSetting(...args: any[]): Promise<any>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 获取窗口控制工具 (仅在渲染进程环境可用)
|
|
64
|
+
*/
|
|
65
|
+
export function useWindowControl(): {
|
|
66
|
+
devtools(win?: any): Promise<any>;
|
|
67
|
+
maximize(win?: any): Promise<any>;
|
|
68
|
+
unmaximize(win?: any): Promise<any>;
|
|
69
|
+
minimize(win?: any): Promise<any>;
|
|
70
|
+
close(win?: any): Promise<any>;
|
|
71
|
+
} | null;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 获取剪贴板工具 (仅在渲染进程环境可用)
|
|
75
|
+
*/
|
|
76
|
+
export function useClipboard(): any;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 在浏览器中打开链接 (仅在渲染进程环境可用)
|
|
80
|
+
*/
|
|
81
|
+
export function openLink(...args: any[]): Promise<any>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 获取日志工具
|
|
85
|
+
*/
|
|
86
|
+
export function useLogger(): {
|
|
87
|
+
log(...args: any[]): void;
|
|
88
|
+
info(...args: any[]): void;
|
|
89
|
+
warn(...args: any[]): void;
|
|
90
|
+
error(...args: any[]): void;
|
|
91
|
+
debug(...args: any[]): void;
|
|
92
|
+
};
|
|
93
|
+
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { isPreviewMode as isPreviewMode$1, initPreviewMock } from "./preview-mock.js";
|
|
2
|
+
if (typeof window !== "undefined" && isPreviewMode$1()) {
|
|
3
|
+
initPreviewMock();
|
|
4
|
+
}
|
|
5
|
+
function isPreviewMode() {
|
|
6
|
+
return isPreviewMode$1();
|
|
7
|
+
}
|
|
8
|
+
function getMainStore() {
|
|
9
|
+
if (typeof global !== "undefined" && global.mainStore) {
|
|
10
|
+
return global.mainStore;
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function usePluginConfig(pluginId) {
|
|
15
|
+
const store = getMainStore();
|
|
16
|
+
return {
|
|
17
|
+
get(key, defaultValue) {
|
|
18
|
+
return store?.config?.get(`plugin.${pluginId}.settings.${key}`, defaultValue);
|
|
19
|
+
},
|
|
20
|
+
set(key, value) {
|
|
21
|
+
store?.config?.set(`plugin.${pluginId}.settings.${key}`, value);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function useIpc() {
|
|
26
|
+
if (typeof window !== "undefined" && window.electron?.useIpc) {
|
|
27
|
+
return window.electron.useIpc();
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
function useVuetify() {
|
|
32
|
+
if (typeof window !== "undefined" && window.vuetify$) {
|
|
33
|
+
return window.vuetify$;
|
|
34
|
+
}
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
function useVuetifyComponents() {
|
|
38
|
+
return useVuetify().components || {};
|
|
39
|
+
}
|
|
40
|
+
function useVuetifyDirectives() {
|
|
41
|
+
return useVuetify().directives || {};
|
|
42
|
+
}
|
|
43
|
+
function useDialog() {
|
|
44
|
+
if (typeof window !== "undefined" && window.electron?.dialog) {
|
|
45
|
+
return window.electron.dialog;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
function useShell() {
|
|
50
|
+
if (typeof window !== "undefined" && window.electron?.shell) {
|
|
51
|
+
return window.electron.shell;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
async function getPluginSetting(...args) {
|
|
56
|
+
if (typeof window !== "undefined" && window.ts?.getPluginSetting) {
|
|
57
|
+
return window.ts.getPluginSetting(...args);
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
async function setPluginSetting(...args) {
|
|
62
|
+
if (typeof window !== "undefined" && window.ts?.setPluginSetting) {
|
|
63
|
+
return window.ts.setPluginSetting(...args);
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function useWindowControl() {
|
|
68
|
+
if (typeof window !== "undefined" && window.ts?.windowControl) {
|
|
69
|
+
return window.ts.windowControl;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function useClipboard() {
|
|
74
|
+
if (typeof window !== "undefined" && window.electron?.clipboard) {
|
|
75
|
+
return window.electron.clipboard;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
async function openLink(...args) {
|
|
80
|
+
if (typeof window !== "undefined" && window.electron?.openLink) {
|
|
81
|
+
return window.electron.openLink(...args);
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
function useLogger() {
|
|
86
|
+
if (typeof global !== "undefined" && global.mainStore) {
|
|
87
|
+
return global.mainStore?.logger || console;
|
|
88
|
+
}
|
|
89
|
+
if (typeof window !== "undefined") {
|
|
90
|
+
return window.ts?.logger || console;
|
|
91
|
+
}
|
|
92
|
+
return console;
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
getMainStore,
|
|
96
|
+
getPluginSetting,
|
|
97
|
+
isPreviewMode,
|
|
98
|
+
openLink,
|
|
99
|
+
setPluginSetting,
|
|
100
|
+
useClipboard,
|
|
101
|
+
useDialog,
|
|
102
|
+
useIpc,
|
|
103
|
+
useLogger,
|
|
104
|
+
usePluginConfig,
|
|
105
|
+
useShell,
|
|
106
|
+
useVuetify,
|
|
107
|
+
useVuetifyComponents,
|
|
108
|
+
useVuetifyDirectives,
|
|
109
|
+
useWindowControl
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["/**\n * Translime SDK\n * 提供插件开发所需的标准 API 和类型提示。\n * 包含主进程 (Main Process) 和渲染进程 (Renderer Process) 的通用接口。\n */\n\nimport {\n isPreviewMode as checkPreviewMode,\n initPreviewMock,\n} from './preview-mock.js';\n\n// ----------------------------------------------------------------------\n// Initialization (Side Effect)\n// ----------------------------------------------------------------------\n\n// 在模块加载时检测并初始化 Preview Mock 环境\n// 确保在 Preview 模式下直接导入 SDK 也能获得 Mock 支持\nif (typeof window !== 'undefined' && checkPreviewMode()) {\n initPreviewMock();\n}\n\n// ----------------------------------------------------------------------\n// Core / Store APIs (Main Process Only)\n// ----------------------------------------------------------------------\n\n/**\n * 检查当前是否为 Preview 模式\n * @returns {boolean}\n */\nexport function isPreviewMode() {\n return checkPreviewMode();\n}\n\n/**\n * @typedef {Object} MainStore\n * @property {Object} config\n * @property {function(string, *): *} config.get\n * @property {function(string, *): void} config.set\n * @property {Object} [logger]\n */\n\n/**\n * 获取主程序 Store\n * @description 仅在 **主进程 (Main Process)** 环境可用\n * @returns {MainStore|null} 若在非主进程环境调用,返回 null\n */\nexport function getMainStore() {\n if (typeof global !== 'undefined' && global.mainStore) {\n return global.mainStore;\n }\n return null;\n}\n\n/**\n * 使用插件配置代理\n * @description 获取针对特定插件的配置读写对象\n * @param {string} pluginId 插件 ID (通常与 package.json 中的 name 一致)\n * @returns {{ get: function(string, *): *, set: function(string, *): void }}\n */\nexport function usePluginConfig(pluginId) {\n const store = getMainStore();\n return {\n get(key, defaultValue) {\n return store?.config?.get(`plugin.${pluginId}.settings.${key}`, defaultValue);\n },\n set(key, value) {\n store?.config?.set(`plugin.${pluginId}.settings.${key}`, value);\n },\n };\n}\n\n// ----------------------------------------------------------------------\n// UI & Renderer APIs (Renderer Process Only)\n// ----------------------------------------------------------------------\n\n/**\n * 获取 IPC 通信工具\n * @description 仅在 **渲染进程 (Renderer Process)** 环境可用\n * @returns {Object|null} 包含 invoke, send, on 等方法的对象\n */\nexport function useIpc() {\n if (typeof window !== 'undefined' && window.electron?.useIpc) {\n return window.electron.useIpc();\n }\n return null;\n}\n\n/**\n * 获取 Vuetify 实例\n * @description 仅在 **渲染进程** 环境可用,用于访问 Vuetify 的全局配置\n * @returns {Object} Vuetify 实例对象\n */\nexport function useVuetify() {\n if (typeof window !== 'undefined' && window.vuetify$) {\n return window.vuetify$;\n }\n return {};\n}\n\n/**\n * 获取全局注册的 Vuetify 组件\n * @returns {Record<string, any>}\n */\nexport function useVuetifyComponents() {\n return useVuetify().components || {};\n}\n\n/**\n * 获取全局注册的 Vuetify 指令\n * @returns {Record<string, any>}\n */\nexport function useVuetifyDirectives() {\n return useVuetify().directives || {};\n}\n\n/**\n * 获取 Dialog API\n * @description 类似于 Electron 的 dialog 模块 (showOpenDialog, showSaveDialog 等)\n * @returns {Object|null}\n */\nexport function useDialog() {\n if (typeof window !== 'undefined' && window.electron?.dialog) {\n return window.electron.dialog;\n }\n return null;\n}\n\n/**\n * 获取 Shell API\n * @description 类似于 Electron 的 shell 模块 (openExternal, showItemInFolder 等)\n * @returns {Object|null}\n */\nexport function useShell() {\n if (typeof window !== 'undefined' && window.electron?.shell) {\n return window.electron.shell;\n }\n return null;\n}\n\n/**\n * 获取插件自身设置 (IPC 封装)\n * @description 仅在 **渲染进程** 环境可用。这是 `plugin.settings` 的前端读取接口。\n * @param {...any} args\n * @returns {Promise<any>}\n */\nexport async function getPluginSetting(...args) {\n if (typeof window !== 'undefined' && window.ts?.getPluginSetting) {\n return window.ts.getPluginSetting(...args);\n }\n return null;\n}\n\n/**\n * 更新插件自身设置 (IPC 封装)\n * @description 仅在 **渲染进程** 环境可用。\n * @param {...any} args\n * @returns {Promise<any>}\n */\nexport async function setPluginSetting(...args) {\n if (typeof window !== 'undefined' && window.ts?.setPluginSetting) {\n return window.ts.setPluginSetting(...args);\n }\n return null;\n}\n\n/**\n * 获取窗口控制工具\n * @description 包含 minimize, maximize, close 等窗口操作\n * @returns {Object|null}\n */\nexport function useWindowControl() {\n if (typeof window !== 'undefined' && window.ts?.windowControl) {\n return window.ts.windowControl;\n }\n return null;\n}\n\n// ----------------------------------------------------------------------\n// Utilities (Shared)\n// ----------------------------------------------------------------------\n\n/**\n * 获取剪贴板工具\n * @returns {Object|null}\n */\nexport function useClipboard() {\n if (typeof window !== 'undefined' && window.electron?.clipboard) {\n return window.electron.clipboard;\n }\n return null;\n}\n\n/**\n * 在默认浏览器中打开链接\n * @param {string} url 要打开的链接\n * @returns {Promise<void>}\n */\nexport async function openLink(...args) {\n if (typeof window !== 'undefined' && window.electron?.openLink) {\n return window.electron.openLink(...args);\n }\n return null;\n}\n\n/**\n * 获取日志工具\n * @description 自动适配 Node.js 环境 (Main) 或浏览器环境 (Renderer)\n * @returns {Record<'log'|'info'|'warn'|'error'|'debug', Function>} Console-like logger\n */\nexport function useLogger() {\n if (typeof global !== 'undefined' && global.mainStore) {\n return global.mainStore?.logger || console;\n }\n if (typeof window !== 'undefined') {\n return window.ts?.logger || console;\n }\n return console;\n}\n\n"],"names":["checkPreviewMode"],"mappings":";AAiBA,IAAI,OAAO,WAAW,eAAeA,mBAAoB;AACvD,kBAAe;AACjB;AAUO,SAAS,gBAAgB;AAC9B,SAAOA,gBAAgB;AACzB;AAeO,SAAS,eAAe;AAC7B,MAAI,OAAO,WAAW,eAAe,OAAO,WAAW;AACrD,WAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACT;AAQO,SAAS,gBAAgB,UAAU;AACxC,QAAM,QAAQ,aAAY;AAC1B,SAAO;AAAA,IACL,IAAI,KAAK,cAAc;AACrB,aAAO,OAAO,QAAQ,IAAI,UAAU,QAAQ,aAAa,GAAG,IAAI,YAAY;AAAA,IAC9E;AAAA,IACA,IAAI,KAAK,OAAO;AACd,aAAO,QAAQ,IAAI,UAAU,QAAQ,aAAa,GAAG,IAAI,KAAK;AAAA,IAChE;AAAA,EACJ;AACA;AAWO,SAAS,SAAS;AACvB,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,QAAQ;AAC5D,WAAO,OAAO,SAAS,OAAM;AAAA,EAC/B;AACA,SAAO;AACT;AAOO,SAAS,aAAa;AAC3B,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU;AACpD,WAAO,OAAO;AAAA,EAChB;AACA,SAAO,CAAA;AACT;AAMO,SAAS,uBAAuB;AACrC,SAAO,WAAU,EAAG,cAAc,CAAA;AACpC;AAMO,SAAS,uBAAuB;AACrC,SAAO,WAAU,EAAG,cAAc,CAAA;AACpC;AAOO,SAAS,YAAY;AAC1B,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,QAAQ;AAC5D,WAAO,OAAO,SAAS;AAAA,EACzB;AACA,SAAO;AACT;AAOO,SAAS,WAAW;AACzB,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,OAAO;AAC3D,WAAO,OAAO,SAAS;AAAA,EACzB;AACA,SAAO;AACT;AAQO,eAAe,oBAAoB,MAAM;AAC9C,MAAI,OAAO,WAAW,eAAe,OAAO,IAAI,kBAAkB;AAChE,WAAO,OAAO,GAAG,iBAAiB,GAAG,IAAI;AAAA,EAC3C;AACA,SAAO;AACT;AAQO,eAAe,oBAAoB,MAAM;AAC9C,MAAI,OAAO,WAAW,eAAe,OAAO,IAAI,kBAAkB;AAChE,WAAO,OAAO,GAAG,iBAAiB,GAAG,IAAI;AAAA,EAC3C;AACA,SAAO;AACT;AAOO,SAAS,mBAAmB;AACjC,MAAI,OAAO,WAAW,eAAe,OAAO,IAAI,eAAe;AAC7D,WAAO,OAAO,GAAG;AAAA,EACnB;AACA,SAAO;AACT;AAUO,SAAS,eAAe;AAC7B,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,WAAW;AAC/D,WAAO,OAAO,SAAS;AAAA,EACzB;AACA,SAAO;AACT;AAOO,eAAe,YAAY,MAAM;AACtC,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU,UAAU;AAC9D,WAAO,OAAO,SAAS,SAAS,GAAG,IAAI;AAAA,EACzC;AACA,SAAO;AACT;AAOO,SAAS,YAAY;AAC1B,MAAI,OAAO,WAAW,eAAe,OAAO,WAAW;AACrD,WAAO,OAAO,WAAW,UAAU;AAAA,EACrC;AACA,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO,OAAO,IAAI,UAAU;AAAA,EAC9B;AACA,SAAO;AACT;"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/preview/settings.scss
|
|
3
|
+
* Preview 模式的 Vuetify 设置,与主程序保持一致
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@forward 'vuetify/settings' with (
|
|
7
|
+
$utilities: (
|
|
8
|
+
'align-content': false,
|
|
9
|
+
'align-items': false,
|
|
10
|
+
'align-self': false,
|
|
11
|
+
'border-bottom': false,
|
|
12
|
+
'border-current': false,
|
|
13
|
+
'border-end': false,
|
|
14
|
+
'border-opacity': false,
|
|
15
|
+
'border-start': false,
|
|
16
|
+
'border-style': false,
|
|
17
|
+
'border-top': false,
|
|
18
|
+
'border': false,
|
|
19
|
+
'bottom': false,
|
|
20
|
+
'cursor': false,
|
|
21
|
+
'display': false,
|
|
22
|
+
'fill-height': false,
|
|
23
|
+
'flex-direction': false,
|
|
24
|
+
'flex-grow': false,
|
|
25
|
+
'flex-shrink': false,
|
|
26
|
+
'flex-wrap': false,
|
|
27
|
+
'flex': false,
|
|
28
|
+
'font-italic': false,
|
|
29
|
+
'font-weight': false,
|
|
30
|
+
'gap-column': false,
|
|
31
|
+
'gap-row': false,
|
|
32
|
+
'gap': false,
|
|
33
|
+
'height-screen': false,
|
|
34
|
+
'height': false,
|
|
35
|
+
'justify-content': false,
|
|
36
|
+
'justify-items': false,
|
|
37
|
+
'left': false,
|
|
38
|
+
'margin-bottom': false,
|
|
39
|
+
'margin-end': false,
|
|
40
|
+
'margin-left': false,
|
|
41
|
+
'margin-right': false,
|
|
42
|
+
'margin-start': false,
|
|
43
|
+
'margin-top': false,
|
|
44
|
+
'margin-x': false,
|
|
45
|
+
'margin-y': false,
|
|
46
|
+
'margin': false,
|
|
47
|
+
'negative-margin-bottom': false,
|
|
48
|
+
'negative-margin-end': false,
|
|
49
|
+
'negative-margin-left': false,
|
|
50
|
+
'negative-margin-right': false,
|
|
51
|
+
'negative-margin-start': false,
|
|
52
|
+
'negative-margin-top': false,
|
|
53
|
+
'negative-margin-x': false,
|
|
54
|
+
'negative-margin-y': false,
|
|
55
|
+
'negative-margin': false,
|
|
56
|
+
'opacity': false,
|
|
57
|
+
'order': false,
|
|
58
|
+
'overflow-wrap': false,
|
|
59
|
+
'overflow-x': false,
|
|
60
|
+
'overflow-y': false,
|
|
61
|
+
'overflow': false,
|
|
62
|
+
'padding-bottom': false,
|
|
63
|
+
'padding-end': false,
|
|
64
|
+
'padding-left': false,
|
|
65
|
+
'padding-right': false,
|
|
66
|
+
'padding-start': false,
|
|
67
|
+
'padding-top': false,
|
|
68
|
+
'padding-x': false,
|
|
69
|
+
'padding-y': false,
|
|
70
|
+
'padding': false,
|
|
71
|
+
'position': false,
|
|
72
|
+
'right': false,
|
|
73
|
+
'text-align': false,
|
|
74
|
+
'text-decoration': false,
|
|
75
|
+
'text-mono': false,
|
|
76
|
+
'text-opacity': false,
|
|
77
|
+
'text-overflow': false,
|
|
78
|
+
'text-transform': false,
|
|
79
|
+
'top': false,
|
|
80
|
+
'typography': false,
|
|
81
|
+
'white-space': false,
|
|
82
|
+
'width': false,
|
|
83
|
+
),
|
|
84
|
+
$layers: true,
|
|
85
|
+
$body-font-family: ('Roboto', 'Noto Sans SC', 'Microsoft YaHei', '微软雅黑', sans-serif),
|
|
86
|
+
);
|