更新utools api到6.0

This commit is contained in:
fofolee
2024-12-22 10:12:17 +08:00
parent 36f6e0ceed
commit 3566e45704
2 changed files with 272 additions and 307 deletions

View File

@@ -1,9 +1,22 @@
const getuToolsLite = () => { const getuToolsLite = () => {
var utoolsLite = Object.assign({}, _.cloneDeep(utools)) var utoolsLite = Object.assign({}, _.cloneDeep(utools))
// if (utools.isDev()) return utoolsLite // if (utools.isDev()) return utoolsLite
const dbBlackList = ['db', 'dbStorage', 'removeFeature', 'setFeature', 'onDbPull'] const dbBlackList = [
"db",
"dbStorage",
"dbCryptoStorage",
"removeFeature",
"setFeature",
"onDbPull",
];
const payBlackList = ['fetchUserServerTemporaryToken', 'isPurchasedUser', 'openPurchase', 'getUserServerTemporaryToken', 'openPayment', 'fetchUserPayments'] const payBlackList = ['fetchUserServerTemporaryToken', 'isPurchasedUser', 'openPurchase', 'getUserServerTemporaryToken', 'openPayment', 'fetchUserPayments']
const etcBlackList = ['onPluginEnter', 'onPluginOut', 'onMainPush', 'createBrowserWindow'] const etcBlackList = [
"onPluginEnter",
"onPluginOut",
"onMainPush",
"createBrowserWindow",
"team",
];
_.concat(dbBlackList, payBlackList, etcBlackList).forEach(item => { _.concat(dbBlackList, payBlackList, etcBlackList).forEach(item => {
delete utoolsLite[item] delete utoolsLite[item]
}) })

View File

@@ -9,7 +9,11 @@ interface UBrowser {
* @param headers 请求头参数 * @param headers 请求头参数
* @param timeout 加载超时,默认 60000 ms(60秒) * @param timeout 加载超时,默认 60000 ms(60秒)
*/ */
goto(url: string, headers?: { Referer: string, userAgent: string }, timeout?: number): this; goto(
url: string,
headers?: { Referer: string; userAgent: string },
timeout?: number
): this;
/** /**
* 页面大小 * 页面大小
*/ */
@@ -29,7 +33,7 @@ interface UBrowser {
/** /**
* 键盘按键 * 键盘按键
*/ */
press(key: string, ...modifier: ('ctrl' | 'shift' | 'alt' | 'meta')[]): this; press(key: string, ...modifier: ("ctrl" | "shift" | "alt" | "meta")[]): this;
/** /**
* 粘贴 * 粘贴
* @param text 如果是图片的base64编码字符串粘贴图片为空只执行粘贴动作 * @param text 如果是图片的base64编码字符串粘贴图片为空只执行粘贴动作
@@ -40,17 +44,31 @@ interface UBrowser {
* @param arg 1.字符串 - 要截取的DOM元素 2.对象 - 截图位置和大小, 3.空 - 为截取整个窗口 * @param arg 1.字符串 - 要截取的DOM元素 2.对象 - 截图位置和大小, 3.空 - 为截取整个窗口
* @param savePath 截图保存路径,可以是文件夹 或 .png文件完全路径, 默认保存临时目录 * @param savePath 截图保存路径,可以是文件夹 或 .png文件完全路径, 默认保存临时目录
*/ */
screenshot(arg: string | { x: number, y: number, width: number, height: number }, savePath?: string): this; screenshot(
arg: string | { x: number; y: number; width: number; height: number },
savePath?: string
): this;
/** /**
* 保存为PDF * 保存为PDF
* @param options 选项 * @param options 选项
* @param savePath PDF保存路径可以是文件夹 或 .pdf文件完全路径, 默认保存临时目录 * @param savePath PDF保存路径可以是文件夹 或 .pdf文件完全路径, 默认保存临时目录
*/ */
pdf(options?: { marginsType: 0 | 1 | 2, pageSize: ('A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid') | ({ width: number, height: number }) }, savePath?: string): this; pdf(
options?: {
marginsType: 0 | 1 | 2;
pageSize:
| ("A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid")
| { width: number; height: number };
},
savePath?: string
): this;
/** /**
* 模拟设备 * 模拟设备
*/ */
device(arg: ('iPhone 11' | 'iPhone X' | 'iPad' | 'iPhone 6/7/8 Plus' | 'iPhone 6/7/8' | 'iPhone 5/SE' | 'HUAWEI Mate10' | 'HUAWEI Mate20' | 'HUAWEI Mate30' | 'HUAWEI Mate30 Pro') | { size: { width: number, height: number }, useragent: string }): this; device(arg: {
size: { width: number; height: number };
useragent: string;
}): this;
/** /**
* 获取 cookie * 获取 cookie
* @param name 为空获取全部cookie * @param name 为空获取全部cookie
@@ -63,7 +81,7 @@ interface UBrowser {
/** /**
* 设置Cookie * 设置Cookie
*/ */
setCookies(cookies: { name: string, value: string }[]): this; setCookies(cookies: { name: string; value: string }[]): this;
/** /**
* 删除 cookie * 删除 cookie
*/ */
@@ -76,13 +94,13 @@ interface UBrowser {
/** /**
* 打开开发者工具 * 打开开发者工具
*/ */
devTools(mode?: 'right' | 'bottom' | 'undocked' | 'detach'): this; devTools(mode?: "right" | "bottom" | "undocked" | "detach"): this;
/** /**
* 执行JS计算 并获得结果 * 执行JS计算 并获得结果
* @param func 在目标网页中执行 * @param func 在目标网页中执行
* @param params 传到 func 中的参数 * @param params 传到 func 中的参数
*/ */
evaluate(func: (...params: any[]) => any, ...params: any[]): this; evaluate<T extends any[]>(func: (...params: T) => any, ...params: T): this;
/** /**
* 等待时间 * 等待时间
* @param ms 毫秒 * @param ms 毫秒
@@ -100,9 +118,13 @@ interface UBrowser {
* @param timeout 超时 默认60000 ms(60秒) * @param timeout 超时 默认60000 ms(60秒)
* @param params 传到 func 中的参数 * @param params 传到 func 中的参数
*/ */
wait(func: (...params: any[]) => boolean, timeout?: number, ...params: any[]): this; wait<T extends any[]>(
func: (...params: T) => boolean,
timeout?: number,
...params: T
): this;
/** /**
* 当元素存在时执行直到碰到 end * 当元素存在时执行直到碰到 end
* @param selector DOM元素 * @param selector DOM元素
*/ */
when(selector: string): this; when(selector: string): this;
@@ -111,7 +133,7 @@ interface UBrowser {
* @param func 执行的JS函数 * @param func 执行的JS函数
* @param params 传到 func 中的参数 * @param params 传到 func 中的参数
*/ */
when(func: (...params: any[]) => boolean, ...params: any[]): this; when<T extends any[]>(func: (...params: T) => boolean, ...params: T): this;
/** /**
* 配合 when 使用 * 配合 when 使用
*/ */
@@ -162,42 +184,50 @@ interface UBrowser {
* 下载文件 * 下载文件
*/ */
download(url: string, savePath?: string): this; download(url: string, savePath?: string): this;
/**
* 下载文件
*/
download(
func: (...params: any[]) => string,
savePath: string | null,
...params: any[]
): this;
/** /**
* 启动一个 ubrowser 运行 * 启动一个 ubrowser 运行
* 当运行结束后,窗口如果为隐藏状态将自动销毁窗口 * 当运行结束后,窗口如果为隐藏状态将自动销毁窗口
* @param options * @param options
*/ */
run(options: { run<T extends any = any[]>(options: {
show?: boolean, show?: boolean;
width?: number, width?: number;
height?: number, height?: number;
x?: number, x?: number;
y?: number, y?: number;
center?: boolean, center?: boolean;
minWidth?: number, minWidth?: number;
minHeight?: number, minHeight?: number;
maxWidth?: number, maxWidth?: number;
maxHeight?: number, maxHeight?: number;
resizable?: boolean, resizable?: boolean;
movable?: boolean, movable?: boolean;
minimizable?: boolean, minimizable?: boolean;
maximizable?: boolean, maximizable?: boolean;
alwaysOnTop?: boolean, alwaysOnTop?: boolean;
fullscreen?: boolean, fullscreen?: boolean;
fullscreenable?: boolean, fullscreenable?: boolean;
enableLargerThanScreen?: boolean, enableLargerThanScreen?: boolean;
opacity?: number opacity?: number;
}): Promise<any[]>; }): Promise<T>;
/** /**
* 运行在闲置的 ubrowser 上 * 运行在闲置的 ubrowser 上
* @param ubrowserId 1. run(options) 运行结束后, 当 ubrowser 实例窗口仍然显示时返回 2. utools.getIdleUBrowsers() 中获得 * @param ubrowserId 1. run(options) 运行结束后, 当 ubrowser 实例窗口仍然显示时返回 2. utools.getIdleUBrowsers() 中获得
*/ */
run(ubrowserId: number): Promise<any[]>; run<T extends any = any[]>(ubrowserId: number): Promise<T>;
} }
interface Display { interface Display {
accelerometerSupport: ('available' | 'unavailable' | 'unknown'); accelerometerSupport: "available" | "unavailable" | "unknown";
bounds: { x: number, y: number, width: number, height: number }; bounds: { x: number; y: number; width: number; height: number };
colorDepth: number; colorDepth: number;
colorSpace: string; colorSpace: string;
depthPerComponent: number; depthPerComponent: number;
@@ -206,48 +236,34 @@ interface Display {
monochrome: boolean; monochrome: boolean;
rotation: number; rotation: number;
scaleFactor: number; scaleFactor: number;
size: { width: number, height: number }; size: { width: number; height: number };
touchSupport: ('available' | 'unavailable' | 'unknown'); touchSupport: "available" | "unavailable" | "unknown";
workArea: { x: number, y: number, width: number, height: number }; workArea: { x: number; y: number; width: number; height: number };
workAreaSize: { width: number, height: number }; workAreaSize: { width: number; height: number };
} }
interface DbDoc { interface PluginFeature {
_id: string, code: string;
_rev?: string, explain?: string;
[key: string]: any platform?:
| ("darwin" | "win32" | "linux")
| Array<"darwin" | "win32" | "linux">;
icon?: string;
cmds: (
| string
| {
type: "img" | "files" | "regex" | "over" | "window";
label: string;
}
)[];
mainHide?: boolean;
mainPush?: boolean;
} }
interface DbReturn { type PluginEnterFrom = "main" | "panel" | "hotkey" | "redirect";
id: string,
rev?: string,
ok?: boolean,
error?: boolean,
name?: string,
message?: string
}
interface UToolsApi { interface UToolsApi {
/**
* 插件应用进入时触发
*/
//onPluginEnter(callback: (action: {code: string, type: string, payload: any, option: any }) => 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; onPluginDetach(callback: () => void): void;
/**
* 插件应用从云端拉取到数据时触发
*/
//onDbPull(callback: (docs: { _id: string, _rev: string }[]) => void): void;
/** /**
* 隐藏主窗口 * 隐藏主窗口
* @param isRestorePreWindow 是否焦点回归到前面的活动窗口,默认 true * @param isRestorePreWindow 是否焦点回归到前面的活动窗口,默认 true
@@ -267,7 +283,11 @@ interface UToolsApi {
* @param placeholder 占位符, 默认为空 * @param placeholder 占位符, 默认为空
* @param isFocus 是否获得焦点,默认为 true * @param isFocus 是否获得焦点,默认为 true
*/ */
setSubInput(onChange: (text: string) => void, placeholder?: string, isFocus?: boolean): boolean; setSubInput(
onChange: (input: { text: string }) => void,
placeholder?: string,
isFocus?: boolean
): boolean;
/** /**
* 移除子输入框 * 移除子输入框
*/ */
@@ -294,11 +314,11 @@ interface UToolsApi {
* @param options 参考 https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions * @param options 参考 https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions
* @param callback url 加载完成时的回调 * @param callback url 加载完成时的回调
*/ */
//createBrowserWindow(url: string, options: { width?: number, height?: number }, callback?: () => void): { id: number, [key: string]: any, webContents: { id: number, [key: string]: any } };
/** /**
* 隐藏插件应用到后台 * 隐藏插件应用到后台
* @param {boolean|undefined} isKill 设置为 `true` 时,会将插件进程杀死
*/ */
outPlugin(): boolean; outPlugin(isKill?: boolean): boolean;
/** /**
* 是否深色模式 * 是否深色模式
*/ */
@@ -306,97 +326,31 @@ interface UToolsApi {
/** /**
* 获取用户 * 获取用户
*/ */
getUser(): { avatar: string, nickname: string, type: string } | null; getUser(): { avatar: string; nickname: string; type: string } | null;
/** /**
* 获取用户服务端临时令牌 * 获取插件应用动态功能,参数为空获取所有动态功能
*/ */
//fetchUserServerTemporaryToken(): Promise<{ token: string, expiredAt: number }>; getFeatures(codes?: string[]): PluginFeature[];
/**
* 是否插件应用的付费用户
*/
//isPurchasedUser(): boolean;
// /**
// * 打开付费 (软件付费)
// * @param callback 购买成功触发
// */
// openPurchase(options: {
// /**
// * 商品 ID在「开发者工具」插件应用中创建
// */
// goodsId: string,
// /**
// * 第三方服务生成的订单号(可选)
// */
// outOrderId?: string,
// /**
// * 第三方服务附加数据在查询API和支付通知中原样返回可作为自定义参数使用(可选)
// */
// 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 | {
// 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
}[]
}[];
/** /**
* 插件应用间跳转 * 插件应用间跳转
* @todo 创建针对type的多个重载
*/ */
redirect(label: string | string[], payload: string | { type: 'text' | 'img' | 'files', data: any }): void; redirect(
label: string | string[],
payload: string | { type: "text" | "img" | "files"; data: any }
): void;
/** /**
* 获取闲置的 ubrowser * 获取闲置的 ubrowser
*/ */
getIdleUBrowsers(): { id: number, title: string, url: string}[]; getIdleUBrowsers(): { id: number; title: string; url: string }[];
/** /**
* 设置 ubrowser 代理 https://www.electronjs.org/docs/api/session#sessetproxyconfig * 设置 ubrowser 代理 https://www.electronjs.org/docs/api/session#sessetproxyconfig
*/ */
setUBrowserProxy(config: {pacScript?: string, proxyRules?: string, proxyBypassRules?: string}): boolean; setUBrowserProxy(config: {
pacScript?: string;
proxyRules?: string;
proxyBypassRules?: string;
}): boolean;
/** /**
* 清空 ubrowser 缓存 * 清空 ubrowser 缓存
*/ */
@@ -404,47 +358,68 @@ interface UToolsApi {
/** /**
* 显示系统通知 * 显示系统通知
*/ */
showNotification(body: string): void; showNotification(body: string, featureName?: string): void;
/** /**
* 弹出文件选择框 * 弹出文件选择框
*/ */
showOpenDialog(options: { showOpenDialog(options: {
title?: string, title?: string;
defaultPath?: string, defaultPath?: string;
buttonLabel?: string, buttonLabel?: string;
filters?: { name: string, extensions: string[] }[], filters?: { name: string; extensions: string[] }[];
properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>, properties?: Array<
message?: string, | "openFile"
securityScopedBookmarks?: boolean | "openDirectory"
}): (string[]) | (undefined); | "multiSelections"
| "showHiddenFiles"
| "createDirectory"
| "promptToCreate"
| "noResolveAliases"
| "treatPackageAsDirectory"
| "dontAddToRecent"
>;
message?: string;
securityScopedBookmarks?: boolean;
}): string[] | undefined;
/** /**
* 弹出文件保存框 * 弹出文件保存框
*/ */
showSaveDialog(options: { showSaveDialog(options: {
title?: string, title?: string;
defaultPath?: string, defaultPath?: string;
buttonLabel?: string, buttonLabel?: string;
filters?: { name: string, extensions: string[] }[], filters?: { name: string; extensions: string[] }[];
message?: string, message?: string;
nameFieldLabel?: string, nameFieldLabel?: string;
showsTagField?: string, showsTagField?: string;
properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>, properties?: Array<
securityScopedBookmarks?: boolean | "showHiddenFiles"
}): (string) | (undefined); | "createDirectory"
| "treatPackageAsDirectory"
| "showOverwriteConfirmation"
| "dontAddToRecent"
>;
securityScopedBookmarks?: boolean;
}): string | undefined;
/** /**
* 插件应用页面中查找 * 插件应用页面中查找
*/ */
findInPage(text: string, options?: { findInPage(
forward?: boolean, text: string,
findNext?: boolean, options?: {
matchCase?: boolean, forward?: boolean;
wordStart?: boolean, findNext?: boolean;
medialCapitalAsWordStart?: boolean matchCase?: boolean;
}): void; wordStart?: boolean;
medialCapitalAsWordStart?: boolean;
}
): void;
/** /**
* 停止插件应用页面中查找 * 停止插件应用页面中查找
*/ */
stopFindInPage (action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void; stopFindInPage(
action: "clearSelection" | "keepSelection" | "activateSelection"
): void;
/** /**
* 拖拽文件 * 拖拽文件
*/ */
@@ -452,7 +427,9 @@ interface UToolsApi {
/** /**
* 屏幕取色 * 屏幕取色
*/ */
screenColorPick(callback: (color: { hex: string, rgb: string }) => void): void; screenColorPick(
callback: (color: { hex: string; rgb: string }) => void
): void;
/** /**
* 屏幕截图 * 屏幕截图
*/ */
@@ -472,11 +449,32 @@ interface UToolsApi {
/** /**
* 获取路径 * 获取路径
*/ */
getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'logs' | 'pepperFlashSystemPlugin'): string; getPath(
name:
| "home"
| "appData"
| "userData"
| "cache"
| "temp"
| "exe"
| "module"
| "desktop"
| "documents"
| "downloads"
| "music"
| "pictures"
| "videos"
| "logs"
| "pepperFlashSystemPlugin"
): string;
/** /**
* 获取文件图标 * 获取文件图标
*/ */
getFileIcon(filePath: string): string; getFileIcon(filePath: string): string;
/**
* 获取当前窗口类型, 'main' 主窗口 | 'detach' 分离窗口 | 'browser' 由 createBrowserWindow 创建的窗口
*/
getWindowType(): "main" | "detach" | "browser";
/** /**
* 复制文件到剪贴板 * 复制文件到剪贴板
*/ */
@@ -493,10 +491,15 @@ interface UToolsApi {
/** /**
* 获取复制的文件或文件夹 * 获取复制的文件或文件夹
*/ */
getCopyedFiles(): { isFile: boolean, isDirectory: boolean, name: string, path: string }[]; getCopyedFiles(): {
isFile: boolean;
isDirectory: boolean;
name: string;
path: string;
}[];
/** /**
* 读取当前文件管理器路径(linux 不支持) * 读取当前文件管理器路径(linux 不支持)
*/ */
readCurrentFolderPath(): Promise<string>; readCurrentFolderPath(): Promise<string>;
/** /**
* 读取当前浏览器窗口的URL(linux 不支持) * 读取当前浏览器窗口的URL(linux 不支持)
@@ -509,6 +512,10 @@ interface UToolsApi {
* 默认方式打开给定的文件 * 默认方式打开给定的文件
*/ */
shellOpenPath(fullPath: string): void; shellOpenPath(fullPath: string): void;
/**
* 删除文件到回收站
*/
shellTrashItem(filename: string): Promise<void>;
/** /**
* 在文件管理器中显示给定的文件 * 在文件管理器中显示给定的文件
*/ */
@@ -522,25 +529,36 @@ interface UToolsApi {
*/ */
shellBeep(): void; shellBeep(): void;
/* /*
* 键入字符串 * 键入字符串
*/ */
hideMainWindowTypeString(str: string): void; hideMainWindowTypeString(str: string): void;
/* /*
* 粘贴文件 * 粘贴文件
*/ */
hideMainWindowPasteFile(file: string | string[]): void; hideMainWindowPasteFile(file: string | string[]): void;
/* /*
* 粘贴图像 * 粘贴图像
*/ */
hideMainWindowPasteImage(img: string): void; hideMainWindowPasteImage(img: string | Uint8Array): void;
/* /*
* 粘贴文本 * 粘贴文本
*/ */
hideMainWindowPasteText(text: string): void; hideMainWindowPasteText(text: string): void;
/** /**
* 模拟键盘按键 * 模拟键盘按键
*/ */
simulateKeyboardTap(key: string, ...modifier: ('control' | 'ctrl' | 'shift' | 'option' | 'alt' | 'command' | 'super')[]): void; simulateKeyboardTap(
key: string,
...modifier: (
| "control"
| "ctrl"
| "shift"
| "option"
| "alt"
| "command"
| "super"
)[]
): void;
/** /**
* 模拟鼠标单击 * 模拟鼠标单击
*/ */
@@ -560,7 +578,7 @@ interface UToolsApi {
/** /**
* 获取鼠标绝对位置 * 获取鼠标绝对位置
*/ */
getCursorScreenPoint(): { x: number, y: number }; getCursorScreenPoint(): { x: number; y: number };
/** /**
* 获取主显示器 * 获取主显示器
*/ */
@@ -572,15 +590,56 @@ interface UToolsApi {
/** /**
* 获取位置所在的显示器 * 获取位置所在的显示器
*/ */
getDisplayNearestPoint(point: { x: number, y: number }): Display; getDisplayNearestPoint(point: { x: number; y: number }): Display;
/** /**
* 获取矩形所在的显示器 * 获取矩形所在的显示器
*/ */
getDisplayMatching(rect: { x: number, y: number, width: number, height: number }): Display; getDisplayMatching(rect: {
x: number;
y: number;
width: number;
height: number;
}): Display;
/**
* 屏幕物理坐标转 DIP 坐标
*/
screenToDipPoint(point: { x: number; y: number }): { x: number; y: number };
/**
* 屏幕 DIP 坐标转物理坐标
*/
dipToScreenPoint(point: { x: number; y: number }): { x: number; y: number };
/**
* 屏幕物理区域转 DIP 区域
*/
screenToDipRect(rect: {
x: number;
y: number;
width: number;
height: number;
}): { x: number; y: number; width: number; height: number };
/**
* 屏幕 DIP 区域转物理区域
*/
dipToScreenRect(rect: {
x: number;
y: number;
width: number;
height: number;
}): { x: number; y: number; width: number; height: number };
/** /**
* 录屏源 * 录屏源
*/ */
desktopCaptureSources(options: { types: string[], thumbnailSize?: { width: number, height: number }, fetchWindowIcons?: boolean }):Promise<{appIcon: {}, display_id: string, id: string, name: string, thumbnail: {} }>; desktopCaptureSources(options: {
types: string[];
thumbnailSize?: { width: number; height: number };
fetchWindowIcons?: boolean;
}): Promise<{
appIcon: {};
display_id: string;
id: string;
name: string;
thumbnail: {};
}>;
/** /**
* 是否开发中 * 是否开发中
*/ */
@@ -598,113 +657,6 @@ interface UToolsApi {
*/ */
isLinux(): boolean; isLinux(): boolean;
// db: {
// /**
// * 创建/更新文档
// */
// put(doc: DbDoc): DbReturn;
// /**
// * 获取文档
// */
// get(id: string): DbDoc | null;
// /**
// * 删除文档
// */
// remove(doc: string | DbDoc): DbReturn;
// /**
// * 批量操作文档(新增、修改、删除)
// */
// bulkDocs(docs: DbDoc[]): DbReturn[];
// /**
// * 获取所有文档 可根据文档id前缀查找
// */
// allDocs(key?: string): DbDoc[];
// /**
// * 存储附件到新文档
// * @param docId 文档ID
// * @param attachment 附件 buffer
// * @param type 附件类型示例image/png, text/plain
// */
// postAttachment(docId: string, attachment: Uint8Array, type: string): DbReturn;
// /**
// * 获取附件
// * @param docId 文档ID
// */
// getAttachment(docId: string): Uint8Array | null;
// /**
// * 获取附件类型
// * @param docId 文档ID
// */
// getAttachmentType(docId: string): string | null;
// /**
// * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1复制中)
// */
// replicateStateFromCloud(): null | 0 | 1;
// /**
// * 异步
// */
// promises: {
// /**
// * 创建/更新文档
// */
// put(doc: DbDoc): Promise<DbReturn>;
// /**
// * 获取文档
// */
// get(id: string): Promise<DbDoc | null>;
// /**
// * 删除文档
// */
// remove(doc: string | DbDoc): Promise<DbReturn>;
// /**
// * 批量操作文档(新增、修改、删除)
// */
// bulkDocs(docs: DbDoc[]): Promise<DbReturn[]>;
// /**
// * 获取所有文档 可根据文档id前缀查找
// */
// allDocs(key?: string): Promise<DbDoc[]>;
// /**
// * 存储附件到新文档
// * @param docId 文档ID
// * @param attachment 附件 buffer
// * @param type 附件类型示例image/png, text/plain
// */
// postAttachment(docId: string, attachment: Uint8Array, type: string): Promise<DbReturn>;
// /**
// * 获取附件
// * @param docId 文档ID
// */
// getAttachment(docId: string): Promise<Uint8Array | null>;
// /**
// * 获取附件类型
// * @param docId 文档ID
// */
// getAttachmentType(docId: string): Promise<string | null>;
// /**
// * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1复制中)
// */
// replicateStateFromCloud(): Promise<null | 0 | 1>;
// }
// };
// dbStorage: {
// /**
// * 键值对存储,如果键名存在,则更新其对应的值
// * @param key 键名(同时为文档ID)
// * @param value 键值
// */
// setItem (key: string, value: any): void;
// /**
// * 获取键名对应的值
// */
// getItem (key: string): any;
// /**
// * 删除键值对(删除文档)
// */
// removeItem (key: string): void;
// };
ubrowser: UBrowser; ubrowser: UBrowser;
} }