@rescript/webapi 0.1.0-experimental-29b94b3
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.
- package/LICENSE +21 -0
- package/README.md +14 -0
- package/package.json +38 -0
- package/rescript.json +19 -0
- package/src/CSSFontLoadingAPI/FontFace.res +34 -0
- package/src/CSSFontLoadingAPI/FontFaceSet.res +112 -0
- package/src/CSSFontLoadingAPI.res +101 -0
- package/src/CanvasAPI/ImageBitmap.res +8 -0
- package/src/CanvasAPI/OffscreenCanvas.res +123 -0
- package/src/CanvasAPI.res +55 -0
- package/src/ChannelMessagingAPI/MessagePort.res +120 -0
- package/src/ChannelMessagingAPI.res +13 -0
- package/src/ClipboardAPI/Clipboard.res +106 -0
- package/src/ClipboardAPI/ClipboardItem.res +21 -0
- package/src/ClipboardAPI.res +31 -0
- package/src/CredentialManagementAPI/CredentialsContainer.res +31 -0
- package/src/CredentialManagementAPI.res +140 -0
- package/src/DOMAPI/Animation.res +137 -0
- package/src/DOMAPI/AnimationEffect.res +19 -0
- package/src/DOMAPI/CSSRuleList.res +7 -0
- package/src/DOMAPI/CSSStyleDeclaration.res +36 -0
- package/src/DOMAPI/CSSStyleSheet.res +32 -0
- package/src/DOMAPI/CSSStyleValue.res +13 -0
- package/src/DOMAPI/CaretPosition.res +4 -0
- package/src/DOMAPI/CharacterData.res +272 -0
- package/src/DOMAPI/Comment.res +278 -0
- package/src/DOMAPI/CustomElementRegistry.res +31 -0
- package/src/DOMAPI/DOMImplementation.res +30 -0
- package/src/DOMAPI/DOMMatrix.res +169 -0
- package/src/DOMAPI/DOMMatrixReadOnly.res +103 -0
- package/src/DOMAPI/DOMPoint.res +29 -0
- package/src/DOMAPI/DOMPointReadOnly.res +24 -0
- package/src/DOMAPI/DOMRect.res +23 -0
- package/src/DOMAPI/DOMRectList.res +4 -0
- package/src/DOMAPI/DOMRectReadOnly.res +17 -0
- package/src/DOMAPI/DOMTokenList.res +72 -0
- package/src/DOMAPI/Document.res +634 -0
- package/src/DOMAPI/DocumentFragment.res +261 -0
- package/src/DOMAPI/DocumentTimeline.res +9 -0
- package/src/DOMAPI/Element.res +634 -0
- package/src/DOMAPI/ElementInternals.res +39 -0
- package/src/DOMAPI/FileList.res +8 -0
- package/src/DOMAPI/HTMLAnchorElement.res +693 -0
- package/src/DOMAPI/HTMLAreaElement.res +687 -0
- package/src/DOMAPI/HTMLAudioElement.res +750 -0
- package/src/DOMAPI/HTMLBRElement.res +686 -0
- package/src/DOMAPI/HTMLBaseElement.res +687 -0
- package/src/DOMAPI/HTMLBodyElement.res +687 -0
- package/src/DOMAPI/HTMLButtonElement.res +714 -0
- package/src/DOMAPI/HTMLCanvasElement.res +741 -0
- package/src/DOMAPI/HTMLCollection.res +15 -0
- package/src/DOMAPI/HTMLCollectionOf.res +16 -0
- package/src/DOMAPI/HTMLDListElement.res +690 -0
- package/src/DOMAPI/HTMLDataElement.res +687 -0
- package/src/DOMAPI/HTMLDataListElement.res +697 -0
- package/src/DOMAPI/HTMLDialogElement.res +715 -0
- package/src/DOMAPI/HTMLDivElement.res +686 -0
- package/src/DOMAPI/HTMLElement.res +685 -0
- package/src/DOMAPI/HTMLEmbedElement.res +693 -0
- package/src/DOMAPI/HTMLFieldSetElement.res +718 -0
- package/src/DOMAPI/HTMLFormControlsCollection.res +16 -0
- package/src/DOMAPI/HTMLFormElement.res +720 -0
- package/src/DOMAPI/HTMLFrameSetElement.res +697 -0
- package/src/DOMAPI/HTMLHRElement.res +686 -0
- package/src/DOMAPI/HTMLHeadElement.res +687 -0
- package/src/DOMAPI/HTMLHeadingElement.res +693 -0
- package/src/DOMAPI/HTMLHtmlElement.res +687 -0
- package/src/DOMAPI/HTMLIFrameElement.res +696 -0
- package/src/DOMAPI/HTMLImageElement.res +696 -0
- package/src/DOMAPI/HTMLInputElement.res +773 -0
- package/src/DOMAPI/HTMLLIElement.res +686 -0
- package/src/DOMAPI/HTMLLabelElement.res +690 -0
- package/src/DOMAPI/HTMLLegendElement.res +693 -0
- package/src/DOMAPI/HTMLLinkElement.res +687 -0
- package/src/DOMAPI/HTMLMapElement.res +686 -0
- package/src/DOMAPI/HTMLMediaElement.res +749 -0
- package/src/DOMAPI/HTMLMenuElement.res +687 -0
- package/src/DOMAPI/HTMLMetaElement.res +687 -0
- package/src/DOMAPI/HTMLMeterElement.res +690 -0
- package/src/DOMAPI/HTMLModElement.res +686 -0
- package/src/DOMAPI/HTMLOListElement.res +690 -0
- package/src/DOMAPI/HTMLObjectElement.res +717 -0
- package/src/DOMAPI/HTMLOptGroupElement.res +697 -0
- package/src/DOMAPI/HTMLOptionElement.res +693 -0
- package/src/DOMAPI/HTMLOptionsCollection.res +21 -0
- package/src/DOMAPI/HTMLOutputElement.res +711 -0
- package/src/DOMAPI/HTMLParagraphElement.res +701 -0
- package/src/DOMAPI/HTMLPictureElement.res +693 -0
- package/src/DOMAPI/HTMLPreElement.res +686 -0
- package/src/DOMAPI/HTMLProgressElement.res +697 -0
- package/src/DOMAPI/HTMLQuoteElement.res +690 -0
- package/src/DOMAPI/HTMLScriptElement.res +699 -0
- package/src/DOMAPI/HTMLSelectElement.res +762 -0
- package/src/DOMAPI/HTMLSlotElement.res +713 -0
- package/src/DOMAPI/HTMLSourceElement.res +693 -0
- package/src/DOMAPI/HTMLSpanElement.res +687 -0
- package/src/DOMAPI/HTMLStyleElement.res +690 -0
- package/src/DOMAPI/HTMLTableCaptionElement.res +714 -0
- package/src/DOMAPI/HTMLTableCellElement.res +701 -0
- package/src/DOMAPI/HTMLTableElement.res +755 -0
- package/src/DOMAPI/HTMLTableRowElement.res +713 -0
- package/src/DOMAPI/HTMLTableSectionElement.res +730 -0
- package/src/DOMAPI/HTMLTemplateElement.res +697 -0
- package/src/DOMAPI/HTMLTextAreaElement.res +758 -0
- package/src/DOMAPI/HTMLTimeElement.res +687 -0
- package/src/DOMAPI/HTMLTitleElement.res +690 -0
- package/src/DOMAPI/HTMLTrackElement.res +690 -0
- package/src/DOMAPI/HTMLUListElement.res +690 -0
- package/src/DOMAPI/HTMLVideoElement.res +778 -0
- package/src/DOMAPI/IdleDeadline.res +7 -0
- package/src/DOMAPI/ImageData.res +18 -0
- package/src/DOMAPI/Location.res +22 -0
- package/src/DOMAPI/MediaList.res +19 -0
- package/src/DOMAPI/MediaQueryList.res +82 -0
- package/src/DOMAPI/NamedNodeMap.res +45 -0
- package/src/DOMAPI/Navigator.res +114 -0
- package/src/DOMAPI/Node.res +179 -0
- package/src/DOMAPI/NodeFilter.res +4 -0
- package/src/DOMAPI/NodeIterator.res +13 -0
- package/src/DOMAPI/NodeList.res +8 -0
- package/src/DOMAPI/NodeListOf.res +9 -0
- package/src/DOMAPI/Range.res +149 -0
- package/src/DOMAPI/SVGGraphicsElement.res +675 -0
- package/src/DOMAPI/SVGLength.res +11 -0
- package/src/DOMAPI/ScreenOrientation.res +88 -0
- package/src/DOMAPI/Selection.res +103 -0
- package/src/DOMAPI/ShadowRoot.res +274 -0
- package/src/DOMAPI/StylePropertyMap.res +50 -0
- package/src/DOMAPI/StylePropertyMapReadOnly.res +13 -0
- package/src/DOMAPI/StyleSheetList.res +7 -0
- package/src/DOMAPI/Text.res +285 -0
- package/src/DOMAPI/TextTrackList.res +89 -0
- package/src/DOMAPI/TimeRanges.res +19 -0
- package/src/DOMAPI/TreeWalker.res +43 -0
- package/src/DOMAPI/VideoColorSpace.res +13 -0
- package/src/DOMAPI/VideoFrame.res +111 -0
- package/src/DOMAPI/Window.res +582 -0
- package/src/DOMAPI/XPathExpression.res +12 -0
- package/src/DOMAPI/XPathResult.res +13 -0
- package/src/DOMAPI.res +9668 -0
- package/src/EncryptedMediaExtensionsAPI/MediaKeySession.res +132 -0
- package/src/EncryptedMediaExtensionsAPI/MediaKeyStatusMap.res +13 -0
- package/src/EncryptedMediaExtensionsAPI/MediaKeySystemAccess.res +13 -0
- package/src/EncryptedMediaExtensionsAPI/MediaKeys.res +28 -0
- package/src/EncryptedMediaExtensionsAPI.res +100 -0
- package/src/EventAPI/AbortController.res +15 -0
- package/src/EventAPI/AbortSignal.res +106 -0
- package/src/EventAPI/Event.res +35 -0
- package/src/EventAPI/EventTarget.res +86 -0
- package/src/EventAPI.res +215 -0
- package/src/FetchAPI/FormData.res +58 -0
- package/src/FetchAPI/Headers.res +50 -0
- package/src/FetchAPI/Request.res +57 -0
- package/src/FetchAPI/Response.res +105 -0
- package/src/FetchAPI/URLSearchParams.res +68 -0
- package/src/FetchAPI.res +287 -0
- package/src/FileAPI/Blob.res +37 -0
- package/src/FileAPI/File.res +42 -0
- package/src/FileAPI/FileSystemDirectoryHandle.res +46 -0
- package/src/FileAPI/FileSystemFileHandle.res +23 -0
- package/src/FileAPI/FileSystemHandle.res +7 -0
- package/src/FileAPI/FileSystemWritableFileStream.res +63 -0
- package/src/FileAPI/ReadableStream.res +61 -0
- package/src/FileAPI/WritableStream.res +29 -0
- package/src/FileAPI/WritableStreamDefaultController.res +8 -0
- package/src/FileAPI.res +218 -0
- package/src/FileAndDirectoryEntriesAPI/FileSystemDirectoryEntry.res +42 -0
- package/src/FileAndDirectoryEntriesAPI/FileSystemDirectoryReader.res +12 -0
- package/src/FileAndDirectoryEntriesAPI/FileSystemEntry.res +11 -0
- package/src/FileAndDirectoryEntriesAPI.res +87 -0
- package/src/GamepadAPI/GamepadHapticActuator.res +17 -0
- package/src/GamepadAPI.res +85 -0
- package/src/GeolocationAPI/Geolocation.res +29 -0
- package/src/GeolocationAPI/GeolocationCoordinates.res +7 -0
- package/src/GeolocationAPI/GeolocationPosition.res +7 -0
- package/src/GeolocationAPI.res +78 -0
- package/src/Global.res +302 -0
- package/src/HistoryAPI/History.res +33 -0
- package/src/HistoryAPI.res +26 -0
- package/src/IndexedDBAPI/IDBDatabase.res +135 -0
- package/src/IndexedDBAPI/IDBFactory.res +31 -0
- package/src/IndexedDBAPI/IDBIndex.res +74 -0
- package/src/IndexedDBAPI/IDBObjectStore.res +167 -0
- package/src/IndexedDBAPI/IDBTransaction.res +102 -0
- package/src/IndexedDBAPI.res +205 -0
- package/src/MediaCapabilitiesAPI/MediaCapabilities.res +19 -0
- package/src/MediaCapabilitiesAPI.res +81 -0
- package/src/MediaCaptureAndStreamsAPI/MediaDeviceInfo.res +7 -0
- package/src/MediaCaptureAndStreamsAPI/MediaDevices.res +113 -0
- package/src/MediaCaptureAndStreamsAPI/MediaStream.res +142 -0
- package/src/MediaCaptureAndStreamsAPI/MediaStreamTrack.res +122 -0
- package/src/MediaCaptureAndStreamsAPI.res +194 -0
- package/src/MediaSessionAPI/MediaMetadata.res +7 -0
- package/src/MediaSessionAPI/MediaSession.res +17 -0
- package/src/MediaSessionAPI.res +83 -0
- package/src/NotificationAPI/Notification.res +102 -0
- package/src/NotificationAPI.res +82 -0
- package/src/PerformanceAPI/Performance.res +169 -0
- package/src/PerformanceAPI/PerformanceEntry.res +7 -0
- package/src/PerformanceAPI/PerformanceMark.res +15 -0
- package/src/PerformanceAPI.res +86 -0
- package/src/PermissionsAPI/Permissions.res +7 -0
- package/src/PermissionsAPI.res +39 -0
- package/src/PictureInPicture.res +18 -0
- package/src/PictureInPictureAPI.res +18 -0
- package/src/Prelude/DOMException.res +7 -0
- package/src/Prelude/DOMStringList.res +15 -0
- package/src/Prelude.res +39 -0
- package/src/PushManagerAPI/PushManager.res +25 -0
- package/src/PushManagerAPI/PushSubscription.res +19 -0
- package/src/PushManagerAPI.res +67 -0
- package/src/RemotePlaybackAPI/RemotePlayback.res +102 -0
- package/src/RemotePlaybackAPI.res +21 -0
- package/src/ResizeObserverAPI/ResizeObserver.res +27 -0
- package/src/ResizeObserverAPI.res +58 -0
- package/src/ScreenWakeLockAPI/WakeLock.res +7 -0
- package/src/ScreenWakeLockAPI/WakeLockSentinel.res +88 -0
- package/src/ScreenWakeLockAPI.res +26 -0
- package/src/ServiceWorkerAPI/Cache.res +100 -0
- package/src/ServiceWorkerAPI/CacheStorage.res +46 -0
- package/src/ServiceWorkerAPI/NavigationPreloadManager.res +25 -0
- package/src/ServiceWorkerAPI/ServiceWorker.res +101 -0
- package/src/ServiceWorkerAPI/ServiceWorkerContainer.res +114 -0
- package/src/ServiceWorkerAPI/ServiceWorkerRegistration.res +114 -0
- package/src/ServiceWorkerAPI.res +134 -0
- package/src/StorageAPI/StorageManager.res +26 -0
- package/src/StorageAPI.res +10 -0
- package/src/ViewTransitionsAPI/ViewTransition.res +7 -0
- package/src/ViewTransitionsAPI.res +23 -0
- package/src/VisualViewportAPI.res +38 -0
- package/src/WebAudioAPI/AnalyserNode.res +180 -0
- package/src/WebAudioAPI/AudioBuffer.res +35 -0
- package/src/WebAudioAPI/AudioBufferSourceNode.res +183 -0
- package/src/WebAudioAPI/AudioContext.res +266 -0
- package/src/WebAudioAPI/AudioListener.res +1 -0
- package/src/WebAudioAPI/AudioNode.res +143 -0
- package/src/WebAudioAPI/AudioParam.res +56 -0
- package/src/WebAudioAPI/AudioProcessingEvent.res +38 -0
- package/src/WebAudioAPI/AudioScheduledSourceNode.res +171 -0
- package/src/WebAudioAPI/AudioWorkletNode.res +160 -0
- package/src/WebAudioAPI/BaseAudioContext.res +212 -0
- package/src/WebAudioAPI/BiquadFilterNode.res +168 -0
- package/src/WebAudioAPI/ChannelMergerNode.res +157 -0
- package/src/WebAudioAPI/ChannelSplitterNode.res +159 -0
- package/src/WebAudioAPI/ConstantSourceNode.res +172 -0
- package/src/WebAudioAPI/ConvolverNode.res +157 -0
- package/src/WebAudioAPI/DelayNode.res +150 -0
- package/src/WebAudioAPI/DynamicsCompressorNode.res +162 -0
- package/src/WebAudioAPI/GainNode.res +149 -0
- package/src/WebAudioAPI/IIRFilterNode.res +168 -0
- package/src/WebAudioAPI/MediaElementAudioSourceNode.res +168 -0
- package/src/WebAudioAPI/MediaStreamAudioDestinationNode.res +168 -0
- package/src/WebAudioAPI/MediaStreamAudioSourceNode.res +168 -0
- package/src/WebAudioAPI/OfflineAudioCompletionEvent.res +40 -0
- package/src/WebAudioAPI/OfflineAudioContext.res +246 -0
- package/src/WebAudioAPI/OscillatorNode.res +176 -0
- package/src/WebAudioAPI/PannerNode.res +150 -0
- package/src/WebAudioAPI/PeriodicWave.res +8 -0
- package/src/WebAudioAPI/StereoPannerNode.res +157 -0
- package/src/WebAudioAPI/WaveShaperNode.res +157 -0
- package/src/WebAudioAPI/Worklet.res +13 -0
- package/src/WebAudioAPI.res +1271 -0
- package/src/WebCryptoAPI/Crypto.res +13 -0
- package/src/WebCryptoAPI/SubtleCrypto.res +173 -0
- package/src/WebCryptoAPI.res +71 -0
- package/src/WebLocksAPI/LockManager.res +29 -0
- package/src/WebLocksAPI.res +47 -0
- package/src/WebMIDIAPI.res +37 -0
- package/src/WebSocketsAPI/CloseEvent.res +37 -0
- package/src/WebSocketsAPI/MessageEvent.res +38 -0
- package/src/WebSocketsAPI/WebSocket.res +130 -0
- package/src/WebSocketsAPI.res +125 -0
- package/src/WebSpeechAPI/SpeechSynthesis.res +112 -0
- package/src/WebSpeechAPI/SpeechSynthesisUtterance.res +88 -0
- package/src/WebSpeechAPI.res +82 -0
- package/src/WebStorageAPI/Storage.res +44 -0
- package/src/WebStorageAPI/StorageEvent.res +37 -0
- package/src/WebStorageAPI.res +57 -0
- package/src/WebVTTAPI/TextTrack.res +96 -0
- package/src/WebVTTAPI/TextTrackCueList.res +10 -0
- package/src/WebVTTAPI.res +122 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ReScript
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# experimental-rescript-webapi
|
|
2
|
+
Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescript-webapi)
|
|
3
|
+
|
|
4
|
+
## New approach to webapi bindings (TODO)
|
|
5
|
+
|
|
6
|
+
1. Find out if it is possible to adapt https://github.com/microsoft/TypeScript-DOM-lib-generator to output `.res` files
|
|
7
|
+
- One example output is here: https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts
|
|
8
|
+
2. Try to type most things with records with which we can model inheritance, but for readability and performance's sake it will be better to keep type spread and the necessity for coercion at a minimum and rather duplicate field names (which should not be a problem when everything is generated) as well as identity functions (coercion can be expensive with big record fields).
|
|
9
|
+
3. 80/20 approach, we want to model the more common APIs in a way so that they are delightful to use while the more obscure ones can be harder to use, but those should still be documented well.
|
|
10
|
+
4. In essence, we apply the rescript-core way of doing things here once again, so doc tests can be implemented as well.
|
|
11
|
+
|
|
12
|
+
## TypeScript-DOM-lib-generator
|
|
13
|
+
|
|
14
|
+
The repository [TypeScript-DOM-lib-generator](https://github.com/microsoft/TypeScript-DOM-lib-generator) was originally forked into [nojaf/TypeScript-DOM-lib-generator](https://github.com/nojaf/TypeScript-DOM-lib-generator/tree/rescript) but has since been copied into `tools/TypeScript-DOM-lib-generator` for easier collaboration.
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rescript/webapi",
|
|
3
|
+
"version": "0.1.0-experimental-29b94b3",
|
|
4
|
+
"description": "Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescript-webapi)",
|
|
5
|
+
"homepage": "https://github.com/rescript-lang/experimental-rescript-webapi",
|
|
6
|
+
"bugs": "https://github.com/rescript-lang/experimental-rescript-webapi/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rescript-lang/experimental-rescript-webapi.git"
|
|
10
|
+
},
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Florian Verdonck"
|
|
13
|
+
},
|
|
14
|
+
"maintainers": [
|
|
15
|
+
"Florian Verdonck (https://github.com/nojaf)"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"rescript",
|
|
19
|
+
"webapi",
|
|
20
|
+
"mdn",
|
|
21
|
+
"dom",
|
|
22
|
+
"fetch"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"rescript.json",
|
|
26
|
+
"src/**/*.res"
|
|
27
|
+
],
|
|
28
|
+
"type": "module",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "node tests/index.js",
|
|
31
|
+
"build": "rewatch",
|
|
32
|
+
"format": "rescript format -all"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"rescript": "^12.0.0-alpha.4"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/rescript.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.0.0",
|
|
3
|
+
"name": "@rescript/webapi",
|
|
4
|
+
"sources": [
|
|
5
|
+
{
|
|
6
|
+
"dir": "src",
|
|
7
|
+
"subdirs": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"dir": "tests",
|
|
11
|
+
"subdirs": true
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"package-specs": {
|
|
15
|
+
"module": "esmodule",
|
|
16
|
+
"in-source": true
|
|
17
|
+
},
|
|
18
|
+
"suffix": ".js"
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
open CSSFontLoadingAPI
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace)
|
|
5
|
+
*/
|
|
6
|
+
@new
|
|
7
|
+
external make: (~family: string, ~source: string, ~descriptors: fontFaceDescriptors=?) => fontFace =
|
|
8
|
+
"FontFace"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace)
|
|
12
|
+
*/
|
|
13
|
+
@new
|
|
14
|
+
external make2: (
|
|
15
|
+
~family: string,
|
|
16
|
+
~source: DataView.t,
|
|
17
|
+
~descriptors: fontFaceDescriptors=?,
|
|
18
|
+
) => fontFace = "FontFace"
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace)
|
|
22
|
+
*/
|
|
23
|
+
@new
|
|
24
|
+
external make3: (
|
|
25
|
+
~family: string,
|
|
26
|
+
~source: ArrayBuffer.t,
|
|
27
|
+
~descriptors: fontFaceDescriptors=?,
|
|
28
|
+
) => fontFace = "FontFace"
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/load)
|
|
32
|
+
*/
|
|
33
|
+
@send
|
|
34
|
+
external load: fontFace => Promise.t<fontFace> = "load"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
open EventAPI
|
|
2
|
+
open CSSFontLoadingAPI
|
|
3
|
+
|
|
4
|
+
external asEventTarget: fontFaceSet => eventTarget = "%identity"
|
|
5
|
+
/**
|
|
6
|
+
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
|
7
|
+
|
|
8
|
+
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
|
|
9
|
+
|
|
10
|
+
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
|
|
11
|
+
|
|
12
|
+
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
|
|
13
|
+
|
|
14
|
+
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
|
|
15
|
+
|
|
16
|
+
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
|
|
17
|
+
|
|
18
|
+
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
|
|
19
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
20
|
+
*/
|
|
21
|
+
@send
|
|
22
|
+
external addEventListener: (
|
|
23
|
+
fontFaceSet,
|
|
24
|
+
~type_: eventType,
|
|
25
|
+
~callback: eventListener<'event>,
|
|
26
|
+
~options: addEventListenerOptions=?,
|
|
27
|
+
) => unit = "addEventListener"
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
|
31
|
+
|
|
32
|
+
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
|
|
33
|
+
|
|
34
|
+
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
|
|
35
|
+
|
|
36
|
+
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
|
|
37
|
+
|
|
38
|
+
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
|
|
39
|
+
|
|
40
|
+
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
|
|
41
|
+
|
|
42
|
+
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
|
|
43
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
44
|
+
*/
|
|
45
|
+
@send
|
|
46
|
+
external addEventListener2: (
|
|
47
|
+
fontFaceSet,
|
|
48
|
+
~type_: eventType,
|
|
49
|
+
~callback: eventListener<'event>,
|
|
50
|
+
~options: bool=?,
|
|
51
|
+
) => unit = "addEventListener"
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
Removes the event listener in target's event listener list with the same type, callback, and options.
|
|
55
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
56
|
+
*/
|
|
57
|
+
@send
|
|
58
|
+
external removeEventListener: (
|
|
59
|
+
fontFaceSet,
|
|
60
|
+
~type_: eventType,
|
|
61
|
+
~callback: eventListener<'event>,
|
|
62
|
+
~options: eventListenerOptions=?,
|
|
63
|
+
) => unit = "removeEventListener"
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
Removes the event listener in target's event listener list with the same type, callback, and options.
|
|
67
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
68
|
+
*/
|
|
69
|
+
@send
|
|
70
|
+
external removeEventListener2: (
|
|
71
|
+
fontFaceSet,
|
|
72
|
+
~type_: eventType,
|
|
73
|
+
~callback: eventListener<'event>,
|
|
74
|
+
~options: bool=?,
|
|
75
|
+
) => unit = "removeEventListener"
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
79
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
|
|
80
|
+
*/
|
|
81
|
+
@send
|
|
82
|
+
external dispatchEvent: (fontFaceSet, event) => bool = "dispatchEvent"
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/add)
|
|
86
|
+
*/
|
|
87
|
+
@send
|
|
88
|
+
external add: (fontFaceSet, fontFace) => fontFaceSet = "add"
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/delete)
|
|
92
|
+
*/
|
|
93
|
+
@send
|
|
94
|
+
external delete: (fontFaceSet, fontFace) => bool = "delete"
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/clear)
|
|
98
|
+
*/
|
|
99
|
+
@send
|
|
100
|
+
external clear: fontFaceSet => unit = "clear"
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/load)
|
|
104
|
+
*/
|
|
105
|
+
@send
|
|
106
|
+
external load: (fontFaceSet, ~font: string, ~text: string=?) => Promise.t<array<fontFace>> = "load"
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/check)
|
|
110
|
+
*/
|
|
111
|
+
@send
|
|
112
|
+
external check: (fontFaceSet, ~font: string, ~text: string=?) => bool = "check"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
@@warning("-30")
|
|
2
|
+
|
|
3
|
+
open EventAPI
|
|
4
|
+
|
|
5
|
+
type fontDisplay =
|
|
6
|
+
| @as("auto") Auto
|
|
7
|
+
| @as("block") Block
|
|
8
|
+
| @as("fallback") Fallback
|
|
9
|
+
| @as("optional") Optional
|
|
10
|
+
| @as("swap") Swap
|
|
11
|
+
|
|
12
|
+
type fontFaceLoadStatus =
|
|
13
|
+
| @as("error") Error
|
|
14
|
+
| @as("loaded") Loaded
|
|
15
|
+
| @as("loading") Loading
|
|
16
|
+
| @as("unloaded") Unloaded
|
|
17
|
+
|
|
18
|
+
type fontFaceSetLoadStatus =
|
|
19
|
+
| @as("loaded") Loaded
|
|
20
|
+
| @as("loading") Loading
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
[See FontFace on MDN](https://developer.mozilla.org/docs/Web/API/FontFace)
|
|
24
|
+
*/
|
|
25
|
+
type rec fontFace = {
|
|
26
|
+
/**
|
|
27
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/family)
|
|
28
|
+
*/
|
|
29
|
+
mutable family: string,
|
|
30
|
+
/**
|
|
31
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/style)
|
|
32
|
+
*/
|
|
33
|
+
mutable style: string,
|
|
34
|
+
/**
|
|
35
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/weight)
|
|
36
|
+
*/
|
|
37
|
+
mutable weight: string,
|
|
38
|
+
/**
|
|
39
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/stretch)
|
|
40
|
+
*/
|
|
41
|
+
mutable stretch: string,
|
|
42
|
+
/**
|
|
43
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/unicodeRange)
|
|
44
|
+
*/
|
|
45
|
+
mutable unicodeRange: string,
|
|
46
|
+
/**
|
|
47
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/featureSettings)
|
|
48
|
+
*/
|
|
49
|
+
mutable featureSettings: string,
|
|
50
|
+
/**
|
|
51
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/display)
|
|
52
|
+
*/
|
|
53
|
+
mutable display: fontDisplay,
|
|
54
|
+
/**
|
|
55
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/ascentOverride)
|
|
56
|
+
*/
|
|
57
|
+
mutable ascentOverride: string,
|
|
58
|
+
/**
|
|
59
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/descentOverride)
|
|
60
|
+
*/
|
|
61
|
+
mutable descentOverride: string,
|
|
62
|
+
/**
|
|
63
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/lineGapOverride)
|
|
64
|
+
*/
|
|
65
|
+
mutable lineGapOverride: string,
|
|
66
|
+
/**
|
|
67
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/status)
|
|
68
|
+
*/
|
|
69
|
+
status: fontFaceLoadStatus,
|
|
70
|
+
/**
|
|
71
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/loaded)
|
|
72
|
+
*/
|
|
73
|
+
loaded: Promise.t<fontFace>,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
[See FontFaceSet on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet)
|
|
78
|
+
*/
|
|
79
|
+
type rec fontFaceSet = {
|
|
80
|
+
...eventTarget,
|
|
81
|
+
/**
|
|
82
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready)
|
|
83
|
+
*/
|
|
84
|
+
ready: Promise.t<fontFaceSet>,
|
|
85
|
+
/**
|
|
86
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status)
|
|
87
|
+
*/
|
|
88
|
+
status: fontFaceSetLoadStatus,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type fontFaceDescriptors = {
|
|
92
|
+
mutable style?: string,
|
|
93
|
+
mutable weight?: string,
|
|
94
|
+
mutable stretch?: string,
|
|
95
|
+
mutable unicodeRange?: string,
|
|
96
|
+
mutable featureSettings?: string,
|
|
97
|
+
mutable display?: fontDisplay,
|
|
98
|
+
mutable ascentOverride?: string,
|
|
99
|
+
mutable descentOverride?: string,
|
|
100
|
+
mutable lineGapOverride?: string,
|
|
101
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
open EventAPI
|
|
2
|
+
open CanvasAPI
|
|
3
|
+
open DOMAPI
|
|
4
|
+
open Prelude
|
|
5
|
+
open FileAPI
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas)
|
|
9
|
+
*/
|
|
10
|
+
@new
|
|
11
|
+
external make: (~width: int, ~height: int) => offscreenCanvas = "OffscreenCanvas"
|
|
12
|
+
|
|
13
|
+
external asEventTarget: offscreenCanvas => eventTarget = "%identity"
|
|
14
|
+
/**
|
|
15
|
+
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
|
16
|
+
|
|
17
|
+
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
|
|
18
|
+
|
|
19
|
+
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
|
|
20
|
+
|
|
21
|
+
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
|
|
22
|
+
|
|
23
|
+
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
|
|
24
|
+
|
|
25
|
+
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
|
|
26
|
+
|
|
27
|
+
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
|
|
28
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
29
|
+
*/
|
|
30
|
+
@send
|
|
31
|
+
external addEventListener: (
|
|
32
|
+
offscreenCanvas,
|
|
33
|
+
~type_: eventType,
|
|
34
|
+
~callback: eventListener<'event>,
|
|
35
|
+
~options: addEventListenerOptions=?,
|
|
36
|
+
) => unit = "addEventListener"
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
|
40
|
+
|
|
41
|
+
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
|
|
42
|
+
|
|
43
|
+
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
|
|
44
|
+
|
|
45
|
+
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
|
|
46
|
+
|
|
47
|
+
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
|
|
48
|
+
|
|
49
|
+
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
|
|
50
|
+
|
|
51
|
+
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
|
|
52
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
53
|
+
*/
|
|
54
|
+
@send
|
|
55
|
+
external addEventListener2: (
|
|
56
|
+
offscreenCanvas,
|
|
57
|
+
~type_: eventType,
|
|
58
|
+
~callback: eventListener<'event>,
|
|
59
|
+
~options: bool=?,
|
|
60
|
+
) => unit = "addEventListener"
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
Removes the event listener in target's event listener list with the same type, callback, and options.
|
|
64
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
65
|
+
*/
|
|
66
|
+
@send
|
|
67
|
+
external removeEventListener: (
|
|
68
|
+
offscreenCanvas,
|
|
69
|
+
~type_: eventType,
|
|
70
|
+
~callback: eventListener<'event>,
|
|
71
|
+
~options: eventListenerOptions=?,
|
|
72
|
+
) => unit = "removeEventListener"
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
Removes the event listener in target's event listener list with the same type, callback, and options.
|
|
76
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
77
|
+
*/
|
|
78
|
+
@send
|
|
79
|
+
external removeEventListener2: (
|
|
80
|
+
offscreenCanvas,
|
|
81
|
+
~type_: eventType,
|
|
82
|
+
~callback: eventListener<'event>,
|
|
83
|
+
~options: bool=?,
|
|
84
|
+
) => unit = "removeEventListener"
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
88
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
|
|
89
|
+
*/
|
|
90
|
+
@send
|
|
91
|
+
external dispatchEvent: (offscreenCanvas, event) => bool = "dispatchEvent"
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API.
|
|
95
|
+
|
|
96
|
+
This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL]
|
|
97
|
+
|
|
98
|
+
Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
|
|
99
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
|
|
100
|
+
*/
|
|
101
|
+
@send
|
|
102
|
+
external getContext: (
|
|
103
|
+
offscreenCanvas,
|
|
104
|
+
~contextId: offscreenRenderingContextId,
|
|
105
|
+
~options: JSON.t=?,
|
|
106
|
+
) => offscreenRenderingContext = "getContext"
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image.
|
|
110
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/transferToImageBitmap)
|
|
111
|
+
*/
|
|
112
|
+
@send
|
|
113
|
+
external transferToImageBitmap: offscreenCanvas => imageBitmap = "transferToImageBitmap"
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
Returns a promise that will fulfill with a new Blob object representing a file containing the image in the OffscreenCanvas object.
|
|
117
|
+
|
|
118
|
+
The argument, if provided, is a dictionary that controls the encoding options of the image file to be created. The type field specifies the file format and has a default value of "image/png"; that type is also used if the requested type isn't supported. If the image format supports variable quality (such as "image/jpeg"), then the quality field is a number in the range 0.0 to 1.0 inclusive indicating the desired quality level for the resulting image.
|
|
119
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/convertToBlob)
|
|
120
|
+
*/
|
|
121
|
+
@send
|
|
122
|
+
external convertToBlob: (offscreenCanvas, ~options: imageEncodeOptions=?) => Promise.t<blob> =
|
|
123
|
+
"convertToBlob"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@@warning("-30")
|
|
2
|
+
|
|
3
|
+
open Prelude
|
|
4
|
+
open EventAPI
|
|
5
|
+
|
|
6
|
+
type offscreenRenderingContextId =
|
|
7
|
+
| @as("2d") V2d
|
|
8
|
+
| @as("bitmaprenderer") Bitmaprenderer
|
|
9
|
+
| @as("webgl") Webgl
|
|
10
|
+
| @as("webgl2") Webgl2
|
|
11
|
+
| @as("webgpu") Webgpu
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
[See OffscreenCanvas on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas)
|
|
15
|
+
*/
|
|
16
|
+
type offscreenCanvas = {
|
|
17
|
+
...eventTarget,
|
|
18
|
+
/**
|
|
19
|
+
These attributes return the dimensions of the OffscreenCanvas object's bitmap.
|
|
20
|
+
|
|
21
|
+
They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it).
|
|
22
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/width)
|
|
23
|
+
*/
|
|
24
|
+
mutable width: int,
|
|
25
|
+
/**
|
|
26
|
+
These attributes return the dimensions of the OffscreenCanvas object's bitmap.
|
|
27
|
+
|
|
28
|
+
They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it).
|
|
29
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/height)
|
|
30
|
+
*/
|
|
31
|
+
mutable height: int,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
[See ImageBitmap on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmap)
|
|
36
|
+
*/
|
|
37
|
+
type imageBitmap = {
|
|
38
|
+
/**
|
|
39
|
+
Returns the intrinsic width of the image, in CSS pixels.
|
|
40
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmap/width)
|
|
41
|
+
*/
|
|
42
|
+
width: int,
|
|
43
|
+
/**
|
|
44
|
+
Returns the intrinsic height of the image, in CSS pixels.
|
|
45
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmap/height)
|
|
46
|
+
*/
|
|
47
|
+
height: int,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type offscreenRenderingContext = any
|
|
51
|
+
|
|
52
|
+
type imageEncodeOptions = {
|
|
53
|
+
@as("type") mutable type_?: string,
|
|
54
|
+
mutable quality?: float,
|
|
55
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
open EventAPI
|
|
2
|
+
open ChannelMessagingAPI
|
|
3
|
+
open Prelude
|
|
4
|
+
|
|
5
|
+
external asEventTarget: messagePort => eventTarget = "%identity"
|
|
6
|
+
/**
|
|
7
|
+
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
|
8
|
+
|
|
9
|
+
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
|
|
10
|
+
|
|
11
|
+
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
|
|
12
|
+
|
|
13
|
+
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
|
|
14
|
+
|
|
15
|
+
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
|
|
16
|
+
|
|
17
|
+
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
|
|
18
|
+
|
|
19
|
+
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
|
|
20
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
21
|
+
*/
|
|
22
|
+
@send
|
|
23
|
+
external addEventListener: (
|
|
24
|
+
messagePort,
|
|
25
|
+
~type_: eventType,
|
|
26
|
+
~callback: eventListener<'event>,
|
|
27
|
+
~options: addEventListenerOptions=?,
|
|
28
|
+
) => unit = "addEventListener"
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
|
32
|
+
|
|
33
|
+
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
|
|
34
|
+
|
|
35
|
+
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
|
|
36
|
+
|
|
37
|
+
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
|
|
38
|
+
|
|
39
|
+
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
|
|
40
|
+
|
|
41
|
+
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
|
|
42
|
+
|
|
43
|
+
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
|
|
44
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
45
|
+
*/
|
|
46
|
+
@send
|
|
47
|
+
external addEventListener2: (
|
|
48
|
+
messagePort,
|
|
49
|
+
~type_: eventType,
|
|
50
|
+
~callback: eventListener<'event>,
|
|
51
|
+
~options: bool=?,
|
|
52
|
+
) => unit = "addEventListener"
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
Removes the event listener in target's event listener list with the same type, callback, and options.
|
|
56
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
57
|
+
*/
|
|
58
|
+
@send
|
|
59
|
+
external removeEventListener: (
|
|
60
|
+
messagePort,
|
|
61
|
+
~type_: eventType,
|
|
62
|
+
~callback: eventListener<'event>,
|
|
63
|
+
~options: eventListenerOptions=?,
|
|
64
|
+
) => unit = "removeEventListener"
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
Removes the event listener in target's event listener list with the same type, callback, and options.
|
|
68
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
69
|
+
*/
|
|
70
|
+
@send
|
|
71
|
+
external removeEventListener2: (
|
|
72
|
+
messagePort,
|
|
73
|
+
~type_: eventType,
|
|
74
|
+
~callback: eventListener<'event>,
|
|
75
|
+
~options: bool=?,
|
|
76
|
+
) => unit = "removeEventListener"
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
80
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
|
|
81
|
+
*/
|
|
82
|
+
@send
|
|
83
|
+
external dispatchEvent: (messagePort, event) => bool = "dispatchEvent"
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
|
|
87
|
+
|
|
88
|
+
Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
|
|
89
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
90
|
+
*/
|
|
91
|
+
@send
|
|
92
|
+
external postMessage: (messagePort, ~message: JSON.t, ~transfer: array<Dict.t<string>>) => unit =
|
|
93
|
+
"postMessage"
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
|
|
97
|
+
|
|
98
|
+
Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
|
|
99
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
100
|
+
*/
|
|
101
|
+
@send
|
|
102
|
+
external postMessage2: (
|
|
103
|
+
messagePort,
|
|
104
|
+
~message: JSON.t,
|
|
105
|
+
~options: structuredSerializeOptions=?,
|
|
106
|
+
) => unit = "postMessage"
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
Begins dispatching messages received on the port.
|
|
110
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
|
|
111
|
+
*/
|
|
112
|
+
@send
|
|
113
|
+
external start: messagePort => unit = "start"
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
Disconnects the port, so that it is no longer active.
|
|
117
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
|
|
118
|
+
*/
|
|
119
|
+
@send
|
|
120
|
+
external close: messagePort => unit = "close"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@@warning("-30")
|
|
2
|
+
|
|
3
|
+
open EventAPI
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
This Channel Messaging API interface represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
|
|
7
|
+
[See MessagePort on MDN](https://developer.mozilla.org/docs/Web/API/MessagePort)
|
|
8
|
+
*/
|
|
9
|
+
type messagePort = {
|
|
10
|
+
...eventTarget,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type structuredSerializeOptions = {mutable transfer?: array<Dict.t<string>>}
|