ms-types 0.9.25 → 0.9.26

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.
@@ -0,0 +1,205 @@
1
+ ---@meta image
2
+ ---@class Image
3
+ local _Image = {}
4
+
5
+ ---@class Size
6
+ ---@field width integer 宽度
7
+ ---@field height integer 高度
8
+
9
+ ---@class Point
10
+ ---@field x integer x坐标
11
+ ---@field y integer y坐标
12
+
13
+ ---@class Rect
14
+ ---@field index integer 模版索引
15
+ ---@field x integer 左上角x坐标
16
+ ---@field y integer 左上角y坐标
17
+ ---@field width integer 宽度
18
+ ---@field height integer 高度
19
+ ---@field confidence number 置信度
20
+ ---@field centerX integer 中心x坐标
21
+ ---@field centerY integer 中心y坐标
22
+ ---@field ex integer 右下角x坐标
23
+ ---@field ey integer 右下角y坐标
24
+
25
+ --- 截取屏幕;坐标缺省 0 表示全屏
26
+ --- @param x integer|nil 左上角 x
27
+ --- @param y integer|nil 左上角 y
28
+ --- @param ex integer|nil 右下角 x
29
+ --- @param ey integer|nil 右下角 y
30
+ --- @return string|nil 图片ID
31
+ function _Image.captureScreen(x, y, ex, ey) return '' end
32
+
33
+ --- 全屏截屏
34
+ --- @return string|nil 图片ID
35
+ function _Image.captureFullScreen() return '' end
36
+
37
+ --- 区域截屏
38
+ --- @param x integer|nil
39
+ --- @param y integer|nil
40
+ --- @param ex integer|nil 右下角x
41
+ --- @param ey integer|nil 右下角y
42
+ --- @return string|nil 图片ID
43
+ function _Image.captureRect(x, y, ex, ey) return '' end
44
+
45
+ --- 读取图片
46
+ --- @param path string 文件路径
47
+ --- @return string 图片ID
48
+ function _Image.readImage(path) return '' end
49
+
50
+ --- 裁剪图片
51
+ --- @param id string 图片ID
52
+ --- @param x integer|nil
53
+ --- @param y integer|nil
54
+ --- @param ex integer|nil 右下角x
55
+ --- @param ey integer|nil 右下角y
56
+ --- @return string 新图片ID
57
+ function _Image.clip(id, x, y, ex, ey) return '' end
58
+
59
+ --- 获取尺寸
60
+ --- @param id string 图片ID
61
+ --- @return Size 尺寸对象
62
+ function _Image.getSize(id)
63
+ ---@type Size
64
+ local ret
65
+ return ret
66
+ end
67
+
68
+ --- 转为Base64
69
+ --- @param id string 图片ID
70
+ --- @param format string 格式,如 'png'
71
+ --- @param quality integer|nil 质量
72
+ --- @return string Base64文本
73
+ function _Image.toBase64Format(id, format, quality) return '' end
74
+
75
+ --- Base64转图片
76
+ --- @param s string Base64文本
77
+ --- @return string 图片ID
78
+ function _Image.base64ToImage(s) return '' end
79
+
80
+ --- 旋转图片
81
+ --- @param id string 图片ID
82
+ --- @param degree integer 角度(90 | -90 | 180)
83
+ --- @return string|nil 新图片ID
84
+ function _Image.rotateImage(id, degree) return '' end
85
+
86
+ --- 图片是否已释放
87
+ --- @param id string 图片ID
88
+ --- @return boolean 已释放
89
+ function _Image.isRelease(id) return false end
90
+
91
+ --- 释放图片
92
+ --- @param id string 图片ID
93
+ function _Image.release(id) end
94
+
95
+ --- 保存图片到路径
96
+ --- @param id string 图片ID
97
+ --- @param path string 文件路径
98
+ --- @return boolean 成功
99
+ function _Image.saveTo(id, path) return true end
100
+
101
+ --- 查找颜色
102
+ --- @param id string 图片ID
103
+ --- @param color string 颜色 "#RRGGBB",可带偏色
104
+ --- @param threshold number 相似度 0.0-1.0
105
+ --- @param x integer|nil 左上x
106
+ --- @param y integer|nil 左上y
107
+ --- @param ex integer|nil 右下x
108
+ --- @param ey integer|nil 右下y
109
+ --- @param limit integer 限制个数
110
+ --- @param orz integer 方向 1-8
111
+ --- @return Point[] 结果点列表
112
+ function _Image.findColor(id, color, threshold, x, y, ex, ey, limit, orz)
113
+ return {}
114
+ end
115
+
116
+ --- 多点比色
117
+ --- @param id string 图片ID
118
+ --- @param points string 点配置 "x|y|主色-偏色,..."
119
+ --- @param threshold number 相似度 0.0-1.0
120
+ --- @return boolean 是否相同
121
+ function _Image.cmpColor(id, points, threshold) return true end
122
+
123
+ --- 查找图片
124
+ --- @param id string 图片ID
125
+ --- @param templateImageId string 模板图片ID
126
+ --- @param x integer|nil 左上x
127
+ --- @param y integer|nil 左上y
128
+ --- @param ex integer|nil 右下x
129
+ --- @param ey integer|nil 右下y
130
+ --- @param threshold number 相似度 0.0-1.0
131
+ --- @param limit integer|nil 限制个数
132
+ --- @param method integer|nil 匹配方法 1|3|5
133
+ --- @param rgb boolean|nil 是否使用RGB
134
+ --- @return Rect[] 结果矩形列表
135
+ function _Image.findImage(id, templateImageId, x, y, ex, ey, threshold, limit,
136
+ method, rgb) return {} end
137
+
138
+ --- 多点找色
139
+ --- @param id string 图片ID
140
+ --- @param firstColor string 首色 "#RRGGBB" 或 "#RRGGBB"
141
+ --- @param threshold number 相似度 0.0-1.0
142
+ --- @param points string 点配置 "x|y|主色-偏色,..."
143
+ --- @param x integer 左上x
144
+ --- @param y integer 左上y
145
+ --- @param ex integer 右下x
146
+ --- @param ey integer 右下y
147
+ --- @param limit integer 限制个数
148
+ --- @param orz integer 方向 1-8
149
+ --- @return Point[] 结果点列表
150
+ function _Image.findMultiColor(id, firstColor, threshold, points, x, y, ex, ey,
151
+ limit, orz) return {} end
152
+
153
+ --- 统计颜色数量
154
+ --- @param id string 图片ID
155
+ --- @param colors string 颜色列表 "主色-偏色|主色-偏色|..."
156
+ --- @param threshold number 相似度 0.0-1.0
157
+ --- @param x integer 左上x
158
+ --- @param y integer 左上y
159
+ --- @param ex integer 右下x
160
+ --- @param ey integer 右下y
161
+ --- @return integer 命中像素数量
162
+ function _Image.countColor(id, colors, threshold, x, y, ex, ey) return 0 end
163
+
164
+ --- 像素值
165
+ --- @param id string 图片ID
166
+ --- @param x integer
167
+ --- @param y integer
168
+ --- @return integer ARGB值
169
+ function _Image.pixel(id, x, y) return 0 end
170
+
171
+ --- 颜色转16进制字符串
172
+ --- @param color integer ARGB整数
173
+ --- @return string #RRGGBB
174
+ function _Image.argb(color) return '' end
175
+
176
+ --- 二值化
177
+ --- @param id string 图片ID
178
+ --- @param threshold number 阈值
179
+ --- @return string 新图片ID
180
+ function _Image.binaryzation(id, threshold) return '' end
181
+
182
+ --- 灰度化
183
+ --- @param id string 图片ID
184
+ --- @return string 新图片ID
185
+ function _Image.gray(id) return '' end
186
+
187
+ --- 扫描条码/二维码
188
+ --- @param id string 图片ID
189
+ --- @return string|nil 文本
190
+ function _Image.scanCode(id) return '' end
191
+
192
+ --- 绘制矩形
193
+ --- @param id string 图片ID
194
+ --- @param x integer|nil 左上x
195
+ --- @param y integer|nil 左上y
196
+ --- @param ex integer|nil 右下x
197
+ --- @param ey integer|nil 右下y
198
+ --- @param color string|nil 颜色 #RRGGBB
199
+ --- @param thickness integer|nil 线宽 -1填充
200
+ function _Image.drawRect(id, x, y, ex, ey, color, thickness) end
201
+
202
+ --- 释放所有图片
203
+ function _Image.releaseAll() end
204
+
205
+ return _Image
@@ -0,0 +1,48 @@
1
+ ---@meta ime
2
+ ---@class Ime
3
+ local _Ime = {}
4
+
5
+ --- 输入法是否可用(键盘是否已弹出)
6
+ --- @return boolean 可用
7
+ function _Ime.isOk() return false end
8
+
9
+ --- 获取当前输入框文本
10
+ --- @return string 文本
11
+ function _Ime.getText() return '' end
12
+
13
+ --- 清空输入框文本
14
+ --- @return boolean 成功
15
+ function _Ime.clearText() return true end
16
+
17
+ --- 输入文本(content 为空时使用剪贴板)
18
+ --- @param text string 文本
19
+ --- @return string 实际输入的文本(失败为空字符串)
20
+ function _Ime.input(text) return '' end
21
+
22
+ --- 粘贴文本(content 为空时使用剪贴板)
23
+ --- @param text string|nil 文本
24
+ --- @return string 实际粘贴的文本(失败为空字符串)
25
+ function _Ime.paste(text) return '' end
26
+
27
+ --- 删除一个字符(返回剩余文本;空表示无数据)
28
+ --- @return string 剩余文本
29
+ function _Ime.pressDel() return '' end
30
+
31
+ --- 回车键
32
+ --- @return boolean 成功
33
+ function _Ime.pressEnter() return true end
34
+
35
+ --- 隐藏键盘
36
+ --- @return boolean 成功
37
+ function _Ime.dismiss() return true end
38
+
39
+ --- 获取剪贴板
40
+ --- @return string 文本
41
+ function _Ime.getClipboard() return '' end
42
+
43
+ --- 设置剪贴板(键盘显示时)
44
+ --- @param text string 文本
45
+ --- @return boolean 成功
46
+ function _Ime.setClipboard(text) return true end
47
+
48
+ return _Ime
@@ -0,0 +1,48 @@
1
+ ---@meta logger
2
+ ---@class Logger
3
+ local _Logger = {}
4
+
5
+ --- 设置日志级别(error|warn|info|debug|off)
6
+ --- @param level string 级别
7
+ function _Logger.setLoggerLevel(level) end
8
+
9
+ --- 设置是否输出到日志文件
10
+ --- @param enabled boolean 是否启用文件输出
11
+ function _Logger.setLogToFile(enabled) end
12
+
13
+ --- 设置最大日志文件数量(默认 10)
14
+ --- @param count integer 数量
15
+ function _Logger.setMaxLogFileCount(count) end
16
+
17
+ --- 设置最大日志文件大小(MB,默认 10)
18
+ --- @param size integer 大小
19
+ function _Logger.setMaxLogFileSize(size) end
20
+
21
+ --- 重置日志文件(创建新文件写入)
22
+ function _Logger.resetLogFile() end
23
+
24
+ --- 输出调试日志(级别:debug)
25
+ --- 可变参数会按空格拼接为一行文本
26
+ --- @param ... any 日志内容(任意类型,自动调用 tostring)
27
+ --- @return nil
28
+ function _Logger.debug(...) end
29
+
30
+ --- 输出信息日志(级别:info)
31
+ --- 可变参数会按空格拼接为一行文本
32
+ --- @param ... any 日志内容(任意类型,自动调用 tostring)
33
+ --- @return nil
34
+ function _Logger.info(...) end
35
+
36
+ --- 输出警告日志(级别:warn)
37
+ --- 可变参数会按空格拼接为一行文本
38
+ --- @param ... any 日志内容(任意类型,自动调用 tostring)
39
+ --- @return nil
40
+ function _Logger.warn(...) end
41
+
42
+ --- 输出错误日志(级别:error)
43
+ --- 可变参数会按空格拼接为一行文本
44
+ --- @param ... any 日志内容(任意类型,自动调用 tostring)
45
+ --- @return nil
46
+ function _Logger.error(...) end
47
+
48
+ return _Logger
@@ -0,0 +1,46 @@
1
+ ---@meta media
2
+ ---@class Media
3
+ local _Media = {}
4
+
5
+ --- 播放MP3
6
+ --- @param file string 文件路径
7
+ --- @param loop boolean|nil 循环播放
8
+ --- @return boolean 成功
9
+ function _Media.playMp3(file, loop) return true end
10
+
11
+ --- 停止播放
12
+ --- @return boolean 成功
13
+ function _Media.stopMp3() return true end
14
+
15
+ --- 播放一次并等待结束
16
+ --- @param file string 文件路径
17
+ --- @return boolean 是否正常播放到结尾
18
+ function _Media.playMp3WaitEnd(file) return true end
19
+
20
+ --- 是否正在播放
21
+ --- @return boolean 正在播放
22
+ function _Media.isMp3Playing() return true end
23
+
24
+ --- 保存图片到相册
25
+ --- @param imageId string 图片ID
26
+ --- @return boolean 成功
27
+ function _Media.saveImageToAlbum(imageId) return true end
28
+
29
+ --- 保存视频到相册(路径)
30
+ --- @param path string 文件路径
31
+ --- @return boolean 成功
32
+ function _Media.saveVideoToAlbumPath(path) return true end
33
+
34
+ --- 清空相册中的图片
35
+ --- @return boolean 成功
36
+ function _Media.deleteAllPhotos() return true end
37
+
38
+ --- 清空相册中的视频
39
+ --- @return boolean 成功
40
+ function _Media.deleteAllVideos() return true end
41
+
42
+ --- 清空相册中的截图
43
+ --- @return boolean 成功
44
+ function _Media.deleteAllScreenshots() return true end
45
+
46
+ return _Media
@@ -0,0 +1,64 @@
1
+ ---@meta mysql
2
+ ---@class MySQL
3
+ local _MySQL = {}
4
+
5
+ ---@class MySQLConfig
6
+ ---@field host string 主机名
7
+ ---@field port integer|nil 端口号
8
+ ---@field username string 用户名
9
+ ---@field password string 密码
10
+ ---@field database string 数据库名
11
+ ---@field charset string|nil 字符集
12
+
13
+ ---@class MySQLResult
14
+ ---@field rows table[] 结果集
15
+ ---@field affectedRows integer 受影响的行数
16
+ ---@field success boolean 是否成功
17
+ ---@field insertId integer|nil 插入ID
18
+ ---@field error string|nil 错误信息
19
+
20
+ --- 连接数据库
21
+ --- @param config MySQLConfig 配置
22
+ --- @return boolean 成功
23
+ function _MySQL.connect(config) return true end
24
+
25
+ --- 断开连接
26
+ function _MySQL.disconnect() end
27
+
28
+ --- 是否连接
29
+ --- @return boolean 连接中
30
+ function _MySQL.isConnected() return false end
31
+
32
+ --- 查询
33
+ --- @param sql string
34
+ --- @param params any[]|nil 参数数组
35
+ --- @return MySQLResult 结果
36
+ function _MySQL.query(sql, params)
37
+ ---@type MySQLResult
38
+ local ret
39
+ return ret
40
+ end
41
+
42
+ --- 执行
43
+ --- @param sql string
44
+ --- @param params any[]|nil 参数数组
45
+ --- @return MySQLResult 结果
46
+ function _MySQL.execute(sql, params)
47
+ ---@type MySQLResult
48
+ local ret
49
+ return ret
50
+ end
51
+
52
+ --- 开始事务
53
+ --- @return boolean 成功
54
+ function _MySQL.beginTransaction() return true end
55
+
56
+ --- 提交
57
+ --- @return boolean 成功
58
+ function _MySQL.commit() return true end
59
+
60
+ --- 回滚
61
+ --- @return boolean 成功
62
+ function _MySQL.rollback() return true end
63
+
64
+ return _MySQL
@@ -0,0 +1,45 @@
1
+ ---@meta netcard
2
+ ---@class NetCard
3
+ local _NetCard = {}
4
+
5
+ ---@class CardInfo 卡密信息
6
+ ---@field cardNo string 卡密
7
+ ---@field batchCard string 批量卡密
8
+ ---@field remark string 备注
9
+ ---@field activeTime string 激活时间
10
+ ---@field expireTime string 过期时间
11
+
12
+ --- 当前是否为授权卡密模式
13
+ --- @return boolean 授权卡密模式
14
+ function _NetCard.isAuthCardMode() return false end
15
+
16
+ --- 验证
17
+ --- @param cardNo string 卡密
18
+ --- @return boolean 成功
19
+ function _NetCard.verify(cardNo) return true end
20
+
21
+ --- 卡信息
22
+ --- @return CardInfo|nil 信息
23
+ function _NetCard.getCardInfo()
24
+ ---@type CardInfo
25
+ local ret
26
+ return ret
27
+ end
28
+
29
+ --- 设置备注
30
+ --- @param remark string 备注
31
+ --- @return boolean 成功
32
+ function _NetCard.setCardRemark(remark) return true end
33
+
34
+ --- 设置值
35
+ --- @param key string 键
36
+ --- @param value string 值
37
+ --- @return string 返回值
38
+ function _NetCard.setValue(key, value) return '' end
39
+
40
+ --- 获取值
41
+ --- @param key string 键
42
+ --- @return string 值
43
+ function _NetCard.getValue(key) return '' end
44
+
45
+ return _NetCard
@@ -0,0 +1,74 @@
1
+ ---@meta node
2
+ ---@class Node
3
+ local _Node = {}
4
+
5
+ ---@class SelectorParams 选择器参数
6
+ ---@field maxDepth integer|nil 最大深度 默认 50
7
+ ---@field mode integer|nil 抓取模式 1/2/3,默认 1
8
+
9
+ ---@class NodeBounds 节点边界
10
+ ---@field x integer 节点左边界
11
+ ---@field y integer 节点上边界
12
+ ---@field width integer 节点宽度
13
+ ---@field height integer 节点高度
14
+ ---@field centerX integer 节点中心X坐标
15
+ ---@field centerY integer 节点中心Y坐标
16
+
17
+ ---@class NodeInfo 节点信息
18
+ ---@field id string 节点ID
19
+ ---@field identifier string 节点标识符
20
+ ---@field label string 节点标签
21
+ ---@field type string 节点类型
22
+ ---@field value string 节点值
23
+ ---@field title string 节点名称
24
+ ---@field visible boolean 是否可见
25
+ ---@field enabled boolean 是否启用
26
+ ---@field accessible boolean 是否可访问
27
+ ---@field selected boolean 是否选中
28
+ ---@field bounds NodeBounds 节点边界
29
+ ---@field depth integer 节点深度
30
+ ---@field index integer 节点索引
31
+ ---@field parentId string 父节点ID
32
+ ---@field childCount integer 子节点数量
33
+ ---@field clickCenter fun(self: NodeInfo, duration: integer|nil): boolean 点击中心
34
+ ---@field clickRandom fun(self: NodeInfo, duration: integer|nil): boolean 点击随机位置
35
+ ---@field parent fun(self: NodeInfo): NodeInfo|nil 父节点
36
+ ---@field child fun(self: NodeInfo, index: integer): NodeInfo|nil 子节点
37
+ ---@field allChildren fun(self: NodeInfo): NodeInfo[] 所有子节点
38
+ ---@field siblings fun(self: NodeInfo): NodeInfo[] 所有兄弟节点
39
+ ---@field previousSiblings fun(self: NodeInfo): NodeInfo[] 前兄弟节点
40
+ ---@field nextSiblings fun(self: NodeInfo): NodeInfo[] 后兄弟节点
41
+ ---@class NodeSelector 节点选择器
42
+ ---@field clearSelector fun(self: NodeSelector): NodeSelector 清除选择器
43
+ ---@field loadNode fun(self: NodeSelector, timeout: integer|nil): NodeSelector 加载节点
44
+ ---@field xml fun(self: NodeSelector, timeout: integer|nil): string|nil 获取XML字符串
45
+ ---@field getNodeInfo fun(self: NodeSelector, timeout: integer|nil): NodeInfo[] 获取所有节点信息
46
+ ---@field getOneNodeInfo fun(self: NodeSelector, timeout: integer|nil): NodeInfo|nil 获取第一个节点信息
47
+ ---@field xpath fun(self: NodeSelector, path: string): NodeSelector 设置XPath路径
48
+ ---@field label fun(self: NodeSelector, label: string): NodeSelector 设置标签
49
+ ---@field labelMatch fun(self: NodeSelector, match: string): NodeSelector 设置标签匹配
50
+ ---@field title fun(self: NodeSelector, title: string): NodeSelector 设置名称
51
+ ---@field titleMatch fun(self: NodeSelector, match: string): NodeSelector 设置名称匹配
52
+ ---@field identifier fun(self: NodeSelector, identifier: string): NodeSelector 设置标识符
53
+ ---@field identifierMatch fun(self: NodeSelector, match: string): NodeSelector 设置标识符匹配
54
+ ---@field type fun(self: NodeSelector, typetitle: string): NodeSelector 设置类型
55
+ ---@field typeMatch fun(self: NodeSelector, match: string): NodeSelector 设置类型匹配
56
+ ---@field value fun(self: NodeSelector, value: string): NodeSelector 设置值
57
+ ---@field valueMatch fun(self: NodeSelector, match: string): NodeSelector 设置值匹配
58
+ ---@field enabled fun(self: NodeSelector, flag: boolean): NodeSelector 设置启用状态
59
+ ---@field visible fun(self: NodeSelector, flag: boolean): NodeSelector 设置可见状态
60
+ ---@field index fun(self: NodeSelector, idx: integer): NodeSelector 设置索引
61
+ ---@field depth fun(self: NodeSelector, d: integer): NodeSelector 设置深度
62
+ ---@field childCount fun(self: NodeSelector, childCount: integer|string): NodeSelector 设置子节点数量
63
+ ---@field bounds fun(self: NodeSelector, x: integer, y: integer, width: integer, height: integer): NodeSelector 设置边界
64
+
65
+ --- 创建选择器(可自动释放)
66
+ --- @param params SelectorParams|nil
67
+ --- @return NodeSelector 选择器
68
+ function _Node.createNodeSelector(params)
69
+ ---@type NodeSelector
70
+ local ret
71
+ return ret
72
+ end
73
+
74
+ return _Node