ms-types 0.9.36 → 0.9.38

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.36",
3
+ "version": "0.9.38",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/types/lua/cv.lua CHANGED
@@ -824,7 +824,7 @@ function _OpenCV.set(mat, options) return false end
824
824
  ---@return OpenCV.Mat|nil
825
825
  function _OpenCV.copyTo(mat, mask) return nil end
826
826
 
827
- --- cvtColor
827
+ --- cvtColor;源图通道必须和转换码一致,例如 COLOR_BGR2GRAY 要 3 通道。
828
828
  ---@param mat OpenCV.Mat
829
829
  ---@param code number
830
830
  ---@return OpenCV.Mat|nil
@@ -836,7 +836,7 @@ function _OpenCV.cvtColor(mat, code) return nil end
836
836
  ---@return OpenCV.Mat|nil
837
837
  function _OpenCV.threshold(mat, options) return nil end
838
838
 
839
- --- adaptiveThreshold
839
+ --- adaptiveThreshold,只接受 CV_8UC1。
840
840
  ---@param mat OpenCV.Mat
841
841
  ---@param options OpenCV.AdaptiveThresholdOptions
842
842
  ---@return OpenCV.Mat|nil
@@ -890,12 +890,12 @@ function _OpenCV.addWeighted(src1, options) return nil end
890
890
  ---@return OpenCV.Mat|nil
891
891
  function _OpenCV.convertScaleAbs(mat, options) return nil end
892
892
 
893
- --- countNonZero
893
+ --- countNonZero,只接受单通道 Mat;多通道返回 -1。
894
894
  ---@param mat OpenCV.Mat
895
895
  ---@return number
896
896
  function _OpenCV.countNonZero(mat) return 0 end
897
897
 
898
- --- minMaxLoc
898
+ --- minMaxLoc,只接受单通道 Mat;多通道返回 nil。可选 mask 必须是 CV_8UC1。
899
899
  ---@param mat OpenCV.Mat
900
900
  ---@param options OpenCV.MaskOptions|nil
901
901
  ---@return OpenCV.MinMaxLocResult|nil
@@ -935,13 +935,13 @@ function _OpenCV.blur(mat, options) return nil end
935
935
  ---@return OpenCV.Mat|nil
936
936
  function _OpenCV.medianBlur(mat, options) return nil end
937
937
 
938
- --- bilateralFilter
938
+ --- bilateralFilter,只接受 1 或 3 通道,深度 CV_8U 或 CV_32F。
939
939
  ---@param mat OpenCV.Mat
940
940
  ---@param options OpenCV.BilateralFilterOptions
941
941
  ---@return OpenCV.Mat|nil
942
942
  function _OpenCV.bilateralFilter(mat, options) return nil end
943
943
 
944
- --- Canny
944
+ --- Canny,只接受 8 位图(CV_8U,1/3/4 通道均可)。
945
945
  ---@param mat OpenCV.Mat
946
946
  ---@param options OpenCV.CannyOptions
947
947
  ---@return OpenCV.Mat|nil
@@ -959,7 +959,7 @@ function _OpenCV.Sobel(mat, options) return nil end
959
959
  ---@return OpenCV.Mat|nil
960
960
  function _OpenCV.Laplacian(mat, options) return nil end
961
961
 
962
- --- equalizeHist
962
+ --- equalizeHist,只接受 CV_8UC1。
963
963
  ---@param mat OpenCV.Mat
964
964
  ---@return OpenCV.Mat|nil
965
965
  function _OpenCV.equalizeHist(mat) return nil end
@@ -1130,7 +1130,7 @@ function _OpenCV.SIFT(mat, options) return nil end
1130
1130
  ---@return OpenCV.FeatureResult|nil
1131
1131
  function _OpenCV.ORB(mat, options) return nil end
1132
1132
 
1133
- --- FAST
1133
+ --- FAST,只接受 CV_8UC1。
1134
1134
  ---@param mat OpenCV.Mat
1135
1135
  ---@param options OpenCV.FASTOptions|nil
1136
1136
  ---@return OpenCV.FASTResult|nil
@@ -1237,7 +1237,7 @@ function _OpenCV.floodFill(mat, options) return nil end
1237
1237
  ---@return OpenCV.Point[]|nil
1238
1238
  function _OpenCV.convexHull(points, options) return nil end
1239
1239
 
1240
- --- moments
1240
+ --- moments;Mat 输入必须是单通道栅格或 2 通道点集。
1241
1241
  ---@param matOrPoints OpenCV.Mat|OpenCV.Point[]
1242
1242
  ---@param options OpenCV.MomentsOptions|nil
1243
1243
  ---@return OpenCV.MomentsResult|nil
@@ -19,7 +19,7 @@ function _File.mkdirs(path) return true end
19
19
 
20
20
  --- 读取文件
21
21
  --- @param path string 路径
22
- --- @return string 内容
22
+ --- @return string 内容,失败为空串
23
23
  function _File.readFile(path) return '' end
24
24
 
25
25
  --- 写入文件
@@ -40,7 +40,7 @@ function _File.deleteAllFile(path) return true end
40
40
 
41
41
  --- 读取资源文件(res 目录)
42
42
  --- @param name string 文件名
43
- --- @return string|nil 内容
43
+ --- @return string 内容,失败为空串
44
44
  function _File.readResFile(name) return '' end
45
45
 
46
46
  --- 获取 res 资源的本地文件路径;用完后应调用 cleanupResFile
@@ -74,12 +74,12 @@ function _File.appendLine(path, data) return true end
74
74
  --- 读取指定行
75
75
  --- @param path string 路径
76
76
  --- @param lineNo integer 行号
77
- --- @return string|nil 内容
77
+ --- @return string 内容,失败为空串
78
78
  function _File.readLine(path, lineNo) return '' end
79
79
 
80
80
  --- 读取所有行
81
81
  --- @param path string 路径
82
- --- @return string[] 行列表
82
+ --- @return string[] 行列表,失败为空表
83
83
  function _File.readAllLines(path) return {} end
84
84
 
85
85
  --- 复制文件
@@ -90,7 +90,7 @@ function _File.copy(src, dest) return true end
90
90
 
91
91
  --- 计算文件MD5
92
92
  --- @param path string 路径
93
- --- @return string|nil MD5
93
+ --- @return string MD5 值,失败为空串
94
94
  function _File.fileMD5(path) return '' end
95
95
 
96
96
  ---@type File
@@ -67,7 +67,7 @@ function Time() return 0 end
67
67
  ---@return string
68
68
  function ToJsonString(data) return '' end
69
69
 
70
- --- 启动同 VM 协作协程(不是 OS 线程),返回协程名
70
+ --- 启动协作协程,返回协程名
71
71
  ---@param func function
72
72
  ---@return string
73
73
  function StartThread(func) return '' end
@@ -76,7 +76,7 @@ function StartThread(func) return '' end
76
76
  ---@param threadName string
77
77
  function StopThread(threadName) end
78
78
 
79
- --- 当前协作协程是否应退出。主脚本收到停止后由引擎 hook / Sleep 直接中断,不必轮询本函数。
79
+ --- 当前协程是否应退出
80
80
  ---@return boolean
81
81
  function ShouldInterruptThread() return false end
82
82
 
@@ -121,18 +121,18 @@ function GetCpuThrottleDelay()
121
121
  return { minMs = 3, maxMs = 30 }
122
122
  end
123
123
 
124
- --- 打印调试日志,等同 `logger.debug(...)`;可变参按空格拼接
124
+ --- 打印调试日志,等同 `logger.debug(...)`
125
125
  ---@param ... any
126
126
  function logd(...) end
127
127
 
128
- --- 打印信息日志,等同 `logger.info(...)`;可变参按空格拼接
128
+ --- 打印信息日志,等同 `logger.info(...)`
129
129
  ---@param ... any
130
130
  function logi(...) end
131
131
 
132
- --- 打印警告日志,等同 `logger.warn(...)`;可变参按空格拼接
132
+ --- 打印警告日志,等同 `logger.warn(...)`
133
133
  ---@param ... any
134
134
  function logw(...) end
135
135
 
136
- --- 打印错误日志,等同 `logger.error(...)`;可变参按空格拼接
136
+ --- 打印错误日志,等同 `logger.error(...)`
137
137
  ---@param ... any
138
138
  function loge(...) end
@@ -4,7 +4,7 @@ local _Http = {}
4
4
 
5
5
  ---@class HttpRequestOptions
6
6
  ---@field url string @请求地址
7
- ---@field timeout integer|nil @请求超时(毫秒)
7
+ ---@field timeout integer|nil @请求超时(毫秒),默认 30000
8
8
  ---@field method string|nil @请求方法 GET/POST/...
9
9
  ---@field proxy {host:string, port:integer}|nil @代理服务器
10
10
  ---@field followRedirects boolean|nil @是否跟随重定向
@@ -47,7 +47,7 @@ end
47
47
  --- GET 请求(同名:httpGet)
48
48
  --- @param url string
49
49
  --- @param params table<string,string>|nil
50
- --- @param timeout integer|nil
50
+ --- @param timeout integer|nil 默认 30000
51
51
  --- @param headers table<string,string>|nil
52
52
  --- @return string|nil
53
53
  function _Http.httpGet(url, params, timeout, headers) return '' end
@@ -56,7 +56,7 @@ function _Http.httpGet(url, params, timeout, headers) return '' end
56
56
  --- @param url string
57
57
  --- @param params table<string,string>|nil
58
58
  --- @param files table<string,string>|nil
59
- --- @param timeout integer|nil
59
+ --- @param timeout integer|nil 默认 30000
60
60
  --- @param headers table<string,string>|nil
61
61
  --- @return string|nil
62
62
  function _Http.httpPost(url, params, files, timeout, headers) return '' end
@@ -64,7 +64,7 @@ function _Http.httpPost(url, params, files, timeout, headers) return '' end
64
64
  --- POST JSON 请求
65
65
  --- @param url string
66
66
  --- @param json table|nil
67
- --- @param timeout integer|nil
67
+ --- @param timeout integer|nil 默认 30000
68
68
  --- @param headers table<string,string>|nil
69
69
  --- @return string|nil
70
70
  function _Http.postJSON(url, json, timeout, headers) return '' end
@@ -72,7 +72,7 @@ function _Http.postJSON(url, json, timeout, headers) return '' end
72
72
  --- 下载文件(同名:downloadFile)
73
73
  --- @param url string
74
74
  --- @param file string
75
- --- @param timeout integer|nil
75
+ --- @param timeout integer|nil 默认 30000
76
76
  --- @param headers table<string,string>|nil
77
77
  --- @return boolean
78
78
  function _Http.downloadFile(url, file, timeout, headers) return true end
@@ -137,7 +137,7 @@ function _Image.cmpColor(id, points, threshold) return true end
137
137
  --- @param ey integer|nil 右下y
138
138
  --- @param threshold number 相似度 0.0-1.0
139
139
  --- @param limit integer|nil 限制个数
140
- --- @param method integer|nil 匹配方法 0|1|3|5|99
140
+ --- @param method integer|nil 匹配方法 0|1|3|5|99,默认 5
141
141
  --- @param rgb boolean|nil 是否使用RGB
142
142
  --- @param options FindImageOptions|nil 选项。scaleFactors 仅 method=99;orz 为查找方向 1-8
143
143
  --- @return Rect[] 结果矩形列表
@@ -22,26 +22,22 @@ function _Logger.setMaxLogFileSize(size) end
22
22
  function _Logger.resetLogFile() end
23
23
 
24
24
  --- 输出调试日志(级别:debug)
25
- --- 可变参数会按空格拼接为一行文本
26
- --- @param ... any 日志内容(任意类型,自动调用 tostring)
25
+ --- @param ... any 日志内容
27
26
  --- @return nil
28
27
  function _Logger.debug(...) end
29
28
 
30
29
  --- 输出信息日志(级别:info)
31
- --- 可变参数会按空格拼接为一行文本
32
- --- @param ... any 日志内容(任意类型,自动调用 tostring)
30
+ --- @param ... any 日志内容
33
31
  --- @return nil
34
32
  function _Logger.info(...) end
35
33
 
36
34
  --- 输出警告日志(级别:warn)
37
- --- 可变参数会按空格拼接为一行文本
38
- --- @param ... any 日志内容(任意类型,自动调用 tostring)
35
+ --- @param ... any 日志内容
39
36
  --- @return nil
40
37
  function _Logger.warn(...) end
41
38
 
42
39
  --- 输出错误日志(级别:error)
43
- --- 可变参数会按空格拼接为一行文本
44
- --- @param ... any 日志内容(任意类型,自动调用 tostring)
40
+ --- @param ... any 日志内容
45
41
  --- @return nil
46
42
  function _Logger.error(...) end
47
43
 
@@ -40,7 +40,7 @@ local _Node = {}
40
40
  ---@field clickCenter fun(self: NodeInfo, duration: integer|nil): boolean 点击中心
41
41
  ---@field clickRandom fun(self: NodeInfo, duration: integer|nil): boolean 点击随机位置
42
42
  ---@field parent fun(self: NodeInfo): NodeInfo|nil 父节点
43
- ---@field child fun(self: NodeInfo, index: integer): NodeInfo|nil 子节点
43
+ ---@field child fun(self: NodeInfo, index: integer): NodeInfo|nil 子节点,index 从 0 开始
44
44
  ---@field allChildren fun(self: NodeInfo): NodeInfo[] 所有子节点
45
45
  ---@field siblings fun(self: NodeInfo): NodeInfo[] 所有兄弟节点
46
46
  ---@field previousSiblings fun(self: NodeInfo): NodeInfo[] 前兄弟节点
@@ -2,15 +2,10 @@
2
2
  ---@class System
3
3
  local _System = {}
4
4
 
5
- ---@class ProcessArguments
6
- ---@field env table<string, any> 环境变量映射(键为字符串,值为任意类型)
7
- ---@field args string[] 启动参数列表
8
-
9
5
  ---@class ActivateAppInfo
10
6
  ---@field name string 应用名称
11
7
  ---@field pid integer 进程 ID
12
8
  ---@field bundleId string 应用 Bundle ID
13
- ---@field processArguments ProcessArguments 启动参数信息
14
9
 
15
10
  ---@class MemoryInfo
16
11
  ---@field used integer 已使用内存(MB)
@@ -20,10 +15,8 @@ local _System = {}
20
15
 
21
16
  --- 启动应用
22
17
  --- @param bundleId string 应用 Bundle ID
23
- --- @param args string[]|nil 启动参数
24
- --- @param env table<string, any>|nil 环境变量
25
18
  --- @return boolean 成功
26
- function _System.startApp(bundleId, args, env) return true end
19
+ function _System.startApp(bundleId) return true end
27
20
 
28
21
  --- 停止应用
29
22
  --- @param bundleId string 应用 Bundle ID
package/types/opencv.d.ts CHANGED
@@ -274,8 +274,10 @@ declare namespace cv {
274
274
  function copyTo(mat: Mat, mask?: Mat | null): Mat | null;
275
275
 
276
276
  // ---- 颜色 / 运算 ----
277
+ /** 源图通道必须和转换码一致,例如 `COLOR_BGR2GRAY` 要 3 通道。 */
277
278
  function cvtColor(mat: Mat, code: number): Mat | null;
278
279
  function threshold(mat: Mat, options: ThresholdOptions): Mat | null;
280
+ /** 只接受 `CV_8UC1`。 */
279
281
  function adaptiveThreshold(mat: Mat, options: AdaptiveThresholdOptions): Mat | null;
280
282
  function inRange(mat: Mat, options: InRangeOptions): Mat | null;
281
283
  function bitwise_and(src1: Mat, options: BitwiseOptions): Mat | null;
@@ -285,7 +287,9 @@ declare namespace cv {
285
287
  function absdiff(src1: Mat, options: { src2: Mat }): Mat | null;
286
288
  function addWeighted(src1: Mat, options: { src2: Mat; alpha?: number; beta?: number; gamma?: number }): Mat | null;
287
289
  function convertScaleAbs(mat: Mat, options?: { alpha?: number; beta?: number }): Mat | null;
290
+ /** 只接受单通道 Mat;多通道返回 `-1`。 */
288
291
  function countNonZero(mat: Mat): number;
292
+ /** 只接受单通道 Mat;多通道返回 `null`。可选 `mask` 必须是 `CV_8UC1`。 */
289
293
  function minMaxLoc(mat: Mat, options?: { mask?: Mat }): MinMaxLocResult | null;
290
294
  function mean(mat: Mat, options?: { mask?: Mat }): number[] | null;
291
295
  function split(mat: Mat): Mat[] | null;
@@ -295,10 +299,13 @@ declare namespace cv {
295
299
  function GaussianBlur(mat: Mat, options: BlurOptions): Mat | null;
296
300
  function blur(mat: Mat, options: { ksize: number | [number, number] | Size }): Mat | null;
297
301
  function medianBlur(mat: Mat, options: { ksize: number }): Mat | null;
302
+ /** 只接受 1 或 3 通道,深度 `CV_8U` 或 `CV_32F`。 */
298
303
  function bilateralFilter(mat: Mat, options: { d?: number; sigmaColor?: number; sigmaSpace?: number }): Mat | null;
304
+ /** 只接受 8 位图(`CV_8U`,1/3/4 通道均可)。 */
299
305
  function Canny(mat: Mat, options: CannyOptions): Mat | null;
300
306
  function Sobel(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; ksize?: number; scale?: number; delta?: number }): Mat | null;
301
307
  function Laplacian(mat: Mat, options: { ddepth?: number; ksize?: number; scale?: number; delta?: number }): Mat | null;
308
+ /** 只接受 `CV_8UC1`。 */
302
309
  function equalizeHist(mat: Mat): Mat | null;
303
310
 
304
311
  // ---- 几何 / 绘制 ----
@@ -507,6 +514,7 @@ declare namespace cv {
507
514
  /** ORB 检测并计算描述子(二进制描述子,匹配常用 NORM_HAMMING) */
508
515
  function ORB(mat: Mat, options?: ORBOptions): FeatureResult | null;
509
516
  /** FAST 仅返回关键点(无描述子) */
517
+ /** 只接受 `CV_8UC1`。 */
510
518
  function FAST(mat: Mat, options?: FASTOptions): { keypoints: KeyPoint[] } | null;
511
519
 
512
520
  /** 暴力匹配描述子,返回 DMatch 数组 */
@@ -542,6 +550,7 @@ declare namespace cv {
542
550
  /** 就地洪水填充,返回填充像素数与外接矩形 */
543
551
  function floodFill(mat: Mat, options: FloodFillOptions): { filled: number; rect: Rect } | null;
544
552
  function convexHull(points: Point[], options?: { clockwise?: boolean }): Point[] | null;
553
+ /** Mat 输入必须是单通道栅格或 2 通道点集。 */
545
554
  function moments(matOrPoints: Mat | Point[], options?: { binaryImage?: boolean }): MomentsResult | null;
546
555
  function matchShapes(contour1: Mat | Point[], contour2: Mat | Point[], options?: { method?: number; parameter?: number }): number;
547
556
  function connectedComponentsWithStats(mat: Mat): ConnectedComponentsResult | null;