ms-types 0.9.31 → 0.9.33

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": "ms-types",
3
- "version": "0.9.31",
3
+ "version": "0.9.33",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -10,4 +10,4 @@
10
10
  }
11
11
  ```
12
12
 
13
- 不要把本目录复制进脚本项目根目录。每个模块文件用 `---@meta <require名>` 和 `package.loaded['<require名>']` 对齐运行时 `require`,例如 `require("cv")`、`require("dotocr")`、`require("yolocls")`。`Sleep`、`HidKey` 等裸全局会随 library 自动加载。
13
+ 不要把本目录复制进脚本项目根目录。每个模块文件用 `---@meta <require名>` 和 `package.loaded['<require名>']` 对齐运行时 `require`,例如 `require("cv")`、`require("dotocr")`、`require("yolocls")`。`Sleep`、`HidKey`、`logd` / `logi` / `logw` / `loge` 等裸全局会随 library 自动加载。
@@ -14,7 +14,8 @@ local _AppleOCR = {}
14
14
  ---@field centerX integer 文本区域中心点 x 坐标
15
15
  ---@field centerY integer 文本区域中心点 y 坐标
16
16
 
17
- --- 识别文本
17
+ --- 识别文本(兼容旧接口,请改用 recognizeAbs)
18
+ --- @deprecated 请改用 recognizeAbs,避免裁剪区域坐标和全屏坐标混用。
18
19
  --- @param input string 图像ID或路径
19
20
  --- @param x integer|nil 区域X,默认0
20
21
  --- @param y integer|nil 区域Y,默认0
@@ -46,7 +47,8 @@ function _AppleOCR.recognizeAbs(input, x, y, ex, ey, langs)
46
47
  return ret
47
48
  end
48
49
 
49
- --- 识别数字
50
+ --- 识别数字(兼容旧接口,请改用 recognizeNumbersAbs)
51
+ --- @deprecated 请改用 recognizeNumbersAbs,避免裁剪区域坐标和全屏坐标混用。
50
52
  --- @param input string 图像ID或路径
51
53
  --- @param x integer|nil 区域X,默认0
52
54
  --- @param y integer|nil 区域Y,默认0
@@ -76,7 +78,8 @@ function _AppleOCR.recognizeNumbersAbs(input, x, y, ex, ey)
76
78
  return ret
77
79
  end
78
80
 
79
- --- 查找文本
81
+ --- 查找文本(兼容旧接口,请改用 findTextAbs)
82
+ --- @deprecated 请改用 findTextAbs,避免裁剪区域坐标和全屏坐标混用。
80
83
  --- @param input string 图像ID或路径
81
84
  --- @param targets string[]|string 目标文本数组或逗号分隔字符串
82
85
  --- @param x integer|nil 区域X,默认0
@@ -120,3 +120,19 @@ end
120
120
  function GetCpuThrottleDelay()
121
121
  return { minMs = 3, maxMs = 30 }
122
122
  end
123
+
124
+ --- 打印调试日志,等同 `logger.debug(...)`;可变参按空格拼接
125
+ ---@param ... any
126
+ function logd(...) end
127
+
128
+ --- 打印信息日志,等同 `logger.info(...)`;可变参按空格拼接
129
+ ---@param ... any
130
+ function logi(...) end
131
+
132
+ --- 打印警告日志,等同 `logger.warn(...)`;可变参按空格拼接
133
+ ---@param ... any
134
+ function logw(...) end
135
+
136
+ --- 打印错误日志,等同 `logger.error(...)`;可变参按空格拼接
137
+ ---@param ... any
138
+ function loge(...) end
@@ -30,11 +30,13 @@ local _Image = {}
30
30
  --- @return string|nil 图片ID
31
31
  function _Image.captureScreen(x, y, ex, ey) return '' end
32
32
 
33
- --- 全屏截屏
33
+ --- 全屏截屏(兼容旧接口,请改用 captureScreen)
34
+ --- @deprecated 请改用 captureScreen()。
34
35
  --- @return string|nil 图片ID
35
36
  function _Image.captureFullScreen() return '' end
36
37
 
37
- --- 区域截屏
38
+ --- 区域截屏(兼容旧接口,请改用 captureScreen)
39
+ --- @deprecated 请改用 captureScreen(x, y, ex, ey)。
38
40
  --- @param x integer|nil
39
41
  --- @param y integer|nil
40
42
  --- @param ex integer|nil 右下角x
@@ -16,7 +16,8 @@ local _PaddleOCR = {}
16
16
  ---@field angle number 文本旋转角度 (度)
17
17
  ---@field orientation integer 文本方向 (0=水平,1=垂直 等)
18
18
 
19
- --- 加载 V5 模型
19
+ --- 加载 V5 模型(兼容旧接口,请改用 loadModel)
20
+ --- @deprecated 请改用 loadModel("ppocr-v5", useGpu);检测长边请使用 setMaxSideLen 单独设置。
20
21
  --- @param maxSideLen integer|nil 目标边长,默认 640
21
22
  --- @param useGpu boolean|nil 是否启用 GPU,默认 false
22
23
  --- @return boolean 成功
@@ -33,7 +34,8 @@ function _PaddleOCR.loadModel(modelId, useGpu) return true end
33
34
  --- @return boolean 成功
34
35
  function _PaddleOCR.setMaxSideLen(maxSideLen) return true end
35
36
 
36
- --- 识别文本
37
+ --- 识别文本(兼容旧接口,请改用 recognizeAbs)
38
+ --- @deprecated 请改用 recognizeAbs,避免裁剪区域坐标和全屏坐标混用。
37
39
  --- @param input string 图像ID或路径
38
40
  --- @param x integer|nil 默认0
39
41
  --- @param y integer|nil 默认0
@@ -61,7 +63,8 @@ function _PaddleOCR.recognizeAbs(input, x, y, ex, ey, confidenceThreshold)
61
63
  return ret
62
64
  end
63
65
 
64
- --- 查找目标文本
66
+ --- 查找目标文本(兼容旧接口,请改用 findTextAbs)
67
+ --- @deprecated 请改用 findTextAbs,避免裁剪区域坐标和全屏坐标混用。
65
68
  --- @param input string 图像ID或路径
66
69
  --- @param targets string[]|string 目标文本数组或逗号分隔字符串
67
70
  --- @param x integer|nil 默认0
@@ -23,7 +23,8 @@ local _Yolo = {}
23
23
  --- @return string|nil 模型ID(失败返回 nil)
24
24
  function _Yolo.load(paramPath, binPath, nc, version, useGpu) return nil end
25
25
 
26
- --- 加载 YOLOv11 模型
26
+ --- 加载 YOLOv11 模型(兼容旧接口,请改用 load)
27
+ --- @deprecated 请改用 load(paramPath, binPath, nc, 11, useGpu)。
27
28
  --- @param paramPath string ncnn param 路径
28
29
  --- @param binPath string ncnn bin 路径
29
30
  --- @param nc integer|nil 标签数量;传 0 或省略时按模型输出推断
@@ -31,7 +32,8 @@ function _Yolo.load(paramPath, binPath, nc, version, useGpu) return nil end
31
32
  --- @return string|nil 模型ID(失败返回 nil)
32
33
  function _Yolo.loadV11(paramPath, binPath, nc, useGpu) return nil end
33
34
 
34
- --- 检测
35
+ --- 检测(兼容旧接口,请改用 detectAbs)
36
+ --- @deprecated 请改用 detectAbs,避免裁剪区域坐标和全屏坐标混用。
35
37
  --- @param id string 模型ID
36
38
  --- @param input string 图像ID或路径
37
39
  --- @param target integer 目标边长(默认 640)
package/types/system.d.ts CHANGED
@@ -58,6 +58,11 @@ declare namespace system {
58
58
  * }
59
59
  */
60
60
  function activateAppInfo(): AppInfo;
61
+ /**
62
+ * 获取前台运行的应用列表
63
+ * @returns 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
64
+ */
65
+ function foregroundAppInfos(): AppInfo[];
61
66
  /**
62
67
  * 获取后台运行的应用列表
63
68
  * @returns 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
package/types/ui.d.ts CHANGED
@@ -116,6 +116,11 @@ declare namespace ui {
116
116
  */
117
117
  function show(): void;
118
118
 
119
+ /**
120
+ * 隐藏WebView
121
+ */
122
+ function hide(): void;
123
+
119
124
  /**
120
125
  * 设置事件回调函数(仅主线程调用,不能在线程脚本中调用)
121
126
  * @param onEvent 事件回调函数,传入 null 会取消监听
@@ -58,6 +58,11 @@ declare namespace $系统 {
58
58
  * }
59
59
  */
60
60
  function 获取当前运行的应用(): APP信息;
61
+ /**
62
+ * 获取前台运行的应用列表
63
+ * @returns 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
64
+ */
65
+ function 获取前台运行的应用列表(): APP信息[];
61
66
  /**
62
67
  * 获取后台运行的应用列表
63
68
  * @returns 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
@@ -9,6 +9,11 @@ declare namespace $视图 {
9
9
  */
10
10
  function 显示(): 无返回值;
11
11
 
12
+ /**
13
+ * 隐藏WebView
14
+ */
15
+ function 隐藏(): 无返回值;
16
+
12
17
  /**
13
18
  * 设置事件回调函数(仅主线程调用,不能在线程脚本中调用)
14
19
  * @param onEvent 事件回调函数,传入 null 会取消监听