export interface WidthResult { selector: string; found: boolean; rect: { x: number; y: number; width: number; height: number; }; parentTag: string; parentWidth: number; viewportWidth: number; /** `rect.width / viewportWidth`, rounded to 3 decimals. */ viewportFill: number; /** `rect.width / parentWidth`, rounded to 3 decimals. 0 when no parent. */ parentFill: number; } /** One element protruding past the viewport. */ export interface OverflowElement { tagName: string; className: string; id: string; rect: { x: number; y: number; width: number; height: number; }; /** Pixels this element's own width exceeds the viewport. 0 if it fits. */ widthOverflowPx: number; /** Pixels this element's right edge extends past the viewport's right. */ rightOverflowPx: number; } export interface OverflowResult { viewport: { width: number; height: number; }; documentScrollWidth: number; hasHorizontalOverflow: boolean; /** documentScrollWidth - viewport.width. Negative/zero means no overflow. */ overflowPx: number; /** Top N elements whose own width exceeds viewport, ranked desc. */ widerThanViewport: OverflowElement[]; /** Top N elements whose right edge protrudes past viewport (but own width fits). */ rightOverflow: OverflowElement[]; } /** * Build the JS function passed to `page.evaluate`. Returns a function * reference (not a string) so Playwright serializes args properly. */ export declare function buildWidthCheck(): (args: { selectors: string[]; }) => WidthResult[]; /** * Build the JS function for overflow detection. Sweeps every element for * widthOverflow (own width > viewport) and rightOverflow (right-edge past * viewport). Caps each list at `sampleLimit` so a degenerate document with * thousands of overflowing elements doesn't blow up the JSON envelope. */ export declare function buildOverflowCheck(): (args: { sampleLimit: number; }) => OverflowResult; /** * Annotate width-check + overflow results onto the live page so the captured * screenshot carries the diagnostic overlay. Separate root from * visibility.ts's annotations so both can coexist on the same screenshot. * * Width targets: green if `viewportFill >= widthThreshold`, red otherwise. * Overflow: dashed amber line at the viewport's right edge + amber boxes * around each protruding element. */ export declare function buildLayoutAnnotateScript(): (args: { widths: WidthResult[]; overflow: OverflowResult | null; widthThreshold: number; }) => void; export declare function buildClearLayoutAnnotationsScript(): () => void; //# sourceMappingURL=layout.d.ts.map