assistsx-js 0.2.0 → 0.2.2

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/index.d.ts CHANGED
@@ -1,5 +1,14 @@
1
1
  import * as pinia from 'pinia';
2
2
 
3
+ /**
4
+ * 与 Android AssistsCore.NodeLookupScope / HTTP scope 查询参数一致的字符串取值。
5
+ */
6
+ type NodeLookupScope = "active_window" | "all_windows";
7
+ /** 与 AssistsCore.NodeLookupScope.ActiveWindow 对应 */
8
+ declare const NODE_LOOKUP_SCOPE_ACTIVE_WINDOW: NodeLookupScope;
9
+ /** 与 AssistsCore.NodeLookupScope.AllWindows 对应 */
10
+ declare const NODE_LOOKUP_SCOPE_ALL_WINDOWS: NodeLookupScope;
11
+
3
12
  declare class Bounds {
4
13
  readonly left: number;
5
14
  readonly top: number;
@@ -890,7 +899,7 @@ interface Screen {
890
899
  height: number;
891
900
  }
892
901
  /** 全局屏幕尺寸,在 assistsxCallback 初始化后自动加载 */
893
- declare let screen: Screen | null;
902
+ declare let screen: Screen;
894
903
  declare class AssistsX {
895
904
  /**
896
905
  * 屏幕尺寸(与全局变量 screen 同源)
@@ -940,11 +949,12 @@ declare class AssistsX {
940
949
  * @param filterText 文本过滤
941
950
  * @returns 节点数组
942
951
  */
943
- static getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
952
+ static getAllNodes({ filterClass, filterViewId, filterDes, filterText, scope, }?: {
944
953
  filterClass?: string;
945
954
  filterViewId?: string;
946
955
  filterDes?: string;
947
956
  filterText?: string;
957
+ scope?: NodeLookupScope;
948
958
  }): Node[];
949
959
  /**
950
960
  * 设置节点文本
@@ -1012,7 +1022,9 @@ declare class AssistsX {
1012
1022
  * 获取当前应用包名
1013
1023
  * @returns 包名
1014
1024
  */
1015
- static getPackageName(): string;
1025
+ static getPackageName(options?: {
1026
+ scope?: NodeLookupScope;
1027
+ }): string;
1016
1028
  /**
1017
1029
  * 显示悬浮提示
1018
1030
  * @param text 提示文本
@@ -1029,11 +1041,12 @@ declare class AssistsX {
1029
1041
  * @param node 父节点范围
1030
1042
  * @returns 节点数组
1031
1043
  */
1032
- static findById(id: string, { filterClass, filterText, filterDes, node, }?: {
1044
+ static findById(id: string, { filterClass, filterText, filterDes, node, scope, }?: {
1033
1045
  filterClass?: string;
1034
1046
  filterText?: string;
1035
1047
  filterDes?: string;
1036
1048
  node?: Node;
1049
+ scope?: NodeLookupScope;
1037
1050
  }): Node[];
1038
1051
  /**
1039
1052
  * 通过文本查找节点
@@ -1044,11 +1057,12 @@ declare class AssistsX {
1044
1057
  * @param node 父节点范围
1045
1058
  * @returns 节点数组
1046
1059
  */
1047
- static findByText(text: string, { filterClass, filterViewId, filterDes, node, }?: {
1060
+ static findByText(text: string, { filterClass, filterViewId, filterDes, node, scope, }?: {
1048
1061
  filterClass?: string;
1049
1062
  filterViewId?: string;
1050
1063
  filterDes?: string;
1051
1064
  node?: Node;
1065
+ scope?: NodeLookupScope;
1052
1066
  }): Node[];
1053
1067
  /**
1054
1068
  * 通过标签查找节点
@@ -1059,18 +1073,21 @@ declare class AssistsX {
1059
1073
  * @param node 父节点范围
1060
1074
  * @returns 节点数组
1061
1075
  */
1062
- static findByTags(className: string, { filterText, filterViewId, filterDes, node, }?: {
1076
+ static findByTags(className: string, { filterText, filterViewId, filterDes, node, scope, }?: {
1063
1077
  filterText?: string;
1064
1078
  filterViewId?: string;
1065
1079
  filterDes?: string;
1066
1080
  node?: Node;
1081
+ scope?: NodeLookupScope;
1067
1082
  }): Node[];
1068
1083
  /**
1069
1084
  * 查找所有匹配文本的节点
1070
1085
  * @param text 要查找的文本
1071
- * @returns 节点数组
1086
+ * @param options.scope 节点查找范围(可选)
1072
1087
  */
1073
- static findByTextAllMatch(text: string): Node[];
1088
+ static findByTextAllMatch(text: string, { scope }?: {
1089
+ scope?: NodeLookupScope;
1090
+ }): Node[];
1074
1091
  /**
1075
1092
  * 检查是否包含指定文本
1076
1093
  * @param text 要检查的文本
@@ -1464,11 +1481,12 @@ declare class StepAsync {
1464
1481
  * @param filterText 文本过滤
1465
1482
  * @returns 节点数组
1466
1483
  */
1467
- getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
1484
+ getAllNodes({ filterClass, filterViewId, filterDes, filterText, scope, }?: {
1468
1485
  filterClass?: string;
1469
1486
  filterViewId?: string;
1470
1487
  filterDes?: string;
1471
1488
  filterText?: string;
1489
+ scope?: NodeLookupScope;
1472
1490
  }): Promise<Node[]>;
1473
1491
  /**
1474
1492
  * 启动应用
@@ -1478,9 +1496,18 @@ declare class StepAsync {
1478
1496
  launchApp(packageName: string): Promise<boolean>;
1479
1497
  /**
1480
1498
  * 获取当前应用包名
1481
- * @returns 包名
1499
+ * @param timeout 超时时间(秒),默认30秒
1482
1500
  */
1483
- getPackageName(): Promise<string>;
1501
+ getPackageName(timeout?: number): Promise<string>;
1502
+ /**
1503
+ * 获取当前应用包名
1504
+ * @param options.timeout 超时时间(秒),默认30秒
1505
+ * @param options.scope 节点查找范围(可选)
1506
+ */
1507
+ getPackageName(options: {
1508
+ timeout?: number;
1509
+ scope?: NodeLookupScope;
1510
+ }): Promise<string>;
1484
1511
  /**
1485
1512
  * 通过ID查找节点
1486
1513
  * @param id 节点ID
@@ -1489,10 +1516,11 @@ declare class StepAsync {
1489
1516
  * @param filterDes 描述过滤
1490
1517
  * @returns 节点数组
1491
1518
  */
1492
- findById(id: string, { filterClass, filterText, filterDes, }?: {
1519
+ findById(id: string, { filterClass, filterText, filterDes, scope, }?: {
1493
1520
  filterClass?: string;
1494
1521
  filterText?: string;
1495
1522
  filterDes?: string;
1523
+ scope?: NodeLookupScope;
1496
1524
  }): Promise<Node[]>;
1497
1525
  /**
1498
1526
  * 通过文本查找节点
@@ -1502,10 +1530,11 @@ declare class StepAsync {
1502
1530
  * @param filterDes 描述过滤
1503
1531
  * @returns 节点数组
1504
1532
  */
1505
- findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
1533
+ findByText(text: string, { filterClass, filterViewId, filterDes, scope, }?: {
1506
1534
  filterClass?: string;
1507
1535
  filterViewId?: string;
1508
1536
  filterDes?: string;
1537
+ scope?: NodeLookupScope;
1509
1538
  }): Promise<Node[]>;
1510
1539
  /**
1511
1540
  * 通过标签查找节点
@@ -1515,17 +1544,28 @@ declare class StepAsync {
1515
1544
  * @param filterDes 描述过滤
1516
1545
  * @returns 节点数组
1517
1546
  */
1518
- findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
1547
+ findByTags(className: string, { filterText, filterViewId, filterDes, scope, }?: {
1519
1548
  filterText?: string;
1520
1549
  filterViewId?: string;
1521
1550
  filterDes?: string;
1551
+ scope?: NodeLookupScope;
1522
1552
  }): Promise<Node[]>;
1523
1553
  /**
1524
1554
  * 查找所有匹配文本的节点
1525
1555
  * @param text 要查找的文本
1526
- * @returns 节点数组
1556
+ * @param timeout 超时时间(秒),默认30秒
1557
+ */
1558
+ findByTextAllMatch(text: string, timeout?: number): Promise<Node[]>;
1559
+ /**
1560
+ * 查找所有匹配文本的节点
1561
+ * @param text 要查找的文本
1562
+ * @param options.timeout 超时时间(秒),默认30秒
1563
+ * @param options.scope 节点查找范围(可选)
1527
1564
  */
1528
- findByTextAllMatch(text: string): Promise<Node[]>;
1565
+ findByTextAllMatch(text: string, options: {
1566
+ timeout?: number;
1567
+ scope?: NodeLookupScope;
1568
+ }): Promise<Node[]>;
1529
1569
  /**
1530
1570
  * 检查是否包含指定文本
1531
1571
  * @param text 要检查的文本
@@ -1698,7 +1738,7 @@ declare class Step {
1698
1738
  */
1699
1739
  repeatCount: number;
1700
1740
  /**
1701
- * 步骤重复执行最大次数,默认不限制
1741
+ * 步骤重复执行最大次数,默认15次
1702
1742
  */
1703
1743
  repeatCountMax: number;
1704
1744
  /**
@@ -1817,11 +1857,12 @@ declare class Step {
1817
1857
  * @param filterText 文本过滤
1818
1858
  * @returns 节点数组
1819
1859
  */
1820
- getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
1860
+ getAllNodes({ filterClass, filterViewId, filterDes, filterText, scope, }?: {
1821
1861
  filterClass?: string;
1822
1862
  filterViewId?: string;
1823
1863
  filterDes?: string;
1824
1864
  filterText?: string;
1865
+ scope?: NodeLookupScope;
1825
1866
  }): Node[];
1826
1867
  /**
1827
1868
  * 启动应用
@@ -1831,9 +1872,11 @@ declare class Step {
1831
1872
  launchApp(packageName: string): boolean;
1832
1873
  /**
1833
1874
  * 获取当前应用包名
1834
- * @returns 包名
1875
+ * @param options.scope 节点查找范围(可选)
1835
1876
  */
1836
- getPackageName(): string;
1877
+ getPackageName(options?: {
1878
+ scope?: NodeLookupScope;
1879
+ }): string;
1837
1880
  /**
1838
1881
  * 通过ID查找节点
1839
1882
  * @param id 节点ID
@@ -1842,10 +1885,11 @@ declare class Step {
1842
1885
  * @param filterDes 描述过滤
1843
1886
  * @returns 节点数组
1844
1887
  */
1845
- findById(id: string, { filterClass, filterText, filterDes, }?: {
1888
+ findById(id: string, { filterClass, filterText, filterDes, scope, }?: {
1846
1889
  filterClass?: string;
1847
1890
  filterText?: string;
1848
1891
  filterDes?: string;
1892
+ scope?: NodeLookupScope;
1849
1893
  }): Node[];
1850
1894
  /**
1851
1895
  * 通过文本查找节点
@@ -1855,10 +1899,11 @@ declare class Step {
1855
1899
  * @param filterDes 描述过滤
1856
1900
  * @returns 节点数组
1857
1901
  */
1858
- findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
1902
+ findByText(text: string, { filterClass, filterViewId, filterDes, scope, }?: {
1859
1903
  filterClass?: string;
1860
1904
  filterViewId?: string;
1861
1905
  filterDes?: string;
1906
+ scope?: NodeLookupScope;
1862
1907
  }): Node[];
1863
1908
  /**
1864
1909
  * 通过标签查找节点
@@ -1868,17 +1913,20 @@ declare class Step {
1868
1913
  * @param filterDes 描述过滤
1869
1914
  * @returns 节点数组
1870
1915
  */
1871
- findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
1916
+ findByTags(className: string, { filterText, filterViewId, filterDes, scope, }?: {
1872
1917
  filterText?: string;
1873
1918
  filterViewId?: string;
1874
1919
  filterDes?: string;
1920
+ scope?: NodeLookupScope;
1875
1921
  }): Node[];
1876
1922
  /**
1877
1923
  * 查找所有匹配文本的节点
1878
1924
  * @param text 要查找的文本
1879
- * @returns 节点数组
1925
+ * @param options.scope 节点查找范围(可选)
1880
1926
  */
1881
- findByTextAllMatch(text: string): Node[];
1927
+ findByTextAllMatch(text: string, { scope }?: {
1928
+ scope?: NodeLookupScope;
1929
+ }): Node[];
1882
1930
  /**
1883
1931
  * 检查是否包含指定文本
1884
1932
  * @param text 要检查的文本
@@ -2118,12 +2166,13 @@ declare class AssistsXAsync {
2118
2166
  * @param timeout 超时时间(秒),默认30秒
2119
2167
  * @returns 节点数组
2120
2168
  */
2121
- static getAllNodes({ filterClass, filterViewId, filterDes, filterText, timeout, }?: {
2169
+ static getAllNodes({ filterClass, filterViewId, filterDes, filterText, timeout, scope, }?: {
2122
2170
  filterClass?: string;
2123
2171
  filterViewId?: string;
2124
2172
  filterDes?: string;
2125
2173
  filterText?: string;
2126
2174
  timeout?: number;
2175
+ scope?: NodeLookupScope;
2127
2176
  }): Promise<Node[]>;
2128
2177
  /**
2129
2178
  * 设置节点文本
@@ -2219,9 +2268,17 @@ declare class AssistsXAsync {
2219
2268
  /**
2220
2269
  * 获取当前应用包名
2221
2270
  * @param timeout 超时时间(秒),默认30秒
2222
- * @returns 包名
2223
2271
  */
2224
2272
  static getPackageName(timeout?: number): Promise<string>;
2273
+ /**
2274
+ * 获取当前应用包名
2275
+ * @param options.timeout 超时时间(秒),默认30秒
2276
+ * @param options.scope 节点查找范围(可选)
2277
+ */
2278
+ static getPackageName(options: {
2279
+ timeout?: number;
2280
+ scope?: NodeLookupScope;
2281
+ }): Promise<string>;
2225
2282
  /**
2226
2283
  * 显示悬浮提示
2227
2284
  * @param text 提示文本
@@ -2240,12 +2297,13 @@ declare class AssistsXAsync {
2240
2297
  * @param timeout 超时时间(秒),默认30秒
2241
2298
  * @returns 节点数组
2242
2299
  */
2243
- static findById(id: string, { filterClass, filterText, filterDes, node, timeout, }?: {
2300
+ static findById(id: string, { filterClass, filterText, filterDes, node, timeout, scope, }?: {
2244
2301
  filterClass?: string;
2245
2302
  filterText?: string;
2246
2303
  filterDes?: string;
2247
2304
  node?: Node;
2248
2305
  timeout?: number;
2306
+ scope?: NodeLookupScope;
2249
2307
  }): Promise<Node[]>;
2250
2308
  /**
2251
2309
  * 通过文本查找节点
@@ -2257,12 +2315,13 @@ declare class AssistsXAsync {
2257
2315
  * @param timeout 超时时间(秒),默认30秒
2258
2316
  * @returns 节点数组
2259
2317
  */
2260
- static findByText(text: string, { filterClass, filterViewId, filterDes, node, timeout, }?: {
2318
+ static findByText(text: string, { filterClass, filterViewId, filterDes, node, timeout, scope, }?: {
2261
2319
  filterClass?: string;
2262
2320
  filterViewId?: string;
2263
2321
  filterDes?: string;
2264
2322
  node?: Node;
2265
2323
  timeout?: number;
2324
+ scope?: NodeLookupScope;
2266
2325
  }): Promise<Node[]>;
2267
2326
  /**
2268
2327
  * 通过标签查找节点
@@ -2274,20 +2333,30 @@ declare class AssistsXAsync {
2274
2333
  * @param timeout 超时时间(秒),默认30秒
2275
2334
  * @returns 节点数组
2276
2335
  */
2277
- static findByTags(className: string, { filterText, filterViewId, filterDes, node, timeout, }?: {
2336
+ static findByTags(className: string, { filterText, filterViewId, filterDes, node, timeout, scope, }?: {
2278
2337
  filterText?: string;
2279
2338
  filterViewId?: string;
2280
2339
  filterDes?: string;
2281
2340
  node?: Node;
2282
2341
  timeout?: number;
2342
+ scope?: NodeLookupScope;
2283
2343
  }): Promise<Node[]>;
2284
2344
  /**
2285
2345
  * 查找所有匹配文本的节点
2286
2346
  * @param text 要查找的文本
2287
2347
  * @param timeout 超时时间(秒),默认30秒
2288
- * @returns 节点数组
2289
2348
  */
2290
2349
  static findByTextAllMatch(text: string, timeout?: number): Promise<Node[]>;
2350
+ /**
2351
+ * 查找所有匹配文本的节点
2352
+ * @param text 要查找的文本
2353
+ * @param options.timeout 超时时间(秒),默认30秒
2354
+ * @param options.scope 节点查找范围(可选)
2355
+ */
2356
+ static findByTextAllMatch(text: string, options: {
2357
+ timeout?: number;
2358
+ scope?: NodeLookupScope;
2359
+ }): Promise<Node[]>;
2291
2360
  /**
2292
2361
  * 检查是否包含指定文本
2293
2362
  * @param text 要检查的文本
@@ -2554,12 +2623,14 @@ declare class AssistsXAsync {
2554
2623
  * @param options.filePath 文件路径(可选,不提供则自动生成)
2555
2624
  * @param options.prettyPrint 是否格式化输出,默认为 true
2556
2625
  * @param options.timeout 超时时间(秒),默认30秒
2626
+ * @param options.scope 节点查找范围(可选)
2557
2627
  * @returns 保存的文件路径
2558
2628
  */
2559
2629
  static saveRootNodeTreeJson(options?: {
2560
2630
  filePath?: string;
2561
2631
  prettyPrint?: boolean;
2562
2632
  timeout?: number;
2633
+ scope?: NodeLookupScope;
2563
2634
  }): Promise<string>;
2564
2635
  /**
2565
2636
  * 获取剪贴板文本内容
@@ -4228,4 +4299,4 @@ declare class Log {
4228
4299
  /** 默认单例,用法与 floatingwindow 模块导出的 float 一致 */
4229
4300
  declare const log: Log;
4230
4301
 
4231
- export { type AccessibilityEvent, type AccessibilityEventData, AccessibilityEventFilter, type AccessibilityEventFilterConfig, type AccessibilityEventListener, AppInfo, AssistsX, AssistsXAsync, BarUtils, BarUtilsCallMethod, type BarUtilsCallMethodType, Bounds, CallMethod, type CallMethodType, CallResponse, type Contact, DeviceInfo, FileIO, type FileInfo, type FileListItem, type FileUploadInfo, FileUtils, Float, FloatCallMethod, type FloatCallMethodType, Gallery, type GalleryDeleteResponse, type GalleryResponse, Http, type HttpConfig, type HttpDownloadResponse, type HttpResponse, type ImageProcessResult, type ImageRotateDegree, type ImageSaveResult, type ImageSize, type ImageType, ImageUtils, Ime, ImeAction, type IsCurrentInputMethodResponse, type IsInputMethodEnabledResponse, Log, LogCallMethod, type LogCallMethodType, LogStream, type LogStreamType, type LogSubscribeUpdatePayload, type LogUpdateData, type LogUpdateEvent, type LogUploadOptions, type LogUploadResult, Mlkit, MlkitCallMethod, type MlkitCallMethodType, type MlkitRegion, Node, NodeAsync, NodeClassValue, type OpenInputMethodSettingsResponse, Path, type PerformEditorActionResponse, type RecognizeTextInScreenshotPosition, type RecognizeTextInScreenshotResult, type RecognizeTextRegion, type Screen, type ScreenTextJsonResult, type ScreenTextRecognitionResult, Step, StepAsync, StepError, type StepImpl, type StepInterceptor, type StepResult, type StepState, type StepStatus, StepStopError, type TextPosition, type WebFloatingWindowOptions, WindowFlags, accessibilityEventListeners, barUtils, callbacks, decodeBase64UTF8, fileIO, fileUtils, float, gallery, generateUUID, http, imageUtils, ime, log, logUpdateListeners, mlkit, pathUtils, screen, sleep, useStepStore };
4302
+ export { type AccessibilityEvent, type AccessibilityEventData, AccessibilityEventFilter, type AccessibilityEventFilterConfig, type AccessibilityEventListener, AppInfo, AssistsX, AssistsXAsync, BarUtils, BarUtilsCallMethod, type BarUtilsCallMethodType, Bounds, CallMethod, type CallMethodType, CallResponse, type Contact, DeviceInfo, FileIO, type FileInfo, type FileListItem, type FileUploadInfo, FileUtils, Float, FloatCallMethod, type FloatCallMethodType, Gallery, type GalleryDeleteResponse, type GalleryResponse, Http, type HttpConfig, type HttpDownloadResponse, type HttpResponse, type ImageProcessResult, type ImageRotateDegree, type ImageSaveResult, type ImageSize, type ImageType, ImageUtils, Ime, ImeAction, type IsCurrentInputMethodResponse, type IsInputMethodEnabledResponse, Log, LogCallMethod, type LogCallMethodType, LogStream, type LogStreamType, type LogSubscribeUpdatePayload, type LogUpdateData, type LogUpdateEvent, type LogUploadOptions, type LogUploadResult, Mlkit, MlkitCallMethod, type MlkitCallMethodType, type MlkitRegion, NODE_LOOKUP_SCOPE_ACTIVE_WINDOW, NODE_LOOKUP_SCOPE_ALL_WINDOWS, Node, NodeAsync, NodeClassValue, type NodeLookupScope, type OpenInputMethodSettingsResponse, Path, type PerformEditorActionResponse, type RecognizeTextInScreenshotPosition, type RecognizeTextInScreenshotResult, type RecognizeTextRegion, type Screen, type ScreenTextJsonResult, type ScreenTextRecognitionResult, Step, StepAsync, StepError, type StepImpl, type StepInterceptor, type StepResult, type StepState, type StepStatus, StepStopError, type TextPosition, type WebFloatingWindowOptions, WindowFlags, accessibilityEventListeners, barUtils, callbacks, decodeBase64UTF8, fileIO, fileUtils, float, gallery, generateUUID, http, imageUtils, ime, log, logUpdateListeners, mlkit, pathUtils, screen, sleep, useStepStore };