utools-api-types 2.6.0 → 3.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 (2) hide show
  1. package/package.json +1 -1
  2. package/utools.api.d.ts +35 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utools-api-types",
3
- "version": "2.6.0",
3
+ "version": "3.0.0",
4
4
  "description": "TypeScript definitions for uTools API",
5
5
  "repository": {
6
6
  "type": "git",
package/utools.api.d.ts CHANGED
@@ -225,19 +225,19 @@ interface DbReturn {
225
225
 
226
226
  interface UToolsApi {
227
227
  /**
228
- * 插件进入时触发
228
+ * 插件应用进入时触发
229
229
  */
230
230
  onPluginEnter(callback: (action: {code: string, type: string, payload: any }) => void): void;
231
231
  /**
232
- * 插件隐藏时触发
232
+ * 插件应用隐藏后台或完全退出时触发
233
233
  */
234
- onPluginOut(callback: () => void): void;
234
+ onPluginOut(callback: (processExit: boolean) => void): void;
235
235
  /**
236
- * 插件分离时触发
236
+ * 插件应用分离时触发
237
237
  */
238
238
  onPluginDetach(callback: () => void): void;
239
239
  /**
240
- * 插件从云端拉取到数据时触发
240
+ * 插件应用从云端拉取到数据时触发
241
241
  */
242
242
  onDbPull(callback: (docs: { _id: string, _rev: string }[]) => void): void;
243
243
  /**
@@ -250,7 +250,7 @@ interface UToolsApi {
250
250
  */
251
251
  showMainWindow(): boolean;
252
252
  /**
253
- * 设置插件自身高度
253
+ * 设置插件应用自身高度
254
254
  */
255
255
  setExpendHeight(height: number): boolean;
256
256
  /**
@@ -277,7 +277,7 @@ interface UToolsApi {
277
277
  */
278
278
  subInputSelect(): boolean;
279
279
  /**
280
- * 子输入框失去焦点,插件获得焦点
280
+ * 子输入框失去焦点,插件应用获得焦点
281
281
  */
282
282
  subInputBlur(): boolean;
283
283
  /**
@@ -288,7 +288,7 @@ interface UToolsApi {
288
288
  */
289
289
  createBrowserWindow(url: string, options: { width?: number, height?: number }, callback?: () => void): { id: number, [key: string]: any, webContents: { id: number, [key: string]: any } };
290
290
  /**
291
- * 隐藏插件到后台
291
+ * 隐藏插件应用到后台
292
292
  */
293
293
  outPlugin(): boolean;
294
294
  /**
@@ -309,7 +309,7 @@ interface UToolsApi {
309
309
  */
310
310
  openPayment(options: {
311
311
  /**
312
- * 商品ID,在 “uTools 开发者工具” 插件中创建
312
+ * 商品ID,在 “uTools 开发者工具” 插件应用中创建
313
313
  */
314
314
  goodsId: string,
315
315
  /**
@@ -326,26 +326,26 @@ interface UToolsApi {
326
326
  */
327
327
  fetchUserPayments(): Promise<{ order_id: string, total_fee: number, body: string, attach: string, goods_id: string, out_order_id: string, paid_at: string }[]>;
328
328
  /**
329
- * 设置插件动态功能
329
+ * 设置插件应用动态功能
330
330
  */
331
331
  setFeature(feature: {
332
332
  code: string,
333
333
  explain: string,
334
334
  platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
335
335
  icon?: string,
336
- cmds: string | {
336
+ cmds: (string | {
337
337
  type: 'img' | 'files' | 'regex' | 'over' | 'window',
338
338
  label: string
339
- }[]
339
+ })[]
340
340
  }): boolean;
341
341
  /**
342
- * 移除插件动态功能
342
+ * 移除插件应用动态功能
343
343
  */
344
344
  removeFeature(code: string): boolean;
345
345
  /**
346
- * 获取插件所有动态功能
346
+ * 获取插件应用动态功能,参数为空获取所有动态功能
347
347
  */
348
- getFeatures(): {
348
+ getFeatures(codes?: string[]): {
349
349
  code: string,
350
350
  explain: string,
351
351
  platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
@@ -356,7 +356,7 @@ interface UToolsApi {
356
356
  }[]
357
357
  }[];
358
358
  /**
359
- * 插件间跳转
359
+ * 插件应用间跳转
360
360
  */
361
361
  redirect(label: string, payload: string | { type: 'text' | 'img' | 'files', data: any }): void;
362
362
  /**
@@ -402,7 +402,7 @@ interface UToolsApi {
402
402
  securityScopedBookmarks?: boolean
403
403
  }): (string) | (undefined);
404
404
  /**
405
- * 插件页面中查找
405
+ * 插件应用页面中查找
406
406
  */
407
407
  findInPage(text: string, options?: {
408
408
  forward?: boolean,
@@ -412,7 +412,7 @@ interface UToolsApi {
412
412
  medialCapitalAsWordStart?: boolean
413
413
  }): void;
414
414
  /**
415
- * 停止插件页面中查找
415
+ * 停止插件应用页面中查找
416
416
  */
417
417
  stopFindInPage (action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
418
418
  /**
@@ -487,6 +487,10 @@ interface UToolsApi {
487
487
  * 播放哔哔声
488
488
  */
489
489
  shellBeep(): void;
490
+ /*
491
+ * 隐藏主窗口并键入字符串
492
+ */
493
+ hideMainWindowTypeString(str: string): void;
490
494
  /**
491
495
  * 模拟键盘按键
492
496
  */
@@ -527,6 +531,10 @@ interface UToolsApi {
527
531
  * 获取矩形所在的显示器
528
532
  */
529
533
  getDisplayMatching(rect: { x: number, y: number, width: number, height: number }): Display;
534
+ /**
535
+ * 录屏源
536
+ */
537
+ desktopCaptureSources(options: { types: string[], thumbnailSize?: { width: number, height: number }, fetchWindowIcons?: boolean }):Promise<{appIcon: {}, display_id: string, id: string, name: string, thumbnail: {} }>;
530
538
  /**
531
539
  * 是否开发中
532
540
  */
@@ -534,7 +542,7 @@ interface UToolsApi {
534
542
  /**
535
543
  * 是否 MacOs 操作系统
536
544
  */
537
- isMacOs(): boolean;
545
+ isMacOS(): boolean;
538
546
  /**
539
547
  * 是否 Windows 操作系统
540
548
  */
@@ -582,6 +590,10 @@ interface UToolsApi {
582
590
  * @param docId 文档ID
583
591
  */
584
592
  getAttachmentType(docId: string): string | null;
593
+ /**
594
+ * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1:复制中)
595
+ */
596
+ replicateStateFromCloud(): null | 0 | 1;
585
597
  /**
586
598
  * 异步
587
599
  */
@@ -623,6 +635,10 @@ interface UToolsApi {
623
635
  * @param docId 文档ID
624
636
  */
625
637
  getAttachmentType(docId: string): Promise<string | null>;
638
+ /**
639
+ * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1:复制中)
640
+ */
641
+ replicateStateFromCloud(): Promise<null | 0 | 1>;
626
642
  }
627
643
  };
628
644