@rescript/webapi 0.1.0-alpha-b1d58f9

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 (341) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/package.json +61 -0
  4. package/rescript.json +557 -0
  5. package/src/animation/Animation.res +149 -0
  6. package/src/animation/AnimationEffect.res +71 -0
  7. package/src/animation/DocumentTimeline.res +8 -0
  8. package/src/canvas/Canvas.res +179 -0
  9. package/src/canvas/CanvasGradient.res +11 -0
  10. package/src/canvas/CanvasPattern.res +11 -0
  11. package/src/canvas/CanvasRenderingContext2D.res +868 -0
  12. package/src/canvas/CanvasTypes.res +452 -0
  13. package/src/canvas/FillStyle.res +25 -0
  14. package/src/canvas/HTMLCanvasElement.res +101 -0
  15. package/src/canvas/ImageBitmap.res +6 -0
  16. package/src/canvas/ImageBitmapRenderingContext.res +9 -0
  17. package/src/canvas/ImageData.res +17 -0
  18. package/src/canvas/OffscreenCanvas.res +87 -0
  19. package/src/canvas/Path2D.res +186 -0
  20. package/src/canvas/VideoColorSpace.res +11 -0
  21. package/src/canvas/VideoFrame.res +217 -0
  22. package/src/core/ArrayBufferTypedArrayOrDataView.res +4 -0
  23. package/src/core/DOM.res +1026 -0
  24. package/src/core/EventType.res +108 -0
  25. package/src/crypto/Crypto.res +11 -0
  26. package/src/crypto/SubtleCrypto.res +173 -0
  27. package/src/crypto/WebCryptoTypes.res +71 -0
  28. package/src/css-font-loading/BaseCSSFontLoading.res +24 -0
  29. package/src/css-font-loading/CssFontLoadingTypes.res +92 -0
  30. package/src/css-font-loading/FontFace.res +62 -0
  31. package/src/css-font-loading/FontFaceSet.res +38 -0
  32. package/src/cssom/CSSRuleList.res +5 -0
  33. package/src/cssom/CSSStyleDeclaration.res +1734 -0
  34. package/src/cssom/CSSStyleValue.res +17 -0
  35. package/src/cssom/MediaList.res +29 -0
  36. package/src/cssom/MediaQueryList.res +18 -0
  37. package/src/cssom/StylePropertyMap.res +56 -0
  38. package/src/cssom/StylePropertyMapReadOnly.res +22 -0
  39. package/src/cssom/StyleSheet.res +152 -0
  40. package/src/cssom/StyleSheetList.res +17 -0
  41. package/src/device/GamepadHapticActuator.res +16 -0
  42. package/src/device/GamepadTypes.res +86 -0
  43. package/src/device/Geolocation.res +31 -0
  44. package/src/device/GeolocationCoordinates.res +5 -0
  45. package/src/device/GeolocationPosition.res +5 -0
  46. package/src/device/GeolocationTypes.res +81 -0
  47. package/src/device/LockManager.res +26 -0
  48. package/src/device/ScreenOrientation.res +7 -0
  49. package/src/device/ScreenWakeLockTypes.res +26 -0
  50. package/src/device/WakeLock.res +8 -0
  51. package/src/device/WakeLockSentinel.res +7 -0
  52. package/src/device/WebLocksTypes.res +45 -0
  53. package/src/device/WebMIDI.res +7 -0
  54. package/src/device/WebMidiTypes.res +36 -0
  55. package/src/dom-nodes/AbstractRange.res +30 -0
  56. package/src/dom-nodes/Attr.res +101 -0
  57. package/src/dom-nodes/CDATASection.res +7 -0
  58. package/src/dom-nodes/CaretPosition.res +2 -0
  59. package/src/dom-nodes/CharacterData.res +199 -0
  60. package/src/dom-nodes/Comment.res +15 -0
  61. package/src/dom-nodes/DOMImplementation.res +131 -0
  62. package/src/dom-nodes/DOMTree.res +1653 -0
  63. package/src/dom-nodes/DocumentFragment.res +96 -0
  64. package/src/dom-nodes/Element.res +509 -0
  65. package/src/dom-nodes/ElementInternals.res +39 -0
  66. package/src/dom-nodes/HTML.res +11 -0
  67. package/src/dom-nodes/HTMLCollection.res +25 -0
  68. package/src/dom-nodes/NamedNodeMap.res +46 -0
  69. package/src/dom-nodes/Node.res +114 -0
  70. package/src/dom-nodes/NodeFilter.res +4 -0
  71. package/src/dom-nodes/NodeIterator.res +38 -0
  72. package/src/dom-nodes/NodeList.res +6 -0
  73. package/src/dom-nodes/ProcessingInstruction.res +15 -0
  74. package/src/dom-nodes/Range.res +156 -0
  75. package/src/dom-nodes/Selection.res +137 -0
  76. package/src/dom-nodes/ShadowRoot.res +23 -0
  77. package/src/dom-nodes/StaticRange.res +6 -0
  78. package/src/dom-nodes/Text.res +31 -0
  79. package/src/dom-nodes/TreeWalker.res +65 -0
  80. package/src/dom-platform/DOMException.res +7 -0
  81. package/src/dom-platform/DOMStringList.res +15 -0
  82. package/src/dom-platform/DOMStringMap.res +5 -0
  83. package/src/dom-platform/DOMTokenList.res +70 -0
  84. package/src/event/AbortController.res +9 -0
  85. package/src/event/AbortSignal.res +25 -0
  86. package/src/event/Event.res +76 -0
  87. package/src/event/EventTarget.res +91 -0
  88. package/src/event/ExtendableEvent.res +14 -0
  89. package/src/fetch/BodyInit.res +46 -0
  90. package/src/fetch/Fetch.res +12 -0
  91. package/src/fetch/FetchTypes.res +282 -0
  92. package/src/fetch/FormData.res +71 -0
  93. package/src/fetch/FormDataEntryValue.res +2 -0
  94. package/src/fetch/Headers.res +59 -0
  95. package/src/fetch/HeadersInit.res +16 -0
  96. package/src/fetch/Request.res +61 -0
  97. package/src/fetch/Response.res +127 -0
  98. package/src/file/BaseFileAndDirectoryEntries.res +72 -0
  99. package/src/file/Blob.res +48 -0
  100. package/src/file/File.res +15 -0
  101. package/src/file/FileAndDirectoryEntriesTypes.res +35 -0
  102. package/src/file/FileList.res +16 -0
  103. package/src/file/FileSystemDirectoryEntry.res +42 -0
  104. package/src/file/FileSystemDirectoryHandle.res +49 -0
  105. package/src/file/FileSystemDirectoryReader.res +9 -0
  106. package/src/file/FileSystemEntry.res +9 -0
  107. package/src/file/FileSystemFileHandle.res +25 -0
  108. package/src/file/FileSystemHandle.res +6 -0
  109. package/src/file/FileSystemWritableFileStream.res +65 -0
  110. package/src/file/FileTypes.res +225 -0
  111. package/src/file/ReadableStream.res +79 -0
  112. package/src/file/WritableStream.res +27 -0
  113. package/src/file/WritableStreamDefaultController.res +5 -0
  114. package/src/geometry/DOMMatrix.res +206 -0
  115. package/src/geometry/DOMMatrixReadOnly.res +140 -0
  116. package/src/geometry/DOMPoint.res +28 -0
  117. package/src/geometry/DOMPointReadOnly.res +22 -0
  118. package/src/geometry/DOMRect.res +22 -0
  119. package/src/geometry/DOMRectList.res +2 -0
  120. package/src/geometry/DOMRectReadOnly.res +19 -0
  121. package/src/html/HTMLAnchorElement.res +373 -0
  122. package/src/html/HTMLAreaElement.res +353 -0
  123. package/src/html/HTMLBRElement.res +9 -0
  124. package/src/html/HTMLBaseElement.res +20 -0
  125. package/src/html/HTMLBodyElement.res +9 -0
  126. package/src/html/HTMLButtonElement.res +98 -0
  127. package/src/html/HTMLDListElement.res +9 -0
  128. package/src/html/HTMLDataElement.res +14 -0
  129. package/src/html/HTMLDataListElement.res +14 -0
  130. package/src/html/HTMLDialogElement.res +40 -0
  131. package/src/html/HTMLDivElement.res +9 -0
  132. package/src/html/HTMLElement.res +108 -0
  133. package/src/html/HTMLEmbedElement.res +275 -0
  134. package/src/html/HTMLFieldSetElement.res +70 -0
  135. package/src/html/HTMLFormControlsCollection.res +21 -0
  136. package/src/html/HTMLFormElement.res +39 -0
  137. package/src/html/HTMLFrameSetElement.res +9 -0
  138. package/src/html/HTMLHRElement.res +9 -0
  139. package/src/html/HTMLHeadElement.res +256 -0
  140. package/src/html/HTMLHeadingElement.res +9 -0
  141. package/src/html/HTMLHtmlElement.res +9 -0
  142. package/src/html/HTMLIFrameElement.res +69 -0
  143. package/src/html/HTMLImageElement.res +349 -0
  144. package/src/html/HTMLInputElement.res +310 -0
  145. package/src/html/HTMLLIElement.res +9 -0
  146. package/src/html/HTMLLabelElement.res +25 -0
  147. package/src/html/HTMLLegendElement.res +14 -0
  148. package/src/html/HTMLLinkElement.res +69 -0
  149. package/src/html/HTMLMapElement.res +20 -0
  150. package/src/html/HTMLMenuElement.res +8 -0
  151. package/src/html/HTMLMetaElement.res +29 -0
  152. package/src/html/HTMLMeterElement.res +38 -0
  153. package/src/html/HTMLModElement.res +9 -0
  154. package/src/html/HTMLOListElement.res +24 -0
  155. package/src/html/HTMLObjectElement.res +89 -0
  156. package/src/html/HTMLOptGroupElement.res +19 -0
  157. package/src/html/HTMLOptionElement.res +49 -0
  158. package/src/html/HTMLOptionsCollection.res +35 -0
  159. package/src/html/HTMLOutputElement.res +73 -0
  160. package/src/html/HTMLParagraphElement.res +9 -0
  161. package/src/html/HTMLPictureElement.res +9 -0
  162. package/src/html/HTMLPreElement.res +9 -0
  163. package/src/html/HTMLProgressElement.res +29 -0
  164. package/src/html/HTMLQuoteElement.res +9 -0
  165. package/src/html/HTMLScriptElement.res +310 -0
  166. package/src/html/HTMLSelectElement.res +157 -0
  167. package/src/html/HTMLSlotElement.res +34 -0
  168. package/src/html/HTMLSourceElement.res +18 -0
  169. package/src/html/HTMLSpanElement.res +9 -0
  170. package/src/html/HTMLStyleElement.res +24 -0
  171. package/src/html/HTMLTableCaptionElement.res +9 -0
  172. package/src/html/HTMLTableCellElement.res +40 -0
  173. package/src/html/HTMLTableElement.res +100 -0
  174. package/src/html/HTMLTableRowElement.res +40 -0
  175. package/src/html/HTMLTableSectionElement.res +30 -0
  176. package/src/html/HTMLTemplateElement.res +31 -0
  177. package/src/html/HTMLTextAreaElement.res +177 -0
  178. package/src/html/HTMLTimeElement.res +14 -0
  179. package/src/html/HTMLTitleElement.res +15 -0
  180. package/src/html/HTMLUListElement.res +9 -0
  181. package/src/html/HTMLUnknownElement.res +9 -0
  182. package/src/media/BaseEncryptedMediaExtensions.res +97 -0
  183. package/src/media/DomHTMLMediaElement.res +206 -0
  184. package/src/media/EncryptedMediaExtensionsHTMLMediaElement.res +15 -0
  185. package/src/media/EncryptedMediaExtensionsTypes.res +43 -0
  186. package/src/media/HTMLAudioElement.res +9 -0
  187. package/src/media/HTMLTrackElement.res +14 -0
  188. package/src/media/HTMLVideoElement.res +78 -0
  189. package/src/media/MediaCapabilities.res +19 -0
  190. package/src/media/MediaCapabilitiesTypes.res +83 -0
  191. package/src/media/MediaCaptureAndStreamsTypes.res +197 -0
  192. package/src/media/MediaDeviceInfo.res +9 -0
  193. package/src/media/MediaDevices.res +40 -0
  194. package/src/media/MediaError.res +14 -0
  195. package/src/media/MediaKeySession.res +53 -0
  196. package/src/media/MediaKeyStatusMap.res +11 -0
  197. package/src/media/MediaKeySystemAccess.res +14 -0
  198. package/src/media/MediaKeys.res +35 -0
  199. package/src/media/MediaMetadata.res +10 -0
  200. package/src/media/MediaSession.res +25 -0
  201. package/src/media/MediaSessionTypes.res +85 -0
  202. package/src/media/MediaStream.res +89 -0
  203. package/src/media/MediaStreamTrack.res +51 -0
  204. package/src/media/PictureInPicture.res +7 -0
  205. package/src/media/PictureInPictureTypes.res +17 -0
  206. package/src/media/RemotePlayback.res +25 -0
  207. package/src/media/RemotePlaybackTypes.res +20 -0
  208. package/src/media/SpeechSynthesis.res +33 -0
  209. package/src/media/SpeechSynthesisUtterance.res +8 -0
  210. package/src/media/TextTrack.res +15 -0
  211. package/src/media/TextTrackCueList.res +9 -0
  212. package/src/media/TextTrackList.res +17 -0
  213. package/src/media/TimeRanges.res +29 -0
  214. package/src/media/VideoPlaybackQuality.res +18 -0
  215. package/src/media/WebSpeechTypes.res +83 -0
  216. package/src/media/WebVttTypes.res +123 -0
  217. package/src/messaging/ApplicationServerKey.res +2 -0
  218. package/src/messaging/ChannelMessagingTypes.res +12 -0
  219. package/src/messaging/CloseEvent.res +10 -0
  220. package/src/messaging/MessageEvent.res +43 -0
  221. package/src/messaging/MessagePort.res +38 -0
  222. package/src/messaging/Notification.res +46 -0
  223. package/src/messaging/NotificationTypes.res +107 -0
  224. package/src/messaging/PushEvent.res +3 -0
  225. package/src/messaging/PushManager.res +24 -0
  226. package/src/messaging/PushMessageData.res +15 -0
  227. package/src/messaging/PushSubscription.res +20 -0
  228. package/src/messaging/PushTypes.res +88 -0
  229. package/src/messaging/WebSocket.res +74 -0
  230. package/src/messaging/WebSocketsTypes.res +124 -0
  231. package/src/navigator/Clipboard.res +29 -0
  232. package/src/navigator/ClipboardItem.res +20 -0
  233. package/src/navigator/ClipboardTypes.res +31 -0
  234. package/src/navigator/CredentialManagementTypes.res +138 -0
  235. package/src/navigator/CredentialsContainer.res +33 -0
  236. package/src/navigator/Navigator.res +166 -0
  237. package/src/navigator/Permissions.res +10 -0
  238. package/src/navigator/PermissionsTypes.res +38 -0
  239. package/src/observers/IntersectionObserver.res +36 -0
  240. package/src/observers/IntersectionObserverRoot.res +23 -0
  241. package/src/observers/IntersectionObserverTypes.res +67 -0
  242. package/src/observers/MutationObserver.res +94 -0
  243. package/src/observers/ResizeObserver.res +30 -0
  244. package/src/observers/ResizeObserverTypes.res +56 -0
  245. package/src/performance/Performance.res +101 -0
  246. package/src/performance/PerformanceEntry.res +5 -0
  247. package/src/performance/PerformanceMark.res +16 -0
  248. package/src/performance/PerformanceTypes.res +86 -0
  249. package/src/storage/Cache.res +117 -0
  250. package/src/storage/CacheStorage.res +43 -0
  251. package/src/storage/CacheTypes.res +24 -0
  252. package/src/storage/IDBDatabase.res +54 -0
  253. package/src/storage/IDBFactory.res +34 -0
  254. package/src/storage/IDBIndex.res +83 -0
  255. package/src/storage/IDBObjectStore.res +183 -0
  256. package/src/storage/IDBTransaction.res +22 -0
  257. package/src/storage/IndexedDbTypes.res +213 -0
  258. package/src/storage/Storage.res +42 -0
  259. package/src/storage/StorageEvent.res +10 -0
  260. package/src/storage/StorageManager.res +24 -0
  261. package/src/storage/StorageTypes.res +11 -0
  262. package/src/storage/WebStorageTypes.res +57 -0
  263. package/src/svg/SVGElement.res +115 -0
  264. package/src/svg/SVGGraphicsElement.res +16 -0
  265. package/src/svg/SVGLength.res +9 -0
  266. package/src/ui-events/CompositionEvent.res +10 -0
  267. package/src/ui-events/DataTransfer.res +38 -0
  268. package/src/ui-events/DataTransferItem.res +21 -0
  269. package/src/ui-events/DataTransferItemList.res +34 -0
  270. package/src/ui-events/FocusEvent.res +10 -0
  271. package/src/ui-events/InputEvent.res +16 -0
  272. package/src/ui-events/KeyboardEvent.res +16 -0
  273. package/src/ui-events/MouseEvent.res +26 -0
  274. package/src/ui-events/PointerEvent.res +24 -0
  275. package/src/ui-events/Touch.res +5 -0
  276. package/src/ui-events/TouchEvent.res +10 -0
  277. package/src/ui-events/TouchList.res +5 -0
  278. package/src/ui-events/UIEvent.res +20 -0
  279. package/src/ui-events/UiEventsTypes.res +590 -0
  280. package/src/ui-events/WheelEvent.res +10 -0
  281. package/src/url/URL.res +38 -0
  282. package/src/url/URLSearchParams.res +104 -0
  283. package/src/url/UrlTypes.res +69 -0
  284. package/src/view-transitions/ViewTransition.res +5 -0
  285. package/src/view-transitions/ViewTransitionsTypes.res +22 -0
  286. package/src/web-audio/AnalyserNode.res +38 -0
  287. package/src/web-audio/AudioBuffer.res +33 -0
  288. package/src/web-audio/AudioBufferSourceNode.res +21 -0
  289. package/src/web-audio/AudioContext.res +59 -0
  290. package/src/web-audio/AudioDestinationNode.res +1 -0
  291. package/src/web-audio/AudioNode.res +76 -0
  292. package/src/web-audio/AudioParam.res +65 -0
  293. package/src/web-audio/AudioProcessingEvent.res +10 -0
  294. package/src/web-audio/AudioScheduledSourceNode.res +23 -0
  295. package/src/web-audio/AudioWorkletNode.res +11 -0
  296. package/src/web-audio/BaseAudioContext.res +141 -0
  297. package/src/web-audio/BiquadFilterNode.res +21 -0
  298. package/src/web-audio/ChannelMergerNode.res +10 -0
  299. package/src/web-audio/ChannelSplitterNode.res +10 -0
  300. package/src/web-audio/ConstantSourceNode.res +10 -0
  301. package/src/web-audio/ConvolverNode.res +10 -0
  302. package/src/web-audio/DelayNode.res +10 -0
  303. package/src/web-audio/DynamicsCompressorNode.res +10 -0
  304. package/src/web-audio/GainNode.res +10 -0
  305. package/src/web-audio/IIRFilterNode.res +21 -0
  306. package/src/web-audio/MediaElementAudioSourceNode.res +10 -0
  307. package/src/web-audio/MediaStreamAudioDestinationNode.res +10 -0
  308. package/src/web-audio/MediaStreamAudioSourceNode.res +10 -0
  309. package/src/web-audio/OfflineAudioCompletionEvent.res +10 -0
  310. package/src/web-audio/OfflineAudioContext.res +58 -0
  311. package/src/web-audio/OscillatorNode.res +17 -0
  312. package/src/web-audio/PannerNode.res +10 -0
  313. package/src/web-audio/PeriodicWave.res +8 -0
  314. package/src/web-audio/StereoPannerNode.res +10 -0
  315. package/src/web-audio/WaveShaperNode.res +10 -0
  316. package/src/web-audio/WebAudioTypes.res +1309 -0
  317. package/src/web-audio/Worklet.res +14 -0
  318. package/src/window/CustomElementRegistry.res +30 -0
  319. package/src/window/Document.res +470 -0
  320. package/src/window/DomGlobal.res +459 -0
  321. package/src/window/History.res +37 -0
  322. package/src/window/HistoryTypes.res +26 -0
  323. package/src/window/IdleDeadline.res +5 -0
  324. package/src/window/Location.res +108 -0
  325. package/src/window/VisualViewport.res +5 -0
  326. package/src/window/VisualViewportTypes.res +37 -0
  327. package/src/window/Window.res +556 -0
  328. package/src/window/XPathExpression.res +16 -0
  329. package/src/window/XPathResult.res +46 -0
  330. package/src/workers/Clients.res +39 -0
  331. package/src/workers/NavigationPreloadManager.res +26 -0
  332. package/src/workers/ServiceWorker.res +38 -0
  333. package/src/workers/ServiceWorkerContainer.res +34 -0
  334. package/src/workers/ServiceWorkerRegistration.res +32 -0
  335. package/src/workers/ServiceWorkerScope.res +12 -0
  336. package/src/workers/ServiceWorkerTypes.res +153 -0
  337. package/src/workers/SharedWorker.res +68 -0
  338. package/src/workers/SharedWorkerScope.res +29 -0
  339. package/src/workers/WebWorkersTypes.res +46 -0
  340. package/src/workers/Worker.res +48 -0
  341. package/src/workers/WorkerLocation.res +18 -0
@@ -0,0 +1,14 @@
1
+ /**
2
+ Loads and executes the module script given by moduleURL into all of worklet's global scopes. It can also create additional global scopes as part of this process, depending on the worklet type. The returned promise will fulfill once the script has been successfully loaded and run in all global scopes.
3
+
4
+ The credentials option can be set to a credentials mode to modify the script-fetching process. It defaults to "same-origin".
5
+
6
+ Any failures in fetching the script or its dependencies will cause the returned promise to be rejected with an "AbortError" DOMException. Any errors in parsing the script or its dependencies will cause the returned promise to be rejected with the exception generated during parsing.
7
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Worklet/addModule)
8
+ */
9
+ @send
10
+ external addModule: (
11
+ WebAudioTypes.worklet,
12
+ ~moduleURL: string,
13
+ ~options: WebAudioTypes.workletOptions=?,
14
+ ) => promise<unit> = "addModule"
@@ -0,0 +1,30 @@
1
+ /**
2
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/define)
3
+ */
4
+ @throws(JsExn) @send
5
+ external define: (
6
+ DOM.customElementRegistry,
7
+ ~name: string,
8
+ ~constructor: DOMTree.htmlElement,
9
+ ~options: DOM.elementDefinitionOptions=?,
10
+ ) => unit = "define"
11
+
12
+ /**
13
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/getName)
14
+ */
15
+ @send
16
+ external getName: (DOM.customElementRegistry, DOM.customElementConstructor) => Null.t<string> =
17
+ "getName"
18
+
19
+ /**
20
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/whenDefined)
21
+ */
22
+ @send
23
+ external whenDefined: (DOM.customElementRegistry, string) => promise<DOM.customElementConstructor> =
24
+ "whenDefined"
25
+
26
+ /**
27
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/upgrade)
28
+ */
29
+ @send
30
+ external upgrade: (DOM.customElementRegistry, DOMTree.node) => unit = "upgrade"
@@ -0,0 +1,470 @@
1
+ /**
2
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document)
3
+ */
4
+ @new
5
+ external make: unit => DOM.document = "Document"
6
+
7
+ include Node.Impl({type t = DOM.document})
8
+
9
+ /**
10
+ Returns the first element within node's descendants whose ID is elementId.
11
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getElementById)
12
+ */
13
+ @send
14
+ external getElementById: (DOM.document, string) => Null.t<DOMTree.element> = "getElementById"
15
+
16
+ /**
17
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getAnimations)
18
+ */
19
+ @send
20
+ external getAnimations: DOM.document => array<Animation.t> = "getAnimations"
21
+
22
+ /**
23
+ Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
24
+
25
+ Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
26
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/prepend)
27
+ */
28
+ @throws(JsExn) @send
29
+ external prepend: (DOM.document, DOMTree.node) => unit = "prepend"
30
+
31
+ /**
32
+ Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
33
+
34
+ Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
35
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/prepend)
36
+ */
37
+ @throws(JsExn) @send
38
+ external prepend2: (DOM.document, string) => unit = "prepend"
39
+
40
+ /**
41
+ Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.
42
+
43
+ Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
44
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/append)
45
+ */
46
+ @throws(JsExn) @send
47
+ external append: (DOM.document, DOMTree.node) => unit = "append"
48
+
49
+ /**
50
+ Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.
51
+
52
+ Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
53
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/append)
54
+ */
55
+ @throws(JsExn) @send
56
+ external append2: (DOM.document, string) => unit = "append"
57
+
58
+ /**
59
+ Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.
60
+
61
+ Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
62
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/replaceChildren)
63
+ */
64
+ @throws(JsExn) @send
65
+ external replaceChildren: (DOM.document, DOMTree.node) => unit = "replaceChildren"
66
+
67
+ /**
68
+ Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.
69
+
70
+ Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
71
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/replaceChildren)
72
+ */
73
+ @throws(JsExn) @send
74
+ external replaceChildren2: (DOM.document, string) => unit = "replaceChildren"
75
+
76
+ /**
77
+ Returns the first element that is a descendant of node that matches selectors.
78
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
79
+ */
80
+ @throws(JsExn) @send
81
+ external querySelector: (DOM.document, string) => Null.t<DOMTree.element> = "querySelector"
82
+
83
+ /**
84
+ Returns all element descendants of node that match selectors.
85
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/querySelectorAll)
86
+ */
87
+ @throws(JsExn) @send
88
+ external querySelectorAll: (DOM.document, string) => DOM.nodeList<DOMTree.element> =
89
+ "querySelectorAll"
90
+
91
+ /**
92
+ This method compiles an XPathExpression which can then be used for (repeated) evaluations.
93
+
94
+ You must call this method on the same document that you run the expression against.
95
+
96
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createExpression)
97
+ */
98
+ @send
99
+ external createExpression: (
100
+ DOM.document,
101
+ ~expression: string,
102
+ /** A function which maps a namespace prefix to a namespace URL (or null if none needed). **/
103
+ ~namespaceURLMapper: Null.t<string> => Null.t<string>=?,
104
+ ) => XPathExpression.t = "createExpression"
105
+
106
+ /**
107
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/evaluate)
108
+ */
109
+ @send
110
+ external evaluate: (
111
+ DOM.document,
112
+ ~expression: string,
113
+ ~contextNode: DOMTree.node,
114
+ ~resolver: Null.t<string> => Null.t<string>=?,
115
+ ~type_: int=?,
116
+ ~result: XPathResult.t=?,
117
+ ) => XPathResult.t = "evaluate"
118
+
119
+ /**
120
+ Retrieves a collection of objects based on the specified element name.
121
+ @param name Specifies the name of an element.
122
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getElementsByTagName)
123
+ */
124
+ @send
125
+ external getElementsByTagName: (DOM.document, string) => HTMLCollection.t<DOMTree.element> =
126
+ "getElementsByTagName"
127
+
128
+ /**
129
+ If namespace and localName are "*" returns a HTMLCollection of all descendant elements.
130
+
131
+ If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName.
132
+
133
+ If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace.
134
+
135
+ Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName.
136
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getElementsByTagNameNS)
137
+ */
138
+ @send
139
+ external getElementsByTagNameNS: (
140
+ DOM.document,
141
+ ~namespace: string,
142
+ ~localName: string,
143
+ ) => HTMLCollection.t<DOMTree.element> = "getElementsByTagNameNS"
144
+
145
+ /**
146
+ Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.
147
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getElementsByClassName)
148
+ */
149
+ @send
150
+ external getElementsByClassName: (DOM.document, string) => HTMLCollection.t<DOMTree.element> =
151
+ "getElementsByClassName"
152
+
153
+ type elementCreationOptions = {mutable is?: string}
154
+
155
+ /**
156
+ Creates an instance of the element for the specified tag.
157
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createElement)
158
+ */
159
+ @throws(JsExn) @send
160
+ external createElement: (
161
+ DOM.document,
162
+ string,
163
+ ~options: elementCreationOptions=?,
164
+ ) => DOMTree.element = "createElement"
165
+
166
+ /**
167
+ Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName.
168
+
169
+ If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown.
170
+
171
+ If one of the following conditions is true a "NamespaceError" DOMException will be thrown:
172
+
173
+ localName does not match the QName production.
174
+ Namespace prefix is not null and namespace is the empty string.
175
+ Namespace prefix is "xml" and namespace is not the XML namespace.
176
+ qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace.
177
+ namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns".
178
+
179
+ When supplied, options's is can be used to create a customized built-in element.
180
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createElementNS)
181
+ */
182
+ @throws(JsExn) @send
183
+ external createElementNS: (
184
+ DOM.document,
185
+ ~namespace: string,
186
+ ~qualifiedName: string,
187
+ ~options: string=?,
188
+ ) => DOMTree.element = "createElementNS"
189
+
190
+ /**
191
+ Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName.
192
+
193
+ If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown.
194
+
195
+ If one of the following conditions is true a "NamespaceError" DOMException will be thrown:
196
+
197
+ localName does not match the QName production.
198
+ Namespace prefix is not null and namespace is the empty string.
199
+ Namespace prefix is "xml" and namespace is not the XML namespace.
200
+ qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace.
201
+ namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns".
202
+
203
+ When supplied, options's is can be used to create a customized built-in element.
204
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createElementNS)
205
+ */
206
+ @throws(JsExn) @send
207
+ external createElementNS2: (
208
+ DOM.document,
209
+ ~namespace: string,
210
+ ~qualifiedName: string,
211
+ ~options: elementCreationOptions=?,
212
+ ) => DOMTree.element = "createElementNS"
213
+
214
+ /**
215
+ Creates a new document.
216
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createDocumentFragment)
217
+ */
218
+ @send
219
+ external createDocumentFragment: DOM.document => DOMTree.documentFragment = "createDocumentFragment"
220
+
221
+ /**
222
+ Creates a text string from the specified value.
223
+ @param data String that specifies the nodeValue property of the text node.
224
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createTextNode)
225
+ */
226
+ @send
227
+ external createTextNode: (DOM.document, string) => Text.t = "createTextNode"
228
+
229
+ /**
230
+ Returns a CDATASection node whose data is data.
231
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createCDATASection)
232
+ */
233
+ @send
234
+ external createCDATASection: (DOM.document, string) => CDATASection.t = "createCDATASection"
235
+
236
+ /**
237
+ Creates a comment object with the specified data.
238
+ @param data Sets the comment object's data.
239
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createComment)
240
+ */
241
+ @send
242
+ external createComment: (DOM.document, string) => Comment.t = "createComment"
243
+
244
+ /**
245
+ Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown.
246
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction)
247
+ */
248
+ @throws(JsExn) @send
249
+ external createProcessingInstruction: (
250
+ DOM.document,
251
+ ~target: string,
252
+ ~data: string,
253
+ ) => ProcessingInstruction.t = "createProcessingInstruction"
254
+
255
+ /**
256
+ Returns a copy of node. If deep is true, the copy also includes the node's descendants.
257
+
258
+ If node is a document or a shadow root, throws a "NotSupportedError" DOMException.
259
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/importNode)
260
+ */
261
+ @throws(JsExn) @send
262
+ external importNode: (DOM.document, 't, ~deep: bool=?) => 't = "importNode"
263
+
264
+ /**
265
+ Moves node from another document and returns it.
266
+
267
+ If node is a document, throws a "NotSupportedError" DOMException or, if node is a shadow root, throws a "HierarchyRequestError" DOMException.
268
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/adoptNode)
269
+ */
270
+ @throws(JsExn) @send
271
+ external adoptNode: (DOM.document, 't) => 't = "adoptNode"
272
+
273
+ /**
274
+ Creates an attribute object with a specified name.
275
+ @param name String that sets the attribute object's name.
276
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createAttribute)
277
+ */
278
+ @throws(JsExn) @send
279
+ external createAttribute: (DOM.document, string) => Attr.t = "createAttribute"
280
+
281
+ /**
282
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createAttributeNS)
283
+ */
284
+ @throws(JsExn) @send
285
+ external createAttributeNS: (DOM.document, ~namespace: string, ~qualifiedName: string) => Attr.t =
286
+ "createAttributeNS"
287
+
288
+ /**
289
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createEvent)
290
+ */
291
+ @send
292
+ external createEvent: (DOM.document, string) => DOM.event = "createEvent"
293
+
294
+ /**
295
+ Returns an empty range object that has both of its boundary points positioned at the beginning of the document.
296
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createRange)
297
+ */
298
+ @send
299
+ external createRange: DOM.document => Range.t = "createRange"
300
+
301
+ /**
302
+ Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
303
+ @param root The root element or node to start traversing on.
304
+ @param whatToShow The type of nodes or elements to appear in the node list
305
+ @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.
306
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createNodeIterator)
307
+ */
308
+ @send
309
+ external createNodeIterator: (
310
+ DOM.document,
311
+ ~root: DOMTree.node,
312
+ ~whatToShow: int=?,
313
+ ~filter: NodeFilter.t=?,
314
+ ) => NodeIterator.t = "createNodeIterator"
315
+
316
+ /**
317
+ Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.
318
+ @param root The root element or node to start traversing on.
319
+ @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow.
320
+ @param filter A custom NodeFilter function to use.
321
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createTreeWalker)
322
+ */
323
+ @send
324
+ external createTreeWalker: (
325
+ DOM.document,
326
+ ~root: DOMTree.node,
327
+ ~whatToShow: int=?,
328
+ ~filter: NodeFilter.t=?,
329
+ ) => TreeWalker.t = "createTreeWalker"
330
+
331
+ /**
332
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/startViewTransition)
333
+ */
334
+ @send
335
+ external startViewTransition: (
336
+ DOM.document,
337
+ ~callbackOptions: ViewTransitionsTypes.viewTransitionUpdateCallback=?,
338
+ ) => ViewTransitionsTypes.viewTransition = "startViewTransition"
339
+
340
+ type caretPositionFromPointOptions = {mutable shadowRoots?: array<DOMTree.shadowRoot>}
341
+
342
+ /**
343
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/caretPositionFromPoint)
344
+ */
345
+ @send
346
+ external caretPositionFromPoint: (
347
+ DOM.document,
348
+ ~x: float,
349
+ ~y: float,
350
+ ~options: caretPositionFromPointOptions=?,
351
+ ) => Null.t<DOM.caretPosition> = "caretPositionFromPoint"
352
+
353
+ /**
354
+ Stops document's fullscreen element from being displayed fullscreen and resolves promise when done.
355
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/exitFullscreen)
356
+ */
357
+ @send
358
+ external exitFullscreen: DOM.document => promise<unit> = "exitFullscreen"
359
+
360
+ /**
361
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/parseHTMLUnsafe_static)
362
+ */
363
+ @throws(JsExn) @scope("Document")
364
+ external parseHTMLUnsafe: string => DOM.document = "parseHTMLUnsafe"
365
+
366
+ /**
367
+ Gets a collection of objects based on the value of the NAME or ID attribute.
368
+ @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
369
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getElementsByName)
370
+ */
371
+ @send
372
+ external getElementsByName: (DOM.document, string) => DOM.nodeList<DOMTree.htmlElement> =
373
+ "getElementsByName"
374
+
375
+ /**
376
+ Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
377
+ @param url Specifies a MIME type for the document.
378
+ @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.
379
+ @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported.
380
+ @param replace Specifies whether the existing entry for the document is replaced in the history list.
381
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/open)
382
+ */
383
+ @send
384
+ external open_: (DOM.document, ~unused1: string=?, ~unused2: string=?) => DOM.document = "open"
385
+
386
+ /**
387
+ Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
388
+ @param url Specifies a MIME type for the document.
389
+ @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.
390
+ @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported.
391
+ @param replace Specifies whether the existing entry for the document is replaced in the history list.
392
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/open)
393
+ */
394
+ @send
395
+ external open2: (
396
+ DOM.document,
397
+ ~url: string,
398
+ ~name: string,
399
+ ~features: string,
400
+ ) => Null.t<DOM.window> = "open"
401
+
402
+ /**
403
+ Closes an output stream and forces the sent data to display.
404
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/close)
405
+ */
406
+ @send
407
+ external close: DOM.document => unit = "close"
408
+
409
+ /**
410
+ Writes one or more HTML expressions to a document in the specified window.
411
+ @param content Specifies the text and HTML tags to write.
412
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/write)
413
+ */
414
+ @throws(JsExn) @send
415
+ external write: (DOM.document, string) => unit = "write"
416
+
417
+ /**
418
+ Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
419
+ @param content The text and HTML tags to write.
420
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/writeln)
421
+ */
422
+ @throws(JsExn) @send
423
+ external writeln: (DOM.document, string) => unit = "writeln"
424
+
425
+ /**
426
+ Gets a value indicating whether the object currently has focus.
427
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/hasFocus)
428
+ */
429
+ @send
430
+ external hasFocus: DOM.document => bool = "hasFocus"
431
+
432
+ /**
433
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/exitPictureInPicture)
434
+ */
435
+ @send
436
+ external exitPictureInPicture: DOM.document => promise<unit> = "exitPictureInPicture"
437
+
438
+ /**
439
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/exitPointerLock)
440
+ */
441
+ @send
442
+ external exitPointerLock: DOM.document => unit = "exitPointerLock"
443
+
444
+ /**
445
+ Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.
446
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getSelection)
447
+ */
448
+ @send
449
+ external getSelection: DOM.document => Null.t<Selection.t> = "getSelection"
450
+
451
+ /**
452
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/hasStorageAccess)
453
+ */
454
+ @send
455
+ external hasStorageAccess: DOM.document => promise<bool> = "hasStorageAccess"
456
+
457
+ /**
458
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/requestStorageAccess)
459
+ */
460
+ @send
461
+ external requestStorageAccess: DOM.document => promise<unit> = "requestStorageAccess"
462
+
463
+ let isInstanceOf = (_: 't): bool => %raw(`param instanceof Document`)
464
+
465
+ /**
466
+ Returns the Location associated with this document, which provides information about the current URL and methods for navigating to another URL.
467
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/location)
468
+ */
469
+ @get
470
+ external location: DOM.document => Null.t<Location.t> = "location"