| 1 | // flow-typed signature: 760aeea3b9b767e808097fe22b68a20f |
| 2 | // flow-typed version: 8584579196/html/flow_>=v0.261.x |
| 3 | |
| 4 | /* DataTransfer */ |
| 5 | |
| 6 | declare class DataTransfer { |
| 7 | clearData(format?: string): void; |
| 8 | getData(format: string): string; |
| 9 | setData(format: string, data: string): void; |
| 10 | setDragImage(image: Element, x: number, y: number): void; |
| 11 | dropEffect: string; |
| 12 | effectAllowed: string; |
| 13 | files: FileList; // readonly |
| 14 | items: DataTransferItemList; // readonly |
| 15 | types: Array<string>; // readonly |
| 16 | } |
| 17 | |
| 18 | declare class DataTransferItemList { |
| 19 | @@iterator(): Iterator<DataTransferItem>; |
| 20 | length: number; // readonly |
| 21 | [index: number]: DataTransferItem; |
| 22 | add(data: string, type: string): ?DataTransferItem; |
| 23 | add(data: File): ?DataTransferItem; |
| 24 | remove(index: number): void; |
| 25 | clear(): void; |
| 26 | } |
| 27 | |
| 28 | // https://wicg.github.io/file-system-access/#drag-and-drop |
| 29 | declare class DataTransferItem { |
| 30 | kind: string; // readonly |
| 31 | type: string; // readonly |
| 32 | getAsString(_callback: ?(data: string) => mixed): void; |
| 33 | getAsFile(): ?File; |
| 34 | /* |
| 35 | * This is not supported by all browsers, please have a fallback plan for it. |
| 36 | * For more information, please checkout |
| 37 | * https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry |
| 38 | */ |
| 39 | webkitGetAsEntry(): void | (() => any); |
| 40 | /* |
| 41 | * Not supported in all browsers |
| 42 | * For up to date compatibility information, please visit |
| 43 | * https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/getAsFileSystemHandle |
| 44 | */ |
| 45 | getAsFileSystemHandle?: () => Promise<?FileSystemHandle>; |
| 46 | } |
| 47 | |
| 48 | declare type DOMStringMap = {[key: string]: string, ...}; |
| 49 | |
| 50 | declare class DOMStringList { |
| 51 | @@iterator(): Iterator<string>; |
| 52 | +[key: number]: string; |
| 53 | +length: number; |
| 54 | item(number): string | null; |
| 55 | contains(string): boolean; |
| 56 | } |
| 57 | |
| 58 | declare type ElementDefinitionOptions = {|extends?: string|}; |
| 59 | |
| 60 | declare interface CustomElementRegistry { |
| 61 | define( |
| 62 | name: string, |
| 63 | ctor: Class<Element>, |
| 64 | options?: ElementDefinitionOptions |
| 65 | ): void; |
| 66 | get(name: string): any; |
| 67 | whenDefined(name: string): Promise<void>; |
| 68 | } |
| 69 | |
| 70 | // https://www.w3.org/TR/eventsource/ |
| 71 | declare class EventSource extends EventTarget { |
| 72 | constructor( |
| 73 | url: string, |
| 74 | configuration?: {withCredentials: boolean, ...} |
| 75 | ): void; |
| 76 | +CLOSED: 2; |
| 77 | +CONNECTING: 0; |
| 78 | +OPEN: 1; |
| 79 | +readyState: 0 | 1 | 2; |
| 80 | +url: string; |
| 81 | +withCredentials: boolean; |
| 82 | onerror: () => void; |
| 83 | onmessage: MessageEventListener; |
| 84 | onopen: () => void; |
| 85 | close: () => void; |
| 86 | } |
| 87 | |
| 88 | // https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface |
| 89 | declare class ErrorEvent extends Event { |
| 90 | constructor( |
| 91 | type: string, |
| 92 | eventInitDict?: { |
| 93 | ...Event$Init, |
| 94 | message?: string, |
| 95 | filename?: string, |
| 96 | lineno?: number, |
| 97 | colno?: number, |
| 98 | error?: any, |
| 99 | ... |
| 100 | } |
| 101 | ): void; |
| 102 | +message: string; |
| 103 | +filename: string; |
| 104 | +lineno: number; |
| 105 | +colno: number; |
| 106 | +error: any; |
| 107 | } |
| 108 | |
| 109 | // https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts |
| 110 | declare class BroadcastChannel extends EventTarget { |
| 111 | name: string; |
| 112 | onmessage: ?(event: MessageEvent<>) => void; |
| 113 | onmessageerror: ?(event: MessageEvent<>) => void; |
| 114 | |
| 115 | constructor(name: string): void; |
| 116 | postMessage(msg: mixed): void; |
| 117 | close(): void; |
| 118 | } |
| 119 | |
| 120 | // https://www.w3.org/TR/webstorage/#the-storageevent-interface |
| 121 | declare class StorageEvent extends Event { |
| 122 | key: ?string; |
| 123 | oldValue: ?string; |
| 124 | newValue: ?string; |
| 125 | url: string; |
| 126 | storageArea: ?Storage; |
| 127 | } |
| 128 | |
| 129 | // https://www.w3.org/TR/html50/browsers.html#beforeunloadevent |
| 130 | declare class BeforeUnloadEvent extends Event { |
| 131 | returnValue: string; |
| 132 | } |
| 133 | |
| 134 | type ToggleEvent$Init = { |
| 135 | ...Event$Init, |
| 136 | oldState: string, |
| 137 | newState: string, |
| 138 | ... |
| 139 | }; |
| 140 | |
| 141 | declare class ToggleEvent extends Event { |
| 142 | constructor(type: ToggleEventTypes, eventInit?: ToggleEvent$Init): void; |
| 143 | +oldState: string; |
| 144 | +newState: string; |
| 145 | } |
| 146 | |
| 147 | // TODO: HTMLDocument |
| 148 | type FocusOptions = {preventScroll?: boolean, ...}; |
| 149 | |
| 150 | declare class HTMLElement extends Element { |
| 151 | blur(): void; |
| 152 | click(): void; |
| 153 | focus(options?: FocusOptions): void; |
| 154 | getBoundingClientRect(): DOMRect; |
| 155 | forceSpellcheck(): void; |
| 156 | |
| 157 | showPopover(options?: {|source?: HTMLElement|}): void; |
| 158 | hidePopover(): void; |
| 159 | togglePopover( |
| 160 | options?: boolean | {|force?: boolean, source?: HTMLElement|} |
| 161 | ): boolean; |
| 162 | |
| 163 | accessKey: string; |
| 164 | accessKeyLabel: string; |
| 165 | contentEditable: string; |
| 166 | contextMenu: ?HTMLMenuElement; |
| 167 | dataset: DOMStringMap; |
| 168 | dir: 'ltr' | 'rtl' | 'auto'; |
| 169 | draggable: boolean; |
| 170 | dropzone: any; |
| 171 | hidden: boolean; |
| 172 | inert: boolean; |
| 173 | isContentEditable: boolean; |
| 174 | itemProp: any; |
| 175 | itemScope: boolean; |
| 176 | itemType: any; |
| 177 | itemValue: Object; |
| 178 | lang: string; |
| 179 | offsetHeight: number; |
| 180 | offsetLeft: number; |
| 181 | offsetParent: ?Element; |
| 182 | offsetTop: number; |
| 183 | offsetWidth: number; |
| 184 | onabort: ?Function; |
| 185 | onblur: ?Function; |
| 186 | oncancel: ?Function; |
| 187 | oncanplay: ?Function; |
| 188 | oncanplaythrough: ?Function; |
| 189 | onchange: ?Function; |
| 190 | onclick: ?Function; |
| 191 | oncontextmenu: ?Function; |
| 192 | oncuechange: ?Function; |
| 193 | ondblclick: ?Function; |
| 194 | ondurationchange: ?Function; |
| 195 | onemptied: ?Function; |
| 196 | onended: ?Function; |
| 197 | onerror: ?Function; |
| 198 | onfocus: ?Function; |
| 199 | onfullscreenchange: ?Function; |
| 200 | onfullscreenerror: ?Function; |
| 201 | ongotpointercapture: ?Function; |
| 202 | oninput: ?Function; |
| 203 | oninvalid: ?Function; |
| 204 | onkeydown: ?Function; |
| 205 | onkeypress: ?Function; |
| 206 | onkeyup: ?Function; |
| 207 | onload: ?Function; |
| 208 | onloadeddata: ?Function; |
| 209 | onloadedmetadata: ?Function; |
| 210 | onloadstart: ?Function; |
| 211 | onlostpointercapture: ?Function; |
| 212 | onmousedown: ?Function; |
| 213 | onmouseenter: ?Function; |
| 214 | onmouseleave: ?Function; |
| 215 | onmousemove: ?Function; |
| 216 | onmouseout: ?Function; |
| 217 | onmouseover: ?Function; |
| 218 | onmouseup: ?Function; |
| 219 | onmousewheel: ?Function; |
| 220 | onpause: ?Function; |
| 221 | onplay: ?Function; |
| 222 | onplaying: ?Function; |
| 223 | onpointercancel: ?Function; |
| 224 | onpointerdown: ?Function; |
| 225 | onpointerenter: ?Function; |
| 226 | onpointerleave: ?Function; |
| 227 | onpointermove: ?Function; |
| 228 | onpointerout: ?Function; |
| 229 | onpointerover: ?Function; |
| 230 | onpointerup: ?Function; |
| 231 | onprogress: ?Function; |
| 232 | onratechange: ?Function; |
| 233 | onreadystatechange: ?Function; |
| 234 | onreset: ?Function; |
| 235 | onresize: ?Function; |
| 236 | onscroll: ?Function; |
| 237 | onseeked: ?Function; |
| 238 | onseeking: ?Function; |
| 239 | onselect: ?Function; |
| 240 | onshow: ?Function; |
| 241 | onstalled: ?Function; |
| 242 | onsubmit: ?Function; |
| 243 | onsuspend: ?Function; |
| 244 | ontimeupdate: ?Function; |
| 245 | ontoggle: ?Function; |
| 246 | onbeforetoggle: ?Function; |
| 247 | onvolumechange: ?Function; |
| 248 | onwaiting: ?Function; |
| 249 | properties: any; |
| 250 | spellcheck: boolean; |
| 251 | style: CSSStyleDeclaration; |
| 252 | tabIndex: number; |
| 253 | title: string; |
| 254 | translate: boolean; |
| 255 | popover: '' | 'auto' | 'manual' | 'hint'; |
| 256 | |
| 257 | +popoverVisibilityState: 'hidden' | 'showing'; |
| 258 | |
| 259 | +popoverInvoker: HTMLElement | null; |
| 260 | } |
| 261 | |
| 262 | declare class HTMLSlotElement extends HTMLElement { |
| 263 | name: string; |
| 264 | assignedNodes(options?: {flatten: boolean, ...}): Node[]; |
| 265 | } |
| 266 | |
| 267 | declare class HTMLTableElement extends HTMLElement { |
| 268 | tagName: 'TABLE'; |
| 269 | caption: HTMLTableCaptionElement | null; |
| 270 | tHead: HTMLTableSectionElement | null; |
| 271 | tFoot: HTMLTableSectionElement | null; |
| 272 | +tBodies: HTMLCollection<HTMLTableSectionElement>; |
| 273 | +rows: HTMLCollection<HTMLTableRowElement>; |
| 274 | createTHead(): HTMLTableSectionElement; |
| 275 | deleteTHead(): void; |
| 276 | createTFoot(): HTMLTableSectionElement; |
| 277 | deleteTFoot(): void; |
| 278 | createCaption(): HTMLTableCaptionElement; |
| 279 | deleteCaption(): void; |
| 280 | insertRow(index?: number): HTMLTableRowElement; |
| 281 | deleteRow(index: number): void; |
| 282 | } |
| 283 | |
| 284 | declare class HTMLTableCaptionElement extends HTMLElement { |
| 285 | tagName: 'CAPTION'; |
| 286 | } |
| 287 | |
| 288 | declare class HTMLTableColElement extends HTMLElement { |
| 289 | tagName: 'COL' | 'COLGROUP'; |
| 290 | span: number; |
| 291 | } |
| 292 | |
| 293 | declare class HTMLTableSectionElement extends HTMLElement { |
| 294 | tagName: 'THEAD' | 'TFOOT' | 'TBODY'; |
| 295 | +rows: HTMLCollection<HTMLTableRowElement>; |
| 296 | insertRow(index?: number): HTMLTableRowElement; |
| 297 | deleteRow(index: number): void; |
| 298 | } |
| 299 | |
| 300 | declare class HTMLTableCellElement extends HTMLElement { |
| 301 | tagName: 'TD' | 'TH'; |
| 302 | colSpan: number; |
| 303 | rowSpan: number; |
| 304 | +cellIndex: number; |
| 305 | } |
| 306 | |
| 307 | declare class HTMLTableRowElement extends HTMLElement { |
| 308 | tagName: 'TR'; |
| 309 | align: 'left' | 'right' | 'center'; |
| 310 | +rowIndex: number; |
| 311 | +sectionRowIndex: number; |
| 312 | +cells: HTMLCollection<HTMLTableCellElement>; |
| 313 | deleteCell(index: number): void; |
| 314 | insertCell(index?: number): HTMLTableCellElement; |
| 315 | } |
| 316 | |
| 317 | declare class HTMLMenuElement extends HTMLElement { |
| 318 | getCompact(): boolean; |
| 319 | setCompact(compact: boolean): void; |
| 320 | } |
| 321 | |
| 322 | declare class HTMLBaseElement extends HTMLElement { |
| 323 | href: string; |
| 324 | target: string; |
| 325 | } |
| 326 | |
| 327 | declare class HTMLTemplateElement extends HTMLElement { |
| 328 | content: DocumentFragment; |
| 329 | } |
| 330 | |
| 331 | declare class CanvasGradient { |
| 332 | addColorStop(offset: number, color: string): void; |
| 333 | } |
| 334 | |
| 335 | declare class CanvasPattern { |
| 336 | setTransform(matrix: SVGMatrix): void; |
| 337 | } |
| 338 | |
| 339 | declare class ImageBitmap { |
| 340 | close(): void; |
| 341 | width: number; |
| 342 | height: number; |
| 343 | } |
| 344 | |
| 345 | type CanvasFillRule = string; |
| 346 | |
| 347 | type CanvasImageSource = |
| 348 | | HTMLImageElement |
| 349 | | HTMLVideoElement |
| 350 | | HTMLCanvasElement |
| 351 | | CanvasRenderingContext2D |
| 352 | | ImageBitmap; |
| 353 | |
| 354 | declare class TextMetrics { |
| 355 | // x-direction |
| 356 | width: number; |
| 357 | actualBoundingBoxLeft: number; |
| 358 | actualBoundingBoxRight: number; |
| 359 | |
| 360 | // y-direction |
| 361 | fontBoundingBoxAscent: number; |
| 362 | fontBoundingBoxDescent: number; |
| 363 | actualBoundingBoxAscent: number; |
| 364 | actualBoundingBoxDescent: number; |
| 365 | emHeightAscent: number; |
| 366 | emHeightDescent: number; |
| 367 | hangingBaseline: number; |
| 368 | alphabeticBaseline: number; |
| 369 | ideographicBaseline: number; |
| 370 | } |
| 371 | |
| 372 | declare class CanvasDrawingStyles { |
| 373 | width: number; |
| 374 | actualBoundingBoxLeft: number; |
| 375 | actualBoundingBoxRight: number; |
| 376 | |
| 377 | // y-direction |
| 378 | fontBoundingBoxAscent: number; |
| 379 | fontBoundingBoxDescent: number; |
| 380 | actualBoundingBoxAscent: number; |
| 381 | actualBoundingBoxDescent: number; |
| 382 | emHeightAscent: number; |
| 383 | emHeightDescent: number; |
| 384 | hangingBaseline: number; |
| 385 | alphabeticBaseline: number; |
| 386 | ideographicBaseline: number; |
| 387 | } |
| 388 | |
| 389 | declare class Path2D { |
| 390 | constructor(path?: Path2D | string): void; |
| 391 | |
| 392 | addPath(path: Path2D, transformation?: ?SVGMatrix): void; |
| 393 | addPathByStrokingPath( |
| 394 | path: Path2D, |
| 395 | styles: CanvasDrawingStyles, |
| 396 | transformation?: ?SVGMatrix |
| 397 | ): void; |
| 398 | addText( |
| 399 | text: string, |
| 400 | styles: CanvasDrawingStyles, |
| 401 | transformation: ?SVGMatrix, |
| 402 | x: number, |
| 403 | y: number, |
| 404 | maxWidth?: number |
| 405 | ): void; |
| 406 | addPathByStrokingText( |
| 407 | text: string, |
| 408 | styles: CanvasDrawingStyles, |
| 409 | transformation: ?SVGMatrix, |
| 410 | x: number, |
| 411 | y: number, |
| 412 | maxWidth?: number |
| 413 | ): void; |
| 414 | addText( |
| 415 | text: string, |
| 416 | styles: CanvasDrawingStyles, |
| 417 | transformation: ?SVGMatrix, |
| 418 | path: Path2D, |
| 419 | maxWidth?: number |
| 420 | ): void; |
| 421 | addPathByStrokingText( |
| 422 | text: string, |
| 423 | styles: CanvasDrawingStyles, |
| 424 | transformation: ?SVGMatrix, |
| 425 | path: Path2D, |
| 426 | maxWidth?: number |
| 427 | ): void; |
| 428 | |
| 429 | // CanvasPathMethods |
| 430 | // shared path API methods |
| 431 | arc( |
| 432 | x: number, |
| 433 | y: number, |
| 434 | radius: number, |
| 435 | startAngle: number, |
| 436 | endAngle: number, |
| 437 | anticlockwise?: boolean |
| 438 | ): void; |
| 439 | arcTo( |
| 440 | x1: number, |
| 441 | y1: number, |
| 442 | x2: number, |
| 443 | y2: number, |
| 444 | radius: number, |
| 445 | _: void, |
| 446 | _: void |
| 447 | ): void; |
| 448 | arcTo( |
| 449 | x1: number, |
| 450 | y1: number, |
| 451 | x2: number, |
| 452 | y2: number, |
| 453 | radiusX: number, |
| 454 | radiusY: number, |
| 455 | rotation: number |
| 456 | ): void; |
| 457 | bezierCurveTo( |
| 458 | cp1x: number, |
| 459 | cp1y: number, |
| 460 | cp2x: number, |
| 461 | cp2y: number, |
| 462 | x: number, |
| 463 | y: number |
| 464 | ): void; |
| 465 | closePath(): void; |
| 466 | ellipse( |
| 467 | x: number, |
| 468 | y: number, |
| 469 | radiusX: number, |
| 470 | radiusY: number, |
| 471 | rotation: number, |
| 472 | startAngle: number, |
| 473 | endAngle: number, |
| 474 | anticlockwise?: boolean |
| 475 | ): void; |
| 476 | lineTo(x: number, y: number): void; |
| 477 | moveTo(x: number, y: number): void; |
| 478 | quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; |
| 479 | rect(x: number, y: number, w: number, h: number): void; |
| 480 | } |
| 481 | |
| 482 | declare class ImageData { |
| 483 | width: number; |
| 484 | height: number; |
| 485 | data: Uint8ClampedArray; |
| 486 | |
| 487 | // constructor methods are used in Worker where CanvasRenderingContext2D |
| 488 | // is unavailable. |
| 489 | // https://html.spec.whatwg.org/multipage/scripting.html#dom-imagedata |
| 490 | constructor(data: Uint8ClampedArray, width: number, height: number): void; |
| 491 | constructor(width: number, height: number): void; |
| 492 | } |
| 493 | |
| 494 | declare class CanvasRenderingContext2D { |
| 495 | canvas: HTMLCanvasElement; |
| 496 | |
| 497 | // canvas dimensions |
| 498 | width: number; |
| 499 | height: number; |
| 500 | |
| 501 | // for contexts that aren't directly fixed to a specific canvas |
| 502 | commit(): void; |
| 503 | |
| 504 | // state |
| 505 | save(): void; |
| 506 | restore(): void; |
| 507 | |
| 508 | // transformations |
| 509 | currentTransform: SVGMatrix; |
| 510 | scale(x: number, y: number): void; |
| 511 | rotate(angle: number): void; |
| 512 | translate(x: number, y: number): void; |
| 513 | transform( |
| 514 | a: number, |
| 515 | b: number, |
| 516 | c: number, |
| 517 | d: number, |
| 518 | e: number, |
| 519 | f: number |
| 520 | ): void; |
| 521 | setTransform( |
| 522 | a: number, |
| 523 | b: number, |
| 524 | c: number, |
| 525 | d: number, |
| 526 | e: number, |
| 527 | f: number |
| 528 | ): void; |
| 529 | resetTransform(): void; |
| 530 | |
| 531 | // compositing |
| 532 | globalAlpha: number; |
| 533 | globalCompositeOperation: string; |
| 534 | |
| 535 | // image smoothing |
| 536 | imageSmoothingEnabled: boolean; |
| 537 | imageSmoothingQuality: 'low' | 'medium' | 'high'; |
| 538 | |
| 539 | // filters |
| 540 | filter: string; |
| 541 | |
| 542 | // colours and styles |
| 543 | strokeStyle: string | CanvasGradient | CanvasPattern; |
| 544 | fillStyle: string | CanvasGradient | CanvasPattern; |
| 545 | createLinearGradient( |
| 546 | x0: number, |
| 547 | y0: number, |
| 548 | x1: number, |
| 549 | y1: number |
| 550 | ): CanvasGradient; |
| 551 | createRadialGradient( |
| 552 | x0: number, |
| 553 | y0: number, |
| 554 | r0: number, |
| 555 | x1: number, |
| 556 | y1: number, |
| 557 | r1: number |
| 558 | ): CanvasGradient; |
| 559 | createPattern(image: CanvasImageSource, repetition: ?string): CanvasPattern; |
| 560 | |
| 561 | // shadows |
| 562 | shadowOffsetX: number; |
| 563 | shadowOffsetY: number; |
| 564 | shadowBlur: number; |
| 565 | shadowColor: string; |
| 566 | |
| 567 | // rects |
| 568 | clearRect(x: number, y: number, w: number, h: number): void; |
| 569 | fillRect(x: number, y: number, w: number, h: number): void; |
| 570 | roundRect( |
| 571 | x: number, |
| 572 | y: number, |
| 573 | w: number, |
| 574 | h: number, |
| 575 | radii?: number | DOMPointInit | $ReadOnlyArray<number | DOMPointInit> |
| 576 | ): void; |
| 577 | strokeRect(x: number, y: number, w: number, h: number): void; |
| 578 | |
| 579 | // path API |
| 580 | beginPath(): void; |
| 581 | fill(fillRule?: CanvasFillRule): void; |
| 582 | fill(path: Path2D, fillRule?: CanvasFillRule): void; |
| 583 | stroke(): void; |
| 584 | stroke(path: Path2D): void; |
| 585 | drawFocusIfNeeded(element: Element): void; |
| 586 | drawFocusIfNeeded(path: Path2D, element: Element): void; |
| 587 | scrollPathIntoView(): void; |
| 588 | scrollPathIntoView(path: Path2D): void; |
| 589 | clip(fillRule?: CanvasFillRule): void; |
| 590 | clip(path: Path2D, fillRule?: CanvasFillRule): void; |
| 591 | resetClip(): void; |
| 592 | isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; |
| 593 | isPointInPath( |
| 594 | path: Path2D, |
| 595 | x: number, |
| 596 | y: number, |
| 597 | fillRule?: CanvasFillRule |
| 598 | ): boolean; |
| 599 | isPointInStroke(x: number, y: number): boolean; |
| 600 | isPointInStroke(path: Path2D, x: number, y: number): boolean; |
| 601 | |
| 602 | // text (see also the CanvasDrawingStyles interface) |
| 603 | fillText(text: string, x: number, y: number, maxWidth?: number): void; |
| 604 | strokeText(text: string, x: number, y: number, maxWidth?: number): void; |
| 605 | measureText(text: string): TextMetrics; |
| 606 | |
| 607 | // drawing images |
| 608 | drawImage(image: CanvasImageSource, dx: number, dy: number): void; |
| 609 | drawImage( |
| 610 | image: CanvasImageSource, |
| 611 | dx: number, |
| 612 | dy: number, |
| 613 | dw: number, |
| 614 | dh: number |
| 615 | ): void; |
| 616 | drawImage( |
| 617 | image: CanvasImageSource, |
| 618 | sx: number, |
| 619 | sy: number, |
| 620 | sw: number, |
| 621 | sh: number, |
| 622 | dx: number, |
| 623 | dy: number, |
| 624 | dw: number, |
| 625 | dh: number |
| 626 | ): void; |
| 627 | |
| 628 | // hit regions |
| 629 | addHitRegion(options?: HitRegionOptions): void; |
| 630 | removeHitRegion(id: string): void; |
| 631 | clearHitRegions(): void; |
| 632 | |
| 633 | // pixel manipulation |
| 634 | createImageData(sw: number, sh: number): ImageData; |
| 635 | createImageData(imagedata: ImageData): ImageData; |
| 636 | getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; |
| 637 | putImageData(imagedata: ImageData, dx: number, dy: number): void; |
| 638 | putImageData( |
| 639 | imagedata: ImageData, |
| 640 | dx: number, |
| 641 | dy: number, |
| 642 | dirtyX: number, |
| 643 | dirtyY: number, |
| 644 | dirtyWidth: number, |
| 645 | dirtyHeight: number |
| 646 | ): void; |
| 647 | |
| 648 | // CanvasDrawingStyles |
| 649 | // line caps/joins |
| 650 | lineWidth: number; |
| 651 | lineCap: string; |
| 652 | lineJoin: string; |
| 653 | miterLimit: number; |
| 654 | |
| 655 | // dashed lines |
| 656 | setLineDash(segments: Array<number>): void; |
| 657 | getLineDash(): Array<number>; |
| 658 | lineDashOffset: number; |
| 659 | |
| 660 | // text |
| 661 | font: string; |
| 662 | textAlign: string; |
| 663 | textBaseline: string; |
| 664 | direction: string; |
| 665 | |
| 666 | // CanvasPathMethods |
| 667 | // shared path API methods |
| 668 | closePath(): void; |
| 669 | moveTo(x: number, y: number): void; |
| 670 | lineTo(x: number, y: number): void; |
| 671 | quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; |
| 672 | bezierCurveTo( |
| 673 | cp1x: number, |
| 674 | cp1y: number, |
| 675 | cp2x: number, |
| 676 | cp2y: number, |
| 677 | x: number, |
| 678 | y: number |
| 679 | ): void; |
| 680 | arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; |
| 681 | arcTo( |
| 682 | x1: number, |
| 683 | y1: number, |
| 684 | x2: number, |
| 685 | y2: number, |
| 686 | radiusX: number, |
| 687 | radiusY: number, |
| 688 | rotation: number |
| 689 | ): void; |
| 690 | rect(x: number, y: number, w: number, h: number): void; |
| 691 | arc( |
| 692 | x: number, |
| 693 | y: number, |
| 694 | radius: number, |
| 695 | startAngle: number, |
| 696 | endAngle: number, |
| 697 | anticlockwise?: boolean |
| 698 | ): void; |
| 699 | ellipse( |
| 700 | x: number, |
| 701 | y: number, |
| 702 | radiusX: number, |
| 703 | radiusY: number, |
| 704 | rotation: number, |
| 705 | startAngle: number, |
| 706 | endAngle: number, |
| 707 | anticlockwise?: boolean |
| 708 | ): void; |
| 709 | } |
| 710 | |
| 711 | // http://www.w3.org/TR/html5/scripting-1.html#renderingcontext |
| 712 | type RenderingContext = CanvasRenderingContext2D | WebGLRenderingContext; |
| 713 | |
| 714 | // https://www.w3.org/TR/html5/scripting-1.html#htmlcanvaselement |
| 715 | declare class HTMLCanvasElement extends HTMLElement { |
| 716 | tagName: 'CANVAS'; |
| 717 | width: number; |
| 718 | height: number; |
| 719 | getContext(contextId: '2d', ...args: any): CanvasRenderingContext2D; |
| 720 | getContext( |
| 721 | contextId: 'webgl', |
| 722 | contextAttributes?: Partial<WebGLContextAttributes> |
| 723 | ): ?WebGLRenderingContext; |
| 724 | // IE currently only supports "experimental-webgl" |
| 725 | getContext( |
| 726 | contextId: 'experimental-webgl', |
| 727 | contextAttributes?: Partial<WebGLContextAttributes> |
| 728 | ): ?WebGLRenderingContext; |
| 729 | getContext(contextId: string, ...args: any): ?RenderingContext; // fallback |
| 730 | toDataURL(type?: string, ...args: any): string; |
| 731 | toBlob(callback: (v: File) => void, type?: string, ...args: any): void; |
| 732 | captureStream(frameRate?: number): CanvasCaptureMediaStream; |
| 733 | } |
| 734 | |
| 735 | // https://html.spec.whatwg.org/multipage/forms.html#the-details-element |
| 736 | declare class HTMLDetailsElement extends HTMLElement { |
| 737 | tagName: 'DETAILS'; |
| 738 | open: boolean; |
| 739 | } |
| 740 | |
| 741 | declare class HTMLFormElement extends HTMLElement { |
| 742 | tagName: 'FORM'; |
| 743 | @@iterator(): Iterator<HTMLElement>; |
| 744 | [index: number | string]: HTMLElement | null; |
| 745 | acceptCharset: string; |
| 746 | action: string; |
| 747 | elements: HTMLCollection<HTMLElement>; |
| 748 | encoding: string; |
| 749 | enctype: string; |
| 750 | length: number; |
| 751 | method: string; |
| 752 | name: string; |
| 753 | rel: string; |
| 754 | target: string; |
| 755 | |
| 756 | checkValidity(): boolean; |
| 757 | reportValidity(): boolean; |
| 758 | reset(): void; |
| 759 | submit(): void; |
| 760 | } |
| 761 | |
| 762 | // https://www.w3.org/TR/html5/forms.html#the-fieldset-element |
| 763 | declare class HTMLFieldSetElement extends HTMLElement { |
| 764 | tagName: 'FIELDSET'; |
| 765 | disabled: boolean; |
| 766 | elements: HTMLCollection<HTMLElement>; // readonly |
| 767 | form: HTMLFormElement | null; // readonly |
| 768 | name: string; |
| 769 | type: string; // readonly |
| 770 | |
| 771 | checkValidity(): boolean; |
| 772 | setCustomValidity(error: string): void; |
| 773 | } |
| 774 | |
| 775 | declare class HTMLLegendElement extends HTMLElement { |
| 776 | tagName: 'LEGEND'; |
| 777 | form: HTMLFormElement | null; // readonly |
| 778 | } |
| 779 | |
| 780 | declare class HTMLIFrameElement extends HTMLElement { |
| 781 | tagName: 'IFRAME'; |
| 782 | allowFullScreen: boolean; |
| 783 | contentDocument: Document; |
| 784 | contentWindow: any; |
| 785 | frameBorder: string; |
| 786 | height: string; |
| 787 | marginHeight: string; |
| 788 | marginWidth: string; |
| 789 | name: string; |
| 790 | scrolling: string; |
| 791 | sandbox: DOMTokenList; |
| 792 | src: string; |
| 793 | // flowlint unsafe-getters-setters:off |
| 794 | get srcdoc(): string; |
| 795 | set srcdoc(value: string | TrustedHTML): void; |
| 796 | // flowlint unsafe-getters-setters:error |
| 797 | width: string; |
| 798 | } |
| 799 | |
| 800 | declare class HTMLImageElement extends HTMLElement { |
| 801 | tagName: 'IMG'; |
| 802 | alt: string; |
| 803 | complete: boolean; // readonly |
| 804 | crossOrigin: ?string; |
| 805 | currentSrc: string; // readonly |
| 806 | height: number; |
| 807 | decode(): Promise<void>; |
| 808 | isMap: boolean; |
| 809 | naturalHeight: number; // readonly |
| 810 | naturalWidth: number; // readonly |
| 811 | sizes: string; |
| 812 | src: string; |
| 813 | srcset: string; |
| 814 | useMap: string; |
| 815 | width: number; |
| 816 | } |
| 817 | |
| 818 | declare class Image extends HTMLImageElement { |
| 819 | constructor(width?: number, height?: number): void; |
| 820 | } |
| 821 | |
| 822 | declare class MediaError { |
| 823 | MEDIA_ERR_ABORTED: number; |
| 824 | MEDIA_ERR_NETWORK: number; |
| 825 | MEDIA_ERR_DECODE: number; |
| 826 | MEDIA_ERR_SRC_NOT_SUPPORTED: number; |
| 827 | code: number; |
| 828 | message: ?string; |
| 829 | } |
| 830 | |
| 831 | declare class TimeRanges { |
| 832 | length: number; |
| 833 | start(index: number): number; |
| 834 | end(index: number): number; |
| 835 | } |
| 836 | |
| 837 | declare class Audio extends HTMLAudioElement { |
| 838 | constructor(URLString?: string): void; |
| 839 | } |
| 840 | |
| 841 | declare class AudioTrack { |
| 842 | id: string; |
| 843 | kind: string; |
| 844 | label: string; |
| 845 | language: string; |
| 846 | enabled: boolean; |
| 847 | } |
| 848 | |
| 849 | declare class AudioTrackList extends EventTarget { |
| 850 | length: number; |
| 851 | [index: number]: AudioTrack; |
| 852 | |
| 853 | getTrackById(id: string): ?AudioTrack; |
| 854 | |
| 855 | onchange: (ev: any) => any; |
| 856 | onaddtrack: (ev: any) => any; |
| 857 | onremovetrack: (ev: any) => any; |
| 858 | } |
| 859 | |
| 860 | declare class VideoTrack { |
| 861 | id: string; |
| 862 | kind: string; |
| 863 | label: string; |
| 864 | language: string; |
| 865 | selected: boolean; |
| 866 | } |
| 867 | |
| 868 | declare class VideoTrackList extends EventTarget { |
| 869 | length: number; |
| 870 | [index: number]: VideoTrack; |
| 871 | getTrackById(id: string): ?VideoTrack; |
| 872 | selectedIndex: number; |
| 873 | |
| 874 | onchange: (ev: any) => any; |
| 875 | onaddtrack: (ev: any) => any; |
| 876 | onremovetrack: (ev: any) => any; |
| 877 | } |
| 878 | |
| 879 | declare class TextTrackCue extends EventTarget { |
| 880 | constructor(startTime: number, endTime: number, text: string): void; |
| 881 | |
| 882 | track: TextTrack; |
| 883 | id: string; |
| 884 | startTime: number; |
| 885 | endTime: number; |
| 886 | pauseOnExit: boolean; |
| 887 | vertical: string; |
| 888 | snapToLines: boolean; |
| 889 | lines: number; |
| 890 | position: number; |
| 891 | size: number; |
| 892 | align: string; |
| 893 | text: string; |
| 894 | |
| 895 | getCueAsHTML(): Node; |
| 896 | onenter: (ev: any) => any; |
| 897 | onexit: (ev: any) => any; |
| 898 | } |
| 899 | |
| 900 | declare class TextTrackCueList { |
| 901 | @@iterator(): Iterator<TextTrackCue>; |
| 902 | length: number; |
| 903 | [index: number]: TextTrackCue; |
| 904 | getCueById(id: string): ?TextTrackCue; |
| 905 | } |
| 906 | |
| 907 | declare class TextTrack extends EventTarget { |
| 908 | kind: string; |
| 909 | label: string; |
| 910 | language: string; |
| 911 | |
| 912 | mode: string; |
| 913 | |
| 914 | cues: TextTrackCueList; |
| 915 | activeCues: TextTrackCueList; |
| 916 | |
| 917 | addCue(cue: TextTrackCue): void; |
| 918 | removeCue(cue: TextTrackCue): void; |
| 919 | |
| 920 | oncuechange: (ev: any) => any; |
| 921 | } |
| 922 | |
| 923 | declare class TextTrackList extends EventTarget { |
| 924 | length: number; |
| 925 | [index: number]: TextTrack; |
| 926 | |
| 927 | onaddtrack: (ev: any) => any; |
| 928 | onremovetrack: (ev: any) => any; |
| 929 | } |
| 930 | |
| 931 | declare class HTMLMediaElement extends HTMLElement { |
| 932 | // error state |
| 933 | error: ?MediaError; |
| 934 | |
| 935 | // network state |
| 936 | src: string; |
| 937 | srcObject: ?any; |
| 938 | currentSrc: string; |
| 939 | crossOrigin: ?string; |
| 940 | NETWORK_EMPTY: number; |
| 941 | NETWORK_IDLE: number; |
| 942 | NETWORK_LOADING: number; |
| 943 | NETWORK_NO_SOURCE: number; |
| 944 | networkState: number; |
| 945 | preload: string; |
| 946 | buffered: TimeRanges; |
| 947 | load(): void; |
| 948 | canPlayType(type: string): string; |
| 949 | |
| 950 | // ready state |
| 951 | HAVE_NOTHING: number; |
| 952 | HAVE_METADATA: number; |
| 953 | HAVE_CURRENT_DATA: number; |
| 954 | HAVE_FUTURE_DATA: number; |
| 955 | HAVE_ENOUGH_DATA: number; |
| 956 | readyState: number; |
| 957 | seeking: boolean; |
| 958 | |
| 959 | // playback state |
| 960 | currentTime: number; |
| 961 | duration: number; |
| 962 | startDate: Date; |
| 963 | paused: boolean; |
| 964 | defaultPlaybackRate: number; |
| 965 | playbackRate: number; |
| 966 | played: TimeRanges; |
| 967 | seekable: TimeRanges; |
| 968 | ended: boolean; |
| 969 | autoplay: boolean; |
| 970 | loop: boolean; |
| 971 | play(): Promise<void>; |
| 972 | pause(): void; |
| 973 | fastSeek(): void; |
| 974 | captureStream(): MediaStream; |
| 975 | |
| 976 | // media controller |
| 977 | mediaGroup: string; |
| 978 | controller: ?any; |
| 979 | |
| 980 | // controls |
| 981 | controls: boolean; |
| 982 | volume: number; |
| 983 | muted: boolean; |
| 984 | defaultMuted: boolean; |
| 985 | controlsList?: DOMTokenList; |
| 986 | |
| 987 | // tracks |
| 988 | audioTracks: AudioTrackList; |
| 989 | videoTracks: VideoTrackList; |
| 990 | textTracks: TextTrackList; |
| 991 | addTextTrack(kind: string, label?: string, language?: string): TextTrack; |
| 992 | |
| 993 | // media keys |
| 994 | mediaKeys?: ?MediaKeys; |
| 995 | setMediakeys?: (mediakeys: ?MediaKeys) => Promise<?MediaKeys>; |
| 996 | } |
| 997 | |
| 998 | declare class HTMLAudioElement extends HTMLMediaElement { |
| 999 | tagName: 'AUDIO'; |
| 1000 | } |
| 1001 | |
| 1002 | declare class HTMLVideoElement extends HTMLMediaElement { |
| 1003 | tagName: 'VIDEO'; |
| 1004 | width: number; |
| 1005 | height: number; |
| 1006 | videoWidth: number; |
| 1007 | videoHeight: number; |
| 1008 | poster: string; |
| 1009 | } |
| 1010 | |
| 1011 | declare class HTMLSourceElement extends HTMLElement { |
| 1012 | tagName: 'SOURCE'; |
| 1013 | src: string; |
| 1014 | type: string; |
| 1015 | |
| 1016 | //when used with the picture element |
| 1017 | srcset: string; |
| 1018 | sizes: string; |
| 1019 | media: string; |
| 1020 | } |
| 1021 | |
| 1022 | declare class ValidityState { |
| 1023 | badInput: boolean; |
| 1024 | customError: boolean; |
| 1025 | patternMismatch: boolean; |
| 1026 | rangeOverflow: boolean; |
| 1027 | rangeUnderflow: boolean; |
| 1028 | stepMismatch: boolean; |
| 1029 | tooLong: boolean; |
| 1030 | tooShort: boolean; |
| 1031 | typeMismatch: boolean; |
| 1032 | valueMissing: boolean; |
| 1033 | valid: boolean; |
| 1034 | } |
| 1035 | |
| 1036 | // https://w3c.github.io/html/sec-forms.html#dom-selectionapielements-setselectionrange |
| 1037 | type SelectionDirection = 'backward' | 'forward' | 'none'; |
| 1038 | type SelectionMode = 'select' | 'start' | 'end' | 'preserve'; |
| 1039 | declare class HTMLInputElement extends HTMLElement { |
| 1040 | tagName: 'INPUT'; |
| 1041 | accept: string; |
| 1042 | align: string; |
| 1043 | alt: string; |
| 1044 | autocomplete: string; |
| 1045 | autofocus: boolean; |
| 1046 | border: string; |
| 1047 | checked: boolean; |
| 1048 | complete: boolean; |
| 1049 | defaultChecked: boolean; |
| 1050 | defaultValue: string; |
| 1051 | dirname: string; |
| 1052 | disabled: boolean; |
| 1053 | dynsrc: string; |
| 1054 | files: FileList; |
| 1055 | form: HTMLFormElement | null; |
| 1056 | formAction: string; |
| 1057 | formEncType: string; |
| 1058 | formMethod: string; |
| 1059 | formNoValidate: boolean; |
| 1060 | formTarget: string; |
| 1061 | height: string; |
| 1062 | hspace: number; |
| 1063 | indeterminate: boolean; |
| 1064 | labels: NodeList<HTMLLabelElement>; |
| 1065 | list: HTMLElement | null; |
| 1066 | loop: number; |
| 1067 | lowsrc: string; |
| 1068 | max: string; |
| 1069 | maxLength: number; |
| 1070 | min: string; |
| 1071 | multiple: boolean; |
| 1072 | name: string; |
| 1073 | pattern: string; |
| 1074 | placeholder: string; |
| 1075 | readOnly: boolean; |
| 1076 | required: boolean; |
| 1077 | selectionDirection: SelectionDirection; |
| 1078 | selectionEnd: number; |
| 1079 | selectionStart: number; |
| 1080 | size: number; |
| 1081 | src: string; |
| 1082 | start: string; |
| 1083 | status: boolean; |
| 1084 | step: string; |
| 1085 | type: string; |
| 1086 | useMap: string; |
| 1087 | validationMessage: string; |
| 1088 | validity: ValidityState; |
| 1089 | value: string; |
| 1090 | valueAsDate: Date; |
| 1091 | valueAsNumber: number; |
| 1092 | vrml: string; |
| 1093 | vspace: number; |
| 1094 | width: string; |
| 1095 | willValidate: boolean; |
| 1096 | popoverTargetElement: Element | null; |
| 1097 | popoverTargetAction: 'toggle' | 'show' | 'hide'; |
| 1098 | |
| 1099 | checkValidity(): boolean; |
| 1100 | reportValidity(): boolean; |
| 1101 | setCustomValidity(error: string): void; |
| 1102 | createTextRange(): TextRange; |
| 1103 | select(): void; |
| 1104 | setRangeText( |
| 1105 | replacement: string, |
| 1106 | start?: void, |
| 1107 | end?: void, |
| 1108 | selectMode?: void |
| 1109 | ): void; |
| 1110 | setRangeText( |
| 1111 | replacement: string, |
| 1112 | start: number, |
| 1113 | end: number, |
| 1114 | selectMode?: SelectionMode |
| 1115 | ): void; |
| 1116 | setSelectionRange( |
| 1117 | start: number, |
| 1118 | end: number, |
| 1119 | direction?: SelectionDirection |
| 1120 | ): void; |
| 1121 | showPicker(): void; |
| 1122 | stepDown(stepDecrement?: number): void; |
| 1123 | stepUp(stepIncrement?: number): void; |
| 1124 | } |
| 1125 | |
| 1126 | declare class HTMLButtonElement extends HTMLElement { |
| 1127 | tagName: 'BUTTON'; |
| 1128 | autofocus: boolean; |
| 1129 | disabled: boolean; |
| 1130 | form: HTMLFormElement | null; |
| 1131 | labels: NodeList<HTMLLabelElement> | null; |
| 1132 | name: string; |
| 1133 | type: string; |
| 1134 | validationMessage: string; |
| 1135 | validity: ValidityState; |
| 1136 | value: string; |
| 1137 | willValidate: boolean; |
| 1138 | |
| 1139 | checkValidity(): boolean; |
| 1140 | reportValidity(): boolean; |
| 1141 | setCustomValidity(error: string): void; |
| 1142 | popoverTargetElement: Element | null; |
| 1143 | popoverTargetAction: 'toggle' | 'show' | 'hide'; |
| 1144 | } |
| 1145 | |
| 1146 | // https://w3c.github.io/html/sec-forms.html#the-textarea-element |
| 1147 | declare class HTMLTextAreaElement extends HTMLElement { |
| 1148 | tagName: 'TEXTAREA'; |
| 1149 | autofocus: boolean; |
| 1150 | cols: number; |
| 1151 | dirName: string; |
| 1152 | disabled: boolean; |
| 1153 | form: HTMLFormElement | null; |
| 1154 | maxLength: number; |
| 1155 | name: string; |
| 1156 | placeholder: string; |
| 1157 | readOnly: boolean; |
| 1158 | required: boolean; |
| 1159 | rows: number; |
| 1160 | wrap: string; |
| 1161 | |
| 1162 | type: string; |
| 1163 | defaultValue: string; |
| 1164 | value: string; |
| 1165 | textLength: number; |
| 1166 | |
| 1167 | willValidate: boolean; |
| 1168 | validity: ValidityState; |
| 1169 | validationMessage: string; |
| 1170 | checkValidity(): boolean; |
| 1171 | setCustomValidity(error: string): void; |
| 1172 | |
| 1173 | labels: NodeList<HTMLLabelElement>; |
| 1174 | |
| 1175 | select(): void; |
| 1176 | selectionStart: number; |
| 1177 | selectionEnd: number; |
| 1178 | selectionDirection: SelectionDirection; |
| 1179 | setSelectionRange( |
| 1180 | start: number, |
| 1181 | end: number, |
| 1182 | direction?: SelectionDirection |
| 1183 | ): void; |
| 1184 | } |
| 1185 | |
| 1186 | declare class HTMLSelectElement extends HTMLElement { |
| 1187 | tagName: 'SELECT'; |
| 1188 | autocomplete: string; |
| 1189 | autofocus: boolean; |
| 1190 | disabled: boolean; |
| 1191 | form: HTMLFormElement | null; |
| 1192 | labels: NodeList<HTMLLabelElement>; |
| 1193 | length: number; |
| 1194 | multiple: boolean; |
| 1195 | name: string; |
| 1196 | options: HTMLOptionsCollection; |
| 1197 | required: boolean; |
| 1198 | selectedIndex: number; |
| 1199 | selectedOptions: HTMLCollection<HTMLOptionElement>; |
| 1200 | size: number; |
| 1201 | type: string; |
| 1202 | validationMessage: string; |
| 1203 | validity: ValidityState; |
| 1204 | value: string; |
| 1205 | willValidate: boolean; |
| 1206 | |
| 1207 | add(element: HTMLElement, before?: HTMLElement): void; |
| 1208 | checkValidity(): boolean; |
| 1209 | item(index: number): HTMLOptionElement | null; |
| 1210 | namedItem(name: string): HTMLOptionElement | null; |
| 1211 | remove(index?: number): void; |
| 1212 | setCustomValidity(error: string): void; |
| 1213 | } |
| 1214 | |
| 1215 | declare class HTMLOptionsCollection extends HTMLCollection<HTMLOptionElement> { |
| 1216 | selectedIndex: number; |
| 1217 | add( |
| 1218 | element: HTMLOptionElement | HTMLOptGroupElement, |
| 1219 | before?: HTMLElement | number |
| 1220 | ): void; |
| 1221 | remove(index: number): void; |
| 1222 | } |
| 1223 | |
| 1224 | declare class HTMLOptionElement extends HTMLElement { |
| 1225 | tagName: 'OPTION'; |
| 1226 | defaultSelected: boolean; |
| 1227 | disabled: boolean; |
| 1228 | form: HTMLFormElement | null; |
| 1229 | index: number; |
| 1230 | label: string; |
| 1231 | selected: boolean; |
| 1232 | text: string; |
| 1233 | value: string; |
| 1234 | } |
| 1235 | |
| 1236 | declare class HTMLOptGroupElement extends HTMLElement { |
| 1237 | tagName: 'OPTGROUP'; |
| 1238 | disabled: boolean; |
| 1239 | label: string; |
| 1240 | } |
| 1241 | |
| 1242 | declare class HTMLAnchorElement extends HTMLElement { |
| 1243 | tagName: 'A'; |
| 1244 | charset: string; |
| 1245 | coords: string; |
| 1246 | download: string; |
| 1247 | hash: string; |
| 1248 | host: string; |
| 1249 | hostname: string; |
| 1250 | href: string; |
| 1251 | hreflang: string; |
| 1252 | media: string; |
| 1253 | name: string; |
| 1254 | origin: string; |
| 1255 | password: string; |
| 1256 | pathname: string; |
| 1257 | port: string; |
| 1258 | protocol: string; |
| 1259 | rel: string; |
| 1260 | rev: string; |
| 1261 | search: string; |
| 1262 | shape: string; |
| 1263 | target: string; |
| 1264 | text: string; |
| 1265 | type: string; |
| 1266 | username: string; |
| 1267 | } |
| 1268 | |
| 1269 | // https://w3c.github.io/html/sec-forms.html#the-label-element |
| 1270 | declare class HTMLLabelElement extends HTMLElement { |
| 1271 | tagName: 'LABEL'; |
| 1272 | form: HTMLFormElement | null; |
| 1273 | htmlFor: string; |
| 1274 | control: HTMLElement | null; |
| 1275 | } |
| 1276 | |
| 1277 | declare class HTMLLinkElement extends HTMLElement { |
| 1278 | tagName: 'LINK'; |
| 1279 | crossOrigin: ?('anonymous' | 'use-credentials'); |
| 1280 | href: string; |
| 1281 | hreflang: string; |
| 1282 | media: string; |
| 1283 | rel: string; |
| 1284 | sizes: DOMTokenList; |
| 1285 | type: string; |
| 1286 | as: string; |
| 1287 | } |
| 1288 | |
| 1289 | declare class HTMLScriptElement extends HTMLElement { |
| 1290 | tagName: 'SCRIPT'; |
| 1291 | async: boolean; |
| 1292 | charset: string; |
| 1293 | crossOrigin?: string; |
| 1294 | defer: boolean; |
| 1295 | // flowlint unsafe-getters-setters:off |
| 1296 | get src(): string; |
| 1297 | set src(value: string | TrustedScriptURL): void; |
| 1298 | get text(): string; |
| 1299 | set text(value: string | TrustedScript): void; |
| 1300 | // flowlint unsafe-getters-setters:error |
| 1301 | type: string; |
| 1302 | } |
| 1303 | |
| 1304 | declare class HTMLStyleElement extends HTMLElement { |
| 1305 | tagName: 'STYLE'; |
| 1306 | disabled: boolean; |
| 1307 | media: string; |
| 1308 | scoped: boolean; |
| 1309 | sheet: ?CSSStyleSheet; |
| 1310 | type: string; |
| 1311 | } |
| 1312 | |
| 1313 | declare class HTMLParagraphElement extends HTMLElement { |
| 1314 | tagName: 'P'; |
| 1315 | align: 'left' | 'center' | 'right' | 'justify'; // deprecated in HTML 4.01 |
| 1316 | } |
| 1317 | |
| 1318 | declare class HTMLHtmlElement extends HTMLElement { |
| 1319 | tagName: 'HTML'; |
| 1320 | } |
| 1321 | |
| 1322 | declare class HTMLBodyElement extends HTMLElement { |
| 1323 | tagName: 'BODY'; |
| 1324 | } |
| 1325 | |
| 1326 | declare class HTMLHeadElement extends HTMLElement { |
| 1327 | tagName: 'HEAD'; |
| 1328 | } |
| 1329 | |
| 1330 | declare class HTMLDivElement extends HTMLElement { |
| 1331 | tagName: 'DIV'; |
| 1332 | } |
| 1333 | |
| 1334 | declare class HTMLSpanElement extends HTMLElement { |
| 1335 | tagName: 'SPAN'; |
| 1336 | } |
| 1337 | |
| 1338 | declare class HTMLAppletElement extends HTMLElement {} |
| 1339 | |
| 1340 | declare class HTMLHeadingElement extends HTMLElement { |
| 1341 | tagName: 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6'; |
| 1342 | } |
| 1343 | |
| 1344 | declare class HTMLHRElement extends HTMLElement { |
| 1345 | tagName: 'HR'; |
| 1346 | } |
| 1347 | |
| 1348 | declare class HTMLBRElement extends HTMLElement { |
| 1349 | tagName: 'BR'; |
| 1350 | } |
| 1351 | |
| 1352 | declare class HTMLDListElement extends HTMLElement { |
| 1353 | tagName: 'DL'; |
| 1354 | } |
| 1355 | |
| 1356 | declare class HTMLAreaElement extends HTMLElement { |
| 1357 | tagName: 'AREA'; |
| 1358 | alt: string; |
| 1359 | coords: string; |
| 1360 | shape: string; |
| 1361 | target: string; |
| 1362 | download: string; |
| 1363 | ping: string; |
| 1364 | rel: string; |
| 1365 | relList: DOMTokenList; |
| 1366 | referrerPolicy: string; |
| 1367 | } |
| 1368 | |
| 1369 | declare class HTMLDataElement extends HTMLElement { |
| 1370 | tagName: 'DATA'; |
| 1371 | value: string; |
| 1372 | } |
| 1373 | |
| 1374 | declare class HTMLDataListElement extends HTMLElement { |
| 1375 | tagName: 'DATALIST'; |
| 1376 | options: HTMLCollection<HTMLOptionElement>; |
| 1377 | } |
| 1378 | |
| 1379 | declare class HTMLDialogElement extends HTMLElement { |
| 1380 | tagName: 'DIALOG'; |
| 1381 | open: boolean; |
| 1382 | returnValue: string; |
| 1383 | show(): void; |
| 1384 | showModal(): void; |
| 1385 | close(returnValue: ?string): void; |
| 1386 | } |
| 1387 | |
| 1388 | declare class HTMLEmbedElement extends HTMLElement { |
| 1389 | tagName: 'EMBED'; |
| 1390 | src: string; |
| 1391 | type: string; |
| 1392 | width: string; |
| 1393 | height: string; |
| 1394 | getSVGDocument(): ?Document; |
| 1395 | } |
| 1396 | |
| 1397 | declare class HTMLMapElement extends HTMLElement { |
| 1398 | tagName: 'MAP'; |
| 1399 | areas: HTMLCollection<HTMLAreaElement>; |
| 1400 | images: HTMLCollection<HTMLImageElement>; |
| 1401 | name: string; |
| 1402 | } |
| 1403 | |
| 1404 | declare class HTMLMeterElement extends HTMLElement { |
| 1405 | tagName: 'METER'; |
| 1406 | high: number; |
| 1407 | low: number; |
| 1408 | max: number; |
| 1409 | min: number; |
| 1410 | optimum: number; |
| 1411 | value: number; |
| 1412 | labels: NodeList<HTMLLabelElement>; |
| 1413 | } |
| 1414 | |
| 1415 | declare class HTMLModElement extends HTMLElement { |
| 1416 | tagName: 'DEL' | 'INS'; |
| 1417 | cite: string; |
| 1418 | dateTime: string; |
| 1419 | } |
| 1420 | |
| 1421 | declare class HTMLObjectElement extends HTMLElement { |
| 1422 | tagName: 'OBJECT'; |
| 1423 | contentDocument: ?Document; |
| 1424 | contentWindow: ?WindowProxy; |
| 1425 | data: string; |
| 1426 | form: ?HTMLFormElement; |
| 1427 | height: string; |
| 1428 | name: string; |
| 1429 | type: string; |
| 1430 | typeMustMatch: boolean; |
| 1431 | useMap: string; |
| 1432 | validationMessage: string; |
| 1433 | validity: ValidityState; |
| 1434 | width: string; |
| 1435 | willValidate: boolean; |
| 1436 | checkValidity(): boolean; |
| 1437 | getSVGDocument(): ?Document; |
| 1438 | reportValidity(): boolean; |
| 1439 | setCustomValidity(error: string): void; |
| 1440 | } |
| 1441 | |
| 1442 | declare class HTMLOutputElement extends HTMLElement { |
| 1443 | defaultValue: string; |
| 1444 | form: ?HTMLFormElement; |
| 1445 | htmlFor: DOMTokenList; |
| 1446 | labels: NodeList<HTMLLabelElement>; |
| 1447 | name: string; |
| 1448 | type: string; |
| 1449 | validationMessage: string; |
| 1450 | validity: ValidityState; |
| 1451 | value: string; |
| 1452 | willValidate: boolean; |
| 1453 | checkValidity(): boolean; |
| 1454 | reportValidity(): boolean; |
| 1455 | setCustomValidity(error: string): void; |
| 1456 | } |
| 1457 | |
| 1458 | declare class HTMLParamElement extends HTMLElement { |
| 1459 | tagName: 'PARAM'; |
| 1460 | name: string; |
| 1461 | value: string; |
| 1462 | } |
| 1463 | |
| 1464 | declare class HTMLProgressElement extends HTMLElement { |
| 1465 | tagName: 'PROGRESS'; |
| 1466 | labels: NodeList<HTMLLabelElement>; |
| 1467 | max: number; |
| 1468 | position: number; |
| 1469 | value: number; |
| 1470 | } |
| 1471 | |
| 1472 | declare class HTMLPictureElement extends HTMLElement { |
| 1473 | tagName: 'PICTURE'; |
| 1474 | } |
| 1475 | |
| 1476 | declare class HTMLTimeElement extends HTMLElement { |
| 1477 | tagName: 'TIME'; |
| 1478 | dateTime: string; |
| 1479 | } |
| 1480 | |
| 1481 | declare class HTMLTitleElement extends HTMLElement { |
| 1482 | tagName: 'TITLE'; |
| 1483 | text: string; |
| 1484 | } |
| 1485 | |
| 1486 | declare class HTMLTrackElement extends HTMLElement { |
| 1487 | tagName: 'TRACK'; |
| 1488 | static NONE: 0; |
| 1489 | static LOADING: 1; |
| 1490 | static LOADED: 2; |
| 1491 | static ERROR: 3; |
| 1492 | |
| 1493 | default: boolean; |
| 1494 | kind: string; |
| 1495 | label: string; |
| 1496 | readyState: 0 | 1 | 2 | 3; |
| 1497 | src: string; |
| 1498 | srclang: string; |
| 1499 | track: TextTrack; |
| 1500 | } |
| 1501 | |
| 1502 | declare class HTMLQuoteElement extends HTMLElement { |
| 1503 | tagName: 'BLOCKQUOTE' | 'Q'; |
| 1504 | cite: string; |
| 1505 | } |
| 1506 | |
| 1507 | declare class HTMLOListElement extends HTMLElement { |
| 1508 | tagName: 'OL'; |
| 1509 | reversed: boolean; |
| 1510 | start: number; |
| 1511 | type: string; |
| 1512 | } |
| 1513 | |
| 1514 | declare class HTMLUListElement extends HTMLElement { |
| 1515 | tagName: 'UL'; |
| 1516 | } |
| 1517 | |
| 1518 | declare class HTMLLIElement extends HTMLElement { |
| 1519 | tagName: 'LI'; |
| 1520 | value: number; |
| 1521 | } |
| 1522 | |
| 1523 | declare class HTMLPreElement extends HTMLElement { |
| 1524 | tagName: 'PRE'; |
| 1525 | } |
| 1526 | |
| 1527 | declare class HTMLMetaElement extends HTMLElement { |
| 1528 | tagName: 'META'; |
| 1529 | content: string; |
| 1530 | httpEquiv: string; |
| 1531 | name: string; |
| 1532 | } |
| 1533 | |
| 1534 | declare class HTMLUnknownElement extends HTMLElement {} |
| 1535 | |
| 1536 | declare class Storage { |
| 1537 | length: number; |
| 1538 | getItem(key: string): ?string; |
| 1539 | setItem(key: string, data: string): void; |
| 1540 | clear(): void; |
| 1541 | removeItem(key: string): void; |
| 1542 | key(index: number): ?string; |
| 1543 | [name: string]: ?string; |
| 1544 | } |
| 1545 | |
| 1546 | /* window */ |
| 1547 | |
| 1548 | declare type WindowProxy = any; |
| 1549 | declare function alert(message?: any): void; |
| 1550 | declare function prompt(message?: any, value?: any): string; |
| 1551 | declare function close(): void; |
| 1552 | declare function confirm(message?: string): boolean; |
| 1553 | declare function getComputedStyle( |
| 1554 | elt: Element, |
| 1555 | pseudoElt?: string |
| 1556 | ): CSSStyleDeclaration; |
| 1557 | declare opaque type AnimationFrameID; |
| 1558 | declare function requestAnimationFrame( |
| 1559 | callback: (timestamp: number) => void |
| 1560 | ): AnimationFrameID; |
| 1561 | declare function cancelAnimationFrame(requestId: AnimationFrameID): void; |
| 1562 | declare opaque type IdleCallbackID; |
| 1563 | declare function requestIdleCallback( |
| 1564 | cb: (deadline: { |
| 1565 | didTimeout: boolean, |
| 1566 | timeRemaining: () => number, |
| 1567 | ... |
| 1568 | }) => void, |
| 1569 | opts?: {timeout: number, ...} |
| 1570 | ): IdleCallbackID; |
| 1571 | declare function cancelIdleCallback(id: IdleCallbackID): void; |
| 1572 | declare var localStorage: Storage; |
| 1573 | declare var devicePixelRatio: number; |
| 1574 | declare function focus(): void; |
| 1575 | declare function onfocus(ev: Event): any; |
| 1576 | declare function open( |
| 1577 | url?: string, |
| 1578 | target?: string, |
| 1579 | features?: string, |
| 1580 | replace?: boolean |
| 1581 | ): any; |
| 1582 | declare var parent: WindowProxy; |
| 1583 | declare function print(): void; |
| 1584 | declare var self: any; |
| 1585 | declare var sessionStorage: Storage; |
| 1586 | declare var top: WindowProxy; |
| 1587 | declare function getSelection(): Selection | null; |
| 1588 | declare var customElements: CustomElementRegistry; |
| 1589 | declare function scroll(x: number, y: number): void; |
| 1590 | declare function scroll(options: ScrollToOptions): void; |
| 1591 | declare function scrollTo(x: number, y: number): void; |
| 1592 | declare function scrollTo(options: ScrollToOptions): void; |
| 1593 | declare function scrollBy(x: number, y: number): void; |
| 1594 | declare function scrollBy(options: ScrollToOptions): void; |
| 1595 | |
| 1596 | type HTMLElementTagNameMap = { |
| 1597 | a: HTMLAnchorElement, |
| 1598 | abbr: HTMLElement, |
| 1599 | address: HTMLElement, |
| 1600 | area: HTMLAreaElement, |
| 1601 | article: HTMLElement, |
| 1602 | aside: HTMLElement, |
| 1603 | audio: HTMLAudioElement, |
| 1604 | b: HTMLElement, |
| 1605 | base: HTMLBaseElement, |
| 1606 | bdi: HTMLElement, |
| 1607 | bdo: HTMLElement, |
| 1608 | blockquote: HTMLQuoteElement, |
| 1609 | body: HTMLBodyElement, |
| 1610 | br: HTMLBRElement, |
| 1611 | button: HTMLButtonElement, |
| 1612 | canvas: HTMLCanvasElement, |
| 1613 | caption: HTMLTableCaptionElement, |
| 1614 | cite: HTMLElement, |
| 1615 | code: HTMLElement, |
| 1616 | col: HTMLTableColElement, |
| 1617 | colgroup: HTMLTableColElement, |
| 1618 | data: HTMLDataElement, |
| 1619 | datalist: HTMLDataListElement, |
| 1620 | dd: HTMLElement, |
| 1621 | del: HTMLModElement, |
| 1622 | details: HTMLDetailsElement, |
| 1623 | dfn: HTMLElement, |
| 1624 | dialog: HTMLDialogElement, |
| 1625 | div: HTMLDivElement, |
| 1626 | dl: HTMLDListElement, |
| 1627 | dt: HTMLElement, |
| 1628 | em: HTMLElement, |
| 1629 | embed: HTMLEmbedElement, |
| 1630 | fieldset: HTMLFieldSetElement, |
| 1631 | figcaption: HTMLElement, |
| 1632 | figure: HTMLElement, |
| 1633 | footer: HTMLElement, |
| 1634 | form: HTMLFormElement, |
| 1635 | h1: HTMLHeadingElement, |
| 1636 | h2: HTMLHeadingElement, |
| 1637 | h3: HTMLHeadingElement, |
| 1638 | h4: HTMLHeadingElement, |
| 1639 | h5: HTMLHeadingElement, |
| 1640 | h6: HTMLHeadingElement, |
| 1641 | head: HTMLHeadElement, |
| 1642 | header: HTMLElement, |
| 1643 | hgroup: HTMLElement, |
| 1644 | hr: HTMLHRElement, |
| 1645 | html: HTMLHtmlElement, |
| 1646 | i: HTMLElement, |
| 1647 | iframe: HTMLIFrameElement, |
| 1648 | img: HTMLImageElement, |
| 1649 | input: HTMLInputElement, |
| 1650 | ins: HTMLModElement, |
| 1651 | kbd: HTMLElement, |
| 1652 | label: HTMLLabelElement, |
| 1653 | legend: HTMLLegendElement, |
| 1654 | li: HTMLLIElement, |
| 1655 | link: HTMLLinkElement, |
| 1656 | main: HTMLElement, |
| 1657 | map: HTMLMapElement, |
| 1658 | mark: HTMLElement, |
| 1659 | menu: HTMLMenuElement, |
| 1660 | meta: HTMLMetaElement, |
| 1661 | meter: HTMLMeterElement, |
| 1662 | nav: HTMLElement, |
| 1663 | noscript: HTMLElement, |
| 1664 | object: HTMLObjectElement, |
| 1665 | ol: HTMLOListElement, |
| 1666 | optgroup: HTMLOptGroupElement, |
| 1667 | option: HTMLOptionElement, |
| 1668 | output: HTMLOutputElement, |
| 1669 | p: HTMLParagraphElement, |
| 1670 | picture: HTMLPictureElement, |
| 1671 | pre: HTMLPreElement, |
| 1672 | progress: HTMLProgressElement, |
| 1673 | q: HTMLQuoteElement, |
| 1674 | rp: HTMLElement, |
| 1675 | rt: HTMLElement, |
| 1676 | ruby: HTMLElement, |
| 1677 | s: HTMLElement, |
| 1678 | samp: HTMLElement, |
| 1679 | script: HTMLScriptElement, |
| 1680 | search: HTMLElement, |
| 1681 | section: HTMLElement, |
| 1682 | select: HTMLSelectElement, |
| 1683 | slot: HTMLSlotElement, |
| 1684 | small: HTMLElement, |
| 1685 | source: HTMLSourceElement, |
| 1686 | span: HTMLSpanElement, |
| 1687 | strong: HTMLElement, |
| 1688 | style: HTMLStyleElement, |
| 1689 | sub: HTMLElement, |
| 1690 | summary: HTMLElement, |
| 1691 | sup: HTMLElement, |
| 1692 | table: HTMLTableElement, |
| 1693 | tbody: HTMLTableSectionElement, |
| 1694 | td: HTMLTableCellElement, |
| 1695 | template: HTMLTemplateElement, |
| 1696 | textarea: HTMLTextAreaElement, |
| 1697 | tfoot: HTMLTableSectionElement, |
| 1698 | th: HTMLTableCellElement, |
| 1699 | thead: HTMLTableSectionElement, |
| 1700 | time: HTMLTimeElement, |
| 1701 | title: HTMLTitleElement, |
| 1702 | tr: HTMLTableRowElement, |
| 1703 | track: HTMLTrackElement, |
| 1704 | u: HTMLElement, |
| 1705 | ul: HTMLUListElement, |
| 1706 | var: HTMLElement, |
| 1707 | video: HTMLVideoElement, |
| 1708 | wbr: HTMLElement, |
| 1709 | [string]: Element, |
| 1710 | }; |