-
Notifications
You must be signed in to change notification settings - Fork 493
/
Copy pathlegacy-defs.d.ts
125 lines (113 loc) · 3.47 KB
/
legacy-defs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
declare class AnchorBox {
x: number;
y: number;
width: number;
height: number;
constructor(x: number, y: number, width: number, height: number);
contains(x: number, y: number): boolean;
relativeToElement(element: Element): AnchorBox;
}
declare namespace Adb {
interface Page {
id: string;
name: string;
url: string;
attached: boolean;
}
interface Browser {
id: string;
adbBrowserChromeVersion: string;
compatibleVersion: boolean;
adbBrowsername: string;
source: string;
adbBrowserVersion: string;
pages: Page[];
}
interface Device {
id: string;
adbModel: string;
adbSerial: string;
browsers: Browser[];
adbPortStatus: number[];
adbConnected: boolean;
}
interface PortForwardingConfig {
[field: string]: string;
}
interface PortForwardingRule {
port: string;
address: string;
}
interface DevicePortForwardingStatus {
ports: {[port: string]: number};
browserId: string;
}
interface PortForwardingStatus {
[field: string]: DevicePortForwardingStatus;
}
interface Config {
discoverUsbDevices: boolean;
portForwardingEnabled: boolean;
portForwardingConfig: PortForwardingConfig;
networkDiscoveryEnabled: boolean;
networkDiscoveryConfig: NetworkDiscoveryConfig;
}
type NetworkDiscoveryConfig = string[];
}
interface Element {
boxInWindow(targetWindow?: Window): AnchorBox;
createChild<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string): HTMLElementTagNameMap[K];
hasFocus(): boolean;
positionAt(x: (number|undefined), y: (number|undefined), relativeTo?: Element): void;
removeChildren(): void;
scrollIntoViewIfNeeded(center?: boolean): void;
}
interface DocumentFragment {
createChild<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string): HTMLElementTagNameMap[K];
}
interface Event {
consume(preventDefault?: boolean): void;
handled: boolean|undefined;
isMetaOrCtrlForTest: boolean;
}
interface Node {
enclosingNodeOrSelfWithClass(className: string, stayWithin?: Element): Element;
getComponentRoot(): Document|DocumentFragment|null;
getComponentSelection(): Selection|null;
hasSelection(): boolean;
isAncestor(node: Node|null): boolean;
isDescendant(node: Node|null): boolean;
isSelfOrAncestor(node: Node|null): boolean;
isSelfOrDescendant(node: Node|null): boolean;
parentElementOrShadowHost(): Element|null;
parentNodeOrShadowHost(): Node|null;
setTextContentTruncatedIfNeeded(text: unknown, placeholder?: string): boolean;
traverseNextNode(stayWithin?: Node): Node|null;
traversePreviousNode(stayWithin?: Node): Node|null;
deepTextContent(): string;
window(): Window;
childTextNodes(): Node[];
}
declare function onInvokeElement(element: Element, callback: (event: Event) => void): void;
// The following types exist in Chrome but were removed for various reasons
// from the TypeScript DOM library.
//
// TODO(crbug.com/1247609): Replace use sites with appropriate web platform types.
interface DOMError {
readonly name: string;
readonly message: string;
}
interface ShadowRoot {
elementFromPoint(x: number, y: number): Element|null;
getSelection(): Selection|null;
}
interface HTMLDialogElement {
open: boolean;
returnValue: string;
close(returnValue?: string): void;
show(): void;
showModal(): void;
}