ms-types 0.10.10 → 0.10.12

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 (57) hide show
  1. package/package.json +1 -1
  2. package/types/cryptoUtils.d.ts +50 -36
  3. package/types/dotocr.d.ts +9 -2
  4. package/types/file.d.ts +1 -1
  5. package/types/hid.d.ts +46 -4
  6. package/types/hotUpdate.d.ts +0 -3
  7. package/types/image.d.ts +447 -447
  8. package/types/lua/action.lua +6 -6
  9. package/types/lua/ai.lua +3 -3
  10. package/types/lua/appleocr.lua +3 -3
  11. package/types/lua/cloud.lua +1 -1
  12. package/types/lua/cryptoUtils.lua +7 -7
  13. package/types/lua/cv.lua +142 -142
  14. package/types/lua/dotocr.lua +4 -4
  15. package/types/lua/file.lua +1 -1
  16. package/types/lua/global.lua +9 -7
  17. package/types/lua/hid.lua +22 -22
  18. package/types/lua/hotupdate.lua +7 -8
  19. package/types/lua/http.lua +27 -12
  20. package/types/lua/image.lua +23 -19
  21. package/types/lua/ime.lua +9 -9
  22. package/types/lua/media.lua +9 -9
  23. package/types/lua/mysql.lua +11 -11
  24. package/types/lua/netcard.lua +6 -6
  25. package/types/lua/node.lua +1 -1
  26. package/types/lua/paddleocr.lua +3 -3
  27. package/types/lua/pip.lua +6 -6
  28. package/types/lua/system.lua +23 -23
  29. package/types/lua/tomatoocr.lua +12 -17
  30. package/types/lua/tts.lua +3 -3
  31. package/types/lua/ui.lua +5 -5
  32. package/types/lua/yolo.lua +2 -2
  33. package/types/lua/yolocls.lua +2 -2
  34. package/types/mysql.d.ts +0 -2
  35. package/types/node.d.ts +1 -0
  36. package/types/opencv.d.ts +571 -38
  37. package/types/paddleocr.d.ts +1 -0
  38. package/types/pip.d.ts +11 -0
  39. package/types/system.d.ts +1 -0
  40. package/types/tomatoocr.d.ts +3 -41
  41. package/types/tts.d.ts +1 -1
  42. package/types/ui.d.ts +2 -0
  43. package/types/web.d.ts +16 -0
  44. package/types/yolo.d.ts +1 -1
  45. package/types/yoloCls.d.ts +1 -1
  46. package/types/zh/HID/346/250/241/345/235/227.d.ts +46 -4
  47. package/types/zh/MySql/346/250/241/345/235/227.d.ts +1 -3
  48. package/types/zh/PaddleOCR/346/250/241/345/235/227.d.ts +1 -0
  49. package/types/zh//345/212/250/344/275/234/346/250/241/345/235/227.d.ts +1 -1
  50. package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +447 -447
  51. package/types/zh//346/202/254/346/265/256/347/252/227/346/250/241/345/235/227.d.ts +10 -0
  52. package/types/zh//346/226/207/344/273/266/346/250/241/345/235/227.d.ts +1 -1
  53. package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +9 -2
  54. package/types/zh//347/203/255/346/233/264/346/226/260/346/250/241/345/235/227.d.ts +0 -3
  55. package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +1 -0
  56. package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +1 -0
  57. package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +2 -0
@@ -108,6 +108,7 @@ declare namespace paddleOcr {
108
108
  ): OCRResult[];
109
109
  /**
110
110
  * 释放OCR模型资源
111
+ * @example paddleOcr.free()
111
112
  */
112
113
  function free(): void;
113
114
  }
package/types/pip.d.ts CHANGED
@@ -5,27 +5,32 @@ declare namespace pip {
5
5
  /**
6
6
  * 判断悬浮窗是否打开
7
7
  * @returns true代表开启了悬浮窗,false代表没有开启
8
+ * @example pip.isPipActive()
8
9
  */
9
10
  function isPipActive(): boolean;
10
11
  /**
11
12
  * 切换到日志模式[首次显示悬浮窗时 App 必须在前台]
12
13
  * 必须iOS设备支持悬浮窗功能,并且开启悬浮窗
13
14
  * @returns true代表已提交切换请求
15
+ * @example pip.switchToLogMode()
14
16
  */
15
17
  function switchToLogMode(): boolean;
16
18
  /**
17
19
  * 切换到保活模式[首次显示悬浮窗时 App 必须在前台]
18
20
  * @returns true代表已提交切换请求
21
+ * @example pip.switchToKeepAliveMode()
19
22
  */
20
23
  function switchToKeepAliveMode(): boolean;
21
24
  /**
22
25
  * 切换到自定义模式[首次显示悬浮窗时 App 必须在前台]
23
26
  * @returns true代表已提交切换请求
27
+ * @example pip.switchToCustomMode()
24
28
  */
25
29
  function switchToCustomMode(): boolean;
26
30
  /**
27
31
  * 关闭悬浮窗
28
32
  * @returns true代表已提交关闭请求
33
+ * @example pip.closeWindow()
29
34
  */
30
35
  function closeWindow(): boolean;
31
36
  /**
@@ -35,36 +40,42 @@ declare namespace pip {
35
40
  * @param width 宽度方向比例值(与 height 共同决定宽高比,不是像素)
36
41
  * @param height 高度方向比例值(与 width 共同决定宽高比,不是像素)
37
42
  * @returns true代表尺寸已提交,false代表当前模式不允许设置或宽高无效
43
+ * @example pip.setContentSize(200, 120)
38
44
  */
39
45
  function setContentSize(width: number, height: number): boolean;
40
46
  /**
41
47
  * 设置日志模式显示文本的文字大小
42
48
  * @param fontSize 日志字号,必须是有效数字
43
49
  * @returns true代表日志文字大小已提交,false代表字号无效
50
+ * @example pip.setLogFontSize(14)
44
51
  */
45
52
  function setLogFontSize(fontSize: number): boolean;
46
53
  /**
47
54
  * 设置自定义模式显示的纯文本
48
55
  * @param text 要显示的文本,支持换行
49
56
  * @returns true代表文本已提交
57
+ * @example pip.setCustomText("hello")
50
58
  */
51
59
  function setCustomText(text: string): boolean;
52
60
  /**
53
61
  * 设置自定义模式显示文本的文字颜色
54
62
  * @param color 文字颜色,支持 RRGGBB、RRGGBBAA,可带 # 前缀;末尾 AA 为透明度
55
63
  * @returns true代表文字颜色已提交
64
+ * @example pip.setCustomTextColor("#FFFFFF")
56
65
  */
57
66
  function setCustomTextColor(color: string): boolean;
58
67
  /**
59
68
  * 设置自定义模式显示文本的文字大小
60
69
  * @param fontSize 文字字号,必须是有效数字
61
70
  * @returns true代表文字大小已提交,false代表字号无效
71
+ * @example pip.setCustomTextSize(14)
62
72
  */
63
73
  function setCustomTextSize(fontSize: number): boolean;
64
74
  /**
65
75
  * 设置自定义模式显示区域的背景色
66
76
  * @param color 背景颜色,支持 RRGGBB、RRGGBBAA,可带 # 前缀;末尾 AA 为透明度
67
77
  * @returns true代表背景色已提交
78
+ * @example pip.setCustomBackgroundColor("#FFFFFF")
68
79
  */
69
80
  function setCustomBackgroundColor(color: string): boolean;
70
81
  }
package/types/system.d.ts CHANGED
@@ -61,6 +61,7 @@ declare namespace system {
61
61
  /**
62
62
  * 获取前台运行的应用列表
63
63
  * @returns 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
64
+ * @example system.foregroundAppInfos()
64
65
  */
65
66
  function foregroundAppInfos(): AppInfo[];
66
67
  /**
@@ -9,13 +9,10 @@ declare namespace tomatoOcr {
9
9
  * @param remark 备注信息(可选)
10
10
  * @returns 设置结果
11
11
  * @example
12
- * ```typescript
13
- * // 不带备注
14
12
  * const result1 = tomatoOcr.initializeWithConfig("online", "授权码");
15
13
  * // 带备注
16
14
  * const result2 = tomatoOcr.initializeWithConfig("online", "授权码", "测试环境");
17
15
  * logi(result1, result2);
18
- * ```
19
16
  */
20
17
  function initializeWithConfig(
21
18
  mode: string,
@@ -33,9 +30,7 @@ declare namespace tomatoOcr {
33
30
  * 设置 HTTP 请求间隔时间
34
31
  * @param second 间隔秒数 设置网络请求间隔时间,非必设置。0-86400
35
32
  * @example
36
- * ```typescript
37
33
  * tomatoOcr.setHttpIntervalTime(3600);
38
- * ```
39
34
  */
40
35
  function setHttpIntervalTime(second: number): void;
41
36
 
@@ -43,8 +38,6 @@ declare namespace tomatoOcr {
43
38
  * 设置识别类型
44
39
  * @param recType 识别类型 模型类型,默认 ch-3.0,除此之外还有 ch-2.0, ch, cht, japan, korean, number
45
40
  * @example
46
- * ```typescript
47
- * // 普通中英文识别,3.0版模型
48
41
  * tomatoOcr.setRecType("ch-3.0");
49
42
  * // 普通中英文识别,2.0版模型
50
43
  * tomatoOcr.setRecType("ch-2.0");
@@ -58,7 +51,6 @@ declare namespace tomatoOcr {
58
51
  * tomatoOcr.setRecType("korean");
59
52
  * // 数字模型
60
53
  * tomatoOcr.setRecType("number");
61
- * ```
62
54
  */
63
55
  function setRecType(recType: string): void;
64
56
 
@@ -66,12 +58,9 @@ declare namespace tomatoOcr {
66
58
  * 设置检测框类型
67
59
  * @param detBoxType 检测框类型 默认"rect": 由于手机上截图文本均为矩形文本;"quad":可准确检测倾斜文本
68
60
  * @example
69
- * ```typescript
70
- * // 矩形文本
71
61
  * tomatoOcr.setDetBoxType("rect");
72
62
  * // 倾斜文本
73
63
  * tomatoOcr.setDetBoxType("quad");
74
- * ```
75
64
  */
76
65
  function setDetBoxType(detBoxType: string): void;
77
66
 
@@ -79,9 +68,7 @@ declare namespace tomatoOcr {
79
68
  * 设置检测框展开比例
80
69
  * @param detUnclipRatio 设置检测模型框选文本范围大小的参数,非必设置,默认为1.9。值范围1.6-2.5之间,值越大框选范围越大,值越小框选范围越小;当框选到了,但识别得分较低,就可以调整该参数改善准确率。
81
70
  * @example
82
- * ```typescript
83
71
  * tomatoOcr.setDetUnclipRatio(1.9);
84
- * ```
85
72
  */
86
73
  function setDetUnclipRatio(detUnclipRatio: number): void;
87
74
 
@@ -89,9 +76,7 @@ declare namespace tomatoOcr {
89
76
  * 设置检测框缩放比例
90
77
  * @param detScaleRatio 检测框缩放比例
91
78
  * @example
92
- * ```typescript
93
79
  * tomatoOcr.setDetScaleRatio(1.2);
94
- * ```
95
80
  */
96
81
  function setDetScaleRatio(detScaleRatio: number): void;
97
82
 
@@ -99,9 +84,7 @@ declare namespace tomatoOcr {
99
84
  * 设置识别分数阈值
100
85
  * @param recScoreThreshold 设置识别模型过滤得分的参数,非必设置,默认0.1。由于返回的识别结果数据太多太乱,可以通过设置该参数,过滤一些得分较低不准的数据,使得结果看起来更加简练。
101
86
  * @example
102
- * ```typescript
103
87
  * tomatoOcr.setRecScoreThreshold(0.1);
104
- * ```
105
88
  */
106
89
  function setRecScoreThreshold(recScoreThreshold: number): void;
107
90
 
@@ -109,9 +92,7 @@ declare namespace tomatoOcr {
109
92
  * 设置返回类型
110
93
  * @param returnType 设置调用插件识别返回格式的参数,非必设置,默认为json。默认"json": 包含得分、坐标和文字;"text":纯文字;"num":纯数字;自定义输入想要返回的文本:".¥1234567890",仅只返回这些内容
111
94
  * @example
112
- * ```typescript
113
95
  * tomatoOcr.setReturnType("json");
114
- * ```
115
96
  */
116
97
  function setReturnType(returnType: string): void;
117
98
 
@@ -119,9 +100,7 @@ declare namespace tomatoOcr {
119
100
  * 设置二值化阈值
120
101
  * @param binaryThresh 设置图像二值化的参数,非必设置,默认0,不进行二值化。 二值化设定0-255,常规情况下不需要设置,可配合中调试应用使用。
121
102
  * @example
122
- * ```typescript
123
103
  * tomatoOcr.setBinaryThresh(0);
124
- * ```
125
104
  */
126
105
  function setBinaryThresh(binaryThresh: number): void;
127
106
 
@@ -129,9 +108,7 @@ declare namespace tomatoOcr {
129
108
  * 设置运行模式
130
109
  * @param runMode 运行模式
131
110
  * @example
132
- * ```typescript
133
111
  * tomatoOcr.setRunMode("fast");
134
- * ```
135
112
  */
136
113
  function setRunMode(runMode: string): void;
137
114
 
@@ -140,10 +117,8 @@ declare namespace tomatoOcr {
140
117
  * @param filterColor 颜色过滤,通过逗号相互连,第一个是颜色值,第二个是负偏色,第三个是正偏色;不同颜色之间以"|"连接
141
118
  * @param backgroundColor 滤色后的背景色,传""或black的时候,背景是黑色,传“white”的时候,背景是白色
142
119
  * @example
143
- * ```typescript
144
120
  * tomatoOcr.setFilterColor("#41917A,38,38", "black");
145
121
  * tomatoOcr.setFilterColor("#41917A,38,38|#E091A8,50,50", "white");
146
- * ```
147
122
  */
148
123
  function setFilterColor(filterColor: string, backgroundColor: string): void;
149
124
 
@@ -157,19 +132,12 @@ declare namespace tomatoOcr {
157
132
  * @param ey 边界框右下角y坐标
158
133
  * @returns OCR识别结果JSON字符串
159
134
  * @example
160
- * ```typescript
161
- * // 识别屏幕
162
- * const result1 = tomatoOcr.ocrImage("screen", 0, 0, 0, 0, 0);
135
+ * const result1 = tomatoOcr.ocrImage("screen", 3);
163
136
  * logi(`识别屏幕结果:${result1}`);
164
- *
165
- * // 识别文件
166
- * const result2 = tomatoOcr.ocrImage("/path/to/image.png", 0);
137
+ * const result2 = tomatoOcr.ocrImage("/path/to/image.png", 3);
167
138
  * logi(`识别文件结果:${result2}`);
168
- *
169
- * // 识别指定屏幕区域
170
- * const result3 = tomatoOcr.ocrImage("screen", 0);
139
+ * const result3 = tomatoOcr.ocrImage("screen", 3, 100, 100, 500, 300);
171
140
  * logi(`识别指定屏幕区域结果:${result3}`);
172
- * ```
173
141
  */
174
142
  function ocrImage(
175
143
  input: string,
@@ -185,11 +153,9 @@ declare namespace tomatoOcr {
185
153
  * @param data 要找的文字
186
154
  * @returns 找“要找的文字”的中心点 没有找到返回空字符串
187
155
  * @example
188
- * ```typescript
189
156
  * const result = tomatoOcr.findTapPoint('{"text": "确定"}');
190
157
  * const tapPoint = JSON.parse(result);
191
158
  * logi(tapPoint);
192
- * ```
193
159
  */
194
160
  function findTapPoint(data: string): string;
195
161
 
@@ -198,20 +164,16 @@ declare namespace tomatoOcr {
198
164
  * @param data 要找的文字
199
165
  * @returns 找“要找的文字”的所有相匹配的中心点 没有找到返回空字符串
200
166
  * @example
201
- * ```typescript
202
167
  * const result = tomatoOcr.findTapPoints('{"texts": ["确定", "取消"]}');
203
168
  * const tapPoints = JSON.parse(result);
204
169
  * logi(tapPoints);
205
- * ```
206
170
  */
207
171
  function findTapPoints(data: string): string;
208
172
 
209
173
  /**
210
174
  * 释放 TomatoOCR SDK 已加载的 OCR 模型和内部资源
211
175
  * @example
212
- * ```typescript
213
176
  * tomatoOcr.release();
214
- * ```
215
177
  */
216
178
  function release(): void;
217
179
  }
package/types/tts.d.ts CHANGED
@@ -17,7 +17,7 @@ declare namespace tts {
17
17
  }
18
18
 
19
19
  /**
20
- * 播放文本转语音(5参数版本)
20
+ * 播放文本转语音
21
21
  * @param text 要转换的文本
22
22
  * @param rate 语速,范围0.0-1.0,默认0.5
23
23
  * @param pitch 音调,范围0.5-2.0,默认1.0
package/types/ui.d.ts CHANGED
@@ -4,11 +4,13 @@
4
4
  declare namespace ui {
5
5
  /**
6
6
  * 显示WebView
7
+ * @example ui.show()
7
8
  */
8
9
  function show(): void;
9
10
 
10
11
  /**
11
12
  * 隐藏WebView
13
+ * @example ui.hide()
12
14
  */
13
15
  function hide(): void;
14
16
 
package/types/web.d.ts CHANGED
@@ -6,6 +6,7 @@ declare namespace ms {
6
6
  * 注册UI函数 网页页面使用,给主进程调用
7
7
  * @param name 函数名称
8
8
  * @param func 函数
9
+ * @example ms.registerUIFunc("onMessage", (data) => {})
9
10
  */
10
11
  function registerUIFunc(
11
12
  name: string,
@@ -16,24 +17,28 @@ declare namespace ms {
16
17
  * 发送事件 网页页面使用 给主进程发送事件
17
18
  * @param event 事件名称
18
19
  * @param data 事件参数
20
+ * @example ms.emitEvent("message", { ok: true })
19
21
  */
20
22
  function emitEvent(event: string, data: Record<string, any>): void;
21
23
 
22
24
  /**
23
25
  * 启动脚本 网页页面使用
24
26
  * @returns 如果启动成功返回true,否则返回false
27
+ * @example ms.startTask()
25
28
  */
26
29
  function startTask(): Promise<boolean>;
27
30
 
28
31
  /**
29
32
  * 停止脚本 网页页面使用
30
33
  * @returns 如果停止成功返回false,否则返回true
34
+ * @example ms.stopTask()
31
35
  */
32
36
  function stopTask(): Promise<boolean>;
33
37
 
34
38
  /**
35
39
  * 检查脚本是否正在运行 网页页面使用
36
40
  * @returns 如果脚本正在运行返回true,否则返回false
41
+ * @example ms.isTaskRunning()
37
42
  */
38
43
  function isTaskRunning(): Promise<boolean>;
39
44
 
@@ -42,6 +47,7 @@ declare namespace ms {
42
47
  * @param key 配置项键
43
48
  * @param value 配置项值
44
49
  * @returns 如果设置成功返回true,否则返回false
50
+ * @example ms.setConfig("theme", "dark")
45
51
  */
46
52
  function setConfig(key: string, value: any): Promise<boolean>;
47
53
 
@@ -49,6 +55,7 @@ declare namespace ms {
49
55
  * 获取配置项
50
56
  * @param key 配置项键
51
57
  * @returns 配置项值
58
+ * @example ms.getConfig("theme")
52
59
  */
53
60
  function getConfig(key: string): Promise<any>;
54
61
 
@@ -56,12 +63,14 @@ declare namespace ms {
56
63
  * 移除配置项
57
64
  * @param key 配置项键
58
65
  * @returns 如果移除成功返回true,否则返回false
66
+ * @example ms.removeConfig("theme")
59
67
  */
60
68
  function removeConfig(key: string): Promise<boolean>;
61
69
 
62
70
  /**
63
71
  * 获取所有配置的字典
64
72
  * @returns 包含所有配置的字典
73
+ * @example ms.getAllConfig()
65
74
  */
66
75
  function getAllConfig(): Promise<Record<string, any>>;
67
76
 
@@ -69,36 +78,42 @@ declare namespace ms {
69
78
  * 设置所有配置项
70
79
  * @param config 包含所有配置项的字典
71
80
  * @returns 如果设置成功返回true,否则返回false
81
+ * @example ms.setAllConfig({})
72
82
  */
73
83
  function setAllConfig(config: Record<string, any>): Promise<boolean>;
74
84
 
75
85
  /**
76
86
  * 获取设备ID
77
87
  * @returns 设备的唯一标识符(IDFV)。卸载重装 APP 后会改变,更新 APP 后不会改变。
88
+ * @example ms.getDeviceID()
78
89
  */
79
90
  function getDeviceID(): Promise<string>;
80
91
 
81
92
  /**
82
93
  * 获取当前软件包缓存的授权卡密
83
94
  * @returns 有缓存的授权卡密时返回卡密字符串,没有缓存时返回空字符串
95
+ * @example ms.getAuthCardNo()
84
96
  */
85
97
  function getAuthCardNo(): Promise<string>;
86
98
 
87
99
  /**
88
100
  * 获取Agent状态
89
101
  * @returns 如果Agent正在运行返回true,否则返回false
102
+ * @example ms.getAgentStatus()
90
103
  */
91
104
  function getAgentStatus(): Promise<boolean>;
92
105
 
93
106
  /**
94
107
  * 启动Agent服务
95
108
  * @returns 如果调用成功返回true,否则返回false。注意:返回值仅表示调用是否成功,不代表Agent服务是否启动成功
109
+ * @example ms.startAgent()
96
110
  */
97
111
  function startAgent(): Promise<boolean>;
98
112
 
99
113
  /**
100
114
  * 停止Agent服务
101
115
  * @returns 如果调用成功返回true,否则返回false。注意:返回值仅表示调用是否成功,不代表Agent服务是否停止成功
116
+ * @example ms.stopAgent()
102
117
  */
103
118
  function stopAgent(): Promise<boolean>;
104
119
 
@@ -106,6 +121,7 @@ declare namespace ms {
106
121
  * 打开URL
107
122
  * @param url URL地址
108
123
  * @returns 如果调用成功返回true,否则返回false
124
+ * @example ms.openURL("https://example.com")
109
125
  */
110
126
  function openURL(url: string): Promise<boolean>;
111
127
  }
package/types/yolo.d.ts CHANGED
@@ -100,7 +100,7 @@ declare namespace yolo {
100
100
  * 释放指定模型资源
101
101
  * @param modelId 模型ID
102
102
  * @example
103
- * yolo.free(modelId)
103
+ * yolo.free("modelId")
104
104
  */
105
105
  function free(modelId: string): void;
106
106
 
@@ -90,7 +90,7 @@ declare namespace yoloCls {
90
90
  * 释放指定模型资源
91
91
  * @param modelId 模型 ID
92
92
  * @example
93
- * yoloCls.free(modelId)
93
+ * yoloCls.free("modelId")
94
94
  */
95
95
  function free(modelId: string): void;
96
96