@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.
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/package.json +61 -0
- package/rescript.json +557 -0
- package/src/animation/Animation.res +149 -0
- package/src/animation/AnimationEffect.res +71 -0
- package/src/animation/DocumentTimeline.res +8 -0
- package/src/canvas/Canvas.res +179 -0
- package/src/canvas/CanvasGradient.res +11 -0
- package/src/canvas/CanvasPattern.res +11 -0
- package/src/canvas/CanvasRenderingContext2D.res +868 -0
- package/src/canvas/CanvasTypes.res +452 -0
- package/src/canvas/FillStyle.res +25 -0
- package/src/canvas/HTMLCanvasElement.res +101 -0
- package/src/canvas/ImageBitmap.res +6 -0
- package/src/canvas/ImageBitmapRenderingContext.res +9 -0
- package/src/canvas/ImageData.res +17 -0
- package/src/canvas/OffscreenCanvas.res +87 -0
- package/src/canvas/Path2D.res +186 -0
- package/src/canvas/VideoColorSpace.res +11 -0
- package/src/canvas/VideoFrame.res +217 -0
- package/src/core/ArrayBufferTypedArrayOrDataView.res +4 -0
- package/src/core/DOM.res +1026 -0
- package/src/core/EventType.res +108 -0
- package/src/crypto/Crypto.res +11 -0
- package/src/crypto/SubtleCrypto.res +173 -0
- package/src/crypto/WebCryptoTypes.res +71 -0
- package/src/css-font-loading/BaseCSSFontLoading.res +24 -0
- package/src/css-font-loading/CssFontLoadingTypes.res +92 -0
- package/src/css-font-loading/FontFace.res +62 -0
- package/src/css-font-loading/FontFaceSet.res +38 -0
- package/src/cssom/CSSRuleList.res +5 -0
- package/src/cssom/CSSStyleDeclaration.res +1734 -0
- package/src/cssom/CSSStyleValue.res +17 -0
- package/src/cssom/MediaList.res +29 -0
- package/src/cssom/MediaQueryList.res +18 -0
- package/src/cssom/StylePropertyMap.res +56 -0
- package/src/cssom/StylePropertyMapReadOnly.res +22 -0
- package/src/cssom/StyleSheet.res +152 -0
- package/src/cssom/StyleSheetList.res +17 -0
- package/src/device/GamepadHapticActuator.res +16 -0
- package/src/device/GamepadTypes.res +86 -0
- package/src/device/Geolocation.res +31 -0
- package/src/device/GeolocationCoordinates.res +5 -0
- package/src/device/GeolocationPosition.res +5 -0
- package/src/device/GeolocationTypes.res +81 -0
- package/src/device/LockManager.res +26 -0
- package/src/device/ScreenOrientation.res +7 -0
- package/src/device/ScreenWakeLockTypes.res +26 -0
- package/src/device/WakeLock.res +8 -0
- package/src/device/WakeLockSentinel.res +7 -0
- package/src/device/WebLocksTypes.res +45 -0
- package/src/device/WebMIDI.res +7 -0
- package/src/device/WebMidiTypes.res +36 -0
- package/src/dom-nodes/AbstractRange.res +30 -0
- package/src/dom-nodes/Attr.res +101 -0
- package/src/dom-nodes/CDATASection.res +7 -0
- package/src/dom-nodes/CaretPosition.res +2 -0
- package/src/dom-nodes/CharacterData.res +199 -0
- package/src/dom-nodes/Comment.res +15 -0
- package/src/dom-nodes/DOMImplementation.res +131 -0
- package/src/dom-nodes/DOMTree.res +1653 -0
- package/src/dom-nodes/DocumentFragment.res +96 -0
- package/src/dom-nodes/Element.res +509 -0
- package/src/dom-nodes/ElementInternals.res +39 -0
- package/src/dom-nodes/HTML.res +11 -0
- package/src/dom-nodes/HTMLCollection.res +25 -0
- package/src/dom-nodes/NamedNodeMap.res +46 -0
- package/src/dom-nodes/Node.res +114 -0
- package/src/dom-nodes/NodeFilter.res +4 -0
- package/src/dom-nodes/NodeIterator.res +38 -0
- package/src/dom-nodes/NodeList.res +6 -0
- package/src/dom-nodes/ProcessingInstruction.res +15 -0
- package/src/dom-nodes/Range.res +156 -0
- package/src/dom-nodes/Selection.res +137 -0
- package/src/dom-nodes/ShadowRoot.res +23 -0
- package/src/dom-nodes/StaticRange.res +6 -0
- package/src/dom-nodes/Text.res +31 -0
- package/src/dom-nodes/TreeWalker.res +65 -0
- package/src/dom-platform/DOMException.res +7 -0
- package/src/dom-platform/DOMStringList.res +15 -0
- package/src/dom-platform/DOMStringMap.res +5 -0
- package/src/dom-platform/DOMTokenList.res +70 -0
- package/src/event/AbortController.res +9 -0
- package/src/event/AbortSignal.res +25 -0
- package/src/event/Event.res +76 -0
- package/src/event/EventTarget.res +91 -0
- package/src/event/ExtendableEvent.res +14 -0
- package/src/fetch/BodyInit.res +46 -0
- package/src/fetch/Fetch.res +12 -0
- package/src/fetch/FetchTypes.res +282 -0
- package/src/fetch/FormData.res +71 -0
- package/src/fetch/FormDataEntryValue.res +2 -0
- package/src/fetch/Headers.res +59 -0
- package/src/fetch/HeadersInit.res +16 -0
- package/src/fetch/Request.res +61 -0
- package/src/fetch/Response.res +127 -0
- package/src/file/BaseFileAndDirectoryEntries.res +72 -0
- package/src/file/Blob.res +48 -0
- package/src/file/File.res +15 -0
- package/src/file/FileAndDirectoryEntriesTypes.res +35 -0
- package/src/file/FileList.res +16 -0
- package/src/file/FileSystemDirectoryEntry.res +42 -0
- package/src/file/FileSystemDirectoryHandle.res +49 -0
- package/src/file/FileSystemDirectoryReader.res +9 -0
- package/src/file/FileSystemEntry.res +9 -0
- package/src/file/FileSystemFileHandle.res +25 -0
- package/src/file/FileSystemHandle.res +6 -0
- package/src/file/FileSystemWritableFileStream.res +65 -0
- package/src/file/FileTypes.res +225 -0
- package/src/file/ReadableStream.res +79 -0
- package/src/file/WritableStream.res +27 -0
- package/src/file/WritableStreamDefaultController.res +5 -0
- package/src/geometry/DOMMatrix.res +206 -0
- package/src/geometry/DOMMatrixReadOnly.res +140 -0
- package/src/geometry/DOMPoint.res +28 -0
- package/src/geometry/DOMPointReadOnly.res +22 -0
- package/src/geometry/DOMRect.res +22 -0
- package/src/geometry/DOMRectList.res +2 -0
- package/src/geometry/DOMRectReadOnly.res +19 -0
- package/src/html/HTMLAnchorElement.res +373 -0
- package/src/html/HTMLAreaElement.res +353 -0
- package/src/html/HTMLBRElement.res +9 -0
- package/src/html/HTMLBaseElement.res +20 -0
- package/src/html/HTMLBodyElement.res +9 -0
- package/src/html/HTMLButtonElement.res +98 -0
- package/src/html/HTMLDListElement.res +9 -0
- package/src/html/HTMLDataElement.res +14 -0
- package/src/html/HTMLDataListElement.res +14 -0
- package/src/html/HTMLDialogElement.res +40 -0
- package/src/html/HTMLDivElement.res +9 -0
- package/src/html/HTMLElement.res +108 -0
- package/src/html/HTMLEmbedElement.res +275 -0
- package/src/html/HTMLFieldSetElement.res +70 -0
- package/src/html/HTMLFormControlsCollection.res +21 -0
- package/src/html/HTMLFormElement.res +39 -0
- package/src/html/HTMLFrameSetElement.res +9 -0
- package/src/html/HTMLHRElement.res +9 -0
- package/src/html/HTMLHeadElement.res +256 -0
- package/src/html/HTMLHeadingElement.res +9 -0
- package/src/html/HTMLHtmlElement.res +9 -0
- package/src/html/HTMLIFrameElement.res +69 -0
- package/src/html/HTMLImageElement.res +349 -0
- package/src/html/HTMLInputElement.res +310 -0
- package/src/html/HTMLLIElement.res +9 -0
- package/src/html/HTMLLabelElement.res +25 -0
- package/src/html/HTMLLegendElement.res +14 -0
- package/src/html/HTMLLinkElement.res +69 -0
- package/src/html/HTMLMapElement.res +20 -0
- package/src/html/HTMLMenuElement.res +8 -0
- package/src/html/HTMLMetaElement.res +29 -0
- package/src/html/HTMLMeterElement.res +38 -0
- package/src/html/HTMLModElement.res +9 -0
- package/src/html/HTMLOListElement.res +24 -0
- package/src/html/HTMLObjectElement.res +89 -0
- package/src/html/HTMLOptGroupElement.res +19 -0
- package/src/html/HTMLOptionElement.res +49 -0
- package/src/html/HTMLOptionsCollection.res +35 -0
- package/src/html/HTMLOutputElement.res +73 -0
- package/src/html/HTMLParagraphElement.res +9 -0
- package/src/html/HTMLPictureElement.res +9 -0
- package/src/html/HTMLPreElement.res +9 -0
- package/src/html/HTMLProgressElement.res +29 -0
- package/src/html/HTMLQuoteElement.res +9 -0
- package/src/html/HTMLScriptElement.res +310 -0
- package/src/html/HTMLSelectElement.res +157 -0
- package/src/html/HTMLSlotElement.res +34 -0
- package/src/html/HTMLSourceElement.res +18 -0
- package/src/html/HTMLSpanElement.res +9 -0
- package/src/html/HTMLStyleElement.res +24 -0
- package/src/html/HTMLTableCaptionElement.res +9 -0
- package/src/html/HTMLTableCellElement.res +40 -0
- package/src/html/HTMLTableElement.res +100 -0
- package/src/html/HTMLTableRowElement.res +40 -0
- package/src/html/HTMLTableSectionElement.res +30 -0
- package/src/html/HTMLTemplateElement.res +31 -0
- package/src/html/HTMLTextAreaElement.res +177 -0
- package/src/html/HTMLTimeElement.res +14 -0
- package/src/html/HTMLTitleElement.res +15 -0
- package/src/html/HTMLUListElement.res +9 -0
- package/src/html/HTMLUnknownElement.res +9 -0
- package/src/media/BaseEncryptedMediaExtensions.res +97 -0
- package/src/media/DomHTMLMediaElement.res +206 -0
- package/src/media/EncryptedMediaExtensionsHTMLMediaElement.res +15 -0
- package/src/media/EncryptedMediaExtensionsTypes.res +43 -0
- package/src/media/HTMLAudioElement.res +9 -0
- package/src/media/HTMLTrackElement.res +14 -0
- package/src/media/HTMLVideoElement.res +78 -0
- package/src/media/MediaCapabilities.res +19 -0
- package/src/media/MediaCapabilitiesTypes.res +83 -0
- package/src/media/MediaCaptureAndStreamsTypes.res +197 -0
- package/src/media/MediaDeviceInfo.res +9 -0
- package/src/media/MediaDevices.res +40 -0
- package/src/media/MediaError.res +14 -0
- package/src/media/MediaKeySession.res +53 -0
- package/src/media/MediaKeyStatusMap.res +11 -0
- package/src/media/MediaKeySystemAccess.res +14 -0
- package/src/media/MediaKeys.res +35 -0
- package/src/media/MediaMetadata.res +10 -0
- package/src/media/MediaSession.res +25 -0
- package/src/media/MediaSessionTypes.res +85 -0
- package/src/media/MediaStream.res +89 -0
- package/src/media/MediaStreamTrack.res +51 -0
- package/src/media/PictureInPicture.res +7 -0
- package/src/media/PictureInPictureTypes.res +17 -0
- package/src/media/RemotePlayback.res +25 -0
- package/src/media/RemotePlaybackTypes.res +20 -0
- package/src/media/SpeechSynthesis.res +33 -0
- package/src/media/SpeechSynthesisUtterance.res +8 -0
- package/src/media/TextTrack.res +15 -0
- package/src/media/TextTrackCueList.res +9 -0
- package/src/media/TextTrackList.res +17 -0
- package/src/media/TimeRanges.res +29 -0
- package/src/media/VideoPlaybackQuality.res +18 -0
- package/src/media/WebSpeechTypes.res +83 -0
- package/src/media/WebVttTypes.res +123 -0
- package/src/messaging/ApplicationServerKey.res +2 -0
- package/src/messaging/ChannelMessagingTypes.res +12 -0
- package/src/messaging/CloseEvent.res +10 -0
- package/src/messaging/MessageEvent.res +43 -0
- package/src/messaging/MessagePort.res +38 -0
- package/src/messaging/Notification.res +46 -0
- package/src/messaging/NotificationTypes.res +107 -0
- package/src/messaging/PushEvent.res +3 -0
- package/src/messaging/PushManager.res +24 -0
- package/src/messaging/PushMessageData.res +15 -0
- package/src/messaging/PushSubscription.res +20 -0
- package/src/messaging/PushTypes.res +88 -0
- package/src/messaging/WebSocket.res +74 -0
- package/src/messaging/WebSocketsTypes.res +124 -0
- package/src/navigator/Clipboard.res +29 -0
- package/src/navigator/ClipboardItem.res +20 -0
- package/src/navigator/ClipboardTypes.res +31 -0
- package/src/navigator/CredentialManagementTypes.res +138 -0
- package/src/navigator/CredentialsContainer.res +33 -0
- package/src/navigator/Navigator.res +166 -0
- package/src/navigator/Permissions.res +10 -0
- package/src/navigator/PermissionsTypes.res +38 -0
- package/src/observers/IntersectionObserver.res +36 -0
- package/src/observers/IntersectionObserverRoot.res +23 -0
- package/src/observers/IntersectionObserverTypes.res +67 -0
- package/src/observers/MutationObserver.res +94 -0
- package/src/observers/ResizeObserver.res +30 -0
- package/src/observers/ResizeObserverTypes.res +56 -0
- package/src/performance/Performance.res +101 -0
- package/src/performance/PerformanceEntry.res +5 -0
- package/src/performance/PerformanceMark.res +16 -0
- package/src/performance/PerformanceTypes.res +86 -0
- package/src/storage/Cache.res +117 -0
- package/src/storage/CacheStorage.res +43 -0
- package/src/storage/CacheTypes.res +24 -0
- package/src/storage/IDBDatabase.res +54 -0
- package/src/storage/IDBFactory.res +34 -0
- package/src/storage/IDBIndex.res +83 -0
- package/src/storage/IDBObjectStore.res +183 -0
- package/src/storage/IDBTransaction.res +22 -0
- package/src/storage/IndexedDbTypes.res +213 -0
- package/src/storage/Storage.res +42 -0
- package/src/storage/StorageEvent.res +10 -0
- package/src/storage/StorageManager.res +24 -0
- package/src/storage/StorageTypes.res +11 -0
- package/src/storage/WebStorageTypes.res +57 -0
- package/src/svg/SVGElement.res +115 -0
- package/src/svg/SVGGraphicsElement.res +16 -0
- package/src/svg/SVGLength.res +9 -0
- package/src/ui-events/CompositionEvent.res +10 -0
- package/src/ui-events/DataTransfer.res +38 -0
- package/src/ui-events/DataTransferItem.res +21 -0
- package/src/ui-events/DataTransferItemList.res +34 -0
- package/src/ui-events/FocusEvent.res +10 -0
- package/src/ui-events/InputEvent.res +16 -0
- package/src/ui-events/KeyboardEvent.res +16 -0
- package/src/ui-events/MouseEvent.res +26 -0
- package/src/ui-events/PointerEvent.res +24 -0
- package/src/ui-events/Touch.res +5 -0
- package/src/ui-events/TouchEvent.res +10 -0
- package/src/ui-events/TouchList.res +5 -0
- package/src/ui-events/UIEvent.res +20 -0
- package/src/ui-events/UiEventsTypes.res +590 -0
- package/src/ui-events/WheelEvent.res +10 -0
- package/src/url/URL.res +38 -0
- package/src/url/URLSearchParams.res +104 -0
- package/src/url/UrlTypes.res +69 -0
- package/src/view-transitions/ViewTransition.res +5 -0
- package/src/view-transitions/ViewTransitionsTypes.res +22 -0
- package/src/web-audio/AnalyserNode.res +38 -0
- package/src/web-audio/AudioBuffer.res +33 -0
- package/src/web-audio/AudioBufferSourceNode.res +21 -0
- package/src/web-audio/AudioContext.res +59 -0
- package/src/web-audio/AudioDestinationNode.res +1 -0
- package/src/web-audio/AudioNode.res +76 -0
- package/src/web-audio/AudioParam.res +65 -0
- package/src/web-audio/AudioProcessingEvent.res +10 -0
- package/src/web-audio/AudioScheduledSourceNode.res +23 -0
- package/src/web-audio/AudioWorkletNode.res +11 -0
- package/src/web-audio/BaseAudioContext.res +141 -0
- package/src/web-audio/BiquadFilterNode.res +21 -0
- package/src/web-audio/ChannelMergerNode.res +10 -0
- package/src/web-audio/ChannelSplitterNode.res +10 -0
- package/src/web-audio/ConstantSourceNode.res +10 -0
- package/src/web-audio/ConvolverNode.res +10 -0
- package/src/web-audio/DelayNode.res +10 -0
- package/src/web-audio/DynamicsCompressorNode.res +10 -0
- package/src/web-audio/GainNode.res +10 -0
- package/src/web-audio/IIRFilterNode.res +21 -0
- package/src/web-audio/MediaElementAudioSourceNode.res +10 -0
- package/src/web-audio/MediaStreamAudioDestinationNode.res +10 -0
- package/src/web-audio/MediaStreamAudioSourceNode.res +10 -0
- package/src/web-audio/OfflineAudioCompletionEvent.res +10 -0
- package/src/web-audio/OfflineAudioContext.res +58 -0
- package/src/web-audio/OscillatorNode.res +17 -0
- package/src/web-audio/PannerNode.res +10 -0
- package/src/web-audio/PeriodicWave.res +8 -0
- package/src/web-audio/StereoPannerNode.res +10 -0
- package/src/web-audio/WaveShaperNode.res +10 -0
- package/src/web-audio/WebAudioTypes.res +1309 -0
- package/src/web-audio/Worklet.res +14 -0
- package/src/window/CustomElementRegistry.res +30 -0
- package/src/window/Document.res +470 -0
- package/src/window/DomGlobal.res +459 -0
- package/src/window/History.res +37 -0
- package/src/window/HistoryTypes.res +26 -0
- package/src/window/IdleDeadline.res +5 -0
- package/src/window/Location.res +108 -0
- package/src/window/VisualViewport.res +5 -0
- package/src/window/VisualViewportTypes.res +37 -0
- package/src/window/Window.res +556 -0
- package/src/window/XPathExpression.res +16 -0
- package/src/window/XPathResult.res +46 -0
- package/src/workers/Clients.res +39 -0
- package/src/workers/NavigationPreloadManager.res +26 -0
- package/src/workers/ServiceWorker.res +38 -0
- package/src/workers/ServiceWorkerContainer.res +34 -0
- package/src/workers/ServiceWorkerRegistration.res +32 -0
- package/src/workers/ServiceWorkerScope.res +12 -0
- package/src/workers/ServiceWorkerTypes.res +153 -0
- package/src/workers/SharedWorker.res +68 -0
- package/src/workers/SharedWorkerScope.res +29 -0
- package/src/workers/WebWorkersTypes.res +46 -0
- package/src/workers/Worker.res +48 -0
- package/src/workers/WorkerLocation.res +18 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
@@warning("-30")
|
|
2
|
+
|
|
3
|
+
type offscreenRenderingContextId =
|
|
4
|
+
| @as("2d") V2d
|
|
5
|
+
| @as("bitmaprenderer") Bitmaprenderer
|
|
6
|
+
| @as("webgl") Webgl
|
|
7
|
+
| @as("webgl2") Webgl2
|
|
8
|
+
| @as("webgpu") Webgpu
|
|
9
|
+
|
|
10
|
+
type globalCompositeOperation =
|
|
11
|
+
| @as("color") Color
|
|
12
|
+
| @as("color-burn") ColorBurn
|
|
13
|
+
| @as("color-dodge") ColorDodge
|
|
14
|
+
| @as("copy") Copy
|
|
15
|
+
| @as("darken") Darken
|
|
16
|
+
| @as("destination-atop") DestinationAtop
|
|
17
|
+
| @as("destination-in") DestinationIn
|
|
18
|
+
| @as("destination-out") DestinationOut
|
|
19
|
+
| @as("destination-over") DestinationOver
|
|
20
|
+
| @as("difference") Difference
|
|
21
|
+
| @as("exclusion") Exclusion
|
|
22
|
+
| @as("hard-light") HardLight
|
|
23
|
+
| @as("hue") Hue
|
|
24
|
+
| @as("lighten") Lighten
|
|
25
|
+
| @as("lighter") Lighter
|
|
26
|
+
| @as("luminosity") Luminosity
|
|
27
|
+
| @as("multiply") Multiply
|
|
28
|
+
| @as("overlay") Overlay
|
|
29
|
+
| @as("saturation") Saturation
|
|
30
|
+
| @as("screen") Screen
|
|
31
|
+
| @as("soft-light") SoftLight
|
|
32
|
+
| @as("source-atop") SourceAtop
|
|
33
|
+
| @as("source-in") SourceIn
|
|
34
|
+
| @as("source-out") SourceOut
|
|
35
|
+
| @as("source-over") SourceOver
|
|
36
|
+
| @as("xor") Xor
|
|
37
|
+
|
|
38
|
+
type imageSmoothingQuality =
|
|
39
|
+
| @as("high") High
|
|
40
|
+
| @as("low") Low
|
|
41
|
+
| @as("medium") Medium
|
|
42
|
+
|
|
43
|
+
type canvasLineCap =
|
|
44
|
+
| @as("butt") Butt
|
|
45
|
+
| @as("round") Round
|
|
46
|
+
| @as("square") Square
|
|
47
|
+
|
|
48
|
+
type canvasLineJoin =
|
|
49
|
+
| @as("bevel") Bevel
|
|
50
|
+
| @as("miter") Miter
|
|
51
|
+
| @as("round") Round
|
|
52
|
+
|
|
53
|
+
type canvasTextAlign =
|
|
54
|
+
| @as("center") Center
|
|
55
|
+
| @as("end") End
|
|
56
|
+
| @as("left") Left
|
|
57
|
+
| @as("right") Right
|
|
58
|
+
| @as("start") Start
|
|
59
|
+
|
|
60
|
+
type canvasTextBaseline =
|
|
61
|
+
| @as("alphabetic") Alphabetic
|
|
62
|
+
| @as("bottom") Bottom
|
|
63
|
+
| @as("hanging") Hanging
|
|
64
|
+
| @as("ideographic") Ideographic
|
|
65
|
+
| @as("middle") Middle
|
|
66
|
+
| @as("top") Top
|
|
67
|
+
|
|
68
|
+
type canvasDirection =
|
|
69
|
+
| @as("inherit") Inherit
|
|
70
|
+
| @as("ltr") Ltr
|
|
71
|
+
| @as("rtl") Rtl
|
|
72
|
+
|
|
73
|
+
type canvasFontKerning =
|
|
74
|
+
| @as("auto") Auto
|
|
75
|
+
| @as("none") None
|
|
76
|
+
| @as("normal") Normal
|
|
77
|
+
|
|
78
|
+
type canvasFontStretch =
|
|
79
|
+
| @as("condensed") Condensed
|
|
80
|
+
| @as("expanded") Expanded
|
|
81
|
+
| @as("extra-condensed") ExtraCondensed
|
|
82
|
+
| @as("extra-expanded") ExtraExpanded
|
|
83
|
+
| @as("normal") Normal
|
|
84
|
+
| @as("semi-condensed") SemiCondensed
|
|
85
|
+
| @as("semi-expanded") SemiExpanded
|
|
86
|
+
| @as("ultra-condensed") UltraCondensed
|
|
87
|
+
| @as("ultra-expanded") UltraExpanded
|
|
88
|
+
|
|
89
|
+
type canvasFontVariantCaps =
|
|
90
|
+
| @as("all-petite-caps") AllPetiteCaps
|
|
91
|
+
| @as("all-small-caps") AllSmallCaps
|
|
92
|
+
| @as("normal") Normal
|
|
93
|
+
| @as("petite-caps") PetiteCaps
|
|
94
|
+
| @as("small-caps") SmallCaps
|
|
95
|
+
| @as("titling-caps") TitlingCaps
|
|
96
|
+
| @as("unicase") Unicase
|
|
97
|
+
|
|
98
|
+
type canvasTextRendering =
|
|
99
|
+
| @as("auto") Auto
|
|
100
|
+
| @as("geometricPrecision") GeometricPrecision
|
|
101
|
+
| @as("optimizeLegibility") OptimizeLegibility
|
|
102
|
+
| @as("optimizeSpeed") OptimizeSpeed
|
|
103
|
+
|
|
104
|
+
type predefinedColorSpace =
|
|
105
|
+
| @as("display-p3") DisplayP3
|
|
106
|
+
| @as("srgb") Srgb
|
|
107
|
+
|
|
108
|
+
type canvasFillRule =
|
|
109
|
+
| @as("evenodd") Evenodd
|
|
110
|
+
| @as("nonzero") Nonzero
|
|
111
|
+
|
|
112
|
+
type webGLPowerPreference =
|
|
113
|
+
| @as("default") Default
|
|
114
|
+
| @as("high-performance") HighPerformance
|
|
115
|
+
| @as("low-power") LowPower
|
|
116
|
+
|
|
117
|
+
@editor.completeFrom(FillStyle) type fillStyle
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
[See OffscreenCanvas on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas)
|
|
121
|
+
TODO: mark as private once mutating fields of private records is allowed
|
|
122
|
+
*/
|
|
123
|
+
@editor.completeFrom(OffscreenCanvas)
|
|
124
|
+
type offscreenCanvas = {
|
|
125
|
+
...DOM.eventTarget,
|
|
126
|
+
/**
|
|
127
|
+
These attributes return the dimensions of the OffscreenCanvas object's bitmap.
|
|
128
|
+
|
|
129
|
+
They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it).
|
|
130
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/width)
|
|
131
|
+
*/
|
|
132
|
+
mutable width: int,
|
|
133
|
+
/**
|
|
134
|
+
These attributes return the dimensions of the OffscreenCanvas object's bitmap.
|
|
135
|
+
|
|
136
|
+
They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it).
|
|
137
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/height)
|
|
138
|
+
*/
|
|
139
|
+
mutable height: int,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
[See ImageBitmap on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmap)
|
|
144
|
+
*/
|
|
145
|
+
@editor.completeFrom(ImageBitmap)
|
|
146
|
+
type imageBitmap = private {
|
|
147
|
+
/**
|
|
148
|
+
Returns the intrinsic width of the image, in CSS pixels.
|
|
149
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmap/width)
|
|
150
|
+
*/
|
|
151
|
+
width: int,
|
|
152
|
+
/**
|
|
153
|
+
Returns the intrinsic height of the image, in CSS pixels.
|
|
154
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmap/height)
|
|
155
|
+
*/
|
|
156
|
+
height: int,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
[See OffscreenCanvasRenderingContext2D on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvasRenderingContext2D)
|
|
161
|
+
*/
|
|
162
|
+
type offscreenCanvasRenderingContext2D = {
|
|
163
|
+
/**
|
|
164
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/canvas)
|
|
165
|
+
*/
|
|
166
|
+
canvas: offscreenCanvas,
|
|
167
|
+
/**
|
|
168
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalAlpha)
|
|
169
|
+
*/
|
|
170
|
+
mutable globalAlpha: float,
|
|
171
|
+
/**
|
|
172
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation)
|
|
173
|
+
*/
|
|
174
|
+
mutable globalCompositeOperation: globalCompositeOperation,
|
|
175
|
+
/**
|
|
176
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled)
|
|
177
|
+
*/
|
|
178
|
+
mutable imageSmoothingEnabled: bool,
|
|
179
|
+
/**
|
|
180
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality)
|
|
181
|
+
*/
|
|
182
|
+
mutable imageSmoothingQuality: imageSmoothingQuality,
|
|
183
|
+
/**
|
|
184
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle)
|
|
185
|
+
*/
|
|
186
|
+
mutable strokeStyle: fillStyle,
|
|
187
|
+
/**
|
|
188
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle)
|
|
189
|
+
*/
|
|
190
|
+
mutable fillStyle: fillStyle,
|
|
191
|
+
/**
|
|
192
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetX)
|
|
193
|
+
*/
|
|
194
|
+
mutable shadowOffsetX: float,
|
|
195
|
+
/**
|
|
196
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetY)
|
|
197
|
+
*/
|
|
198
|
+
mutable shadowOffsetY: float,
|
|
199
|
+
/**
|
|
200
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowBlur)
|
|
201
|
+
*/
|
|
202
|
+
mutable shadowBlur: float,
|
|
203
|
+
/**
|
|
204
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowColor)
|
|
205
|
+
*/
|
|
206
|
+
mutable shadowColor: string,
|
|
207
|
+
/**
|
|
208
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/filter)
|
|
209
|
+
*/
|
|
210
|
+
mutable filter: string,
|
|
211
|
+
/**
|
|
212
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineWidth)
|
|
213
|
+
*/
|
|
214
|
+
mutable lineWidth: float,
|
|
215
|
+
/**
|
|
216
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineCap)
|
|
217
|
+
*/
|
|
218
|
+
mutable lineCap: canvasLineCap,
|
|
219
|
+
/**
|
|
220
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineJoin)
|
|
221
|
+
*/
|
|
222
|
+
mutable lineJoin: canvasLineJoin,
|
|
223
|
+
/**
|
|
224
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/miterLimit)
|
|
225
|
+
*/
|
|
226
|
+
mutable miterLimit: float,
|
|
227
|
+
/**
|
|
228
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineDashOffset)
|
|
229
|
+
*/
|
|
230
|
+
mutable lineDashOffset: float,
|
|
231
|
+
/**
|
|
232
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/font)
|
|
233
|
+
*/
|
|
234
|
+
mutable font: string,
|
|
235
|
+
/**
|
|
236
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textAlign)
|
|
237
|
+
*/
|
|
238
|
+
mutable textAlign: canvasTextAlign,
|
|
239
|
+
/**
|
|
240
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textBaseline)
|
|
241
|
+
*/
|
|
242
|
+
mutable textBaseline: canvasTextBaseline,
|
|
243
|
+
/**
|
|
244
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/direction)
|
|
245
|
+
*/
|
|
246
|
+
mutable direction: canvasDirection,
|
|
247
|
+
/**
|
|
248
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/letterSpacing)
|
|
249
|
+
*/
|
|
250
|
+
mutable letterSpacing: string,
|
|
251
|
+
/**
|
|
252
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontKerning)
|
|
253
|
+
*/
|
|
254
|
+
mutable fontKerning: canvasFontKerning,
|
|
255
|
+
/**
|
|
256
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontStretch)
|
|
257
|
+
*/
|
|
258
|
+
mutable fontStretch: canvasFontStretch,
|
|
259
|
+
/**
|
|
260
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontVariantCaps)
|
|
261
|
+
*/
|
|
262
|
+
mutable fontVariantCaps: canvasFontVariantCaps,
|
|
263
|
+
/**
|
|
264
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textRendering)
|
|
265
|
+
*/
|
|
266
|
+
mutable textRendering: canvasTextRendering,
|
|
267
|
+
/**
|
|
268
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/wordSpacing)
|
|
269
|
+
*/
|
|
270
|
+
mutable wordSpacing: string,
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
[See ImageBitmapRenderingContext on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmapRenderingContext)
|
|
275
|
+
*/
|
|
276
|
+
@editor.completeFrom(ImageBitmapRenderingContext)
|
|
277
|
+
type imageBitmapRenderingContext = private {
|
|
278
|
+
/**
|
|
279
|
+
Returns the canvas element that the context is bound to.
|
|
280
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmapRenderingContext/canvas)
|
|
281
|
+
*/
|
|
282
|
+
canvas: unknown,
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
Provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of an HTML <canvas> element.
|
|
287
|
+
[See WebGLRenderingContext on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext)
|
|
288
|
+
*/
|
|
289
|
+
type webGLRenderingContext = {
|
|
290
|
+
/**
|
|
291
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/canvas)
|
|
292
|
+
*/
|
|
293
|
+
canvas: unknown,
|
|
294
|
+
/**
|
|
295
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferWidth)
|
|
296
|
+
*/
|
|
297
|
+
drawingBufferWidth: float,
|
|
298
|
+
/**
|
|
299
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferHeight)
|
|
300
|
+
*/
|
|
301
|
+
drawingBufferHeight: float,
|
|
302
|
+
/**
|
|
303
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferColorSpace)
|
|
304
|
+
*/
|
|
305
|
+
mutable drawingBufferColorSpace: predefinedColorSpace,
|
|
306
|
+
/**
|
|
307
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/unpackColorSpace)
|
|
308
|
+
*/
|
|
309
|
+
mutable unpackColorSpace: predefinedColorSpace,
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
[See WebGL2RenderingContext on MDN](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext)
|
|
314
|
+
*/
|
|
315
|
+
type webGL2RenderingContext = {
|
|
316
|
+
/**
|
|
317
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/canvas)
|
|
318
|
+
*/
|
|
319
|
+
canvas: unknown,
|
|
320
|
+
/**
|
|
321
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferWidth)
|
|
322
|
+
*/
|
|
323
|
+
drawingBufferWidth: float,
|
|
324
|
+
/**
|
|
325
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferHeight)
|
|
326
|
+
*/
|
|
327
|
+
drawingBufferHeight: float,
|
|
328
|
+
/**
|
|
329
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferColorSpace)
|
|
330
|
+
*/
|
|
331
|
+
mutable drawingBufferColorSpace: predefinedColorSpace,
|
|
332
|
+
/**
|
|
333
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/unpackColorSpace)
|
|
334
|
+
*/
|
|
335
|
+
mutable unpackColorSpace: predefinedColorSpace,
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient().
|
|
340
|
+
[See CanvasGradient on MDN](https://developer.mozilla.org/docs/Web/API/CanvasGradient)
|
|
341
|
+
*/
|
|
342
|
+
@editor.completeFrom(CanvasGradient)
|
|
343
|
+
type canvasGradient = private {}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method.
|
|
347
|
+
[See CanvasPattern on MDN](https://developer.mozilla.org/docs/Web/API/CanvasPattern)
|
|
348
|
+
*/
|
|
349
|
+
@editor.completeFrom(CanvasPattern)
|
|
350
|
+
type canvasPattern = private {}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
This WebApiCanvas 2D API interface is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired.
|
|
354
|
+
[See Path2D on MDN](https://developer.mozilla.org/docs/Web/API/Path2D)
|
|
355
|
+
*/
|
|
356
|
+
@editor.completeFrom(Path2D)
|
|
357
|
+
type path2D = private {}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
The dimensions of a piece of text in the canvas, as created by the CanvasRenderingContext2D.measureText() method.
|
|
361
|
+
[See TextMetrics on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics)
|
|
362
|
+
*/
|
|
363
|
+
type textMetrics = {
|
|
364
|
+
/**
|
|
365
|
+
Returns the measurement described below.
|
|
366
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/width)
|
|
367
|
+
*/
|
|
368
|
+
width: float,
|
|
369
|
+
/**
|
|
370
|
+
Returns the measurement described below.
|
|
371
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxLeft)
|
|
372
|
+
*/
|
|
373
|
+
actualBoundingBoxLeft: float,
|
|
374
|
+
/**
|
|
375
|
+
Returns the measurement described below.
|
|
376
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxRight)
|
|
377
|
+
*/
|
|
378
|
+
actualBoundingBoxRight: float,
|
|
379
|
+
/**
|
|
380
|
+
Returns the measurement described below.
|
|
381
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/fontBoundingBoxAscent)
|
|
382
|
+
*/
|
|
383
|
+
fontBoundingBoxAscent: float,
|
|
384
|
+
/**
|
|
385
|
+
Returns the measurement described below.
|
|
386
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/fontBoundingBoxDescent)
|
|
387
|
+
*/
|
|
388
|
+
fontBoundingBoxDescent: float,
|
|
389
|
+
/**
|
|
390
|
+
Returns the measurement described below.
|
|
391
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxAscent)
|
|
392
|
+
*/
|
|
393
|
+
actualBoundingBoxAscent: float,
|
|
394
|
+
/**
|
|
395
|
+
Returns the measurement described below.
|
|
396
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxDescent)
|
|
397
|
+
*/
|
|
398
|
+
actualBoundingBoxDescent: float,
|
|
399
|
+
/**
|
|
400
|
+
Returns the measurement described below.
|
|
401
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/emHeightAscent)
|
|
402
|
+
*/
|
|
403
|
+
emHeightAscent: float,
|
|
404
|
+
/**
|
|
405
|
+
Returns the measurement described below.
|
|
406
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/emHeightDescent)
|
|
407
|
+
*/
|
|
408
|
+
emHeightDescent: float,
|
|
409
|
+
/**
|
|
410
|
+
Returns the measurement described below.
|
|
411
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/hangingBaseline)
|
|
412
|
+
*/
|
|
413
|
+
hangingBaseline: float,
|
|
414
|
+
/**
|
|
415
|
+
Returns the measurement described below.
|
|
416
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/alphabeticBaseline)
|
|
417
|
+
*/
|
|
418
|
+
alphabeticBaseline: float,
|
|
419
|
+
/**
|
|
420
|
+
Returns the measurement described below.
|
|
421
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/ideographicBaseline)
|
|
422
|
+
*/
|
|
423
|
+
ideographicBaseline: float,
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
type offscreenRenderingContext = unknown
|
|
427
|
+
|
|
428
|
+
type imageEncodeOptions = {
|
|
429
|
+
@as("type") mutable type_?: string,
|
|
430
|
+
mutable quality?: float,
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
type canvasRenderingContext2DSettings = {
|
|
434
|
+
mutable alpha?: bool,
|
|
435
|
+
mutable desynchronized?: bool,
|
|
436
|
+
mutable colorSpace?: predefinedColorSpace,
|
|
437
|
+
mutable willReadFrequently?: bool,
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
type webGLContextAttributes = {
|
|
441
|
+
mutable alpha?: bool,
|
|
442
|
+
mutable depth?: bool,
|
|
443
|
+
mutable stencil?: bool,
|
|
444
|
+
mutable antialias?: bool,
|
|
445
|
+
mutable premultipliedAlpha?: bool,
|
|
446
|
+
mutable preserveDrawingBuffer?: bool,
|
|
447
|
+
mutable powerPreference?: webGLPowerPreference,
|
|
448
|
+
mutable failIfMajorPerformanceCaveat?: bool,
|
|
449
|
+
mutable desynchronized?: bool,
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
type imageBitmapRenderingContextSettings = {mutable alpha?: bool}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
external fromString: string => CanvasTypes.fillStyle = "%identity"
|
|
2
|
+
external fromCanvasGradient: CanvasTypes.canvasGradient => CanvasTypes.fillStyle = "%identity"
|
|
3
|
+
external fromCanvasPattern: CanvasTypes.canvasPattern => CanvasTypes.fillStyle = "%identity"
|
|
4
|
+
|
|
5
|
+
external toString: CanvasTypes.fillStyle => string = "%identity"
|
|
6
|
+
external toCanvasGradient: CanvasTypes.fillStyle => CanvasTypes.canvasGradient = "%identity"
|
|
7
|
+
external toCanvasPattern: CanvasTypes.fillStyle => CanvasTypes.canvasPattern = "%identity"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
Represents a decoded version of the abstract `fillStyle` type, used in Context2D.
|
|
11
|
+
*/
|
|
12
|
+
type decoded =
|
|
13
|
+
| String(string)
|
|
14
|
+
| CanvasGradient(CanvasTypes.canvasGradient)
|
|
15
|
+
| CanvasPattern(CanvasTypes.canvasPattern)
|
|
16
|
+
|
|
17
|
+
let decode = (t: CanvasTypes.fillStyle): decoded => {
|
|
18
|
+
if CanvasGradient.isInstanceOf(t) {
|
|
19
|
+
CanvasGradient(toCanvasGradient(t))
|
|
20
|
+
} else if CanvasPattern.isInstanceOf(t) {
|
|
21
|
+
CanvasPattern(toCanvasPattern(t))
|
|
22
|
+
} else {
|
|
23
|
+
String(toString(t))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Provides properties and methods for manipulating the layout and presentation of <canvas> elements. The HTMLCanvasElement interface also inherits the properties and methods of the HTMLElement interface.
|
|
3
|
+
[See HTMLCanvasElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement)
|
|
4
|
+
TODO: mark as private once mutating fields of private records is allowed
|
|
5
|
+
*/
|
|
6
|
+
type t = {
|
|
7
|
+
...DOMTree.htmlElement,
|
|
8
|
+
/**
|
|
9
|
+
Gets or sets the width of a canvas element on a document.
|
|
10
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/width)
|
|
11
|
+
*/
|
|
12
|
+
mutable width: int,
|
|
13
|
+
/**
|
|
14
|
+
Gets or sets the height of a canvas element on a document.
|
|
15
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/height)
|
|
16
|
+
*/
|
|
17
|
+
mutable height: int,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
include HTMLElement.Impl({type t = t})
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
|
24
|
+
Creates a CanvasRenderingContext2D object representing a two-dimensional rendering context.
|
|
25
|
+
|
|
26
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext#2d)
|
|
27
|
+
*/
|
|
28
|
+
@throws(JsExn) @send
|
|
29
|
+
external getContext2D: (
|
|
30
|
+
t,
|
|
31
|
+
@as("2d") _,
|
|
32
|
+
~options: CanvasTypes.canvasRenderingContext2DSettings=?,
|
|
33
|
+
) => Null.t<DOM.canvasRenderingContext2D> = "getContext"
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
|
37
|
+
@param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
|
38
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/getContext)
|
|
39
|
+
*/
|
|
40
|
+
@throws(JsExn) @send
|
|
41
|
+
external getContextWebGL: (
|
|
42
|
+
t,
|
|
43
|
+
@as("webgl") _,
|
|
44
|
+
~options: CanvasTypes.webGLContextAttributes=?,
|
|
45
|
+
) => Null.t<CanvasTypes.webGLRenderingContext> = "getContext"
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
|
49
|
+
@param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
|
50
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/getContext)
|
|
51
|
+
*/
|
|
52
|
+
@throws(JsExn) @send
|
|
53
|
+
external getContextWebGL2: (
|
|
54
|
+
t,
|
|
55
|
+
@as("webgl2") _,
|
|
56
|
+
~options: CanvasTypes.webGLContextAttributes=?,
|
|
57
|
+
) => Null.t<CanvasTypes.webGL2RenderingContext> = "getContext"
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
|
61
|
+
@param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
|
62
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/getContext)
|
|
63
|
+
*/
|
|
64
|
+
@throws(JsExn) @send
|
|
65
|
+
external getContextBitmapRenderer: (
|
|
66
|
+
t,
|
|
67
|
+
@as("bitmaprenderer") _,
|
|
68
|
+
~options: CanvasTypes.imageBitmapRenderingContextSettings=?,
|
|
69
|
+
) => Null.t<CanvasTypes.imageBitmapRenderingContext> = "getContext"
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.
|
|
73
|
+
@param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
|
74
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toDataURL)
|
|
75
|
+
*/
|
|
76
|
+
@throws(JsExn) @send
|
|
77
|
+
external toDataURL: (t, ~type_: string=?, ~quality: JSON.t=?) => string = "toDataURL"
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toBlob)
|
|
81
|
+
*/
|
|
82
|
+
@throws(JsExn) @send
|
|
83
|
+
external toBlob: (
|
|
84
|
+
t,
|
|
85
|
+
~callback: FileTypes.blob => unit,
|
|
86
|
+
~type_: string=?,
|
|
87
|
+
~quality: JSON.t=?,
|
|
88
|
+
) => unit = "toBlob"
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen)
|
|
92
|
+
*/
|
|
93
|
+
@throws(JsExn) @send
|
|
94
|
+
external transferControlToOffscreen: t => CanvasTypes.offscreenCanvas = "transferControlToOffscreen"
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/captureStream)
|
|
98
|
+
*/
|
|
99
|
+
@throws(JsExn) @send
|
|
100
|
+
external captureStream: (t, ~frameRequestRate: float=?) => MediaCaptureAndStreamsTypes.mediaStream =
|
|
101
|
+
"captureStream"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Transfers the underlying bitmap data from imageBitmap to context, and the bitmap becomes the contents of the canvas element to which context is bound.
|
|
3
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmapRenderingContext/transferFromImageBitmap)
|
|
4
|
+
*/
|
|
5
|
+
@send
|
|
6
|
+
external transferFromImageBitmap: (
|
|
7
|
+
CanvasTypes.imageBitmapRenderingContext,
|
|
8
|
+
CanvasTypes.imageBitmap,
|
|
9
|
+
) => unit = "transferFromImageBitmap"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageData)
|
|
3
|
+
*/
|
|
4
|
+
@throws(JsExn) @new
|
|
5
|
+
external make: (~sw: int, ~sh: int, ~settings: DOM.imageDataSettings=?) => DOM.imageData =
|
|
6
|
+
"ImageData"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageData)
|
|
10
|
+
*/
|
|
11
|
+
@throws(JsExn) @new
|
|
12
|
+
external makeWithData: (
|
|
13
|
+
~data: Uint8ClampedArray.t,
|
|
14
|
+
~sw: int,
|
|
15
|
+
~sh: int=?,
|
|
16
|
+
~settings: DOM.imageDataSettings=?,
|
|
17
|
+
) => DOM.imageData = "ImageData"
|