import type { ViewNode } from '@mobilewright/protocol'; /** Discriminated union of the four locator strategies mobilewright supports. */ export type Locator = { kind: 'testId'; value: string; } | { kind: 'role'; value: string; name: string | undefined; } | { kind: 'label'; value: string; } | { kind: 'text'; value: string; }; export interface ElementEntry { node: ViewNode; locator: Locator | null; locators: Locator[]; /** Nesting level in the view tree; roots are 0. With the depth-first order this rebuilds the tree. */ depth: number; } /** Whether text can be typed into the node: the same types getByRole('textfield') matches. */ export declare function isEditable(node: ViewNode): boolean; /** * Derive all matching mobilewright locators for a single ViewNode. * Returns array ordered by priority: testId > role > label > text. * Empty array when no supported locator field is present. */ export declare function deriveLocators(node: ViewNode): Locator[]; /** Keep single-locator derive for backward compat — returns highest priority match or null. */ export declare function deriveLocator(node: ViewNode): Locator | null; /** * Flatten a ViewNode tree depth-first and annotate each node with its locators. * Nodes with no locatable field are included with locators: []. */ export declare function deriveElementList(roots: ViewNode[]): ElementEntry[]; /** Where a node sits among every node its locator matches. */ export interface MatchPosition { index: number; count: number; } /** * Position of `node` among all matches of `locator`, computed with core's own query * engine, so `index` is exactly what `.nth(index)` resolves to when the test runs. * Returns null when the locator does not match the node at all. * ponytail: one full-tree query per element, O(n²) per refresh; index the tree if screens get huge. */ export declare function locatorMatchPosition(roots: ViewNode[], node: ViewNode, locator: Locator): MatchPosition | null; //# sourceMappingURL=locator-derivation.d.ts.map