@midscene/shared 0.16.10 → 0.16.11-beta-20250512134434.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.
@@ -362,8 +362,24 @@ function getNodeAttributes(node, currentWindow) {
362
362
  }
363
363
  function midsceneGenerateHash(node, content, rect) {
364
364
  const slicedHash = generateHashId(rect, content);
365
+ if (node) {
366
+ if (!window.midsceneNodeHashCacheList) {
367
+ setNodeHashCacheListOnWindow();
368
+ }
369
+ setNodeToCacheList(node, slicedHash);
370
+ }
365
371
  return slicedHash;
366
372
  }
373
+ function setNodeHashCacheListOnWindow() {
374
+ if (typeof window !== "undefined") {
375
+ window.midsceneNodeHashCacheList = [];
376
+ }
377
+ }
378
+ function setNodeToCacheList(node, id) {
379
+ if (typeof window !== "undefined") {
380
+ window.midsceneNodeHashCacheList.push({ node, id });
381
+ }
382
+ }
367
383
  function setMidsceneVisibleRectOnWindow() {
368
384
  if (typeof window !== "undefined") {
369
385
  window.midsceneVisibleRect = visibleRect;
@@ -434,9 +450,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
434
450
  Math.round(rect.left + rect.width / 2),
435
451
  Math.round(rect.top + rect.height / 2)
436
452
  ],
437
- zoom: rect.zoom,
438
- screenWidth: currentWindow.innerWidth,
439
- screenHeight: currentWindow.innerHeight
453
+ zoom: rect.zoom
440
454
  };
441
455
  return elementInfo;
442
456
  }
@@ -463,9 +477,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
463
477
  Math.round(rect.left + rect.width / 2),
464
478
  Math.round(rect.top + rect.height / 2)
465
479
  ],
466
- zoom: rect.zoom,
467
- screenWidth: currentWindow.innerWidth,
468
- screenHeight: currentWindow.innerHeight
480
+ zoom: rect.zoom
469
481
  };
470
482
  return elementInfo;
471
483
  }
@@ -493,9 +505,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
493
505
  Math.round(rect.left + rect.width / 2),
494
506
  Math.round(rect.top + rect.height / 2)
495
507
  ],
496
- zoom: rect.zoom,
497
- screenWidth: currentWindow.innerWidth,
498
- screenHeight: currentWindow.innerHeight
508
+ zoom: rect.zoom
499
509
  };
500
510
  return elementInfo;
501
511
  }
@@ -526,12 +536,9 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
526
536
  Math.round(rect.left + rect.width / 2),
527
537
  Math.round(rect.top + rect.height / 2)
528
538
  ],
529
- // attributes,
530
539
  content: text,
531
540
  rect,
532
- zoom: rect.zoom,
533
- screenWidth: currentWindow.innerWidth,
534
- screenHeight: currentWindow.innerHeight
541
+ zoom: rect.zoom
535
542
  };
536
543
  return elementInfo;
537
544
  }
@@ -556,9 +563,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
556
563
  Math.round(rect.left + rect.width / 2),
557
564
  Math.round(rect.top + rect.height / 2)
558
565
  ],
559
- zoom: rect.zoom,
560
- screenWidth: currentWindow.innerWidth,
561
- screenHeight: currentWindow.innerHeight
566
+ zoom: rect.zoom
562
567
  };
563
568
  return elementInfo;
564
569
  }
@@ -1,47 +1,2 @@
1
- import { NodeType } from './constants.js';
2
- import { B as BaseElement, E as ElementTreeNode } from './index-305e7a7e.js';
3
-
4
- declare function descriptionOfTree<ElementType extends BaseElement = BaseElement>(tree: ElementTreeNode<ElementType>, truncateTextLength?: number, filterNonTextContent?: boolean): string;
5
- declare function treeToList<T extends BaseElement>(tree: ElementTreeNode<T>): T[];
6
- declare function traverseTree<T extends BaseElement, ReturnNodeType extends BaseElement>(tree: ElementTreeNode<T>, onNode: (node: T) => ReturnNodeType): ElementTreeNode<ReturnNodeType>;
7
-
8
- interface WebElementInfo extends ElementInfo {
9
- zoom: number;
10
- screenWidth?: number;
11
- screenHeight?: number;
12
- }
13
- interface WebElementNode {
14
- node: WebElementInfo | null;
15
- children: WebElementNode[];
16
- }
17
- declare function extractTextWithPosition$1(initNode: globalThis.Node, debugMode?: boolean): WebElementInfo[];
18
- declare function extractTreeNodeAsString(initNode: globalThis.Node, debugMode?: boolean): string;
19
- declare function extractTreeNode(initNode: globalThis.Node, debugMode?: boolean): WebElementNode;
20
-
21
- declare function extractTextWithPosition(initNode: globalThis.Document): ElementInfo[];
22
-
23
- interface ElementInfo {
24
- id: string;
25
- indexId: number;
26
- nodeHashId: string;
27
- locator: string;
28
- attributes: {
29
- nodeType: NodeType;
30
- [key: string]: string;
31
- };
32
- nodeType: NodeType;
33
- content: string;
34
- rect: {
35
- left: number;
36
- top: number;
37
- width: number;
38
- height: number;
39
- };
40
- center: [number, number];
41
- }
42
- interface ElementNode {
43
- node: ElementInfo | null;
44
- children: ElementNode[];
45
- }
46
-
47
- export { type ElementInfo, type ElementNode, extractTextWithPosition as clientExtractTextWithPosition, descriptionOfTree, traverseTree, treeToList, extractTreeNode as webExtractNodeTree, extractTreeNodeAsString as webExtractNodeTreeAsString, extractTextWithPosition$1 as webExtractTextWithPosition };
1
+ import './constants.js';
2
+ export { E as ElementInfo, a as ElementNode, d as descriptionOfTree, i as getElementInfoByXpath, h as getNodeInfoByXpath, g as getXpathsById, s as setNodeHashCacheListOnWindow, t as traverseTree, b as treeToList, c as webExtractNodeTree, f as webExtractNodeTreeAsString, e as webExtractTextWithPosition } from './index-2cb7865f.js';
@@ -483,8 +483,32 @@ function getNodeAttributes(node, currentWindow) {
483
483
  }
484
484
  function midsceneGenerateHash(node, content, rect) {
485
485
  const slicedHash = generateHashId(rect, content);
486
+ if (node) {
487
+ if (!window.midsceneNodeHashCacheList) {
488
+ setNodeHashCacheListOnWindow();
489
+ }
490
+ setNodeToCacheList(node, slicedHash);
491
+ }
486
492
  return slicedHash;
487
493
  }
494
+ function setNodeHashCacheListOnWindow() {
495
+ if (typeof window !== "undefined") {
496
+ window.midsceneNodeHashCacheList = [];
497
+ }
498
+ }
499
+ function setNodeToCacheList(node, id) {
500
+ if (typeof window !== "undefined") {
501
+ window.midsceneNodeHashCacheList.push({ node, id });
502
+ }
503
+ }
504
+ function getNodeFromCacheList(id) {
505
+ if (typeof window !== "undefined") {
506
+ return window.midsceneNodeHashCacheList.find(
507
+ (item) => item.id === id
508
+ )?.node;
509
+ }
510
+ return null;
511
+ }
488
512
  function getTopDocument() {
489
513
  const container = document.body || document;
490
514
  return container;
@@ -545,9 +569,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
545
569
  Math.round(rect.left + rect.width / 2),
546
570
  Math.round(rect.top + rect.height / 2)
547
571
  ],
548
- zoom: rect.zoom,
549
- screenWidth: currentWindow.innerWidth,
550
- screenHeight: currentWindow.innerHeight
572
+ zoom: rect.zoom
551
573
  };
552
574
  return elementInfo;
553
575
  }
@@ -574,9 +596,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
574
596
  Math.round(rect.left + rect.width / 2),
575
597
  Math.round(rect.top + rect.height / 2)
576
598
  ],
577
- zoom: rect.zoom,
578
- screenWidth: currentWindow.innerWidth,
579
- screenHeight: currentWindow.innerHeight
599
+ zoom: rect.zoom
580
600
  };
581
601
  return elementInfo;
582
602
  }
@@ -604,9 +624,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
604
624
  Math.round(rect.left + rect.width / 2),
605
625
  Math.round(rect.top + rect.height / 2)
606
626
  ],
607
- zoom: rect.zoom,
608
- screenWidth: currentWindow.innerWidth,
609
- screenHeight: currentWindow.innerHeight
627
+ zoom: rect.zoom
610
628
  };
611
629
  return elementInfo;
612
630
  }
@@ -637,12 +655,9 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
637
655
  Math.round(rect.left + rect.width / 2),
638
656
  Math.round(rect.top + rect.height / 2)
639
657
  ],
640
- // attributes,
641
658
  content: text,
642
659
  rect,
643
- zoom: rect.zoom,
644
- screenWidth: currentWindow.innerWidth,
645
- screenHeight: currentWindow.innerHeight
660
+ zoom: rect.zoom
646
661
  };
647
662
  return elementInfo;
648
663
  }
@@ -667,9 +682,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
667
682
  Math.round(rect.left + rect.width / 2),
668
683
  Math.round(rect.top + rect.height / 2)
669
684
  ],
670
- zoom: rect.zoom,
671
- screenWidth: currentWindow.innerWidth,
672
- screenHeight: currentWindow.innerHeight
685
+ zoom: rect.zoom
673
686
  };
674
687
  return elementInfo;
675
688
  }
@@ -778,166 +791,113 @@ function extractTreeNode(initNode, debugMode2 = false) {
778
791
  };
779
792
  }
780
793
 
781
- // src/extractor/client-extractor.ts
782
- function getNodeAttributes2(node) {
783
- const attrs = {};
784
- if (node && node.nodeType === 1) {
785
- const element = node;
786
- for (let i = 0; i < element.attributes.length; i++) {
787
- const attr = element.attributes[i];
788
- attrs[attr.nodeName] = attr.nodeValue ?? "";
789
- }
790
- }
791
- return attrs;
792
- }
793
- function getRect2(attributes) {
794
- const x = Math.round(Number.parseFloat(attributes.x ?? "0"));
795
- const y = Math.round(Number.parseFloat(attributes.y ?? "0"));
796
- const width = Math.round(Number.parseFloat(attributes.width ?? "0"));
797
- const height = Math.round(Number.parseFloat(attributes.height ?? "0"));
798
- return {
799
- left: Math.max(0, Math.floor(x)),
800
- top: Math.max(0, Math.floor(y)),
801
- width: Math.max(0, width),
802
- height: Math.max(0, height)
803
- };
804
- }
805
- function validTextNodeContent(node) {
806
- if (node.nodeType === 3) {
807
- return node.nodeValue?.trim() || "";
808
- }
809
- return "";
810
- }
811
- function getXPathForElement(element) {
812
- if (element.nodeType !== 1) {
813
- return "";
794
+ // src/extractor/locator.ts
795
+ var getElementIndex = (element) => {
796
+ let index = 1;
797
+ let prev = element.previousElementSibling;
798
+ while (prev) {
799
+ if (prev.nodeName.toLowerCase() === element.nodeName.toLowerCase()) {
800
+ index++;
801
+ }
802
+ prev = prev.previousElementSibling;
814
803
  }
815
- const getIndex = (sib, name) => {
816
- let count = 1;
817
- for (let cur = sib.previousSibling; cur; cur = cur.previousSibling) {
818
- if (cur.nodeType === 1 && cur.nodeName === name) {
819
- count++;
820
- }
804
+ return index;
805
+ };
806
+ var findFirstAncestorWithId = (element) => {
807
+ let current = element;
808
+ while (current?.parentElement) {
809
+ if (current.id) {
810
+ return current;
821
811
  }
822
- return count;
823
- };
824
- const buildAttributePart = (elem) => {
825
- const attributes = ["id", "resource-id", "content-desc", "class"];
826
- for (const attr of attributes) {
827
- if (elem.hasAttribute(attr)) {
828
- const value = elem.getAttribute(attr);
829
- if (value && value.trim() !== "") {
830
- return `[@${attr}="${value}"]`;
831
- }
832
- }
812
+ current = current.parentElement;
813
+ }
814
+ return null;
815
+ };
816
+ var getElementXPath = (element) => {
817
+ if (element.nodeType === Node.TEXT_NODE) {
818
+ const parentNode = element.parentNode;
819
+ if (parentNode && parentNode.nodeType === Node.ELEMENT_NODE) {
820
+ const parentXPath = getElementXPath(parentNode);
821
+ return `${parentXPath}/text()`;
833
822
  }
834
823
  return "";
835
- };
836
- const getPath = (node, path = "") => {
837
- if (node.parentNode) {
838
- path = getPath(node.parentNode, path);
839
- }
840
- if (node.nodeType === 1) {
841
- const elem = node;
842
- const tagName = elem.nodeName.toLowerCase();
843
- let part = `/${tagName}`;
844
- const attributePart = buildAttributePart(elem);
845
- if (attributePart) {
846
- part += attributePart;
847
- } else {
848
- const index = getIndex(node, node.nodeName);
849
- if (index > 1) {
850
- part += `[${index}]`;
851
- }
852
- }
853
- path += part;
854
- }
855
- return path;
856
- };
857
- return getPath(element);
824
+ }
825
+ if (element.nodeType !== Node.ELEMENT_NODE)
826
+ return "";
827
+ const el = element;
828
+ if (el === document.documentElement) {
829
+ return "/html";
830
+ }
831
+ if (el === document.body) {
832
+ return "/html/body";
833
+ }
834
+ if (el.id) {
835
+ return `//*[@id="${el.id}"]`;
836
+ }
837
+ const ancestorWithId = findFirstAncestorWithId(el);
838
+ if (ancestorWithId) {
839
+ const ancestorPath = `//*[@id="${ancestorWithId.id}"]`;
840
+ let current = el;
841
+ const pathParts = [];
842
+ while (current && current !== ancestorWithId) {
843
+ const index2 = getElementIndex(current);
844
+ const tagName2 = current.nodeName.toLowerCase();
845
+ pathParts.unshift(`${tagName2}[${index2}]`);
846
+ current = current.parentElement;
847
+ }
848
+ return pathParts.length > 0 ? `${ancestorPath}/${pathParts.join("/")}` : ancestorPath;
849
+ }
850
+ if (!el.parentNode) {
851
+ return `/${el.nodeName.toLowerCase()}`;
852
+ }
853
+ const index = getElementIndex(el);
854
+ const tagName = el.nodeName.toLowerCase();
855
+ if (el.parentNode) {
856
+ const parentXPath = getElementXPath(el.parentNode);
857
+ return `${parentXPath}/${tagName}[${index}]`;
858
+ }
859
+ return `/${tagName}[${index}]`;
860
+ };
861
+ function generateXPaths(node) {
862
+ if (!node)
863
+ return [];
864
+ const xPath = getElementXPath(node);
865
+ return [xPath];
866
+ }
867
+ function getXpathsById(id) {
868
+ const node = getNodeFromCacheList(id);
869
+ if (!node) {
870
+ return null;
871
+ }
872
+ return generateXPaths(node);
858
873
  }
859
- function extractTextWithPosition2(initNode) {
860
- const elementInfoArray = [];
861
- let nodeIndex = 1;
862
- function dfs(node, parentNode = null) {
863
- if (!node) {
864
- return;
865
- }
866
- const currentNodeDes = { node, children: [] };
867
- if (parentNode) {
868
- parentNode.children.push(currentNodeDes);
869
- }
870
- collectElementInfo2(node);
871
- if (node.childNodes && node.childNodes.length > 0) {
872
- for (let i = 0; i < node.childNodes.length; i++) {
873
- dfs(node.childNodes[i], currentNodeDes);
874
- }
875
- }
874
+ function getNodeInfoByXpath(xpath) {
875
+ const xpathResult = document.evaluate(
876
+ xpath,
877
+ document,
878
+ null,
879
+ XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
880
+ null
881
+ );
882
+ if (xpathResult.snapshotLength !== 1) {
883
+ return null;
876
884
  }
877
- function collectElementInfo2(node) {
878
- const attributes = getNodeAttributes2(node);
879
- const rect = getRect2(attributes);
880
- const nodeHashId = midsceneGenerateHash(null, attributes.placeholder, rect);
881
- const text = validTextNodeContent(node);
882
- let nodeType;
883
- switch (node.nodeName.toUpperCase()) {
884
- case "TEXT":
885
- nodeType = "TEXT Node" /* TEXT */;
886
- break;
887
- case "IMAGE":
888
- nodeType = "IMG Node" /* IMG */;
889
- break;
890
- case "BUTTON":
891
- nodeType = "BUTTON Node" /* BUTTON */;
892
- break;
893
- case "SEARCHINPUT":
894
- case "TEXTINPUT":
895
- case "INPUT":
896
- nodeType = "FORM_ITEM Node" /* FORM_ITEM */;
897
- break;
898
- case "NAV":
899
- case "LIST":
900
- case "CELL":
901
- nodeType = "CONTAINER Node" /* CONTAINER */;
902
- break;
903
- default:
904
- if (attributes.id === "android:id/input" || attributes.id === "android:id/inputArea") {
905
- nodeType = "FORM_ITEM Node" /* FORM_ITEM */;
906
- } else {
907
- nodeType = "CONTAINER Node" /* CONTAINER */;
908
- }
909
- break;
910
- }
911
- const xpath = getXPathForElement(node);
912
- const elementInfo = {
913
- id: nodeHashId,
914
- indexId: nodeIndex++,
915
- nodeHashId,
916
- locator: xpath,
917
- attributes: {
918
- nodeType,
919
- ...attributes
920
- },
921
- content: text,
922
- rect,
923
- center: [
924
- Math.round(rect.left + rect.width / 2),
925
- Math.round(rect.top + rect.height / 2)
926
- ],
927
- nodeType
928
- };
929
- if (elementInfo.nodeType !== "CONTAINER Node" /* CONTAINER */) {
930
- elementInfoArray.push(elementInfo);
931
- }
885
+ const node = xpathResult.snapshotItem(0);
886
+ return node;
887
+ }
888
+ function getElementInfoByXpath(xpath) {
889
+ const node = getNodeInfoByXpath(xpath);
890
+ if (!node) {
891
+ return null;
932
892
  }
933
- const rootNode = initNode;
934
- const rootDescriptor = { node: rootNode, children: [] };
935
- dfs(rootNode, rootDescriptor);
936
- return elementInfoArray;
893
+ return collectElementInfo(node, window, document);
937
894
  }
938
895
  export {
939
- extractTextWithPosition2 as clientExtractTextWithPosition,
940
896
  descriptionOfTree,
897
+ getElementInfoByXpath,
898
+ getNodeInfoByXpath,
899
+ getXpathsById,
900
+ setNodeHashCacheListOnWindow,
941
901
  traverseTree,
942
902
  treeToList,
943
903
  extractTreeNode as webExtractNodeTree,
package/dist/es/fs.d.ts CHANGED
@@ -10,6 +10,7 @@ declare function getRunningPkgInfo(dir?: string): PkgInfo | null;
10
10
  * @returns {string|null} - The most recent package.json file path or null
11
11
  */
12
12
  declare function findNearestPackageJson(dir: string): string | null;
13
+ declare function getElementInfosScriptContent(): string;
13
14
  declare function getExtraReturnLogic(tree?: boolean): Promise<string | null>;
14
15
 
15
- export { findNearestPackageJson, getExtraReturnLogic, getRunningPkgInfo };
16
+ export { findNearestPackageJson, getElementInfosScriptContent, getExtraReturnLogic, getRunningPkgInfo };
package/dist/es/fs.js CHANGED
@@ -50,15 +50,19 @@ function findNearestPackageJson(dir) {
50
50
  }
51
51
  return findNearestPackageJson(parentDir);
52
52
  }
53
- async function getExtraReturnLogic(tree = false) {
54
- if (ifInBrowser) {
55
- return null;
56
- }
53
+ function getElementInfosScriptContent() {
57
54
  const currentFilePath = __filename;
58
55
  const pathDir = findNearestPackageJson(dirname(currentFilePath));
59
56
  assert(pathDir, `can't find pathDir, with ${dirname}`);
60
57
  const scriptPath = path.join(pathDir, "./dist/script/htmlElement.js");
61
58
  const elementInfosScriptContent = readFileSync(scriptPath, "utf-8");
59
+ return elementInfosScriptContent;
60
+ }
61
+ async function getExtraReturnLogic(tree = false) {
62
+ if (ifInBrowser) {
63
+ return null;
64
+ }
65
+ const elementInfosScriptContent = `${getElementInfosScriptContent()}midscene_element_inspector.setNodeHashCacheListOnWindow();`;
62
66
  if (tree) {
63
67
  return `${elementInfosScriptContent}midscene_element_inspector.webExtractNodeTree()`;
64
68
  }
@@ -66,6 +70,7 @@ async function getExtraReturnLogic(tree = false) {
66
70
  }
67
71
  export {
68
72
  findNearestPackageJson,
73
+ getElementInfosScriptContent,
69
74
  getExtraReturnLogic,
70
75
  getRunningPkgInfo
71
76
  };
package/dist/es/img.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import Jimp from 'jimp';
3
- import { R as Rect, B as BaseElement } from './index-305e7a7e.js';
3
+ import { R as Rect, B as BaseElement } from './index-2cb7865f.js';
4
4
  import './constants.js';
5
5
 
6
6
  interface Size {
@@ -0,0 +1,78 @@
1
+ import { NodeType } from './constants.js';
2
+
3
+ declare function descriptionOfTree<ElementType extends BaseElement = BaseElement>(tree: ElementTreeNode<ElementType>, truncateTextLength?: number, filterNonTextContent?: boolean): string;
4
+ declare function treeToList<T extends BaseElement>(tree: ElementTreeNode<T>): T[];
5
+ declare function traverseTree<T extends BaseElement, ReturnNodeType extends BaseElement>(tree: ElementTreeNode<T>, onNode: (node: T) => ReturnNodeType): ElementTreeNode<ReturnNodeType>;
6
+
7
+ interface WebElementNode {
8
+ node: WebElementInfo | null;
9
+ children: WebElementNode[];
10
+ }
11
+ declare function extractTextWithPosition(initNode: globalThis.Node, debugMode?: boolean): WebElementInfo[];
12
+ declare function extractTreeNodeAsString(initNode: globalThis.Node, debugMode?: boolean): string;
13
+ declare function extractTreeNode(initNode: globalThis.Node, debugMode?: boolean): WebElementNode;
14
+
15
+ declare function setNodeHashCacheListOnWindow(): void;
16
+
17
+ declare function getXpathsById(id: string): string[] | null;
18
+ declare function getNodeInfoByXpath(xpath: string): Node | null;
19
+ declare function getElementInfoByXpath(xpath: string): ElementInfo | null;
20
+
21
+ interface ElementInfo {
22
+ id: string;
23
+ indexId: number;
24
+ nodeHashId: string;
25
+ locator: string;
26
+ xpaths?: string[];
27
+ attributes: {
28
+ nodeType: NodeType;
29
+ [key: string]: string;
30
+ };
31
+ nodeType: NodeType;
32
+ content: string;
33
+ rect: {
34
+ left: number;
35
+ top: number;
36
+ width: number;
37
+ height: number;
38
+ };
39
+ center: [number, number];
40
+ }
41
+ interface ElementNode {
42
+ node: ElementInfo | null;
43
+ children: ElementNode[];
44
+ }
45
+
46
+ interface Point {
47
+ left: number;
48
+ top: number;
49
+ }
50
+ interface Size {
51
+ width: number;
52
+ height: number;
53
+ dpr?: number;
54
+ }
55
+ type Rect = Point & Size & {
56
+ zoom?: number;
57
+ };
58
+ declare abstract class BaseElement {
59
+ abstract id: string;
60
+ abstract indexId?: number;
61
+ abstract attributes: {
62
+ nodeType: NodeType;
63
+ [key: string]: string;
64
+ };
65
+ abstract content: string;
66
+ abstract rect: Rect;
67
+ abstract center: [number, number];
68
+ abstract locator?: string;
69
+ }
70
+ interface ElementTreeNode<ElementType extends BaseElement = BaseElement> {
71
+ node: ElementType | null;
72
+ children: ElementTreeNode<ElementType>[];
73
+ }
74
+ interface WebElementInfo extends ElementInfo {
75
+ zoom: number;
76
+ }
77
+
78
+ export { BaseElement as B, type ElementInfo as E, type Point as P, type Rect as R, type Size as S, type WebElementInfo as W, type ElementNode as a, treeToList as b, extractTreeNode as c, descriptionOfTree as d, extractTextWithPosition as e, extractTreeNodeAsString as f, getXpathsById as g, getNodeInfoByXpath as h, getElementInfoByXpath as i, type ElementTreeNode as j, setNodeHashCacheListOnWindow as s, traverseTree as t };
@@ -0,0 +1,2 @@
1
+ import './constants.js';
2
+ export { B as BaseElement, j as ElementTreeNode, P as Point, R as Rect, S as Size, W as WebElementInfo } from './index-2cb7865f.js';
@@ -0,0 +1,6 @@
1
+ // src/types/index.ts
2
+ var BaseElement = class {
3
+ };
4
+ export {
5
+ BaseElement
6
+ };