@maaxyz/maa-node 4.5.2 → 4.5.4
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/dist/controller.d.ts +61 -2
- package/package.json +7 -7
- package/src/controller.ts +75 -15
package/dist/controller.d.ts
CHANGED
|
@@ -15,12 +15,71 @@ declare class ImageJob extends Job<maa.CtrlId, JobSource<maa.CtrlId>> {
|
|
|
15
15
|
get: () => Promise<ArrayBuffer | null>;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
type Point = [x: number, y: number];
|
|
19
|
+
export type SwipeParam = {
|
|
20
|
+
begin: Point;
|
|
21
|
+
end: Point[];
|
|
22
|
+
end_hold: number[];
|
|
23
|
+
duration: number[];
|
|
24
|
+
only_hover: boolean;
|
|
25
|
+
starting: number;
|
|
26
|
+
};
|
|
18
27
|
export type ControllerNotify = {
|
|
19
28
|
msg: 'Action.Starting' | 'Action.Succeeded' | 'Action.Failed';
|
|
20
|
-
action: 'connect' | 'click' | 'swipe' | 'touch_down' | 'touch_move' | 'touch_up' | 'click_key' | 'input_text' | 'screencap' | 'start_app' | 'stop_app' | 'key_down' | 'key_up';
|
|
21
29
|
ctrl_id: maa.CtrlId;
|
|
22
30
|
uuid: string;
|
|
23
|
-
}
|
|
31
|
+
} & ({
|
|
32
|
+
action: 'connect';
|
|
33
|
+
param?: never;
|
|
34
|
+
} | {
|
|
35
|
+
action: 'click';
|
|
36
|
+
param: {
|
|
37
|
+
point: Point;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
action: 'long_press';
|
|
41
|
+
param: {
|
|
42
|
+
point: Point;
|
|
43
|
+
duration: number;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
action: 'swipe';
|
|
47
|
+
param: SwipeParam;
|
|
48
|
+
} | {
|
|
49
|
+
action: 'multi_swipe';
|
|
50
|
+
param: SwipeParam[];
|
|
51
|
+
} | {
|
|
52
|
+
action: 'touch_down' | 'touch_move' | 'touch_up';
|
|
53
|
+
param: {
|
|
54
|
+
contact: number;
|
|
55
|
+
point: Point;
|
|
56
|
+
pressure: number;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
action: 'click_key' | 'key_down' | 'key_up';
|
|
60
|
+
param: {
|
|
61
|
+
keycode: number[];
|
|
62
|
+
};
|
|
63
|
+
} | {
|
|
64
|
+
action: 'long_press_key';
|
|
65
|
+
param: {
|
|
66
|
+
keycode: number[];
|
|
67
|
+
duration: number;
|
|
68
|
+
};
|
|
69
|
+
} | {
|
|
70
|
+
action: 'input_text';
|
|
71
|
+
param: {
|
|
72
|
+
text: string;
|
|
73
|
+
};
|
|
74
|
+
} | {
|
|
75
|
+
action: 'screencap';
|
|
76
|
+
param?: never;
|
|
77
|
+
} | {
|
|
78
|
+
action: 'start_app' | 'stop_app';
|
|
79
|
+
param: {
|
|
80
|
+
package: string;
|
|
81
|
+
};
|
|
82
|
+
});
|
|
24
83
|
export declare class ControllerBase {
|
|
25
84
|
#private;
|
|
26
85
|
handle: maa.ControllerHandle;
|
package/package.json
CHANGED
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"prettier": "^3.5.2",
|
|
26
26
|
"typescript": "^5.8.2"
|
|
27
27
|
},
|
|
28
|
-
"version": "4.5.
|
|
28
|
+
"version": "4.5.4",
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@maaxyz/maa-node-darwin-arm64": "4.5.
|
|
31
|
-
"@maaxyz/maa-node-darwin-x64": "4.5.
|
|
32
|
-
"@maaxyz/maa-node-linux-arm64": "4.5.
|
|
33
|
-
"@maaxyz/maa-node-linux-x64": "4.5.
|
|
34
|
-
"@maaxyz/maa-node-win32-arm64": "4.5.
|
|
35
|
-
"@maaxyz/maa-node-win32-x64": "4.5.
|
|
30
|
+
"@maaxyz/maa-node-darwin-arm64": "4.5.4",
|
|
31
|
+
"@maaxyz/maa-node-darwin-x64": "4.5.4",
|
|
32
|
+
"@maaxyz/maa-node-linux-arm64": "4.5.4",
|
|
33
|
+
"@maaxyz/maa-node-linux-x64": "4.5.4",
|
|
34
|
+
"@maaxyz/maa-node-win32-arm64": "4.5.4",
|
|
35
|
+
"@maaxyz/maa-node-win32-x64": "4.5.4"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/controller.ts
CHANGED
|
@@ -38,25 +38,85 @@ class ImageJob extends Job<maa.CtrlId, JobSource<maa.CtrlId>> {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
type Point = [x: number, y: number]
|
|
42
|
+
|
|
43
|
+
export type SwipeParam = {
|
|
44
|
+
begin: Point
|
|
45
|
+
end: Point[]
|
|
46
|
+
end_hold: number[]
|
|
47
|
+
duration: number[]
|
|
48
|
+
only_hover: boolean
|
|
49
|
+
starting: number
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
export type ControllerNotify = {
|
|
42
53
|
msg: 'Action.Starting' | 'Action.Succeeded' | 'Action.Failed'
|
|
43
|
-
action:
|
|
44
|
-
| 'connect'
|
|
45
|
-
| 'click'
|
|
46
|
-
| 'swipe'
|
|
47
|
-
| 'touch_down'
|
|
48
|
-
| 'touch_move'
|
|
49
|
-
| 'touch_up'
|
|
50
|
-
| 'click_key'
|
|
51
|
-
| 'input_text'
|
|
52
|
-
| 'screencap'
|
|
53
|
-
| 'start_app'
|
|
54
|
-
| 'stop_app'
|
|
55
|
-
| 'key_down'
|
|
56
|
-
| 'key_up'
|
|
57
54
|
ctrl_id: maa.CtrlId
|
|
58
55
|
uuid: string
|
|
59
|
-
}
|
|
56
|
+
} & (
|
|
57
|
+
| {
|
|
58
|
+
action: 'connect'
|
|
59
|
+
param?: never
|
|
60
|
+
}
|
|
61
|
+
| {
|
|
62
|
+
action: 'click'
|
|
63
|
+
param: {
|
|
64
|
+
point: Point
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
| {
|
|
68
|
+
action: 'long_press'
|
|
69
|
+
param: {
|
|
70
|
+
point: Point
|
|
71
|
+
duration: number
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
action: 'swipe'
|
|
76
|
+
param: SwipeParam
|
|
77
|
+
}
|
|
78
|
+
| {
|
|
79
|
+
action: 'multi_swipe'
|
|
80
|
+
param: SwipeParam[]
|
|
81
|
+
}
|
|
82
|
+
| {
|
|
83
|
+
action: 'touch_down' | 'touch_move' | 'touch_up'
|
|
84
|
+
param: {
|
|
85
|
+
contact: number
|
|
86
|
+
point: Point
|
|
87
|
+
pressure: number
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
| {
|
|
91
|
+
action: 'click_key' | 'key_down' | 'key_up'
|
|
92
|
+
param: {
|
|
93
|
+
keycode: number[]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
| {
|
|
97
|
+
action: 'long_press_key'
|
|
98
|
+
param: {
|
|
99
|
+
keycode: number[]
|
|
100
|
+
duration: number
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
| {
|
|
104
|
+
action: 'input_text'
|
|
105
|
+
param: {
|
|
106
|
+
text: string
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
action: 'screencap'
|
|
111
|
+
param?: never
|
|
112
|
+
}
|
|
113
|
+
| {
|
|
114
|
+
action: 'start_app' | 'stop_app'
|
|
115
|
+
param: {
|
|
116
|
+
package: string
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
)
|
|
60
120
|
|
|
61
121
|
export class ControllerBase {
|
|
62
122
|
handle: maa.ControllerHandle
|