ms-types 0.10.7 → 0.10.9
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 +2 -2
- package/types/action.d.ts +7 -2
- package/types/ai.d.ts +5 -4
- package/types/appleocr.d.ts +4 -4
- package/types/cloud.d.ts +1 -2
- package/types/config.d.ts +1 -1
- package/types/cryptoUtils.d.ts +5 -2
- package/types/device.d.ts +1 -1
- package/types/dotocr.d.ts +3 -1
- package/types/file.d.ts +2 -2
- package/types/hotUpdate.d.ts +1 -2
- package/types/http.d.ts +6 -6
- package/types/image.d.ts +1 -1
- package/types/ime.d.ts +1 -1
- package/types/logger.d.ts +2 -2
- package/types/lua/action.lua +119 -89
- package/types/lua/ai.lua +34 -16
- package/types/lua/appleocr.lua +35 -22
- package/types/lua/cloud.lua +25 -12
- package/types/lua/config.lua +18 -11
- package/types/lua/cryptoUtils.lua +35 -27
- package/types/lua/cv.lua +173 -25
- package/types/lua/device.lua +38 -20
- package/types/lua/dotocr.lua +8 -2
- package/types/lua/file.lua +61 -40
- package/types/lua/global.lua +56 -20
- package/types/lua/hid.lua +147 -101
- package/types/lua/hotupdate.lua +25 -3
- package/types/lua/http.lua +71 -41
- package/types/lua/image.lua +222 -98
- package/types/lua/ime.lua +37 -13
- package/types/lua/logger.lua +22 -12
- package/types/lua/media.lua +54 -14
- package/types/lua/mysql.lua +61 -12
- package/types/lua/netcard.lua +25 -11
- package/types/lua/node.lua +4 -2
- package/types/lua/paddleocr.lua +35 -21
- package/types/lua/pip.lua +30 -18
- package/types/lua/system.lua +112 -31
- package/types/lua/tomatoocr.lua +73 -26
- package/types/lua/tts.lua +26 -10
- package/types/lua/ui.lua +35 -14
- package/types/lua/utils.lua +27 -17
- package/types/lua/yolo.lua +25 -17
- package/types/lua/yolocls.lua +27 -18
- package/types/media.d.ts +1 -1
- package/types/mysql.d.ts +1 -1
- package/types/netCard.d.ts +3 -0
- package/types/node.d.ts +1 -1
- package/types/paddleocr.d.ts +2 -5
- package/types/pip.d.ts +3 -0
- package/types/system.d.ts +1 -1
- package/types/tomatoocr.d.ts +3 -4
- package/types/tts.d.ts +2 -2
- package/types/ui.d.ts +1 -1
- package/types/utils.d.ts +1 -1
- package/types/web.d.ts +1 -1
- package/types/yolo.d.ts +1 -1
- package/types/yoloCls.d.ts +1 -1
- package/types/zh/HID/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh/HTTP/346/250/241/345/235/227.d.ts +7 -6
- package/types/zh/MySql/346/250/241/345/235/227.d.ts +2 -1
- package/types/zh/PaddleOCR/346/250/241/345/235/227.d.ts +3 -5
- package/types/zh/YOLO/345/210/206/347/261/273/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh/YOLO/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//344/272/221/346/216/247/346/250/241/345/235/227.d.ts +4 -1
- package/types/zh//345/212/250/344/275/234/346/250/241/345/235/227.d.ts +7 -2
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +2 -1
- package/types/zh//345/252/222/344/275/223/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//345/267/245/345/205/267/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//346/202/254/346/265/256/347/252/227/346/250/241/345/235/227.d.ts +2 -1
- package/types/zh//346/226/207/344/273/266/346/250/241/345/235/227.d.ts +3 -2
- package/types/zh//346/226/207/345/255/227/350/275/254/350/257/255/351/237/263/346/250/241/345/235/227.d.ts +3 -2
- package/types/zh//346/227/245/345/277/227/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +3 -1
- package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +2 -1
- package/types/zh//347/272/277/347/250/213/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//350/213/271/346/236/234OCR.d.ts +4 -4
- package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh//350/256/276/345/244/207/346/250/241/345/235/227.d.ts +2 -1
- package/types/zh//350/276/223/345/205/245/346/263/225/346/250/241/345/235/227.d.ts +2 -1
- package/types/zh//351/205/215/347/275/256/346/250/241/345/235/227.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ms-types",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"vitepress": "^1.6.4",
|
|
20
20
|
"vitepress-theme-teek": "^1.6.2",
|
|
21
|
-
"wrangler": "^4.
|
|
21
|
+
"wrangler": "^4.131.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/types/action.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 动作模块
|
|
2
|
+
* 动作模块
|
|
3
3
|
*/
|
|
4
4
|
declare namespace action {
|
|
5
5
|
/**
|
|
@@ -196,7 +196,12 @@ declare namespace action {
|
|
|
196
196
|
* @example action.pressButton("home")
|
|
197
197
|
*/
|
|
198
198
|
function pressButton(
|
|
199
|
-
button:
|
|
199
|
+
button:
|
|
200
|
+
| "home"
|
|
201
|
+
| "volumeup"
|
|
202
|
+
| "volumedown"
|
|
203
|
+
| "brightnessup"
|
|
204
|
+
| "brightnessdown",
|
|
200
205
|
): boolean;
|
|
201
206
|
|
|
202
207
|
/**
|
package/types/ai.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AI
|
|
3
|
-
* 支持 openai 兼容 / anthropic / gemini 三种协议;模型配置写在脚本里,脚本开头 ai.setProvider 一次即可。
|
|
4
|
-
* 所有方法同步阻塞,失败返回 null / false,原因用 ai.lastError() 查看。
|
|
2
|
+
* AI模块
|
|
5
3
|
*/
|
|
6
4
|
declare namespace ai {
|
|
7
5
|
/**
|
|
@@ -160,7 +158,10 @@ declare namespace ai {
|
|
|
160
158
|
* @example
|
|
161
159
|
* ai.chat([{ role: "system", content: "你是助手" }, { role: "user", content: "看下这是哪个页面", image: "screen" }])
|
|
162
160
|
*/
|
|
163
|
-
function chat(
|
|
161
|
+
function chat(
|
|
162
|
+
messages: (AiMessage | string)[],
|
|
163
|
+
options?: AiOptions,
|
|
164
|
+
): string | null;
|
|
164
165
|
/**
|
|
165
166
|
* 从模型文本里解析 JSON,自动剥掉 Markdown 代码块和前后解释
|
|
166
167
|
* @param text 模型输出
|
package/types/appleocr.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* AppleOCR模块
|
|
3
3
|
*/
|
|
4
4
|
declare namespace appleOcr {
|
|
5
5
|
/**
|
|
@@ -49,7 +49,7 @@ declare namespace appleOcr {
|
|
|
49
49
|
y?: number,
|
|
50
50
|
ex?: number,
|
|
51
51
|
ey?: number,
|
|
52
|
-
languages?: string[]
|
|
52
|
+
languages?: string[],
|
|
53
53
|
): OCRResult[];
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -71,7 +71,7 @@ declare namespace appleOcr {
|
|
|
71
71
|
x?: number,
|
|
72
72
|
y?: number,
|
|
73
73
|
ex?: number,
|
|
74
|
-
ey?: number
|
|
74
|
+
ey?: number,
|
|
75
75
|
): OCRResult[];
|
|
76
76
|
|
|
77
77
|
/**
|
|
@@ -99,6 +99,6 @@ declare namespace appleOcr {
|
|
|
99
99
|
ex?: number,
|
|
100
100
|
ey?: number,
|
|
101
101
|
languages?: string[],
|
|
102
|
-
exactMatch?: boolean
|
|
102
|
+
exactMatch?: boolean,
|
|
103
103
|
): OCRResult[];
|
|
104
104
|
}
|
package/types/cloud.d.ts
CHANGED
package/types/config.d.ts
CHANGED
package/types/cryptoUtils.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 加密工具模块
|
|
3
|
+
*/
|
|
1
4
|
declare namespace cryptoUtils {
|
|
2
5
|
/// 使用AES ECB模式加密数据 默认使用PKCS7填充
|
|
3
6
|
/// - Parameters:
|
|
@@ -8,7 +11,7 @@ declare namespace cryptoUtils {
|
|
|
8
11
|
function encryptWithAES_ECB(
|
|
9
12
|
data: string,
|
|
10
13
|
aesKey: string,
|
|
11
|
-
noPadding?: boolean
|
|
14
|
+
noPadding?: boolean,
|
|
12
15
|
): string;
|
|
13
16
|
|
|
14
17
|
/// 使用AES ECB模式解密数据 默认使用PKCS7填充
|
|
@@ -20,7 +23,7 @@ declare namespace cryptoUtils {
|
|
|
20
23
|
function decryptWithAES_ECB(
|
|
21
24
|
data: string,
|
|
22
25
|
aesKey: string,
|
|
23
|
-
noPadding?: boolean
|
|
26
|
+
noPadding?: boolean,
|
|
24
27
|
): string;
|
|
25
28
|
|
|
26
29
|
/// 使用RSA公钥加密数据 默认使用PKCS1填充
|
package/types/device.d.ts
CHANGED
package/types/dotocr.d.ts
CHANGED
package/types/file.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 文件模块
|
|
2
|
+
* 文件模块
|
|
3
3
|
*/
|
|
4
4
|
declare namespace file {
|
|
5
5
|
/**
|
|
@@ -9,7 +9,7 @@ declare namespace file {
|
|
|
9
9
|
* @example file.getInternalDir("documents")
|
|
10
10
|
*/
|
|
11
11
|
function getInternalDir(
|
|
12
|
-
type: "documents" | "library" | "temp" | "libraryCaches"
|
|
12
|
+
type: "documents" | "library" | "temp" | "libraryCaches",
|
|
13
13
|
): string;
|
|
14
14
|
/**
|
|
15
15
|
* 创建文件
|
package/types/hotUpdate.d.ts
CHANGED
package/types/http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP模块
|
|
2
|
+
* HTTP模块
|
|
3
3
|
*/
|
|
4
4
|
declare namespace http {
|
|
5
5
|
/**
|
|
@@ -131,7 +131,7 @@ declare namespace http {
|
|
|
131
131
|
url: string,
|
|
132
132
|
file: string,
|
|
133
133
|
timeout?: number,
|
|
134
|
-
headers?: Record<string, string
|
|
134
|
+
headers?: Record<string, string>,
|
|
135
135
|
): boolean;
|
|
136
136
|
|
|
137
137
|
/**
|
|
@@ -148,7 +148,7 @@ declare namespace http {
|
|
|
148
148
|
url: string,
|
|
149
149
|
params?: Record<string, string>,
|
|
150
150
|
timeout?: number,
|
|
151
|
-
headers?: Record<string, string
|
|
151
|
+
headers?: Record<string, string>,
|
|
152
152
|
): string | null;
|
|
153
153
|
|
|
154
154
|
/**
|
|
@@ -167,7 +167,7 @@ declare namespace http {
|
|
|
167
167
|
params?: Record<string, string>,
|
|
168
168
|
files?: Record<string, string>,
|
|
169
169
|
timeout?: number,
|
|
170
|
-
headers?: Record<string, string
|
|
170
|
+
headers?: Record<string, string>,
|
|
171
171
|
): string | null;
|
|
172
172
|
|
|
173
173
|
/**
|
|
@@ -187,7 +187,7 @@ declare namespace http {
|
|
|
187
187
|
url: string,
|
|
188
188
|
json?: Record<string, any>,
|
|
189
189
|
timeout?: number,
|
|
190
|
-
headers?: Record<string, string
|
|
190
|
+
headers?: Record<string, string>,
|
|
191
191
|
): string | null;
|
|
192
192
|
|
|
193
193
|
/**
|
|
@@ -206,7 +206,7 @@ declare namespace http {
|
|
|
206
206
|
*/
|
|
207
207
|
function newWebsocket(
|
|
208
208
|
url: string,
|
|
209
|
-
header?: Record<string, string
|
|
209
|
+
header?: Record<string, string>,
|
|
210
210
|
): WebSocket;
|
|
211
211
|
|
|
212
212
|
/**
|
package/types/image.d.ts
CHANGED
package/types/ime.d.ts
CHANGED
package/types/logger.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 日志模块
|
|
2
|
+
* 日志模块
|
|
3
3
|
*/
|
|
4
4
|
declare namespace logger {
|
|
5
5
|
/**
|
|
@@ -9,7 +9,7 @@ declare namespace logger {
|
|
|
9
9
|
* logger.setLoggerLevel("info");
|
|
10
10
|
*/
|
|
11
11
|
function setLoggerLevel(
|
|
12
|
-
level: "error" | "warn" | "debug" | "info" | "off"
|
|
12
|
+
level: "error" | "warn" | "debug" | "info" | "off",
|
|
13
13
|
): void;
|
|
14
14
|
/**
|
|
15
15
|
* 设置是否输出到文件 默认开启
|
package/types/lua/action.lua
CHANGED
|
@@ -1,128 +1,147 @@
|
|
|
1
1
|
---@meta
|
|
2
|
+
--- 动作模块
|
|
2
3
|
---@class Action
|
|
3
4
|
local _Action = {}
|
|
4
5
|
|
|
5
6
|
--- 设置动作抖动值
|
|
6
|
-
|
|
7
|
+
---@param value integer 抖动值
|
|
8
|
+
---@example action.setJitterValue(5)
|
|
7
9
|
function _Action.setJitterValue(value) end
|
|
8
10
|
|
|
9
11
|
--- 点击
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
---@param x integer 坐标x
|
|
13
|
+
---@param y integer 坐标y
|
|
14
|
+
---@param duration integer|nil 持续时间 默认20ms
|
|
15
|
+
---@param jitter boolean|nil 抖动 开启抖动,会在像素范围随机偏移 点击 默认false
|
|
16
|
+
---@return boolean 点击是否成功
|
|
17
|
+
---@example action.click(100, 100, 20, true)
|
|
15
18
|
function _Action.click(x, y, duration, jitter) return true end
|
|
16
19
|
|
|
17
20
|
--- 随机点击
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
---@param x1 integer 区域左上角x坐标
|
|
22
|
+
---@param y1 integer 区域左上角y坐标
|
|
23
|
+
---@param x2 integer 区域右下角x坐标
|
|
24
|
+
---@param y2 integer 区域右下角y坐标
|
|
25
|
+
---@param duration integer|nil 持续时间 默认20ms
|
|
26
|
+
---@return boolean 随机点击是否成功
|
|
27
|
+
---@example action.clickRandom(100, 100, 200, 200, 20)
|
|
24
28
|
function _Action.clickRandom(x1, y1, x2, y2, duration) return true end
|
|
25
29
|
|
|
26
30
|
--- 双击
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
---@param x integer 坐标x
|
|
32
|
+
---@param y integer 坐标y
|
|
33
|
+
---@param duration integer|nil 持续时间 默认20ms
|
|
34
|
+
---@param interval integer|nil 双击间隔时间 默认20ms
|
|
35
|
+
---@param jitter boolean|nil 抖动 开启抖动,会在像素范围随机偏移 点击 默认false
|
|
36
|
+
---@return boolean 双击是否成功
|
|
37
|
+
---@example action.doubleClick(100, 100, 20, 20, true)
|
|
33
38
|
function _Action.doubleClick(x, y, duration, interval, jitter) return true end
|
|
34
39
|
|
|
35
40
|
--- 随机双击
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
---@param x1 integer 区域左上角x坐标
|
|
42
|
+
---@param y1 integer 区域左上角y坐标
|
|
43
|
+
---@param x2 integer 区域右下角x坐标
|
|
44
|
+
---@param y2 integer 区域右下角y坐标
|
|
45
|
+
---@param duration integer|nil 持续时间 默认20ms
|
|
46
|
+
---@param interval integer|nil 双击间隔时间 默认20ms
|
|
47
|
+
---@return boolean 随机双击是否成功
|
|
48
|
+
---@example action.doubleClickRandom(100, 100, 200, 200, 20, 20)
|
|
43
49
|
function _Action.doubleClickRandom(x1, y1, x2, y2, duration, interval)
|
|
44
50
|
return true
|
|
45
51
|
end
|
|
46
52
|
|
|
47
53
|
--- 直线滑动
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
---@param startX integer 起始坐标x
|
|
55
|
+
---@param startY integer 起始坐标y
|
|
56
|
+
---@param endX integer 结束坐标x
|
|
57
|
+
---@param endY integer 结束坐标y
|
|
58
|
+
---@param duration integer|nil 持续时间 默认 100ms
|
|
59
|
+
---@param jitter boolean|nil 抖动 开启抖动,会在像素范围随机偏移 滑动 默认false
|
|
60
|
+
---@param steps integer|nil 步数 生成抖动点数量 默认6
|
|
61
|
+
---@return boolean 滑动是否成功
|
|
62
|
+
---@example action.swipe(100, 100, 200, 200, 500, true, 10)
|
|
56
63
|
function _Action.swipe(startX, startY, endX, endY, duration, jitter, steps)
|
|
57
64
|
return true
|
|
58
65
|
end
|
|
59
66
|
|
|
60
67
|
--- 长按并滑动
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
---@param startX integer 起始坐标x
|
|
69
|
+
---@param startY integer 起始坐标y
|
|
70
|
+
---@param endX integer 结束坐标x
|
|
71
|
+
---@param endY integer 结束坐标y
|
|
72
|
+
---@param touchDown integer|nil 按下持续时间 默认500ms
|
|
73
|
+
---@param touchMove integer|nil 移动持续时间 默认1000ms
|
|
74
|
+
---@param touchUp integer|nil 松开持续时间 默认500ms
|
|
75
|
+
---@param jitter boolean|nil 抖动 开启抖动,会在像素范围随机偏移 长按滑动 默认false
|
|
76
|
+
---@param steps integer|nil 步数 生成抖动点数量 默认6
|
|
77
|
+
---@return boolean 长按滑动是否成功
|
|
78
|
+
---@example action.pressAndSwipe(100, 100, 200, 200, 500, 500, 500, true, 10)
|
|
71
79
|
function _Action.pressAndSwipe(startX, startY, endX, endY, touchDown, touchMove,
|
|
72
80
|
touchUp, jitter, steps) return true end
|
|
73
81
|
|
|
74
82
|
--- 曲线滑动
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
---@param startX integer 起始x坐标
|
|
84
|
+
---@param startY integer 起始y坐标
|
|
85
|
+
---@param midX integer 中间点x坐标(控制曲线弯曲程度)
|
|
86
|
+
---@param midY integer 中间点y坐标(控制曲线弯曲程度)
|
|
87
|
+
---@param endX integer 目标x坐标
|
|
88
|
+
---@param endY integer 目标y坐标
|
|
89
|
+
---@param duration integer 总持续时间(毫秒),默认1000ms,实际执行时间会有随机变化
|
|
90
|
+
---@return boolean 曲线滑动是否成功
|
|
91
|
+
---@example action.swipeCurve(100, 100, 200, 150, 300, 200, 1000)
|
|
83
92
|
function _Action.swipeCurve(startX, startY, midX, midY, endX, endY, duration)
|
|
84
93
|
return true
|
|
85
94
|
end
|
|
86
95
|
|
|
87
96
|
--- 输入文本
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
---@param text string 文本内容
|
|
98
|
+
---@return boolean 输入文本是否成功
|
|
99
|
+
---@example action.input("123456")
|
|
90
100
|
function _Action.input(text) return true end
|
|
91
101
|
|
|
92
102
|
--- 基础文本输入(不支持中文,走键盘按键)
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
---@param text string 文本内容
|
|
104
|
+
---@return boolean 输入是否成功
|
|
105
|
+
---@example action.inputSimple("hello_123")
|
|
95
106
|
function _Action.inputSimple(text) return true end
|
|
96
107
|
|
|
97
108
|
--- 删除文本
|
|
98
|
-
|
|
99
|
-
|
|
109
|
+
---@param count integer|nil 删除数量 默认为1
|
|
110
|
+
---@return boolean 删除文本是否成功
|
|
111
|
+
---@example action.backspace(1)
|
|
100
112
|
function _Action.backspace(count) return true end
|
|
101
113
|
|
|
102
114
|
--- 回车
|
|
103
|
-
|
|
115
|
+
---@return boolean 调用回车是否成功
|
|
116
|
+
---@example action.enter()
|
|
104
117
|
function _Action.enter() return true end
|
|
105
118
|
|
|
106
119
|
--- 回到主页
|
|
107
|
-
|
|
120
|
+
---@return boolean 返回首页是否成功
|
|
121
|
+
---@example action.homeScreen()
|
|
108
122
|
function _Action.homeScreen() return true end
|
|
109
123
|
|
|
110
124
|
--- 按键
|
|
111
|
-
|
|
112
|
-
|
|
125
|
+
---@param name string 按钮 home 按下home键 volumeup 按下音量上键 volumedown 按下音量下键 brightnessup 调高屏幕亮度 brightnessdown 调低屏幕亮度
|
|
126
|
+
---@return boolean 按下按钮是否成功
|
|
127
|
+
---@example action.pressButton("home")
|
|
113
128
|
function _Action.pressButton(name) return true end
|
|
114
129
|
|
|
115
130
|
--- 发送键盘组合键(标准 USB HID usage)
|
|
116
|
-
|
|
117
|
-
|
|
131
|
+
---@param keys (string|integer)[] 要发送的按键数组
|
|
132
|
+
---@return boolean 发送是否成功
|
|
133
|
+
---@example action.sendKey({"COMMAND", "c"})
|
|
134
|
+
---@example action.sendKey({0xe3, 0x06})
|
|
135
|
+
---@example action.sendKey({HidKey.COMMAND, "v"})
|
|
118
136
|
function _Action.sendKey(keys) return true end
|
|
119
137
|
|
|
120
138
|
---@class W3CActionsJson
|
|
121
139
|
---@field actions table<string, any>[] W3C action 序列
|
|
122
140
|
|
|
123
141
|
--- 执行 W3C Actions JSON
|
|
124
|
-
|
|
125
|
-
|
|
142
|
+
---@param json W3CActionsJson W3C Actions 请求体,例如 { actions: [...] }
|
|
143
|
+
---@return boolean 执行是否成功
|
|
144
|
+
---@example action.w3cActions({ actions = { { type = "pointer", id = "finger1" } } })
|
|
126
145
|
function _Action.w3cActions(json) return true end
|
|
127
146
|
|
|
128
147
|
---@class TapPoint
|
|
@@ -133,8 +152,9 @@ function _Action.w3cActions(json) return true end
|
|
|
133
152
|
local _ActionBuilder = {}
|
|
134
153
|
|
|
135
154
|
--- 添加手指
|
|
136
|
-
|
|
137
|
-
|
|
155
|
+
---@param id integer 指针编号
|
|
156
|
+
---@return Pointer 返回指针对象
|
|
157
|
+
---@example builder:addPointer(id)
|
|
138
158
|
function _ActionBuilder:addPointer(id)
|
|
139
159
|
---@type Pointer
|
|
140
160
|
local ret
|
|
@@ -142,10 +162,11 @@ function _ActionBuilder:addPointer(id)
|
|
|
142
162
|
end
|
|
143
163
|
|
|
144
164
|
--- 单指点击
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
165
|
+
---@param x integer
|
|
166
|
+
---@param y integer
|
|
167
|
+
---@param duration integer|nil 按下持续时间,默认20ms
|
|
168
|
+
---@return ActionBuilder self
|
|
169
|
+
---@example builder:singleTap(x, y, duration)
|
|
149
170
|
function _ActionBuilder:singleTap(x, y, duration)
|
|
150
171
|
---@type ActionBuilder
|
|
151
172
|
local ret
|
|
@@ -153,9 +174,10 @@ function _ActionBuilder:singleTap(x, y, duration)
|
|
|
153
174
|
end
|
|
154
175
|
|
|
155
176
|
--- 多指同时点击
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
177
|
+
---@param points TapPoint[] 坐标数组
|
|
178
|
+
---@param duration integer|nil 按下持续时间,默认20ms
|
|
179
|
+
---@return ActionBuilder self
|
|
180
|
+
---@example builder:multiTap(points, duration)
|
|
159
181
|
function _ActionBuilder:multiTap(points, duration)
|
|
160
182
|
---@type ActionBuilder
|
|
161
183
|
local ret
|
|
@@ -163,17 +185,19 @@ function _ActionBuilder:multiTap(points, duration)
|
|
|
163
185
|
end
|
|
164
186
|
|
|
165
187
|
--- 执行动作
|
|
166
|
-
|
|
188
|
+
---@return boolean 成功与否
|
|
189
|
+
---@example builder:execute()
|
|
167
190
|
function _ActionBuilder:execute() return true end
|
|
168
191
|
|
|
169
192
|
---@class Pointer
|
|
170
193
|
local _Pointer = {}
|
|
171
194
|
|
|
172
195
|
--- 移动到
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
196
|
+
---@param x integer
|
|
197
|
+
---@param y integer
|
|
198
|
+
---@param duration integer|nil 持续时间
|
|
199
|
+
---@return Pointer self
|
|
200
|
+
---@example pointer:moveTo(x, y, duration)
|
|
177
201
|
function _Pointer:moveTo(x, y, duration)
|
|
178
202
|
---@type Pointer
|
|
179
203
|
local ret
|
|
@@ -181,7 +205,8 @@ function _Pointer:moveTo(x, y, duration)
|
|
|
181
205
|
end
|
|
182
206
|
|
|
183
207
|
--- 按下
|
|
184
|
-
|
|
208
|
+
---@return Pointer self
|
|
209
|
+
---@example pointer:down()
|
|
185
210
|
function _Pointer:down()
|
|
186
211
|
---@type Pointer
|
|
187
212
|
local ret
|
|
@@ -189,7 +214,8 @@ function _Pointer:down()
|
|
|
189
214
|
end
|
|
190
215
|
|
|
191
216
|
--- 抬起
|
|
192
|
-
|
|
217
|
+
---@return Pointer self
|
|
218
|
+
---@example pointer:up()
|
|
193
219
|
function _Pointer:up()
|
|
194
220
|
---@type Pointer
|
|
195
221
|
local ret
|
|
@@ -197,8 +223,9 @@ function _Pointer:up()
|
|
|
197
223
|
end
|
|
198
224
|
|
|
199
225
|
--- 停留
|
|
200
|
-
|
|
201
|
-
|
|
226
|
+
---@param duration integer 停留时间,默认20ms
|
|
227
|
+
---@return Pointer self
|
|
228
|
+
---@example pointer:stay(duration)
|
|
202
229
|
function _Pointer:stay(duration)
|
|
203
230
|
---@type Pointer
|
|
204
231
|
local ret
|
|
@@ -206,10 +233,11 @@ function _Pointer:stay(duration)
|
|
|
206
233
|
end
|
|
207
234
|
|
|
208
235
|
--- 点击
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
236
|
+
---@param x integer
|
|
237
|
+
---@param y integer
|
|
238
|
+
---@param duration integer|nil 按下持续时间,默认20ms
|
|
239
|
+
---@return Pointer self
|
|
240
|
+
---@example pointer:tap(x, y, duration)
|
|
213
241
|
function _Pointer:tap(x, y, duration)
|
|
214
242
|
---@type Pointer
|
|
215
243
|
local ret
|
|
@@ -217,7 +245,8 @@ function _Pointer:tap(x, y, duration)
|
|
|
217
245
|
end
|
|
218
246
|
|
|
219
247
|
--- 完成,返回构建器
|
|
220
|
-
|
|
248
|
+
---@return ActionBuilder builder
|
|
249
|
+
---@example pointer:done()
|
|
221
250
|
function _Pointer:done()
|
|
222
251
|
---@type ActionBuilder
|
|
223
252
|
local ret
|
|
@@ -225,7 +254,8 @@ function _Pointer:done()
|
|
|
225
254
|
end
|
|
226
255
|
|
|
227
256
|
--- 创建构建器
|
|
228
|
-
|
|
257
|
+
---@return ActionBuilder ActionBuilder 实例
|
|
258
|
+
---@example local builder = action.createBuilder()
|
|
229
259
|
function _Action.createBuilder()
|
|
230
260
|
---@type ActionBuilder
|
|
231
261
|
local ret
|