askui 0.3.2 → 0.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.
Files changed (52) hide show
  1. package/README.md +6 -12
  2. package/dist/cjs/core/annotation/annotation-writer.js +2 -4
  3. package/dist/cjs/core/annotation/annotation.d.ts +3 -4
  4. package/dist/cjs/core/annotation/annotation.js +5 -4
  5. package/dist/cjs/core/inference-response/inference-response.d.ts +15 -0
  6. package/dist/cjs/core/inference-response/inference-response.js +25 -0
  7. package/dist/cjs/core/model/annotation-result/boundary-box.d.ts +23 -0
  8. package/dist/cjs/core/model/annotation-result/boundary-box.js +27 -0
  9. package/dist/cjs/core/model/annotation-result/detected-element.d.ts +9 -3
  10. package/dist/cjs/core/model/annotation-result/detected-element.js +10 -4
  11. package/dist/cjs/core/ui-control-commands/control-command.d.ts +1 -1
  12. package/dist/cjs/core/ui-control-commands/control-command.js +2 -1
  13. package/dist/cjs/core/ui-control-commands/index.d.ts +1 -0
  14. package/dist/cjs/core/ui-control-commands/index.js +3 -1
  15. package/dist/cjs/execution/dsl.d.ts +691 -2
  16. package/dist/cjs/execution/dsl.js +968 -7
  17. package/dist/cjs/execution/dsl.spec.js +4 -4
  18. package/dist/cjs/execution/execution-runtime.d.ts +2 -0
  19. package/dist/cjs/execution/execution-runtime.js +11 -1
  20. package/dist/cjs/execution/inference-client.d.ts +3 -0
  21. package/dist/cjs/execution/inference-client.js +28 -12
  22. package/dist/cjs/execution/inference-response-error.d.ts +2 -0
  23. package/dist/cjs/execution/inference-response-error.js +6 -0
  24. package/dist/cjs/execution/ui-control-client.d.ts +5 -3
  25. package/dist/cjs/execution/ui-control-client.js +10 -2
  26. package/dist/cjs/utils/http/http-client-got.js +5 -1
  27. package/dist/esm/core/annotation/annotation-writer.js +2 -4
  28. package/dist/esm/core/annotation/annotation.d.ts +3 -4
  29. package/dist/esm/core/annotation/annotation.js +5 -4
  30. package/dist/esm/core/inference-response/inference-response.d.ts +15 -0
  31. package/dist/esm/core/inference-response/inference-response.js +21 -0
  32. package/dist/esm/core/model/annotation-result/boundary-box.d.ts +23 -0
  33. package/dist/esm/core/model/annotation-result/boundary-box.js +27 -0
  34. package/dist/esm/core/model/annotation-result/detected-element.d.ts +9 -3
  35. package/dist/esm/core/model/annotation-result/detected-element.js +10 -4
  36. package/dist/esm/core/ui-control-commands/control-command.d.ts +1 -1
  37. package/dist/esm/core/ui-control-commands/control-command.js +2 -1
  38. package/dist/esm/core/ui-control-commands/index.d.ts +1 -0
  39. package/dist/esm/core/ui-control-commands/index.js +1 -0
  40. package/dist/esm/execution/dsl.d.ts +691 -2
  41. package/dist/esm/execution/dsl.js +962 -6
  42. package/dist/esm/execution/dsl.spec.js +4 -4
  43. package/dist/esm/execution/execution-runtime.d.ts +2 -0
  44. package/dist/esm/execution/execution-runtime.js +11 -1
  45. package/dist/esm/execution/inference-client.d.ts +3 -0
  46. package/dist/esm/execution/inference-client.js +29 -13
  47. package/dist/esm/execution/inference-response-error.d.ts +2 -0
  48. package/dist/esm/execution/inference-response-error.js +2 -0
  49. package/dist/esm/execution/ui-control-client.d.ts +5 -3
  50. package/dist/esm/execution/ui-control-client.js +11 -3
  51. package/dist/esm/utils/http/http-client-got.js +5 -1
  52. package/package.json +1 -1
@@ -5,7 +5,7 @@
5
5
  /* eslint-disable max-len */
6
6
  // Autogenerated from typescript.template file
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.FluentCommand = exports.FluentFiltersOrRelationsCondition = exports.FluentFiltersCondition = exports.FluentFiltersOrRelations = exports.FluentFilters = exports.Exec = exports.Separators = void 0;
8
+ exports.ApiCommands = exports.Getter = exports.FluentFiltersOrRelationsGetter = exports.FluentFiltersGetter = exports.ExecGetter = exports.FluentCommand = exports.FluentFiltersOrRelationsCondition = exports.FluentFiltersCondition = exports.FluentFiltersOrRelations = exports.FluentFilters = exports.Exec = exports.Separators = void 0;
9
9
  var Separators;
10
10
  (function (Separators) {
11
11
  Separators["STRING"] = "<|string|>";
@@ -25,25 +25,38 @@ class FluentBase {
25
25
  });
26
26
  return paramsList;
27
27
  }
28
- commandStringBuilder(currentInstruction = '', paramsList = new Map()) {
28
+ fluentCommandStringBuilder(currentInstruction = '', paramsList = new Map()) {
29
29
  const newCurrentInstruction = `${this.textStr} ${currentInstruction}`;
30
30
  const newParamsList = FluentBase.addParams(paramsList, this._params);
31
31
  if (this instanceof FluentCommand) {
32
32
  const fluentCommand = this;
33
33
  const customElements = newParamsList.has('customElement') ? newParamsList.get('customElement') : [];
34
- return fluentCommand.exec(newCurrentInstruction.trim(), customElements);
34
+ return fluentCommand.fluentCommandExecutor(newCurrentInstruction.trim(), customElements);
35
35
  }
36
36
  if (!this.prev) {
37
37
  throw new Error('Prev element not defined');
38
38
  }
39
- return this.prev.commandStringBuilder(newCurrentInstruction, newParamsList);
39
+ return this.prev.fluentCommandStringBuilder(newCurrentInstruction, newParamsList);
40
+ }
41
+ getterStringBuilder(currentInstruction = '', paramsList = new Map()) {
42
+ const newCurrentInstruction = `${this.textStr} ${currentInstruction}`;
43
+ const newParamsList = FluentBase.addParams(paramsList, this._params);
44
+ if (this instanceof Getter) {
45
+ const getter = this;
46
+ const customElements = newParamsList.has('customElement') ? newParamsList.get('customElement') : [];
47
+ return getter.getterExecutor(newCurrentInstruction.trim(), customElements);
48
+ }
49
+ if (!this.prev) {
50
+ throw new Error('Prev element not defined');
51
+ }
52
+ return this.prev.getterStringBuilder(newCurrentInstruction, newParamsList);
40
53
  }
41
54
  get textStr() { return this._textStr; }
42
55
  get params() { return this._params; }
43
56
  }
44
57
  class Exec extends FluentBase {
45
58
  exec() {
46
- return this.commandStringBuilder();
59
+ return this.fluentCommandStringBuilder();
47
60
  }
48
61
  }
49
62
  exports.Exec = Exec;
@@ -955,7 +968,7 @@ class FluentFiltersOrRelations extends FluentFilters {
955
968
  return new FluentFilters(this);
956
969
  }
957
970
  exec() {
958
- return this.commandStringBuilder();
971
+ return this.fluentCommandStringBuilder();
959
972
  }
960
973
  }
961
974
  exports.FluentFiltersOrRelations = FluentFiltersOrRelations;
@@ -2001,7 +2014,7 @@ class FluentCommand extends FluentBase {
2001
2014
  * @return {Exec}
2002
2015
  */
2003
2016
  moveMouse(x_coordinate, y_coordinate) {
2004
- this._textStr = `Move mouse to x ${x_coordinate} y ${y_coordinate}`;
2017
+ this._textStr = `Move mouse to x ${x_coordinate} y ${y_coordinate}`;
2005
2018
  return new Exec(this);
2006
2019
  }
2007
2020
  /**
@@ -2175,3 +2188,951 @@ class FluentCommand extends FluentBase {
2175
2188
  }
2176
2189
  }
2177
2190
  exports.FluentCommand = FluentCommand;
2191
+ class ExecGetter extends FluentBase {
2192
+ exec() {
2193
+ return this.getterStringBuilder();
2194
+ }
2195
+ }
2196
+ exports.ExecGetter = ExecGetter;
2197
+ // Filters
2198
+ class FluentFiltersGetter extends FluentBase {
2199
+ /**
2200
+ * Filters for a UI element 'wizard item active'.
2201
+ *
2202
+ * @return {FluentFiltersOrRelationsGetter}
2203
+ */
2204
+ wizardItemActive() {
2205
+ this._textStr = 'wizard item active';
2206
+ return new FluentFiltersOrRelationsGetter(this);
2207
+ }
2208
+ /**
2209
+ * Filters for a UI element 'wizard item'.
2210
+ *
2211
+ * @return {FluentFiltersOrRelationsGetter}
2212
+ */
2213
+ wizardItem() {
2214
+ this._textStr = 'wizard item';
2215
+ return new FluentFiltersOrRelationsGetter(this);
2216
+ }
2217
+ /**
2218
+ * Filters for a UI element 'wizard'.
2219
+ *
2220
+ * @return {FluentFiltersOrRelationsGetter}
2221
+ */
2222
+ wizard() {
2223
+ this._textStr = 'wizard';
2224
+ return new FluentFiltersOrRelationsGetter(this);
2225
+ }
2226
+ /**
2227
+ * Filters for a UI element 'windows bar'.
2228
+ *
2229
+ * @return {FluentFiltersOrRelationsGetter}
2230
+ */
2231
+ windowsBar() {
2232
+ this._textStr = 'windows bar';
2233
+ return new FluentFiltersOrRelationsGetter(this);
2234
+ }
2235
+ /**
2236
+ * Filters for a UI element 'window'.
2237
+ *
2238
+ * @return {FluentFiltersOrRelationsGetter}
2239
+ */
2240
+ window() {
2241
+ this._textStr = 'window';
2242
+ return new FluentFiltersOrRelationsGetter(this);
2243
+ }
2244
+ /**
2245
+ * Filters for a UI element 'video'.
2246
+ *
2247
+ * @return {FluentFiltersOrRelationsGetter}
2248
+ */
2249
+ video() {
2250
+ this._textStr = 'video';
2251
+ return new FluentFiltersOrRelationsGetter(this);
2252
+ }
2253
+ /**
2254
+ * Filters for a UI element 'url'.
2255
+ *
2256
+ * @return {FluentFiltersOrRelationsGetter}
2257
+ */
2258
+ url() {
2259
+ this._textStr = 'url';
2260
+ return new FluentFiltersOrRelationsGetter(this);
2261
+ }
2262
+ /**
2263
+ * Filters for a UI element 'tooltip'.
2264
+ *
2265
+ * @return {FluentFiltersOrRelationsGetter}
2266
+ */
2267
+ tooltip() {
2268
+ this._textStr = 'tooltip';
2269
+ return new FluentFiltersOrRelationsGetter(this);
2270
+ }
2271
+ /**
2272
+ * Filters for a UI element 'textfield'.
2273
+ *
2274
+ * @return {FluentFiltersOrRelationsGetter}
2275
+ */
2276
+ textfield() {
2277
+ this._textStr = 'textfield';
2278
+ return new FluentFiltersOrRelationsGetter(this);
2279
+ }
2280
+ /**
2281
+ * Filters for a UI element 'textarea'.
2282
+ *
2283
+ * @return {FluentFiltersOrRelationsGetter}
2284
+ */
2285
+ textarea() {
2286
+ this._textStr = 'textarea';
2287
+ return new FluentFiltersOrRelationsGetter(this);
2288
+ }
2289
+ /**
2290
+ * Filters for a UI element 'table row'.
2291
+ *
2292
+ * @return {FluentFiltersOrRelationsGetter}
2293
+ */
2294
+ tableRow() {
2295
+ this._textStr = 'table row';
2296
+ return new FluentFiltersOrRelationsGetter(this);
2297
+ }
2298
+ /**
2299
+ * Filters for a UI element 'table header'.
2300
+ *
2301
+ * @return {FluentFiltersOrRelationsGetter}
2302
+ */
2303
+ tableHeader() {
2304
+ this._textStr = 'table header';
2305
+ return new FluentFiltersOrRelationsGetter(this);
2306
+ }
2307
+ /**
2308
+ * Filters for a UI element 'table column'.
2309
+ *
2310
+ * @return {FluentFiltersOrRelationsGetter}
2311
+ */
2312
+ tableColumn() {
2313
+ this._textStr = 'table column';
2314
+ return new FluentFiltersOrRelationsGetter(this);
2315
+ }
2316
+ /**
2317
+ * Filters for a UI element 'table'.
2318
+ *
2319
+ * @return {FluentFiltersOrRelationsGetter}
2320
+ */
2321
+ table() {
2322
+ this._textStr = 'table';
2323
+ return new FluentFiltersOrRelationsGetter(this);
2324
+ }
2325
+ /**
2326
+ * Filters for a UI element 'tab selected'.
2327
+ *
2328
+ * @return {FluentFiltersOrRelationsGetter}
2329
+ */
2330
+ tabSelected() {
2331
+ this._textStr = 'tab selected';
2332
+ return new FluentFiltersOrRelationsGetter(this);
2333
+ }
2334
+ /**
2335
+ * Filters for a UI element 'tab bar'.
2336
+ *
2337
+ * @return {FluentFiltersOrRelationsGetter}
2338
+ */
2339
+ tabBar() {
2340
+ this._textStr = 'tab bar';
2341
+ return new FluentFiltersOrRelationsGetter(this);
2342
+ }
2343
+ /**
2344
+ * Filters for a UI element 'tab active'.
2345
+ *
2346
+ * @return {FluentFiltersOrRelationsGetter}
2347
+ */
2348
+ tabActive() {
2349
+ this._textStr = 'tab active';
2350
+ return new FluentFiltersOrRelationsGetter(this);
2351
+ }
2352
+ /**
2353
+ * Filters for a UI element 'tab'.
2354
+ *
2355
+ * @return {FluentFiltersOrRelationsGetter}
2356
+ */
2357
+ tab() {
2358
+ this._textStr = 'tab';
2359
+ return new FluentFiltersOrRelationsGetter(this);
2360
+ }
2361
+ /**
2362
+ * Filters for a UI element 'switch enabled'.
2363
+ *
2364
+ * @return {FluentFiltersOrRelationsGetter}
2365
+ */
2366
+ switchEnabled() {
2367
+ this._textStr = 'switch enabled';
2368
+ return new FluentFiltersOrRelationsGetter(this);
2369
+ }
2370
+ /**
2371
+ * Filters for a UI element 'switch disabled'.
2372
+ *
2373
+ * @return {FluentFiltersOrRelationsGetter}
2374
+ */
2375
+ switchDisabled() {
2376
+ this._textStr = 'switch disabled';
2377
+ return new FluentFiltersOrRelationsGetter(this);
2378
+ }
2379
+ /**
2380
+ * Filters for a UI element 'status bar'.
2381
+ *
2382
+ * @return {FluentFiltersOrRelationsGetter}
2383
+ */
2384
+ statusBar() {
2385
+ this._textStr = 'status bar';
2386
+ return new FluentFiltersOrRelationsGetter(this);
2387
+ }
2388
+ /**
2389
+ * Filters for a UI element 'slider indicator'.
2390
+ *
2391
+ * @return {FluentFiltersOrRelationsGetter}
2392
+ */
2393
+ sliderIndicator() {
2394
+ this._textStr = 'slider indicator';
2395
+ return new FluentFiltersOrRelationsGetter(this);
2396
+ }
2397
+ /**
2398
+ * Filters for a UI element 'slider'.
2399
+ *
2400
+ * @return {FluentFiltersOrRelationsGetter}
2401
+ */
2402
+ slider() {
2403
+ this._textStr = 'slider';
2404
+ return new FluentFiltersOrRelationsGetter(this);
2405
+ }
2406
+ /**
2407
+ * Filters for a UI element 'sidebar'.
2408
+ *
2409
+ * @return {FluentFiltersOrRelationsGetter}
2410
+ */
2411
+ sidebar() {
2412
+ this._textStr = 'sidebar';
2413
+ return new FluentFiltersOrRelationsGetter(this);
2414
+ }
2415
+ /**
2416
+ * Filters for a UI element 'scroll bar'.
2417
+ *
2418
+ * @return {FluentFiltersOrRelationsGetter}
2419
+ */
2420
+ scrollBar() {
2421
+ this._textStr = 'scroll bar';
2422
+ return new FluentFiltersOrRelationsGetter(this);
2423
+ }
2424
+ /**
2425
+ * Filters for a UI element 'rect'.
2426
+ *
2427
+ * @return {FluentFiltersOrRelationsGetter}
2428
+ */
2429
+ rect() {
2430
+ this._textStr = 'rect';
2431
+ return new FluentFiltersOrRelationsGetter(this);
2432
+ }
2433
+ /**
2434
+ * Filters for a UI element 'recaptcha'.
2435
+ *
2436
+ * @return {FluentFiltersOrRelationsGetter}
2437
+ */
2438
+ recaptcha() {
2439
+ this._textStr = 'recaptcha';
2440
+ return new FluentFiltersOrRelationsGetter(this);
2441
+ }
2442
+ /**
2443
+ * Filters for a UI element 'rate'.
2444
+ *
2445
+ * @return {FluentFiltersOrRelationsGetter}
2446
+ */
2447
+ rate() {
2448
+ this._textStr = 'rate';
2449
+ return new FluentFiltersOrRelationsGetter(this);
2450
+ }
2451
+ /**
2452
+ * Filters for a UI element 'radio button unselected'.
2453
+ *
2454
+ * @return {FluentFiltersOrRelationsGetter}
2455
+ */
2456
+ radioButtonUnselected() {
2457
+ this._textStr = 'radio button unselected';
2458
+ return new FluentFiltersOrRelationsGetter(this);
2459
+ }
2460
+ /**
2461
+ * Filters for a UI element 'radio button selected'.
2462
+ *
2463
+ * @return {FluentFiltersOrRelationsGetter}
2464
+ */
2465
+ radioButtonSelected() {
2466
+ this._textStr = 'radio button selected';
2467
+ return new FluentFiltersOrRelationsGetter(this);
2468
+ }
2469
+ /**
2470
+ * Filters for a UI element 'progressbar'.
2471
+ *
2472
+ * @return {FluentFiltersOrRelationsGetter}
2473
+ */
2474
+ progressbar() {
2475
+ this._textStr = 'progressbar';
2476
+ return new FluentFiltersOrRelationsGetter(this);
2477
+ }
2478
+ /**
2479
+ * Filters for a UI element 'progress bar'.
2480
+ *
2481
+ * @return {FluentFiltersOrRelationsGetter}
2482
+ */
2483
+ progressBar() {
2484
+ this._textStr = 'progress bar';
2485
+ return new FluentFiltersOrRelationsGetter(this);
2486
+ }
2487
+ /**
2488
+ * Filters for a UI element 'popover'.
2489
+ *
2490
+ * @return {FluentFiltersOrRelationsGetter}
2491
+ */
2492
+ popover() {
2493
+ this._textStr = 'popover';
2494
+ return new FluentFiltersOrRelationsGetter(this);
2495
+ }
2496
+ /**
2497
+ * Filters for a UI element 'pil'.
2498
+ *
2499
+ * @return {FluentFiltersOrRelationsGetter}
2500
+ */
2501
+ pil() {
2502
+ this._textStr = 'pil';
2503
+ return new FluentFiltersOrRelationsGetter(this);
2504
+ }
2505
+ /**
2506
+ * Filters for a UI element 'password'.
2507
+ *
2508
+ * @return {FluentFiltersOrRelationsGetter}
2509
+ */
2510
+ password() {
2511
+ this._textStr = 'password';
2512
+ return new FluentFiltersOrRelationsGetter(this);
2513
+ }
2514
+ /**
2515
+ * Filters for a UI element 'pager'.
2516
+ *
2517
+ * @return {FluentFiltersOrRelationsGetter}
2518
+ */
2519
+ pager() {
2520
+ this._textStr = 'pager';
2521
+ return new FluentFiltersOrRelationsGetter(this);
2522
+ }
2523
+ /**
2524
+ * Filters for a UI element 'navigation bar'.
2525
+ *
2526
+ * @return {FluentFiltersOrRelationsGetter}
2527
+ */
2528
+ navigationBar() {
2529
+ this._textStr = 'navigation bar';
2530
+ return new FluentFiltersOrRelationsGetter(this);
2531
+ }
2532
+ /**
2533
+ * Filters for a UI element 'mouse text'.
2534
+ *
2535
+ * @return {FluentFiltersOrRelationsGetter}
2536
+ */
2537
+ mouseText() {
2538
+ this._textStr = 'mouse text';
2539
+ return new FluentFiltersOrRelationsGetter(this);
2540
+ }
2541
+ /**
2542
+ * Filters for a UI element 'mouse pointer'.
2543
+ *
2544
+ * @return {FluentFiltersOrRelationsGetter}
2545
+ */
2546
+ mousePointer() {
2547
+ this._textStr = 'mouse pointer';
2548
+ return new FluentFiltersOrRelationsGetter(this);
2549
+ }
2550
+ /**
2551
+ * Filters for a UI element 'mouse cursor'.
2552
+ *
2553
+ * @return {FluentFiltersOrRelationsGetter}
2554
+ */
2555
+ mouseCursor() {
2556
+ this._textStr = 'mouse cursor';
2557
+ return new FluentFiltersOrRelationsGetter(this);
2558
+ }
2559
+ /**
2560
+ * Filters for a UI element 'modal'.
2561
+ *
2562
+ * @return {FluentFiltersOrRelationsGetter}
2563
+ */
2564
+ modal() {
2565
+ this._textStr = 'modal';
2566
+ return new FluentFiltersOrRelationsGetter(this);
2567
+ }
2568
+ /**
2569
+ * Filters for a UI element 'message box'.
2570
+ *
2571
+ * @return {FluentFiltersOrRelationsGetter}
2572
+ */
2573
+ messageBox() {
2574
+ this._textStr = 'message box';
2575
+ return new FluentFiltersOrRelationsGetter(this);
2576
+ }
2577
+ /**
2578
+ * Filters for a UI element 'map'.
2579
+ *
2580
+ * @return {FluentFiltersOrRelationsGetter}
2581
+ */
2582
+ map() {
2583
+ this._textStr = 'map';
2584
+ return new FluentFiltersOrRelationsGetter(this);
2585
+ }
2586
+ /**
2587
+ * Filters for a UI element 'logo'.
2588
+ *
2589
+ * @return {FluentFiltersOrRelationsGetter}
2590
+ */
2591
+ logo() {
2592
+ this._textStr = 'logo';
2593
+ return new FluentFiltersOrRelationsGetter(this);
2594
+ }
2595
+ /**
2596
+ * Filters for a UI element 'link'.
2597
+ *
2598
+ * @return {FluentFiltersOrRelationsGetter}
2599
+ */
2600
+ link() {
2601
+ this._textStr = 'link';
2602
+ return new FluentFiltersOrRelationsGetter(this);
2603
+ }
2604
+ /**
2605
+ * Filters for a UI element 'keyboard'.
2606
+ *
2607
+ * @return {FluentFiltersOrRelationsGetter}
2608
+ */
2609
+ keyboard() {
2610
+ this._textStr = 'keyboard';
2611
+ return new FluentFiltersOrRelationsGetter(this);
2612
+ }
2613
+ /**
2614
+ * Filters for a UI element 'image'.
2615
+ *
2616
+ * @return {FluentFiltersOrRelationsGetter}
2617
+ */
2618
+ image() {
2619
+ this._textStr = 'image';
2620
+ return new FluentFiltersOrRelationsGetter(this);
2621
+ }
2622
+ /**
2623
+ * Filters for a UI element 'header'.
2624
+ *
2625
+ * @return {FluentFiltersOrRelationsGetter}
2626
+ */
2627
+ header() {
2628
+ this._textStr = 'header';
2629
+ return new FluentFiltersOrRelationsGetter(this);
2630
+ }
2631
+ /**
2632
+ * Filters for a UI element 'footer'.
2633
+ *
2634
+ * @return {FluentFiltersOrRelationsGetter}
2635
+ */
2636
+ footer() {
2637
+ this._textStr = 'footer';
2638
+ return new FluentFiltersOrRelationsGetter(this);
2639
+ }
2640
+ /**
2641
+ * Filters for a UI element 'flag'.
2642
+ *
2643
+ * @return {FluentFiltersOrRelationsGetter}
2644
+ */
2645
+ flag() {
2646
+ this._textStr = 'flag';
2647
+ return new FluentFiltersOrRelationsGetter(this);
2648
+ }
2649
+ /**
2650
+ * Filters for a UI element 'dropdown menu'.
2651
+ *
2652
+ * @return {FluentFiltersOrRelationsGetter}
2653
+ */
2654
+ dropdownMenu() {
2655
+ this._textStr = 'dropdown menu';
2656
+ return new FluentFiltersOrRelationsGetter(this);
2657
+ }
2658
+ /**
2659
+ * Filters for a UI element 'divider'.
2660
+ *
2661
+ * @return {FluentFiltersOrRelationsGetter}
2662
+ */
2663
+ divider() {
2664
+ this._textStr = 'divider';
2665
+ return new FluentFiltersOrRelationsGetter(this);
2666
+ }
2667
+ /**
2668
+ * Filters for a UI element 'circle'.
2669
+ *
2670
+ * @return {FluentFiltersOrRelationsGetter}
2671
+ */
2672
+ circle() {
2673
+ this._textStr = 'circle';
2674
+ return new FluentFiltersOrRelationsGetter(this);
2675
+ }
2676
+ /**
2677
+ * Filters for a UI element 'checkbox unchecked'.
2678
+ *
2679
+ * @return {FluentFiltersOrRelationsGetter}
2680
+ */
2681
+ checkboxUnchecked() {
2682
+ this._textStr = 'checkbox unchecked';
2683
+ return new FluentFiltersOrRelationsGetter(this);
2684
+ }
2685
+ /**
2686
+ * Filters for a UI element 'checkbox checked'.
2687
+ *
2688
+ * @return {FluentFiltersOrRelationsGetter}
2689
+ */
2690
+ checkboxChecked() {
2691
+ this._textStr = 'checkbox checked';
2692
+ return new FluentFiltersOrRelationsGetter(this);
2693
+ }
2694
+ /**
2695
+ * Filters for a UI element 'chart pie'.
2696
+ *
2697
+ * @return {FluentFiltersOrRelationsGetter}
2698
+ */
2699
+ chartPie() {
2700
+ this._textStr = 'chart pie';
2701
+ return new FluentFiltersOrRelationsGetter(this);
2702
+ }
2703
+ /**
2704
+ * Filters for a UI element 'chart'.
2705
+ *
2706
+ * @return {FluentFiltersOrRelationsGetter}
2707
+ */
2708
+ chart() {
2709
+ this._textStr = 'chart';
2710
+ return new FluentFiltersOrRelationsGetter(this);
2711
+ }
2712
+ /**
2713
+ * Filters for a UI element 'card'.
2714
+ *
2715
+ * @return {FluentFiltersOrRelationsGetter}
2716
+ */
2717
+ card() {
2718
+ this._textStr = 'card';
2719
+ return new FluentFiltersOrRelationsGetter(this);
2720
+ }
2721
+ /**
2722
+ * Filters for a UI element 'browser bar'.
2723
+ *
2724
+ * @return {FluentFiltersOrRelationsGetter}
2725
+ */
2726
+ browserBar() {
2727
+ this._textStr = 'browser bar';
2728
+ return new FluentFiltersOrRelationsGetter(this);
2729
+ }
2730
+ /**
2731
+ * Filters for a UI element 'breadcrumb'.
2732
+ *
2733
+ * @return {FluentFiltersOrRelationsGetter}
2734
+ */
2735
+ breadcrumb() {
2736
+ this._textStr = 'breadcrumb';
2737
+ return new FluentFiltersOrRelationsGetter(this);
2738
+ }
2739
+ /**
2740
+ * Filters for a UI element 'banner'.
2741
+ *
2742
+ * @return {FluentFiltersOrRelationsGetter}
2743
+ */
2744
+ banner() {
2745
+ this._textStr = 'banner';
2746
+ return new FluentFiltersOrRelationsGetter(this);
2747
+ }
2748
+ /**
2749
+ * Filters for a UI element 'badge'.
2750
+ *
2751
+ * @return {FluentFiltersOrRelationsGetter}
2752
+ */
2753
+ badge() {
2754
+ this._textStr = 'badge';
2755
+ return new FluentFiltersOrRelationsGetter(this);
2756
+ }
2757
+ /**
2758
+ * Filters for a UI element 'alert'.
2759
+ *
2760
+ * @return {FluentFiltersOrRelationsGetter}
2761
+ */
2762
+ alert() {
2763
+ this._textStr = 'alert';
2764
+ return new FluentFiltersOrRelationsGetter(this);
2765
+ }
2766
+ /**
2767
+ * Filters for a UI element 'unknown'.
2768
+ *
2769
+ * @return {FluentFiltersOrRelationsGetter}
2770
+ */
2771
+ unknown() {
2772
+ this._textStr = 'unknown';
2773
+ return new FluentFiltersOrRelationsGetter(this);
2774
+ }
2775
+ /**
2776
+ * Filters for an UI element 'button'.
2777
+ *
2778
+ * @return {FluentFiltersOrRelationsGetter}
2779
+ */
2780
+ button() {
2781
+ this._textStr = 'button';
2782
+ return new FluentFiltersOrRelationsGetter(this);
2783
+ }
2784
+ /**
2785
+ * Filters for an UI element 'text'.
2786
+ *
2787
+ * @return {FluentFiltersOrRelationsGetter}
2788
+ */
2789
+ text() {
2790
+ this._textStr = 'text';
2791
+ return new FluentFiltersOrRelationsGetter(this);
2792
+ }
2793
+ /**
2794
+ * Filters for an UI element 'dropdown'.
2795
+ *
2796
+ * @return {FluentFiltersOrRelationsGetter}
2797
+ */
2798
+ dropdown() {
2799
+ this._textStr = 'dropdown';
2800
+ return new FluentFiltersOrRelationsGetter(this);
2801
+ }
2802
+ /**
2803
+ * Filters for an UI element 'icon'.
2804
+ *
2805
+ * You can combine it with the 'withText' command to look for a specific icon.
2806
+ *
2807
+ * **Examples:**
2808
+ * ```typescript
2809
+ * icon().withText('plus')
2810
+ * ```
2811
+ *
2812
+ * Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
2813
+ *
2814
+ * @return {FluentFiltersOrRelationsGetter}
2815
+ */
2816
+ icon() {
2817
+ this._textStr = 'icon';
2818
+ return new FluentFiltersOrRelationsGetter(this);
2819
+ }
2820
+ /**
2821
+ * Filters for a custom UI element (see {@link CustomElementJson}).
2822
+ *
2823
+ * **Important**: This increases the runtime quite a bit. So
2824
+ * only use it when absolutely necessary.
2825
+ *
2826
+ * @param {CustomElementJson} customElement - The custom element to filter for.
2827
+ *
2828
+ * @return {FluentFiltersOrRelationsGetter}
2829
+ */
2830
+ customElement(customElement) {
2831
+ this._textStr = 'custom element';
2832
+ this._params.set('customElement', customElement);
2833
+ return new FluentFiltersOrRelationsGetter(this);
2834
+ }
2835
+ /**
2836
+ * Filters for a UI element 'checkbox' checked or unchecked.
2837
+ *
2838
+ * @return {FluentFiltersOrRelationsGetter}
2839
+ */
2840
+ checkbox() {
2841
+ this._textStr = 'checkbox';
2842
+ return new FluentFiltersOrRelationsGetter(this);
2843
+ }
2844
+ /**
2845
+ * Filters for similar (doesn't need to be a 100% equal) text.
2846
+ *
2847
+ * **Examples:**
2848
+ * ```typescript
2849
+ * 'text' === withText('text') => true
2850
+ * 'test' === withText('text') => true
2851
+ * 'other' === withText('text') => false
2852
+ * ```
2853
+ *
2854
+ * @param {string} text - A text to be matched.
2855
+ *
2856
+ * @return {FluentFiltersOrRelationsGetter}
2857
+ */
2858
+ withText(text) {
2859
+ this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
2860
+ return new FluentFiltersOrRelationsGetter(this);
2861
+ }
2862
+ /**
2863
+ * Filters for texts, which match the regex pattern.
2864
+ *
2865
+ * **Examples:**
2866
+ *
2867
+ * ```typescript
2868
+ * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
2869
+ * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
2870
+ * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
2871
+ * ```
2872
+ *
2873
+ * @param {string} regex_pattern - An regex pattern
2874
+ *
2875
+ * @return {FluentFiltersOrRelationsGetter}
2876
+ */
2877
+ withTextRegex(regex_pattern) {
2878
+ this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
2879
+ return new FluentFiltersOrRelationsGetter(this);
2880
+ }
2881
+ /**
2882
+ * Filters for equal text.
2883
+ *
2884
+ * **Note:** This should be only used in cases where the similarity
2885
+ * comparison of {@link FluentFilters.withText()} allows not for
2886
+ * specific enough filtering (too many elements).
2887
+ *
2888
+ * **Examples:**
2889
+ * ```typescript
2890
+ * 'text' === withExactText('text') => true
2891
+ * 'test' === withExactText('text') => false
2892
+ * 'other' === withExactText('text') => false
2893
+ * ```
2894
+ *
2895
+ * @param {string} text - A text to be matched.
2896
+ *
2897
+ * @return {FluentFiltersOrRelationsGetter}
2898
+ */
2899
+ withExactText(text) {
2900
+ this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
2901
+ return new FluentFiltersOrRelationsGetter(this);
2902
+ }
2903
+ /**
2904
+ * Filters for text containing the text provided as an argument.
2905
+ *
2906
+ * **Examples:**
2907
+ * ```typescript
2908
+ * 'This is an text' === containsText('text') => true
2909
+ * 'This is an text' === containsText('other text') => false
2910
+ * 'This is an text' === containsText('other') => false
2911
+ * ```
2912
+ *
2913
+ * @param {string} text - A text to be matched.
2914
+ *
2915
+ * @return {FluentFiltersOrRelationsGetter}
2916
+ */
2917
+ containsText(text) {
2918
+ this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
2919
+ return new FluentFiltersOrRelationsGetter(this);
2920
+ }
2921
+ /**
2922
+ * Filters for elements having a specific color.
2923
+ *
2924
+ * @param {COLOR} color - A color to match
2925
+ *
2926
+ * @return {FluentFiltersOrRelationsGetter}
2927
+ */
2928
+ colored(color) {
2929
+ this._textStr = `with color ${color}`;
2930
+ return new FluentFiltersOrRelationsGetter(this);
2931
+ }
2932
+ }
2933
+ exports.FluentFiltersGetter = FluentFiltersGetter;
2934
+ // Relations
2935
+ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
2936
+ /**
2937
+ * Filters for an element inside another element.
2938
+ *
2939
+ * **Examples:**
2940
+ * ```typescript
2941
+ * --------------------
2942
+ * | outerEl |
2943
+ * | -------------- |
2944
+ * | | innerEl | |
2945
+ * | -------------- |
2946
+ * | |
2947
+ * --------------------
2948
+ *
2949
+ * // Returns innerEl because innerEl is inside outerEl
2950
+ * ...innerEl().in().outerEl()
2951
+ * // Returns nothing because innerEl is not inside outerEl
2952
+ * ...outerEl().in().innerEl()
2953
+ * ```
2954
+ *
2955
+ * @return {FluentFiltersGetter}
2956
+ */
2957
+ in() {
2958
+ this._textStr = 'in';
2959
+ return new FluentFiltersGetter(this);
2960
+ }
2961
+ /**
2962
+ * Filters for an element right of another element.
2963
+ *
2964
+ * **Examples:**
2965
+ * ```typescript
2966
+ * -------------- --------------
2967
+ * | leftEl | | rightEl |
2968
+ * -------------- --------------
2969
+ *
2970
+ * // Returns rightEl because rightEl is right of leftEl
2971
+ * ...rightEl().rightOf().leftEl()
2972
+ * // Returns no element because leftEl is left of rightEl
2973
+ * ...leftEl().rightOf().rightEl()
2974
+ * ```
2975
+ *
2976
+ * @return {FluentFiltersGetter}
2977
+ */
2978
+ rightOf() {
2979
+ this._textStr = 'right of';
2980
+ return new FluentFiltersGetter(this);
2981
+ }
2982
+ /**
2983
+ * Filters for an element left of another element.
2984
+ *
2985
+ * **Examples:**
2986
+ * ```typescript
2987
+ * -------------- --------------
2988
+ * | leftEl | | rightEl |
2989
+ * -------------- --------------
2990
+ *
2991
+ * // Returns leftEl because leftEl is left of rightEl
2992
+ * ...leftEl().leftOf().rightEl()
2993
+ * // Returns no element because rightEl is left of leftEl
2994
+ * ...rightEl().leftOf().leftEl()
2995
+ * ```
2996
+ *
2997
+ * @return {FluentFiltersGetter}
2998
+ */
2999
+ leftOf() {
3000
+ this._textStr = 'left of';
3001
+ return new FluentFiltersGetter(this);
3002
+ }
3003
+ /**
3004
+ * Filters for an element below another element.
3005
+ *
3006
+ * **Examples:**
3007
+ * ```typescript
3008
+ * --------------
3009
+ * | text |
3010
+ * --------------
3011
+ * --------------
3012
+ * | button |
3013
+ * --------------
3014
+ *
3015
+ * // Returns button because button is below text
3016
+ * ...button().below().text()
3017
+ * // Returns no element because text is above button
3018
+ * ...text().below().button()
3019
+ * ```
3020
+ *
3021
+ * @return {FluentFiltersGetter}
3022
+ */
3023
+ below() {
3024
+ this._textStr = 'below';
3025
+ return new FluentFiltersGetter(this);
3026
+ }
3027
+ /**
3028
+ * Filters for an element above another element.
3029
+ *
3030
+ * **Examples:**
3031
+ * ```typescript
3032
+ * --------------
3033
+ * | text |
3034
+ * --------------
3035
+ * --------------
3036
+ * | button |
3037
+ * --------------
3038
+ *
3039
+ * // Returns text because text is above button
3040
+ * ...text().above().button()
3041
+ * // Returns no element because button is below text
3042
+ * ...button().above().text()
3043
+ * ```
3044
+ *
3045
+ * @return {FluentFiltersGetter}
3046
+ */
3047
+ above() {
3048
+ this._textStr = 'above';
3049
+ return new FluentFiltersGetter(this);
3050
+ }
3051
+ /**
3052
+ * Filters for an element nearest to another element.
3053
+ *
3054
+ * **Examples:**
3055
+ * ```typescript
3056
+ * --------------
3057
+ * | button 1 |
3058
+ * --------------
3059
+ * --------------
3060
+ * | text |
3061
+ * --------------
3062
+ *
3063
+ *
3064
+ *
3065
+ * --------------
3066
+ * | button 2 |
3067
+ * --------------
3068
+ *
3069
+ * // Returns button 1 because button 1 is nearer to the text than button 2
3070
+ * ...button().nearestTo().text()
3071
+ * ```
3072
+ *
3073
+ * @return {FluentFiltersGetter}
3074
+ */
3075
+ nearestTo() {
3076
+ this._textStr = 'nearest to';
3077
+ return new FluentFiltersGetter(this);
3078
+ }
3079
+ /**
3080
+ * Filters for an element containing another element.
3081
+ *
3082
+ * **Example:**
3083
+ * ```typescript
3084
+ * --------------------
3085
+ * | outerEl |
3086
+ * | -------------- |
3087
+ * | | innerEl | |
3088
+ * | -------------- |
3089
+ * | |
3090
+ * --------------------
3091
+ *
3092
+ * // Returns outerEl because outerEl contains innerEl
3093
+ * ...outerEl().contains().innerEl()
3094
+ * // Returns no element because innerEl contains no outerEl
3095
+ * ...innerEl().contains().outerEl()
3096
+ * ```
3097
+ *
3098
+ * @return {FluentFiltersGetter}
3099
+ */
3100
+ contains() {
3101
+ this._textStr = 'contains';
3102
+ return new FluentFiltersGetter(this);
3103
+ }
3104
+ /**
3105
+ * Returns a list of detected elements
3106
+ *
3107
+ * @return {DetectedElement[]}
3108
+ */
3109
+ exec() {
3110
+ return this.getterStringBuilder();
3111
+ }
3112
+ }
3113
+ exports.FluentFiltersOrRelationsGetter = FluentFiltersOrRelationsGetter;
3114
+ // Commands
3115
+ class Getter extends FluentCommand {
3116
+ /**
3117
+ * Returns the filtered element
3118
+ *
3119
+ * @return {FluentFiltersGetter}
3120
+ */
3121
+ get() {
3122
+ this._textStr = 'get element';
3123
+ return new FluentFiltersGetter(this);
3124
+ }
3125
+ /**
3126
+ * Returns all detected elements
3127
+ *
3128
+ * @return {ExecGetter}
3129
+ */
3130
+ getAll() {
3131
+ this._textStr = 'get all elements';
3132
+ return new ExecGetter(this);
3133
+ }
3134
+ }
3135
+ exports.Getter = Getter;
3136
+ class ApiCommands extends Getter {
3137
+ }
3138
+ exports.ApiCommands = ApiCommands;