@e2e-dev/electron 0.0.0-stage → 0.0.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 (75) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +91 -2
  4. package/dist/.build.json +1 -0
  5. package/dist/actionability.d.ts +41 -0
  6. package/dist/actionability.js +121 -0
  7. package/dist/actions.d.ts +52 -0
  8. package/dist/actions.js +418 -0
  9. package/dist/app-process.d.ts +114 -0
  10. package/dist/app-process.js +610 -0
  11. package/dist/budget.d.ts +33 -0
  12. package/dist/budget.js +64 -0
  13. package/dist/capture.d.ts +21 -0
  14. package/dist/capture.js +137 -0
  15. package/dist/cdp/connection.d.ts +68 -0
  16. package/dist/cdp/connection.js +232 -0
  17. package/dist/cdp/input.d.ts +67 -0
  18. package/dist/cdp/input.js +195 -0
  19. package/dist/cdp/keys.d.ts +21 -0
  20. package/dist/cdp/keys.js +114 -0
  21. package/dist/console-text.d.ts +4 -0
  22. package/dist/console-text.js +27 -0
  23. package/dist/devtools.d.ts +36 -0
  24. package/dist/devtools.js +111 -0
  25. package/dist/dialogs.d.ts +38 -0
  26. package/dist/dialogs.js +81 -0
  27. package/dist/electron.d.ts +9 -0
  28. package/dist/electron.js +174 -0
  29. package/dist/engine-entry.d.ts +13 -0
  30. package/dist/engine-entry.js +9 -0
  31. package/dist/engine.d.ts +27 -0
  32. package/dist/engine.js +98 -0
  33. package/dist/errors.d.ts +17 -0
  34. package/dist/errors.js +54 -0
  35. package/dist/evaluate.d.ts +40 -0
  36. package/dist/evaluate.js +115 -0
  37. package/dist/executable.d.ts +29 -0
  38. package/dist/executable.js +249 -0
  39. package/dist/ffmpeg.d.ts +12 -0
  40. package/dist/ffmpeg.js +100 -0
  41. package/dist/fields.d.ts +93 -0
  42. package/dist/fields.js +254 -0
  43. package/dist/file-bound.d.ts +31 -0
  44. package/dist/file-bound.js +104 -0
  45. package/dist/fixtures.d.ts +168 -0
  46. package/dist/fixtures.js +6 -0
  47. package/dist/in-page/masks.d.ts +25 -0
  48. package/dist/in-page/masks.js +140 -0
  49. package/dist/in-page/node-ops.d.ts +96 -0
  50. package/dist/in-page/node-ops.js +406 -0
  51. package/dist/index.d.ts +18 -0
  52. package/dist/index.js +18 -0
  53. package/dist/launcher.d.ts +45 -0
  54. package/dist/launcher.js +167 -0
  55. package/dist/locate.d.ts +46 -0
  56. package/dist/locate.js +103 -0
  57. package/dist/main-process.d.ts +25 -0
  58. package/dist/main-process.js +60 -0
  59. package/dist/options.d.ts +65 -0
  60. package/dist/options.js +120 -0
  61. package/dist/page.d.ts +100 -0
  62. package/dist/page.js +229 -0
  63. package/dist/runner-test.d.ts +15 -0
  64. package/dist/runner-test.js +45 -0
  65. package/dist/snapshot.d.ts +143 -0
  66. package/dist/snapshot.js +260 -0
  67. package/dist/surface.d.ts +158 -0
  68. package/dist/surface.js +602 -0
  69. package/dist/tree.d.ts +51 -0
  70. package/dist/tree.js +406 -0
  71. package/dist/video.d.ts +42 -0
  72. package/dist/video.js +253 -0
  73. package/dist/windows.d.ts +81 -0
  74. package/dist/windows.js +200 -0
  75. package/package.json +72 -3
package/dist/page.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ /**
2
+ * One page target of the app: a window's or a view's web contents, its
3
+ * DevTools session, the isolated world the engine's page-side code runs in,
4
+ * and its keyboard and mouse.
5
+ */
6
+ import type { Deadline } from '@e2e-dev/core/engine';
7
+ import type { Session } from './cdp/connection.ts';
8
+ import { Keyboard, Mouse, type InputTarget } from './cdp/input.ts';
9
+ /** The isolated world the engine's own page-side reads run in, apart from the app's globals. */
10
+ export declare const WORLD_NAME = "__e2e_electron__";
11
+ type PageEvent = 'close' | 'crash' | 'load' | 'document';
12
+ /** What a page function threw, as the protocol reports it. */
13
+ export declare function thrown(details: {
14
+ readonly text: string;
15
+ readonly exception?: {
16
+ readonly description?: string;
17
+ };
18
+ }): string;
19
+ export declare class PageTarget implements InputTarget {
20
+ readonly targetId: string;
21
+ readonly session: Session;
22
+ /** The window whose page opened this one with `window.open` or a link, when one did. */
23
+ readonly opener?: PageTarget | undefined;
24
+ readonly keyboard: Keyboard;
25
+ readonly mouse: Mouse;
26
+ private address;
27
+ private closed;
28
+ private isolated;
29
+ private documents;
30
+ /** Whether the current document fired its load event. */
31
+ private loaded;
32
+ private gestures;
33
+ private readonly handlers;
34
+ constructor(targetId: string, session: Session, url: string,
35
+ /** The window whose page opened this one with `window.open` or a link, when one did. */
36
+ opener?: PageTarget | undefined);
37
+ url(): string;
38
+ navigated(url: string): void;
39
+ isClosed(): boolean;
40
+ on(event: PageEvent, handler: () => void): () => void;
41
+ /** Resolves at the page's next `event`. */
42
+ next(event: PageEvent): Promise<void>;
43
+ emit(event: PageEvent): void;
44
+ /** The document's title; empty while the page has no document to ask. */
45
+ title(): Promise<string>;
46
+ bringToFront(): Promise<void>;
47
+ /**
48
+ * How many documents the page has left behind. A node id carries it: the
49
+ * renderer a navigation or a crash starts numbers its nodes from the start
50
+ * again, so a number alone could name another node in the next document.
51
+ */
52
+ get generation(): number;
53
+ /** The current document fired its load event. */
54
+ markLoaded(): void;
55
+ /** The page has another document: the isolated world of the last one is dropped, and its nodes are no longer this page's. */
56
+ documentChanged(): void;
57
+ /**
58
+ * The renderer crashed: its document is gone, and so is every answer it
59
+ * owed. A gesture still waiting for one would hold the next back for good,
60
+ * and nothing it pressed is held in the renderer that comes next.
61
+ */
62
+ crashed(): void;
63
+ /**
64
+ * Runs one gesture after the ones before it have let go. A gesture its
65
+ * caller stopped waiting for still has keys and buttons to release once
66
+ * the page answers; the next one starts with none held. One that never
67
+ * lets go (a page that stopped drawing frames answers no wait for one)
68
+ * holds its turn only a moment past `deadline`, its operation's end. Its
69
+ * turn starts when the one before it ends, however long it waited: a
70
+ * gesture that gave up waiting lets none past the one still holding input.
71
+ */
72
+ exclusive<T>(gesture: () => Promise<T>, deadline: Deadline): Promise<T>;
73
+ /** Set while a recording's screencast runs on the page: a capture then leaves the screencast alone. */
74
+ recording: boolean;
75
+ private captures;
76
+ /**
77
+ * Runs a capture with the page counted as being captured. Chromium draws
78
+ * nothing of a window that is hidden or minimized, and a screenshot of one
79
+ * never returns, unless something captures it: a screencast is the
80
+ * protocol's way to say so. Its frames are not read.
81
+ */
82
+ captured<T>(capture: () => Promise<T>): Promise<T>;
83
+ /** The execution context of the engine's isolated world in the page's main frame, made once per document. */
84
+ world(): Promise<number>;
85
+ /**
86
+ * Runs test code in the page's own world, where the app's globals are:
87
+ * `source` is a function expression called with `arg`. Rejects with
88
+ * `EvaluateError` when the code throws.
89
+ */
90
+ evaluateInPage(source: string, arg: unknown): Promise<unknown>;
91
+ /**
92
+ * Reloads the page's document and resolves once the new one has loaded: a
93
+ * load the document before it was still finishing does not count. Rejects
94
+ * when the window closes or its renderer crashes instead.
95
+ */
96
+ reload(): Promise<void>;
97
+ /** Calls a self-contained page function in the isolated world with JSON arguments and returns its JSON result. */
98
+ evaluate<A extends readonly unknown[], R>(fn: (...args: A) => R | Promise<R>, ...args: A): Promise<R>;
99
+ }
100
+ export {};
package/dist/page.js ADDED
@@ -0,0 +1,229 @@
1
+ /**
2
+ * One page target of the app: a window's or a view's web contents, its
3
+ * DevTools session, the isolated world the engine's page-side code runs in,
4
+ * and its keyboard and mouse.
5
+ */
6
+ import { Keyboard, Mouse } from './cdp/input.js';
7
+ import { callForPlainData } from './evaluate.js';
8
+ /** How long past its operation's end a gesture may still hold the page's input, to release what it pressed. */
9
+ const RELEASE_MS = 1_000;
10
+ /** The isolated world the engine's own page-side reads run in, apart from the app's globals. */
11
+ export const WORLD_NAME = '__e2e_electron__';
12
+ /** What a page function threw, as the protocol reports it. */
13
+ export function thrown(details) {
14
+ return details.exception?.description ?? details.text;
15
+ }
16
+ export class PageTarget {
17
+ targetId;
18
+ session;
19
+ opener;
20
+ keyboard;
21
+ mouse;
22
+ address;
23
+ closed = false;
24
+ isolated;
25
+ documents = 0;
26
+ /** Whether the current document fired its load event. */
27
+ loaded = false;
28
+ gestures = Promise.resolve();
29
+ handlers = new Map();
30
+ constructor(targetId, session, url,
31
+ /** The window whose page opened this one with `window.open` or a link, when one did. */
32
+ opener) {
33
+ this.targetId = targetId;
34
+ this.session = session;
35
+ this.opener = opener;
36
+ this.address = url;
37
+ this.keyboard = new Keyboard(this);
38
+ this.mouse = new Mouse(this, this.keyboard);
39
+ }
40
+ url() {
41
+ return this.address;
42
+ }
43
+ navigated(url) {
44
+ this.address = url;
45
+ }
46
+ isClosed() {
47
+ return this.closed;
48
+ }
49
+ on(event, handler) {
50
+ let handlers = this.handlers.get(event);
51
+ if (handlers === undefined) {
52
+ handlers = new Set();
53
+ this.handlers.set(event, handlers);
54
+ }
55
+ handlers.add(handler);
56
+ return () => void handlers.delete(handler);
57
+ }
58
+ /** Resolves at the page's next `event`. */
59
+ next(event) {
60
+ return new Promise((resolve) => {
61
+ const stop = this.on(event, () => {
62
+ stop();
63
+ resolve();
64
+ });
65
+ });
66
+ }
67
+ emit(event) {
68
+ if (event === 'close') {
69
+ if (this.closed)
70
+ return;
71
+ this.closed = true;
72
+ }
73
+ for (const handler of this.handlers.get(event) ?? [])
74
+ handler();
75
+ }
76
+ /** The document's title; empty while the page has no document to ask. */
77
+ async title() {
78
+ const { result } = await this.session.send('Runtime.evaluate', { expression: 'document.title', returnByValue: true });
79
+ return typeof result.value === 'string' ? result.value : '';
80
+ }
81
+ async bringToFront() {
82
+ await this.session.send('Page.bringToFront');
83
+ }
84
+ /**
85
+ * How many documents the page has left behind. A node id carries it: the
86
+ * renderer a navigation or a crash starts numbers its nodes from the start
87
+ * again, so a number alone could name another node in the next document.
88
+ */
89
+ get generation() {
90
+ return this.documents;
91
+ }
92
+ /** The current document fired its load event. */
93
+ markLoaded() {
94
+ this.loaded = true;
95
+ this.emit('load');
96
+ }
97
+ /** The page has another document: the isolated world of the last one is dropped, and its nodes are no longer this page's. */
98
+ documentChanged() {
99
+ this.isolated = undefined;
100
+ this.documents += 1;
101
+ this.loaded = false;
102
+ this.emit('document');
103
+ }
104
+ /**
105
+ * The renderer crashed: its document is gone, and so is every answer it
106
+ * owed. A gesture still waiting for one would hold the next back for good,
107
+ * and nothing it pressed is held in the renderer that comes next.
108
+ */
109
+ crashed() {
110
+ this.documentChanged();
111
+ this.gestures = Promise.resolve();
112
+ this.keyboard.reset();
113
+ this.mouse.reset();
114
+ }
115
+ /**
116
+ * Runs one gesture after the ones before it have let go. A gesture its
117
+ * caller stopped waiting for still has keys and buttons to release once
118
+ * the page answers; the next one starts with none held. One that never
119
+ * lets go (a page that stopped drawing frames answers no wait for one)
120
+ * holds its turn only a moment past `deadline`, its operation's end. Its
121
+ * turn starts when the one before it ends, however long it waited: a
122
+ * gesture that gave up waiting lets none past the one still holding input.
123
+ */
124
+ exclusive(gesture, deadline) {
125
+ const before = this.gestures;
126
+ const run = before.then(gesture);
127
+ const settled = run.then(() => undefined, () => undefined);
128
+ this.gestures = before.then(() => new Promise((resolve) => {
129
+ const lapsed = setTimeout(resolve, Math.max(0, deadline.remaining()) + RELEASE_MS);
130
+ lapsed.unref();
131
+ void settled.then(() => {
132
+ clearTimeout(lapsed);
133
+ resolve();
134
+ });
135
+ }));
136
+ return run;
137
+ }
138
+ /** Set while a recording's screencast runs on the page: a capture then leaves the screencast alone. */
139
+ recording = false;
140
+ captures = 0;
141
+ /**
142
+ * Runs a capture with the page counted as being captured. Chromium draws
143
+ * nothing of a window that is hidden or minimized, and a screenshot of one
144
+ * never returns, unless something captures it: a screencast is the
145
+ * protocol's way to say so. Its frames are not read.
146
+ */
147
+ async captured(capture) {
148
+ this.captures += 1;
149
+ if (!this.recording && this.captures === 1)
150
+ await this.session.send('Page.startScreencast', { format: 'jpeg', quality: 1, maxWidth: 16, maxHeight: 16 }).catch(() => undefined);
151
+ try {
152
+ return await capture();
153
+ }
154
+ finally {
155
+ this.captures -= 1;
156
+ if (!this.recording && this.captures === 0)
157
+ await this.session.send('Page.stopScreencast').catch(() => undefined);
158
+ }
159
+ }
160
+ /** The execution context of the engine's isolated world in the page's main frame, made once per document. */
161
+ world() {
162
+ if (this.isolated === undefined) {
163
+ const session = this.session;
164
+ const world = (async () => {
165
+ const { frameTree } = await session.send('Page.getFrameTree');
166
+ const { executionContextId } = await session.send('Page.createIsolatedWorld', { frameId: frameTree.frame.id, worldName: WORLD_NAME, grantUniveralAccess: false });
167
+ return executionContextId;
168
+ })();
169
+ this.isolated = world;
170
+ world.catch(() => {
171
+ if (this.isolated === world)
172
+ this.isolated = undefined;
173
+ });
174
+ }
175
+ return this.isolated;
176
+ }
177
+ /**
178
+ * Runs test code in the page's own world, where the app's globals are:
179
+ * `source` is a function expression called with `arg`. Rejects with
180
+ * `EvaluateError` when the code throws.
181
+ */
182
+ async evaluateInPage(source, arg) {
183
+ const { session } = this;
184
+ const { result: scope } = await session.send('Runtime.evaluate', { expression: 'globalThis' });
185
+ if (scope.objectId === undefined)
186
+ throw new Error('the page has no global object to run code on');
187
+ try {
188
+ return await callForPlainData(session, { objectId: scope.objectId, source, arg, userGesture: true });
189
+ }
190
+ finally {
191
+ void session.send('Runtime.releaseObject', { objectId: scope.objectId }).catch(() => undefined);
192
+ }
193
+ }
194
+ /**
195
+ * Reloads the page's document and resolves once the new one has loaded: a
196
+ * load the document before it was still finishing does not count. Rejects
197
+ * when the window closes or its renderer crashes instead.
198
+ */
199
+ async reload() {
200
+ const before = this.documents;
201
+ let stop = () => undefined;
202
+ const ended = new Promise((_resolve, reject) => {
203
+ const gone = () => reject(new Error('the window closed or its renderer crashed while it reloaded (Target closed)'));
204
+ const stops = [this.on('close', gone), this.on('crash', gone)];
205
+ stop = () => stops.forEach((off) => off());
206
+ });
207
+ ended.catch(() => undefined);
208
+ try {
209
+ await this.session.send('Page.reload');
210
+ while (this.documents === before)
211
+ await Promise.race([this.next('document'), ended]);
212
+ if (!this.loaded)
213
+ await Promise.race([this.next('load'), ended]);
214
+ }
215
+ finally {
216
+ stop();
217
+ }
218
+ }
219
+ /** Calls a self-contained page function in the isolated world with JSON arguments and returns its JSON result. */
220
+ async evaluate(fn, ...args) {
221
+ const session = this.session;
222
+ const contextId = await this.world();
223
+ const expression = `(${fn.toString()})(...${JSON.stringify(args)})`;
224
+ const { result, exceptionDetails } = await session.send('Runtime.evaluate', { expression, contextId, returnByValue: true, awaitPromise: true });
225
+ if (exceptionDetails !== undefined)
226
+ throw new Error(thrown(exceptionDetails));
227
+ return result.value;
228
+ }
229
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The test runner's `test`, which the main entry extends, loaded only when
3
+ * `e2e` is installed. `e2e` is an optional peer: a program on
4
+ * `@e2e-dev/core` alone imports `electron` from this package too.
5
+ */
6
+ import type { test as RunnerTest } from 'e2e';
7
+ type Test = typeof RunnerTest;
8
+ /**
9
+ * `e2e`'s `test`, or, when `e2e` is not installed, a stand-in whose every
10
+ * call and member throws `RUNNER_NOT_INSTALLED`. Loaded with `require()`
11
+ * rather than a top-level `await import()`, so this entry stays loadable by
12
+ * `require()` from a CommonJS file.
13
+ */
14
+ export declare function runnerTest(): Test;
15
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The test runner's `test`, which the main entry extends, loaded only when
3
+ * `e2e` is installed. `e2e` is an optional peer: a program on
4
+ * `@e2e-dev/core` alone imports `electron` from this package too.
5
+ */
6
+ import { createRequire } from 'node:module';
7
+ import { ConfigurationError } from '@e2e-dev/core/engine';
8
+ const ownRequire = createRequire(import.meta.url);
9
+ /**
10
+ * `e2e`'s `test`, or, when `e2e` is not installed, a stand-in whose every
11
+ * call and member throws `RUNNER_NOT_INSTALLED`. Loaded with `require()`
12
+ * rather than a top-level `await import()`, so this entry stays loadable by
13
+ * `require()` from a CommonJS file.
14
+ */
15
+ export function runnerTest() {
16
+ try {
17
+ ownRequire.resolve('e2e');
18
+ }
19
+ catch (error) {
20
+ // An installed `e2e` whose entry file is gone throws MODULE_NOT_FOUND too, naming that file: rethrown, not reported as not installed.
21
+ if (error.code === 'MODULE_NOT_FOUND' && error.message.startsWith("Cannot find module 'e2e'"))
22
+ return missingRunner();
23
+ throw error;
24
+ }
25
+ return ownRequire('e2e').test;
26
+ }
27
+ /**
28
+ * A `test` whose every call, and every member's call, throws
29
+ * `RUNNER_NOT_INSTALLED`, except `extend`, which returns it again so the
30
+ * main entry can extend it while it loads.
31
+ */
32
+ function missingRunner() {
33
+ const fail = () => {
34
+ throw new ConfigurationError('RUNNER_NOT_INSTALLED', "`test` from '@e2e-dev/electron' needs e2e, the test runner, which is not installed. Install e2e to write tests, or import electron() from '@e2e-dev/electron/engine' to drive an Electron app with @e2e-dev/core.");
35
+ };
36
+ // oxlint-disable-next-line e2e/no-chained-type-assertions -- the proxy answers every call and member of `test`, so it has its shape by construction
37
+ const missing = new Proxy(fail, {
38
+ get: (target, key) => {
39
+ if (key === 'extend')
40
+ return () => missing;
41
+ return typeof key === 'string' && !Reflect.has(target, key) ? fail : Reflect.get(target, key);
42
+ },
43
+ });
44
+ return missing;
45
+ }
@@ -0,0 +1,143 @@
1
+ /**
2
+ * One `DOMSnapshot.captureSnapshot` document, indexed once: each element's
3
+ * facts by backend DOM node id, and the questions the projection asks of the
4
+ * document's order (source text, white space between runs, table cells,
5
+ * subtrees). Pure: the surface reads the snapshot, this answers from it.
6
+ */
7
+ /** A `DOMSnapshot` rare-string table: `value[i]` is the string index for node `index[i]`. */
8
+ interface RareStrings {
9
+ readonly index: readonly number[];
10
+ readonly value: readonly number[];
11
+ }
12
+ /** The fields of one `DOMSnapshot.captureSnapshot` document the engine reads. */
13
+ export interface SnapshotDocument {
14
+ readonly nodes: {
15
+ readonly backendNodeId?: readonly number[];
16
+ readonly nodeName?: readonly number[];
17
+ readonly attributes?: readonly (readonly number[])[];
18
+ readonly inputValue?: RareStrings;
19
+ /** A textarea's current text. */
20
+ readonly textValue?: RareStrings;
21
+ readonly nodeType?: readonly number[];
22
+ readonly nodeValue?: readonly number[];
23
+ /** The option elements that are selected. */
24
+ readonly optionSelected?: {
25
+ readonly index: readonly number[];
26
+ };
27
+ /** The checkboxes and radios that are checked. */
28
+ readonly inputChecked?: {
29
+ readonly index: readonly number[];
30
+ };
31
+ readonly parentIndex?: readonly number[];
32
+ /** For every node inside a shadow root, that root's type: `open`, `closed`, or `user-agent`. */
33
+ readonly shadowRootType?: RareStrings;
34
+ };
35
+ readonly layout: {
36
+ readonly nodeIndex: readonly number[];
37
+ readonly bounds: readonly (readonly number[])[];
38
+ /** Per layout node, the computed styles the read asked for, as string indexes: `visibility` alone. */
39
+ readonly styles?: readonly (readonly number[])[];
40
+ };
41
+ }
42
+ /** The computed styles a snapshot is captured with, in the order `layout.styles` lists them. */
43
+ export declare const SNAPSHOT_STYLES: readonly string[];
44
+ /** Elements a screenshot paints over besides a secure field's value: the nested documents the engine does not read. */
45
+ export declare const MASKED_TAGS: readonly string[];
46
+ /** One element's facts from the snapshot. */
47
+ export interface DomFacts {
48
+ /** The node's position in the snapshot, its document order. */
49
+ readonly index: number;
50
+ readonly nodeName: string;
51
+ /** Attribute names in lower case. */
52
+ readonly attributes: Readonly<Record<string, string>>;
53
+ readonly inputValue?: string;
54
+ /** A textarea's current text. */
55
+ readonly textValue?: string;
56
+ /** Whether the node's text content holds anything but white space, as `textContent` reads it. */
57
+ readonly hasText: boolean;
58
+ /** A select's value: what its first selected option submits. */
59
+ readonly selectValue?: string;
60
+ /** A checkbox or radio that is checked now, whatever its `checked` attribute says. */
61
+ readonly checked: boolean;
62
+ /** Device-pixel document bounds; none for a node with no layout box. */
63
+ readonly bounds?: readonly number[];
64
+ /** Its computed `visibility` is `hidden` or `collapse`. */
65
+ readonly invisible: boolean;
66
+ }
67
+ /** A password input: it reports no value and no text, and a screenshot paints it over. */
68
+ export declare function isSecureField(nodeName: string, attributes: Readonly<Record<string, string>>): boolean;
69
+ /** Collapses runs of white space the way rendered text reads. */
70
+ export declare function collapse(text: string): string;
71
+ export declare class DomSnapshot {
72
+ private readonly strings;
73
+ private readonly names;
74
+ private readonly parents;
75
+ private readonly types;
76
+ private readonly values;
77
+ private readonly backendIds;
78
+ private readonly attributePairs;
79
+ private readonly closedShadow;
80
+ private readonly rendered;
81
+ private readonly facts;
82
+ /** Per node with a layout box, its device-pixel bounds. */
83
+ private readonly boxes;
84
+ /** The label elements that name an id with `for`, by that id. */
85
+ private readonly labelsFor;
86
+ /** Per node, how many white-space-only text nodes precede or are it. */
87
+ private readonly blanks;
88
+ /** Per node, its nearest table cell, or -1. */
89
+ private readonly cells;
90
+ constructor(document: SnapshotDocument, strings: readonly string[]);
91
+ /** The element with this backend DOM node id, if the snapshot holds it. */
92
+ element(backendNodeId: number): DomFacts | undefined;
93
+ /** Every node of the document, text nodes included, by backend DOM node id. */
94
+ elements(): IterableIterator<[number, DomFacts]>;
95
+ /** A text node's text as the source has it, white space included; undefined for any other node. */
96
+ sourceText(index: number): string | undefined;
97
+ /** Whether the source has white space (a text node of nothing else) between two nodes, which reads as a space, as it renders. */
98
+ gap(from: number, to: number): boolean;
99
+ /** The snapshot index of the node's parent, or -1 for the document. */
100
+ parentOf(index: number): number;
101
+ /** The node's nearest table cell, from the DOM: Chromium gives a layout table's cells no cell role. */
102
+ cellOf(index: number): number;
103
+ /** The snapshot indices inside the node at `index`, itself included: its descendants follow it in document order. */
104
+ subtree(index: number): Set<number>;
105
+ /** The text content of the node at `index`, white space collapsed. */
106
+ textContent(index: number): string;
107
+ /** The backend ids of the node's ancestors, nearest first. */
108
+ ancestors(index: number): IterableIterator<number>;
109
+ /** Whether anything inside the node, itself aside, has a layout box: what a `display: contents` wrapper holds. */
110
+ rendersContent(index: number): boolean;
111
+ /**
112
+ * Whether a shown label of the element's own draws it: a label around it or
113
+ * one whose `for` names it, with a box, that is no control itself and holds
114
+ * no other one. A checkbox or radio with no box under such a label is on
115
+ * screen as the label, as the web reads it.
116
+ */
117
+ drawnByLabel(index: number): boolean;
118
+ /**
119
+ * How many rendered elements a screenshot must paint over and a selector
120
+ * cannot reach: password inputs and nested documents inside a closed shadow
121
+ * root, at any depth. The snapshot enters every shadow root, so it holds
122
+ * whatever the accessibility tree leaves out (`aria-hidden`, the node cap).
123
+ * Every other such element in the document, open shadow roots included, a
124
+ * selector mask covers.
125
+ */
126
+ unmaskableCount(): number;
127
+ private isControl;
128
+ private nameAt;
129
+ private attributesAt;
130
+ private rare;
131
+ private indexFacts;
132
+ /** The node indices whose text content holds anything but white space: every ancestor of such a text node. */
133
+ private nodesWithText;
134
+ /**
135
+ * Each select's value, by node index: what its first selected option
136
+ * submits, the option's `value` attribute or else its text, as
137
+ * `HTMLSelectElement.value` reads it. An option's text is all the text
138
+ * under it, with ASCII white space collapsed and no other: a no-break
139
+ * space stays one.
140
+ */
141
+ private selectValues;
142
+ }
143
+ export {};