utools-api-types 6.0.0 → 6.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utools-api-types",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "TypeScript definitions for uTools API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,6 +15,7 @@
15
15
  "url": "https://github.com/uTools-Labs/utools-api-types/issues"
16
16
  },
17
17
  "homepage": "https://github.com/uTools-Labs/utools-api-types#readme",
18
+ "readme": "./README.md",
18
19
  "exports": {
19
20
  "default": {
20
21
  "types": "./utools.api.d.ts"
@@ -17,18 +17,6 @@
17
17
  "type": "string",
18
18
  "description": "插件图标,支持png,jpg格式"
19
19
  },
20
- "platform": {
21
- "type": "array",
22
- "description": "插件支持的平台,默认为所有平台。",
23
- "items": {
24
- "type": "string",
25
- "enum": [
26
- "win32",
27
- "darwin",
28
- "linux"
29
- ]
30
- }
31
- },
32
20
  "development": {
33
21
  "type": "object",
34
22
  "properties": {
@@ -72,18 +60,6 @@
72
60
  "mainPush": {
73
61
  "type": "boolean"
74
62
  },
75
- "platform": {
76
- "type": "array",
77
- "description": "此功能的支持平台,默认为所有平台。",
78
- "items": {
79
- "type": "string",
80
- "enum": [
81
- "win32",
82
- "darwin",
83
- "linux"
84
- ]
85
- }
86
- },
87
63
  "cmds": {
88
64
  "type": "array",
89
65
  "description": "该功能下可响应的命令集,支持 6 种类型,由 cmds 的类型或 cmds.type 决定。",
@@ -148,9 +124,9 @@
148
124
  }
149
125
  }
150
126
  },
151
- "mainHide":{
152
- "type":"boolean",
153
- "description": "设置为 `true` 时,启动对应的 `feature` 不主动弹出主面板"
127
+ "mainHide": {
128
+ "type": "boolean",
129
+ "description": "设置为 `true` 时,打开对应的 `feature` 不主动弹出搜索框面板"
154
130
  }
155
131
  }
156
132
  }
package/utools.api.d.ts CHANGED
@@ -1,5 +1,16 @@
1
1
  /// <reference path="ubw.d.ts"/>
2
2
  /// <reference path="electron.d.ts"/>
3
+
4
+ interface CookieFilter {
5
+ url ?: string;
6
+ name?: string;
7
+ domain?: string;
8
+ path?: string;
9
+ secure?: boolean;
10
+ session?: boolean;
11
+ httpOnly?: boolean;
12
+ }
13
+
3
14
  interface UBrowser {
4
15
  /**
5
16
  * 设置 User-Agent
@@ -54,10 +65,15 @@ interface UBrowser {
54
65
  */
55
66
  device(arg: { size: { width: number, height: number }, useragent: string }): this;
56
67
  /**
57
- * 获取 cookie
58
- * @param name 为空获取全部cookie
68
+ * 在当前 url 根据名称获取 cookie
69
+ * @param name 为空获取当前 url 全部 cookie
59
70
  */
60
71
  cookies(name?: string): this;
72
+ /**
73
+ * 根据条件获取 ubrowser cookies
74
+ * @param filter 条件过滤对象
75
+ */
76
+ cookies(filter: CookieFilter): this;
61
77
  /**
62
78
  * 设置Cookie
63
79
  */
@@ -251,6 +267,22 @@ type PluginEnterFrom =
251
267
  | 'hotkey'
252
268
  | 'redirect'
253
269
 
270
+ interface FfmpegRunProgress {
271
+ bitrate: string;
272
+ fps: number;
273
+ frame: number;
274
+ percent?: number;
275
+ q: number | string;
276
+ size: string;
277
+ speed: string;
278
+ time: string;
279
+ }
280
+
281
+ interface FfmpegPromise extends Promise<void> {
282
+ kill(): void;
283
+ quit(): void;
284
+ }
285
+
254
286
  interface UToolsApi {
255
287
  /**
256
288
  * 插件应用进入时触发
@@ -319,6 +351,13 @@ interface UToolsApi {
319
351
  * @param callback url 加载完成时的回调
320
352
  */
321
353
  createBrowserWindow(url: string, options: BrowserWindow.InitOptions, callback?: () => void): BrowserWindow.WindowInstance;
354
+ /**
355
+ * 发送消息到父窗口
356
+ * **仅在 `createBrowserWindow` 创建的窗口中使用有效**
357
+ * @param channel 通道名
358
+ * @param params 发送的数据
359
+ */
360
+ sendToParent(channel: string, ...params: any[]): void;
322
361
  /**
323
362
  * 隐藏插件应用到后台
324
363
  * @param {boolean|undefined} isKill 设置为 `true` 时,会将插件进程杀死
@@ -396,7 +435,7 @@ interface UToolsApi {
396
435
  * 插件应用间跳转
397
436
  * @todo 创建针对type的多个重载
398
437
  */
399
- redirect(label: string | string[], payload: string | { type: 'text' | 'img' | 'files', data: any }): void;
438
+ redirect(label: string | string[], payload: string | { type: 'text' | 'img' | 'files', data: any }): boolean;
400
439
  /**
401
440
  * 获取闲置的 ubrowser
402
441
  */
@@ -756,7 +795,7 @@ interface UToolsApi {
756
795
 
757
796
  team: {
758
797
  /**
759
- * 获取团队信息
798
+ * 获取团队信息
760
799
  */
761
800
  info(): {
762
801
  teamId: string,
@@ -777,6 +816,13 @@ interface UToolsApi {
777
816
  }
778
817
 
779
818
  ubrowser: UBrowser;
819
+
820
+ /**
821
+ * 运行 ffmpeg
822
+ * @param args ffmpeg 命令行参数
823
+ * @param onProgress 进度回调
824
+ */
825
+ runFFmpeg(args: string[], onProgress?: () => FfmpegRunProgress): FfmpegPromise;
780
826
  }
781
827
 
782
828
  declare var utools: UToolsApi;