screw-bugs 0.0.0-stage → 0.1.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 (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +906 -2
  3. package/bin/screw-bugs.js +29 -0
  4. package/dist/browser-playwright/annotate.d.ts +9 -0
  5. package/dist/browser-playwright/annotate.js +86 -0
  6. package/dist/browser-playwright/capture.d.ts +232 -0
  7. package/dist/browser-playwright/capture.js +1049 -0
  8. package/dist/browser-playwright/frames.d.ts +77 -0
  9. package/dist/browser-playwright/frames.js +191 -0
  10. package/dist/browser-playwright/index.d.ts +2 -0
  11. package/dist/browser-playwright/index.js +2 -0
  12. package/dist/browser-playwright/input.d.ts +44 -0
  13. package/dist/browser-playwright/input.js +116 -0
  14. package/dist/browser-playwright/launch.d.ts +21 -0
  15. package/dist/browser-playwright/launch.js +86 -0
  16. package/dist/browser-playwright/page.d.ts +387 -0
  17. package/dist/browser-playwright/page.js +1930 -0
  18. package/dist/build-info.json +5 -0
  19. package/dist/cli/app.d.ts +19 -0
  20. package/dist/cli/app.js +70 -0
  21. package/dist/cli/build-info.d.ts +52 -0
  22. package/dist/cli/build-info.js +82 -0
  23. package/dist/cli/commands.d.ts +14 -0
  24. package/dist/cli/commands.js +308 -0
  25. package/dist/cli/config.d.ts +16 -0
  26. package/dist/cli/config.js +71 -0
  27. package/dist/cli/doctor.d.ts +19 -0
  28. package/dist/cli/doctor.js +113 -0
  29. package/dist/cli/environment.d.ts +20 -0
  30. package/dist/cli/environment.js +34 -0
  31. package/dist/cli/exit-codes.d.ts +29 -0
  32. package/dist/cli/exit-codes.js +28 -0
  33. package/dist/cli/failure.d.ts +20 -0
  34. package/dist/cli/failure.js +15 -0
  35. package/dist/cli/index.d.ts +6 -0
  36. package/dist/cli/index.js +6 -0
  37. package/dist/cli/install-method.d.ts +96 -0
  38. package/dist/cli/install-method.js +148 -0
  39. package/dist/cli/main.d.ts +1 -0
  40. package/dist/cli/main.js +10 -0
  41. package/dist/cli/mcp.d.ts +30 -0
  42. package/dist/cli/mcp.js +309 -0
  43. package/dist/cli/node-version.d.ts +3 -0
  44. package/dist/cli/node-version.js +22 -0
  45. package/dist/cli/operations.d.ts +127 -0
  46. package/dist/cli/operations.js +337 -0
  47. package/dist/cli/package-info.d.ts +22 -0
  48. package/dist/cli/package-info.js +25 -0
  49. package/dist/cli/report-server.d.ts +170 -0
  50. package/dist/cli/report-server.js +387 -0
  51. package/dist/cli/signals.d.ts +37 -0
  52. package/dist/cli/signals.js +61 -0
  53. package/dist/cli/stamp-build.d.ts +1 -0
  54. package/dist/cli/stamp-build.js +9 -0
  55. package/dist/cli/update-check.d.ts +140 -0
  56. package/dist/cli/update-check.js +316 -0
  57. package/dist/cli/uploads.d.ts +16 -0
  58. package/dist/cli/uploads.js +80 -0
  59. package/dist/core/css.d.ts +95 -0
  60. package/dist/core/css.js +436 -0
  61. package/dist/core/engine.d.ts +65 -0
  62. package/dist/core/engine.js +436 -0
  63. package/dist/core/errors.d.ts +66 -0
  64. package/dist/core/errors.js +30 -0
  65. package/dist/core/evidence.d.ts +14 -0
  66. package/dist/core/evidence.js +127 -0
  67. package/dist/core/index.d.ts +12 -0
  68. package/dist/core/index.js +12 -0
  69. package/dist/core/labels.d.ts +47 -0
  70. package/dist/core/labels.js +199 -0
  71. package/dist/core/liveness.d.ts +45 -0
  72. package/dist/core/liveness.js +64 -0
  73. package/dist/core/marks.d.ts +63 -0
  74. package/dist/core/marks.js +410 -0
  75. package/dist/core/services.d.ts +444 -0
  76. package/dist/core/services.js +22 -0
  77. package/dist/core/steps.d.ts +96 -0
  78. package/dist/core/steps.js +656 -0
  79. package/dist/core/uploads.d.ts +49 -0
  80. package/dist/core/uploads.js +133 -0
  81. package/dist/core/video.d.ts +16 -0
  82. package/dist/core/video.js +101 -0
  83. package/dist/core/viewport.d.ts +28 -0
  84. package/dist/core/viewport.js +50 -0
  85. package/dist/report/html.d.ts +37 -0
  86. package/dist/report/html.js +762 -0
  87. package/dist/report/index.d.ts +5 -0
  88. package/dist/report/index.js +5 -0
  89. package/dist/report/markup.d.ts +27 -0
  90. package/dist/report/markup.js +75 -0
  91. package/dist/report/pr-summary.d.ts +11 -0
  92. package/dist/report/pr-summary.js +110 -0
  93. package/dist/report/sha256.d.ts +9 -0
  94. package/dist/report/sha256.js +97 -0
  95. package/dist/report/styles.d.ts +1 -0
  96. package/dist/report/styles.js +328 -0
  97. package/dist/report/view.d.ts +141 -0
  98. package/dist/report/view.js +368 -0
  99. package/dist/report/walkthrough.d.ts +75 -0
  100. package/dist/report/walkthrough.js +458 -0
  101. package/dist/schema/config.d.ts +7 -0
  102. package/dist/schema/config.js +6 -0
  103. package/dist/schema/doctor.d.ts +46 -0
  104. package/dist/schema/doctor.js +23 -0
  105. package/dist/schema/evidence.d.ts +994 -0
  106. package/dist/schema/evidence.js +521 -0
  107. package/dist/schema/findings.d.ts +159 -0
  108. package/dist/schema/findings.js +80 -0
  109. package/dist/schema/index.d.ts +7 -0
  110. package/dist/schema/index.js +7 -0
  111. package/dist/schema/job.d.ts +1724 -0
  112. package/dist/schema/job.js +505 -0
  113. package/dist/schema/ledger.d.ts +951 -0
  114. package/dist/schema/ledger.js +193 -0
  115. package/dist/schema/status.d.ts +7 -0
  116. package/dist/schema/status.js +11 -0
  117. package/dist/store-local/accounts.d.ts +7 -0
  118. package/dist/store-local/accounts.js +9 -0
  119. package/dist/store-local/index.d.ts +3 -0
  120. package/dist/store-local/index.js +3 -0
  121. package/dist/store-local/paths.d.ts +10 -0
  122. package/dist/store-local/paths.js +17 -0
  123. package/dist/store-local/storage.d.ts +20 -0
  124. package/dist/store-local/storage.js +170 -0
  125. package/package.json +73 -4
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ // Keep this file to syntax every Node version can parse, so people on an old Node get a plain
3
+ // message instead of a syntax error. The minimum comes from "engines" in package.json.
4
+ import { readFileSync } from 'fs';
5
+
6
+ var pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
7
+ var minimum = /(\d+)\.(\d+)\.(\d+)/.exec(pkg.engines.node).slice(1).map(Number);
8
+ var current = process.versions.node.split('.').map(Number);
9
+
10
+ function isOldNode() {
11
+ for (var i = 0; i < 3; i++) {
12
+ if (current[i] !== minimum[i]) return current[i] < minimum[i];
13
+ }
14
+ return false;
15
+ }
16
+
17
+ if (isOldNode()) {
18
+ console.error(
19
+ 'screw-bugs needs Node.js ' +
20
+ minimum.join('.') +
21
+ ' or newer, but this is Node.js ' +
22
+ process.versions.node +
23
+ '.\n' +
24
+ 'Install the current LTS release from https://nodejs.org, then run the command again.',
25
+ );
26
+ process.exit(1);
27
+ }
28
+
29
+ import('../dist/cli/main.js');
@@ -0,0 +1,9 @@
1
+ import { Effect } from 'effect';
2
+ import type { Browser as PlaywrightBrowser } from 'playwright-core';
3
+ import { type AnnotateJob } from '../core/index.js';
4
+ /** How long drawing one annotated copy may take. */
5
+ export declare const ANNOTATE_TIMEOUT_MS = 15000;
6
+ /** The drawing page: the screenshot at its own size, with each box and its label on top. */
7
+ export declare const annotationPage: (job: AnnotateJob) => string;
8
+ /** Draws every job's copy in turn; resolves with the ones written. */
9
+ export declare const annotateAll: (browser: PlaywrightBrowser, jobs: ReadonlyArray<AnnotateJob>) => Effect.Effect<string[], never, never>;
@@ -0,0 +1,86 @@
1
+ import { Effect } from 'effect';
2
+ import { clipBox, outsetBox, placeLabels } from '../core/index.js';
3
+ /** How long drawing one annotated copy may take. */
4
+ export const ANNOTATE_TIMEOUT_MS = 15_000;
5
+ /** The made-up origin the drawing page is served from; nothing is fetched from the network. */
6
+ const ORIGIN = 'http://screw-bugs.annotate';
7
+ /** Box colors on the image, the same in light and dark reports: screenshots have no theme. */
8
+ const colors = { red: '#e5484d', green: '#12a150' };
9
+ const escapeHtml = (text) => text.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
10
+ /** The drawing page: the screenshot at its own size, with each box and its label on top. */
11
+ export const annotationPage = (job) => {
12
+ // Lines grow with the image, so they read the same on a phone's 3x screenshot as on a desktop's.
13
+ const line = Math.max(3, Math.round(job.width / 400));
14
+ const font = Math.max(14, Math.round(job.width / 80));
15
+ const [padY, padX] = [Math.round(font / 4), Math.round(font / 2.5)];
16
+ // A box's line goes outside its element, a white ring (`ring`) away from it, so it never covers
17
+ // the element; only at the image's edge, with no room outside, is it cut back onto it.
18
+ const ring = Math.ceil(line / 2);
19
+ // Labels go outside their boxes, past the line's outer white ring too.
20
+ const gap = ring + 4;
21
+ const image = { x: 0, y: 0, width: job.width, height: job.height };
22
+ const marks = job.marks.map((mark) => ({
23
+ ...mark,
24
+ box: clipBox(outsetBox(mark.box, line + ring), image),
25
+ }));
26
+ // Bold digits and letters are at most about 0.62 em wide; the label's white ring adds 2px a side.
27
+ const places = placeLabels(job, marks.map(({ box, label }) => ({
28
+ box,
29
+ label: {
30
+ width: Math.ceil(label.length * font * 0.62) + 2 * padX + 4,
31
+ height: font + 2 * padY + 4,
32
+ },
33
+ })), gap, job.obstacles);
34
+ const boxes = marks
35
+ .map(({ box, color, label }, i) => `<div class="b" style="left:${box.x}px;top:${box.y}px;width:${box.width}px;` +
36
+ `height:${box.height}px;border-color:${colors[color]}">` +
37
+ `<span class="l ${places[i].spot}" style="background:${colors[color]}` +
38
+ `${places[i].shift > 0 ? `;margin-left:${Math.round(places[i].shift)}px` : ''}">` +
39
+ `${escapeHtml(label)}</span></div>`)
40
+ .join('');
41
+ // Label offsets are from the box's inner edge: its line, then the gap.
42
+ const off = `calc(100% + ${line + gap}px)`;
43
+ return (`<!doctype html><meta charset="utf-8"><style>` +
44
+ `html,body{margin:0;background:#fff}` +
45
+ `.f{position:relative;width:${job.width}px;height:${job.height}px;overflow:hidden}` +
46
+ `img{display:block;width:${job.width}px;height:${job.height}px}` +
47
+ `.b{position:absolute;box-sizing:border-box;border:${line}px solid;border-radius:${line}px;` +
48
+ `box-shadow:0 0 0 ${ring}px #fff,inset 0 0 0 ${ring}px #fff}` +
49
+ `.l{position:absolute;white-space:nowrap;` +
50
+ `font:700 ${font}px/1 system-ui,sans-serif;color:#fff;padding:${padY}px ${padX}px;` +
51
+ `border-radius:${line}px;box-shadow:0 0 0 2px #fff}` +
52
+ `.above-start,.above-end{bottom:${off}}.below-start,.below-end{top:${off}}` +
53
+ `.above-start,.below-start{left:-${line}px}.above-end,.below-end{right:-${line}px}` +
54
+ `.right{left:${off};top:-${line}px}.left{right:${off};top:-${line}px}` +
55
+ `.inside{left:0;top:0}` +
56
+ `</style><div class="f"><img src="${ORIGIN}/image.png" alt="">${boxes}</div>`);
57
+ };
58
+ /**
59
+ * Draws one copy: the screenshot and its boxes in a page of their own, served from memory and
60
+ * from the screenshot file (by Playwright's routing, so no request leaves the browser), then
61
+ * captured at the image's own size.
62
+ */
63
+ const annotateOne = (browser, job) => Effect.acquireRelease(
64
+ // Boundary: Playwright's API is promises.
65
+ Effect.tryPromise(() => browser.newContext({
66
+ viewport: { width: job.width, height: Math.min(job.height, 4_000) },
67
+ deviceScaleFactor: 1,
68
+ javaScriptEnabled: false,
69
+ })),
70
+ // A copy that was written stays written: a context that fails to close changes nothing.
71
+ (context) => Effect.tryPromise(() => context.close()).pipe(Effect.ignore)).pipe(Effect.flatMap((context) => Effect.tryPromise(async () => {
72
+ await context.route('**/*', (route) => {
73
+ const url = route.request().url();
74
+ if (url === `${ORIGIN}/`)
75
+ return route.fulfill({ contentType: 'text/html', body: annotationPage(job) });
76
+ if (url === `${ORIGIN}/image.png`)
77
+ return route.fulfill({ contentType: 'image/png', path: job.image });
78
+ return route.abort();
79
+ });
80
+ const page = await context.newPage();
81
+ await page.goto(`${ORIGIN}/`, { waitUntil: 'load', timeout: ANNOTATE_TIMEOUT_MS });
82
+ await page.screenshot({ path: job.out, fullPage: true, timeout: ANNOTATE_TIMEOUT_MS });
83
+ return job.out;
84
+ })), Effect.timeoutOption(ANNOTATE_TIMEOUT_MS * 2), Effect.map((written) => (written._tag === 'Some' ? written.value : undefined)), Effect.orElseSucceed(() => undefined), Effect.scoped);
85
+ /** Draws every job's copy in turn; resolves with the ones written. */
86
+ export const annotateAll = (browser, jobs) => Effect.forEach(jobs, (job) => annotateOne(browser, job)).pipe(Effect.map((written) => written.filter((out) => out !== undefined)));
@@ -0,0 +1,232 @@
1
+ /** An element as `captureState` returns it: a `Candidate` with its box in CSS pixels. */
2
+ export interface CapturedCandidate {
3
+ readonly tag: string;
4
+ readonly role?: string;
5
+ readonly name?: string;
6
+ readonly text?: string;
7
+ readonly label?: string;
8
+ readonly alt?: string;
9
+ readonly src?: string;
10
+ readonly href?: string;
11
+ readonly id?: string;
12
+ readonly classes?: ReadonlyArray<string>;
13
+ readonly testId?: string;
14
+ readonly attrs?: Record<string, string>;
15
+ readonly cutAttrs?: ReadonlyArray<string>;
16
+ readonly omittedAttrs?: ReadonlyArray<string>;
17
+ readonly moreAttrs?: boolean;
18
+ readonly moreClasses?: boolean;
19
+ readonly foreign?: boolean;
20
+ readonly up?: number;
21
+ readonly upCut?: boolean;
22
+ readonly box: {
23
+ x: number;
24
+ y: number;
25
+ width: number;
26
+ height: number;
27
+ };
28
+ readonly content?: {
29
+ x: number;
30
+ y: number;
31
+ width: number;
32
+ height: number;
33
+ };
34
+ readonly parent?: number;
35
+ readonly visible?: boolean;
36
+ }
37
+ /** An element that holds a kept one, as `captureState` saves it: a `PageNode`. */
38
+ export interface CapturedNode {
39
+ readonly tag: string;
40
+ readonly id?: string;
41
+ readonly classes?: ReadonlyArray<string>;
42
+ readonly testId?: string;
43
+ readonly attrs?: Record<string, string>;
44
+ readonly cutAttrs?: ReadonlyArray<string>;
45
+ readonly omittedAttrs?: ReadonlyArray<string>;
46
+ readonly moreAttrs?: boolean;
47
+ readonly moreClasses?: boolean;
48
+ readonly foreign?: boolean;
49
+ readonly parent?: number;
50
+ }
51
+ /** What `captureState` found but did not keep; the `Truncated` of the screenshot's page state. */
52
+ export interface CapturedTruncation {
53
+ readonly found: number;
54
+ readonly complete: boolean;
55
+ readonly unsaved: Record<string, number>;
56
+ readonly nested: ReadonlyArray<number>;
57
+ }
58
+ /**
59
+ * The elements a highlight may name, as they are now: interactive elements, headings, labelled
60
+ * fields and elements with a role, test ID or ARIA label first, then blocks of visible text, at
61
+ * most `max`, in page order. Boxes are in CSS pixels: from the top left of the page for a
62
+ * full-page screenshot, of the viewport otherwise. Also the device pixel ratio and scroll offsets.
63
+ * When it found more than it kept, or the page was too big to look at whole, `truncated` says so,
64
+ * with how many elements not kept share each key (as `candidateKeys` makes them) of a kept one.
65
+ * Also the visual viewport (`visual`: its scale and offset in the layout), as `VisualViewport`
66
+ * says, which boxes in the layout show through. Each element's `content` is where its visible text and images are, as in `contentOf`. An
67
+ * element that is there but not seen (see `seen`) is kept with `visible: false`. In a frame,
68
+ * `opacity` is that of its `<iframe>` with what is around it (see `frameElementInfo`), so an
69
+ * element is seen through it. Images get their alternative text and source, links their absolute
70
+ * address, each cut to `urlMax` characters (a `data:` URL to its type). For CSS selectors, each
71
+ * element gets at most `attrsMax` of its attributes (as `Attributes` says which), and the
72
+ * elements that hold kept ones are saved too, at most `nodesMax`, each with the one it is in.
73
+ */
74
+ export declare const captureState: (options: {
75
+ readonly fullPage: boolean;
76
+ readonly max: number;
77
+ readonly textMax: number;
78
+ readonly urlMax: number;
79
+ readonly attrsMax: number;
80
+ readonly attrValueMax: number;
81
+ readonly nodesMax: number;
82
+ readonly opacity?: number;
83
+ }) => {
84
+ scale: number;
85
+ scrollX: number;
86
+ scrollY: number;
87
+ candidates: {
88
+ classes?: string[];
89
+ moreClasses?: boolean;
90
+ attrs?: Record<string, string>;
91
+ cutAttrs?: string[];
92
+ omittedAttrs?: string[];
93
+ moreAttrs?: boolean;
94
+ foreign?: boolean;
95
+ tag: string;
96
+ role?: string;
97
+ name?: string;
98
+ text?: string;
99
+ label?: string;
100
+ alt?: string;
101
+ src?: string;
102
+ href?: string;
103
+ id?: string;
104
+ testId?: string;
105
+ up?: number;
106
+ upCut?: true;
107
+ box: {
108
+ x: any;
109
+ y: any;
110
+ width: any;
111
+ height: any;
112
+ };
113
+ content?: {
114
+ width: number;
115
+ height: number;
116
+ x: any;
117
+ y: any;
118
+ };
119
+ parent?: number;
120
+ visible?: false;
121
+ }[];
122
+ nodes: CapturedNode[];
123
+ truncated?: CapturedTruncation;
124
+ visual?: {
125
+ scale: any;
126
+ x: any;
127
+ y: any;
128
+ };
129
+ };
130
+ /**
131
+ * Scrolls through the whole page, a viewport at a time, and back to where it was, so that what a
132
+ * page shows only once it is scrolled to (sections that fade in, lazy images, counters) is there
133
+ * for a full-page screenshot. At most `steps` viewports, `stepMs` apart; then waits for images
134
+ * still loading while `budgetMs` from the start allows, and gives what came in, once it has
135
+ * scrolled back, `settleMs` to finish (such as a fade-in). Never takes longer than `budgetMs` and a frame or two.
136
+ * Smooth scrolling of the page is turned off meanwhile, so each step lands at once.
137
+ */
138
+ export declare const revealPage: (options: {
139
+ readonly steps: number;
140
+ readonly stepMs: number;
141
+ readonly settleMs: number;
142
+ readonly budgetMs: number;
143
+ }) => Promise<void>;
144
+ /**
145
+ * The visible text around an element: its own, or that of the nearest of its first few ancestors
146
+ * with enough to read, on one line and cut to `max` characters. Text in separate boxes is kept
147
+ * apart by a space, as in `captureState`. For the start of the page's text, pass `body`.
148
+ */
149
+ export declare const nearText: (element: unknown, max: number) => string | undefined;
150
+ /**
151
+ * Where an element's visible text and images are, relative to the top left of its own box, in CSS
152
+ * pixels: the union of its text's and its images' and fields' boxes, as `captureState` saves
153
+ * them. Undefined when it has none, or too much to look at quickly.
154
+ */
155
+ export declare const contentOf: (element: unknown) => {
156
+ x: number;
157
+ y: number;
158
+ width: number;
159
+ height: number;
160
+ } | undefined;
161
+ /** An image or link as `mediaFacts` returns it: an `ImageFact` or a `LinkFact`. */
162
+ export interface MediaFacts {
163
+ readonly images: ReadonlyArray<{
164
+ alt?: string;
165
+ src?: string;
166
+ width: number;
167
+ height: number;
168
+ }>;
169
+ readonly links: ReadonlyArray<{
170
+ text?: string;
171
+ href: string;
172
+ }>;
173
+ }
174
+ /**
175
+ * The images and links visible in the document, in page order, at most `max` of each: images with
176
+ * their alternative text (as `captureState` reads it), source and size in CSS pixels, links with
177
+ * their text and absolute address. Texts are cut to `textMax` characters, addresses to `urlMax`
178
+ * (a `data:` URL to its type).
179
+ */
180
+ export declare const mediaFacts: (options: {
181
+ readonly max: number;
182
+ readonly textMax: number;
183
+ readonly urlMax: number;
184
+ }) => MediaFacts;
185
+ /**
186
+ * Whether `root` (an element, or a document's `<html>`) shows anything yet: visible text, or a
187
+ * visible image, video, canvas or field, itself included, in open shadow roots too. An `<iframe>`
188
+ * does not count: what it shows is its own document's. Seen as `findText` sees, with `opacity`
189
+ * that of the `<iframe>` its document is in. Before it shows something, an absence of text proves
190
+ * nothing.
191
+ */
192
+ export declare const hasContent: (root: unknown, options: {
193
+ readonly opacity: number;
194
+ }) => boolean;
195
+ /** Where `findText` found its text: as visible text, an image's alt text or an ARIA label. */
196
+ export interface FoundText {
197
+ readonly as: 'text' | 'alt' | 'label';
198
+ /** The text, alt text or label that holds it, around it and cut to `max` characters. */
199
+ readonly value: string;
200
+ /** Where it is, as a short selector such as `.clients` or `#about`; missing when nothing says. */
201
+ readonly near?: string;
202
+ }
203
+ /**
204
+ * What `findText` came to: the text was found, it was not, or the document could not be read
205
+ * whole (it is too big), so that it cannot be said that it is not there.
206
+ */
207
+ export type TextSearch = ({
208
+ readonly _tag: 'found';
209
+ } & FoundText) | {
210
+ readonly _tag: 'absent';
211
+ } | {
212
+ readonly _tag: 'incomplete';
213
+ readonly reason: string;
214
+ };
215
+ /**
216
+ * Looks for `text` (case-insensitive, whitespace collapsed, as `getByText` matches) in what `root`
217
+ * shows, `root` itself included: its visible text, the alt text of its visible images (and the
218
+ * ARIA label or `<title>` of those with role img, such as an `<svg>` logo), and the ARIA labels of
219
+ * its visible elements. Open shadow roots are read as they render: a host shows its shadow root,
220
+ * a `<slot>` what is assigned to it. Visible as `captureState` judges it: with a size, not hidden,
221
+ * and not almost transparent with what is around it (`opacity` is that of the `<iframe>` the
222
+ * document is in). Text in frames inside it is not looked at here. When the document is bigger
223
+ * than it reads (`nodesMax` nodes of text, `labelsMax` labelled elements), it says so rather than
224
+ * "absent". `root` may be a shadow root itself: a closed one, which only CDP can hand over.
225
+ */
226
+ export declare const findText: (root: unknown, options: {
227
+ readonly text: string;
228
+ readonly max: number;
229
+ readonly opacity: number;
230
+ readonly nodesMax: number;
231
+ readonly labelsMax: number;
232
+ }) => TextSearch;