mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 21:46:12 +08:00
更新 4.0 utools api 声明
This commit is contained in:
parent
a9df2a76b1
commit
29a6b07dfe
@ -2,8 +2,8 @@ const getuToolsLite = () => {
|
||||
var utoolsLite = Object.assign({}, _.cloneDeep(utools))
|
||||
// if (utools.isDev()) return utoolsLite
|
||||
const dbBlackList = ['db', 'dbStorage', 'removeFeature', 'setFeature', 'onDbPull']
|
||||
const payBlackList = ['fetchUserServerTemporaryToken', 'getUserServerTemporaryToken', 'openPayment', 'fetchUserPayments']
|
||||
const etcBlackList = ['onPluginEnter', 'onPluginOut', 'createBrowserWindow']
|
||||
const payBlackList = ['fetchUserServerTemporaryToken', 'isPurchasedUser', 'openPurchase', 'getUserServerTemporaryToken', 'openPayment', 'fetchUserPayments']
|
||||
const etcBlackList = ['onPluginEnter', 'onPluginOut', 'onMainPush', 'createBrowserWindow']
|
||||
_.concat(dbBlackList, payBlackList, etcBlackList).forEach(item => {
|
||||
delete utoolsLite[item]
|
||||
})
|
||||
|
161
src/plugins/monaco/types/utools.api.d.ts
vendored
161
src/plugins/monaco/types/utools.api.d.ts
vendored
@ -29,7 +29,7 @@ interface UBrowser {
|
||||
/**
|
||||
* 键盘按键
|
||||
*/
|
||||
press(key: string, ...modifier: ('control' | 'ctrl' | 'shift' | 'meta' | 'alt' | 'command' | 'cmd')[]): this;
|
||||
press(key: string, ...modifier: ('ctrl' | 'shift' | 'alt' | 'meta')[]): this;
|
||||
/**
|
||||
* 粘贴
|
||||
* @param text 如果是图片的base64编码字符串,粘贴图片,为空只执行粘贴动作
|
||||
@ -159,10 +159,9 @@ interface UBrowser {
|
||||
*/
|
||||
scroll(x: number, y: number): this;
|
||||
/**
|
||||
* 运行在闲置的 ubrowser 上
|
||||
* @param ubrowserId utools.getIdleUBrowsers() 中获得
|
||||
* 下载文件
|
||||
*/
|
||||
run(ubrowserId: number): Promise<any[]>;
|
||||
download(url: string, savePath?: string): this;
|
||||
/**
|
||||
* 启动一个 ubrowser 运行
|
||||
* 当运行结束后,窗口如果为隐藏状态将自动销毁窗口
|
||||
@ -189,6 +188,11 @@ interface UBrowser {
|
||||
enableLargerThanScreen?: boolean,
|
||||
opacity?: number
|
||||
}): Promise<any[]>;
|
||||
/**
|
||||
* 运行在闲置的 ubrowser 上
|
||||
* @param ubrowserId 1. run(options) 运行结束后, 当 ubrowser 实例窗口仍然显示时返回 2. utools.getIdleUBrowsers() 中获得
|
||||
*/
|
||||
run(ubrowserId: number): Promise<any[]>;
|
||||
}
|
||||
|
||||
interface Display {
|
||||
@ -225,19 +229,23 @@ interface DbReturn {
|
||||
|
||||
interface UToolsApi {
|
||||
/**
|
||||
* 插件进入时触发
|
||||
* 插件应用进入时触发
|
||||
*/
|
||||
onPluginEnter(callback: (action: {code: string, type: string, payload: any }) => void): void;
|
||||
//onPluginEnter(callback: (action: {code: string, type: string, payload: any, option: any }) => void): void;
|
||||
/**
|
||||
* 插件隐藏时触发
|
||||
* 向搜索面板推送消息
|
||||
*/
|
||||
onPluginOut(callback: () => void): void;
|
||||
//onMainPush(callback: (action: {code: string, type: string, payload: any }) => { icon?: string, text: string, title?: string }[], selectCallback: (action: {code: string, type: string, payload: any, option: { icon?: string, text: string, title?: string }}) => void): void;
|
||||
/**
|
||||
* 插件分离时触发
|
||||
* 插件应用隐藏后台或完全退出时触发
|
||||
*/
|
||||
//onPluginOut(callback: (processExit: boolean) => void): void;
|
||||
/**
|
||||
* 插件应用分离时触发
|
||||
*/
|
||||
onPluginDetach(callback: () => void): void;
|
||||
/**
|
||||
* 插件从云端拉取到数据时触发
|
||||
* 插件应用从云端拉取到数据时触发
|
||||
*/
|
||||
//onDbPull(callback: (docs: { _id: string, _rev: string }[]) => void): void;
|
||||
/**
|
||||
@ -250,7 +258,7 @@ interface UToolsApi {
|
||||
*/
|
||||
showMainWindow(): boolean;
|
||||
/**
|
||||
* 设置插件自身高度
|
||||
* 设置插件应用自身高度
|
||||
*/
|
||||
setExpendHeight(height: number): boolean;
|
||||
/**
|
||||
@ -277,11 +285,18 @@ interface UToolsApi {
|
||||
*/
|
||||
subInputSelect(): boolean;
|
||||
/**
|
||||
* 子输入框失去焦点,插件获得焦点
|
||||
* 子输入框失去焦点,插件应用获得焦点
|
||||
*/
|
||||
subInputBlur(): boolean;
|
||||
/**
|
||||
* 隐藏插件到后台
|
||||
* 创建独立窗口
|
||||
* @param url 相对路径 html 文件
|
||||
* @param options 参考 https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions
|
||||
* @param callback url 加载完成时的回调
|
||||
*/
|
||||
//createBrowserWindow(url: string, options: { width?: number, height?: number }, callback?: () => void): { id: number, [key: string]: any, webContents: { id: number, [key: string]: any } };
|
||||
/**
|
||||
* 隐藏插件应用到后台
|
||||
*/
|
||||
outPlugin(): boolean;
|
||||
/**
|
||||
@ -297,12 +312,16 @@ interface UToolsApi {
|
||||
*/
|
||||
//fetchUserServerTemporaryToken(): Promise<{ token: string, expiredAt: number }>;
|
||||
/**
|
||||
* 打开支付
|
||||
* @param callback 支付成功触发
|
||||
* 是否插件应用的付费用户
|
||||
*/
|
||||
// openPayment(options: {
|
||||
//isPurchasedUser(): boolean;
|
||||
// /**
|
||||
// * 商品ID,在 “uTools 开发者工具” 插件中创建
|
||||
// * 打开付费 (软件付费)
|
||||
// * @param callback 购买成功触发
|
||||
// */
|
||||
// openPurchase(options: {
|
||||
// /**
|
||||
// * 商品 ID,在「开发者工具」插件应用中创建
|
||||
// */
|
||||
// goodsId: string,
|
||||
// /**
|
||||
@ -314,44 +333,62 @@ interface UToolsApi {
|
||||
// */
|
||||
// attach?: string
|
||||
// }, callback?: () => void): void;
|
||||
/**
|
||||
* 获取用户支付记录
|
||||
*/
|
||||
// /**
|
||||
// * 打开支付 (付费付费)
|
||||
// * @param callback 支付成功触发
|
||||
// */
|
||||
// openPayment(options: {
|
||||
// /**
|
||||
// * 商品 ID,在「开发者工具」插件应用中创建
|
||||
// */
|
||||
// goodsId: string,
|
||||
// /**
|
||||
// * 第三方服务生成的订单号(可选)
|
||||
// */
|
||||
// outOrderId?: string,
|
||||
// /**
|
||||
// * 第三方服务附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用(可选)
|
||||
// */
|
||||
// attach?: string
|
||||
// }, callback?: () => void): void;
|
||||
// /**
|
||||
// * 获取用户支付记录
|
||||
// */
|
||||
// fetchUserPayments(): Promise<{ order_id: string, total_fee: number, body: string, attach: string, goods_id: string, out_order_id: string, paid_at: string }[]>;
|
||||
/**
|
||||
* 设置插件动态功能
|
||||
*/
|
||||
// /**
|
||||
// * 设置插件应用动态功能
|
||||
// */
|
||||
// setFeature(feature: {
|
||||
// code: string,
|
||||
// explain: string,
|
||||
// platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
|
||||
// icon?: string,
|
||||
// cmds: string | {
|
||||
// cmds: (string | {
|
||||
// type: 'img' | 'files' | 'regex' | 'over' | 'window',
|
||||
// label: string
|
||||
// }[]
|
||||
// })[]
|
||||
// }): boolean;
|
||||
/**
|
||||
* 移除插件动态功能
|
||||
*/
|
||||
// /**
|
||||
// * 移除插件应用动态功能
|
||||
// */
|
||||
// removeFeature(code: string): boolean;
|
||||
// /**
|
||||
// * 获取插件应用动态功能,参数为空获取所有动态功能
|
||||
// */
|
||||
getFeatures(codes?: string[]): {
|
||||
code: string,
|
||||
explain: string,
|
||||
platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
|
||||
icon?: string,
|
||||
cmds: string | {
|
||||
type: 'img' | 'files' | 'regex' | 'over' | 'window',
|
||||
label: string
|
||||
}[]
|
||||
}[];
|
||||
/**
|
||||
* 获取插件所有动态功能
|
||||
* 插件应用间跳转
|
||||
*/
|
||||
// getFeatures(): {
|
||||
// code: string,
|
||||
// explain: string,
|
||||
// platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
|
||||
// icon?: string,
|
||||
// cmds: string | {
|
||||
// type: 'img' | 'files' | 'regex' | 'over' | 'window',
|
||||
// label: string
|
||||
// }[]
|
||||
// }[];
|
||||
/**
|
||||
* 插件间跳转
|
||||
*/
|
||||
redirect(label: string, payload: string | { type: 'text' | 'img' | 'files', data: any }): void;
|
||||
redirect(label: string | string[], payload: string | { type: 'text' | 'img' | 'files', data: any }): void;
|
||||
/**
|
||||
* 获取闲置的 ubrowser
|
||||
*/
|
||||
@ -395,7 +432,7 @@ interface UToolsApi {
|
||||
securityScopedBookmarks?: boolean
|
||||
}): (string) | (undefined);
|
||||
/**
|
||||
* 插件页面中查找
|
||||
* 插件应用页面中查找
|
||||
*/
|
||||
findInPage(text: string, options?: {
|
||||
forward?: boolean,
|
||||
@ -405,7 +442,7 @@ interface UToolsApi {
|
||||
medialCapitalAsWordStart?: boolean
|
||||
}): void;
|
||||
/**
|
||||
* 停止插件页面中查找
|
||||
* 停止插件应用页面中查找
|
||||
*/
|
||||
stopFindInPage (action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
|
||||
/**
|
||||
@ -428,6 +465,10 @@ interface UToolsApi {
|
||||
* 获取软件版本
|
||||
*/
|
||||
getAppVersion(): string;
|
||||
/**
|
||||
* 获取软件名称
|
||||
*/
|
||||
getAppName(): string;
|
||||
/**
|
||||
* 获取路径
|
||||
*/
|
||||
@ -480,6 +521,22 @@ interface UToolsApi {
|
||||
* 播放哔哔声
|
||||
*/
|
||||
shellBeep(): void;
|
||||
/*
|
||||
* 键入字符串
|
||||
*/
|
||||
hideMainWindowTypeString(str: string): void;
|
||||
/*
|
||||
* 粘贴文件
|
||||
*/
|
||||
hideMainWindowPasteFile(file: string | string[]): void;
|
||||
/*
|
||||
* 粘贴图像
|
||||
*/
|
||||
hideMainWindowPasteImage(img: string): void;
|
||||
/*
|
||||
* 粘贴文本
|
||||
*/
|
||||
hideMainWindowPasteText(text: string): void;
|
||||
/**
|
||||
* 模拟键盘按键
|
||||
*/
|
||||
@ -520,6 +577,10 @@ interface UToolsApi {
|
||||
* 获取矩形所在的显示器
|
||||
*/
|
||||
getDisplayMatching(rect: { x: number, y: number, width: number, height: number }): Display;
|
||||
/**
|
||||
* 录屏源
|
||||
*/
|
||||
desktopCaptureSources(options: { types: string[], thumbnailSize?: { width: number, height: number }, fetchWindowIcons?: boolean }):Promise<{appIcon: {}, display_id: string, id: string, name: string, thumbnail: {} }>;
|
||||
/**
|
||||
* 是否开发中
|
||||
*/
|
||||
@ -527,7 +588,7 @@ interface UToolsApi {
|
||||
/**
|
||||
* 是否 MacOs 操作系统
|
||||
*/
|
||||
isMacOs(): boolean;
|
||||
isMacOS(): boolean;
|
||||
/**
|
||||
* 是否 Windows 操作系统
|
||||
*/
|
||||
@ -576,6 +637,10 @@ interface UToolsApi {
|
||||
// */
|
||||
// getAttachmentType(docId: string): string | null;
|
||||
// /**
|
||||
// * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1:复制中)
|
||||
// */
|
||||
// replicateStateFromCloud(): null | 0 | 1;
|
||||
// /**
|
||||
// * 异步
|
||||
// */
|
||||
// promises: {
|
||||
@ -616,6 +681,10 @@ interface UToolsApi {
|
||||
// * @param docId 文档ID
|
||||
// */
|
||||
// getAttachmentType(docId: string): Promise<string | null>;
|
||||
// /**
|
||||
// * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1:复制中)
|
||||
// */
|
||||
// replicateStateFromCloud(): Promise<null | 0 | 1>;
|
||||
// }
|
||||
// };
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user