@aspiresys/visor 1.3.4 → 1.4.0
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/app.js +2 -2
- package/dist/config.js +2 -2
- package/dist/dialog.js +4 -4
- package/dist/display.js +21 -7
- package/dist/index.d.ts +156 -139
- package/dist/index.js +197 -163
- package/dist/inspector/index.js +10 -8
- package/dist/matcher.d.ts +2 -2
- package/dist/matcher.js +50 -25
- package/dist/mouse.d.ts +1 -1
- package/dist/mouse.js +4 -4
- package/dist/ocr.d.ts +2 -1
- package/dist/ocr.js +15 -15
- package/dist/path.js +1 -1
- package/dist/region.js +3 -4
- package/dist/screen.js +5 -5
- package/dist/src/index.js +15 -16
- package/dist/src/matcher.d.ts +1 -1
- package/dist/src/matcher.js +13 -12
- package/dist/src/mouse.d.ts +1 -1
- package/dist/src/mouse.js +9 -11
- package/dist/src/screen.js +12 -10
- package/dist/src/types.js +2 -2
- package/dist/templateMetadata.d.ts +1 -0
- package/dist/templateMetadata.js +20 -0
- package/dist/text.d.ts +1 -1
- package/dist/text.js +8 -8
- package/dist/types.d.ts +249 -159
- package/dist/types.js +330 -170
- package/dist/version.d.ts +1 -0
- package/dist/version.js +18 -0
- package/inspector/index.html +82 -55
- package/inspector/main.js +135 -189
- package/inspector/src/preload.js +10 -15
- package/inspector/src/renderer.js +177 -235
- package/inspector/start.js +8 -16
- package/inspector/styles.css +456 -458
- package/package.json +57 -51
- package/readme.md +790 -799
package/dist/types.d.ts
CHANGED
|
@@ -31,63 +31,79 @@ export declare class Region {
|
|
|
31
31
|
constructor(x: number, y: number, width: number, height: number, confidence?: number);
|
|
32
32
|
private checkConfig;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
* Captures a screenshot of the
|
|
35
|
+
* region and saves it
|
|
36
|
+
* to the specified path.
|
|
37
|
+
*
|
|
38
|
+
* Supported formats depend on
|
|
39
|
+
* the output file extension.
|
|
40
|
+
*
|
|
41
|
+
* @param path Output image path.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* await region.capture(
|
|
45
|
+
* "./screenshots/output.png"
|
|
46
|
+
* );
|
|
47
|
+
*/
|
|
48
|
+
capture(path: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the center point of the region.
|
|
51
|
+
*
|
|
52
|
+
* Useful for:
|
|
53
|
+
* - mouse movement
|
|
54
|
+
* - coordinate calculations
|
|
55
|
+
* - custom interactions
|
|
56
|
+
*/
|
|
41
57
|
center(): {
|
|
42
58
|
x: number;
|
|
43
59
|
y: number;
|
|
44
60
|
};
|
|
45
61
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
* Moves the mouse to the center of the region.
|
|
63
|
+
*
|
|
64
|
+
* Mouse coordinates are automatically
|
|
65
|
+
* adjusted for display scaling.
|
|
66
|
+
*/
|
|
51
67
|
move(): Promise<void>;
|
|
52
68
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
* Performs a left click on the region.
|
|
70
|
+
*
|
|
71
|
+
* Clicks the center of the region by default.
|
|
72
|
+
*
|
|
73
|
+
* Optional offset can be supplied to click
|
|
74
|
+
* a specific position relative to the center.
|
|
75
|
+
*/
|
|
60
76
|
click(offset?: Offset): Promise<void>;
|
|
61
77
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
78
|
+
* Finds an image in the Region using OpenCV
|
|
79
|
+
* and performs a left mouse click
|
|
80
|
+
* on the matched region.
|
|
81
|
+
*
|
|
82
|
+
* @param image Optional image filename or path.
|
|
83
|
+
*
|
|
84
|
+
* @param confidence Match confidence threshold.
|
|
85
|
+
*
|
|
86
|
+
* Accepted range:
|
|
87
|
+
* 0.0 to 1.0
|
|
88
|
+
*
|
|
89
|
+
* Default:
|
|
90
|
+
* 0.8
|
|
91
|
+
*
|
|
92
|
+
* Recommended values:
|
|
93
|
+
* - 0.7 for dynamic UI
|
|
94
|
+
* - 0.8 for standard usage
|
|
95
|
+
* - 0.9+ for strict matching
|
|
96
|
+
*
|
|
97
|
+
* Lower confidence increases
|
|
98
|
+
* flexibility but may increase
|
|
99
|
+
* false positives.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* await region.clickImg("save.png");
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* await region.clickImg("./images/save.png", 0.9);
|
|
106
|
+
*/
|
|
91
107
|
clickImg(image?: string, confidence?: number, offset?: Offset): Promise<void>;
|
|
92
108
|
/**
|
|
93
109
|
* Finds the image in the Region and
|
|
@@ -144,144 +160,218 @@ export declare class Region {
|
|
|
144
160
|
*/
|
|
145
161
|
doubleClickImg(image?: string, confidence?: number, offset?: Offset): Promise<void>;
|
|
146
162
|
/**
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
163
|
+
* Waits until an image appears
|
|
164
|
+
* in the Region.
|
|
165
|
+
*
|
|
166
|
+
* @param image Image filename or path.
|
|
167
|
+
*
|
|
168
|
+
* @param confidence Match confidence threshold.
|
|
169
|
+
*
|
|
170
|
+
* Accepted range:
|
|
171
|
+
* 0.0 to 1.0
|
|
172
|
+
*
|
|
173
|
+
* Default:
|
|
174
|
+
* 0.8
|
|
175
|
+
*
|
|
176
|
+
* Recommended values:
|
|
177
|
+
* - 0.7 for dynamic UI
|
|
178
|
+
* - 0.8 for standard usage
|
|
179
|
+
* - 0.9+ for strict matching
|
|
180
|
+
*
|
|
181
|
+
* @param timeout Timeout duration
|
|
182
|
+
* in milliseconds.
|
|
183
|
+
*
|
|
184
|
+
* Default:
|
|
185
|
+
* 5000ms
|
|
186
|
+
*
|
|
187
|
+
* Recommended range:
|
|
188
|
+
* 1000ms to 30000ms
|
|
189
|
+
*
|
|
190
|
+
* @throws Error if timeout occurs.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* await region.waitImg("loading-done.png");
|
|
194
|
+
*/
|
|
179
195
|
waitImg(image: string, { confidence, timeout }?: {
|
|
180
196
|
confidence?: number;
|
|
181
197
|
timeout?: number;
|
|
182
198
|
}): Promise<boolean>;
|
|
183
199
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
200
|
+
* Waits until any image from
|
|
201
|
+
* a list appears in the Region.
|
|
202
|
+
*
|
|
203
|
+
* Useful for handling:
|
|
204
|
+
* - multiple themes
|
|
205
|
+
* - alternate UI layouts
|
|
206
|
+
* - dynamic application states
|
|
207
|
+
*
|
|
208
|
+
* @param images Array of image
|
|
209
|
+
* filenames or paths.
|
|
210
|
+
*
|
|
211
|
+
* @param confidence Match confidence threshold.
|
|
212
|
+
*
|
|
213
|
+
* Accepted range:
|
|
214
|
+
* 0.0 to 1.0
|
|
215
|
+
*
|
|
216
|
+
* Default:
|
|
217
|
+
* 0.8
|
|
218
|
+
*
|
|
219
|
+
* Recommended values:
|
|
220
|
+
* - 0.7 for dynamic UI
|
|
221
|
+
* - 0.8 for standard usage
|
|
222
|
+
* - 0.9+ for strict matching
|
|
223
|
+
*
|
|
224
|
+
* Lower confidence increases
|
|
225
|
+
* flexibility but may increase
|
|
226
|
+
* false positives.
|
|
227
|
+
*
|
|
228
|
+
* @param timeout Timeout duration
|
|
229
|
+
* in milliseconds.
|
|
230
|
+
*
|
|
231
|
+
* Default:
|
|
232
|
+
* 5000ms
|
|
233
|
+
*
|
|
234
|
+
* Recommended range:
|
|
235
|
+
* 1000ms to 30000ms
|
|
236
|
+
*
|
|
237
|
+
* @throws Error if timeout occurs.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* await visor.waitAnyImg([
|
|
241
|
+
* "home-light.png",
|
|
242
|
+
* "home-dark.png"
|
|
243
|
+
* ]);
|
|
244
|
+
*/
|
|
245
|
+
waitAnyImg(images: string[], { confidence, timeout }?: {
|
|
246
|
+
confidence?: number;
|
|
247
|
+
timeout?: number;
|
|
248
|
+
}): Promise<Region>;
|
|
249
|
+
/**
|
|
250
|
+
* Finds the first matching image
|
|
251
|
+
* within the current Region and
|
|
252
|
+
* performs a click.
|
|
253
|
+
*
|
|
254
|
+
* Useful for:
|
|
255
|
+
* - theme variations
|
|
256
|
+
* - alternate UI states
|
|
257
|
+
* - dynamic controls
|
|
258
|
+
*
|
|
259
|
+
* @param images Array of image paths.
|
|
260
|
+
* @param confidence Match confidence.
|
|
261
|
+
* @param offset Optional click offset.
|
|
262
|
+
*
|
|
263
|
+
* @returns Matched Region.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* await region.clickAny([
|
|
267
|
+
* "save-light.png",
|
|
268
|
+
* "save-dark.png"
|
|
269
|
+
* ]);
|
|
270
|
+
*/
|
|
271
|
+
clickAny(images: string[], confidence?: number, offset?: Offset): Promise<Region>;
|
|
272
|
+
/**
|
|
273
|
+
* Performs a double left click on the region.
|
|
274
|
+
*
|
|
275
|
+
* Optional offset can be supplied to click
|
|
276
|
+
* a specific position relative to the center.
|
|
277
|
+
*/
|
|
189
278
|
doubleClick(offset?: Offset): Promise<void>;
|
|
190
279
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
280
|
+
* Performs a right click on the region.
|
|
281
|
+
*
|
|
282
|
+
* Optional offset can be supplied to click
|
|
283
|
+
* a specific position relative to the center.
|
|
284
|
+
*/
|
|
196
285
|
rightClick(offset?: Offset): Promise<void>;
|
|
197
286
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
287
|
+
* Checks whether the supplied coordinates
|
|
288
|
+
* are located inside this region.
|
|
289
|
+
*
|
|
290
|
+
* Returns:
|
|
291
|
+
* - true if inside
|
|
292
|
+
* - false otherwise
|
|
293
|
+
*/
|
|
205
294
|
contains(x: number, y: number): boolean;
|
|
206
295
|
/**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
296
|
+
* Creates a new Region shifted by the
|
|
297
|
+
* supplied x and y offsets.
|
|
298
|
+
*
|
|
299
|
+
* Original region remains unchanged.
|
|
300
|
+
*/
|
|
212
301
|
offset(x: number, y: number): Region;
|
|
213
302
|
/**
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
303
|
+
* Checks whether this region overlaps
|
|
304
|
+
* with another region.
|
|
305
|
+
*
|
|
306
|
+
* Returns:
|
|
307
|
+
* - true if regions intersect
|
|
308
|
+
* - false otherwise
|
|
309
|
+
*/
|
|
221
310
|
intersects(region: Region): boolean;
|
|
222
311
|
/**
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
312
|
+
* Returns the total area of the region
|
|
313
|
+
* in pixels.
|
|
314
|
+
*/
|
|
226
315
|
area(): number;
|
|
227
316
|
/**
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
317
|
+
* Extracts OCR text from this region.
|
|
318
|
+
*
|
|
319
|
+
* Returns full OCR output including:
|
|
320
|
+
* - text
|
|
321
|
+
* - TSV data
|
|
322
|
+
* - HOCR data
|
|
323
|
+
* - block information
|
|
324
|
+
*/
|
|
236
325
|
readText(): Promise<any>;
|
|
237
326
|
/**
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
327
|
+
* Searches for text within this region.
|
|
328
|
+
*
|
|
329
|
+
* Returns the matching text region
|
|
330
|
+
* if found, otherwise null.
|
|
331
|
+
*
|
|
332
|
+
* Supports selecting a specific match
|
|
333
|
+
* using the index parameter.
|
|
334
|
+
*/
|
|
246
335
|
findText(text: string, index?: number): Promise<Region>;
|
|
247
336
|
/**
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
337
|
+
* Checks whether the supplied text
|
|
338
|
+
* exists within this region.
|
|
339
|
+
*
|
|
340
|
+
* Returns:
|
|
341
|
+
* - true if found
|
|
342
|
+
* - false otherwise
|
|
343
|
+
*/
|
|
255
344
|
existsText(text: string): Promise<boolean>;
|
|
256
345
|
/**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
346
|
+
* Searches for an image within this region.
|
|
347
|
+
*
|
|
348
|
+
* Matching is performed only inside
|
|
349
|
+
* the current region, improving speed
|
|
350
|
+
* and reducing false positives.
|
|
351
|
+
*
|
|
352
|
+
* Returns:
|
|
353
|
+
* - matching Region if found
|
|
354
|
+
* - null otherwise
|
|
355
|
+
*/
|
|
267
356
|
find(image: string, confidence?: number): Promise<Region>;
|
|
357
|
+
expand(pixels: number): Region;
|
|
268
358
|
/**
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
359
|
+
* Finds all image matches within this region.
|
|
360
|
+
*
|
|
361
|
+
* Matching is performed only inside
|
|
362
|
+
* the current region.
|
|
363
|
+
*
|
|
364
|
+
* Returns an array of matching regions.
|
|
365
|
+
*/
|
|
276
366
|
findAll(image: string, confidence?: number): Promise<Region[]>;
|
|
277
367
|
/**
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
368
|
+
* Checks whether an image exists
|
|
369
|
+
* within this region.
|
|
370
|
+
*
|
|
371
|
+
* Returns:
|
|
372
|
+
* - true if found
|
|
373
|
+
* - false otherwise
|
|
374
|
+
*/
|
|
285
375
|
exists(image: string, confidence?: number): Promise<boolean>;
|
|
286
376
|
}
|
|
287
377
|
/**
|