From 4c831cab9e19a89337e20f92820b7f555b727af2 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 26 Jan 2017 19:19:02 +0300 Subject: [PATCH] JS: regenerate stdlib files from IDL --- js/js.libraries/src/generated/org.w3c.dom.kt | 284 +++++++++++++++--- .../src/generated/org.w3c.fetch.kt | 104 ++++++- .../src/generated/org.w3c.notifications.kt | 26 +- .../src/generated/org.w3c.workers.kt | 40 ++- js/js.libraries/src/generated/org.w3c.xhr.kt | 13 +- 5 files changed, 395 insertions(+), 72 deletions(-) diff --git a/js/js.libraries/src/generated/org.w3c.dom.kt b/js/js.libraries/src/generated/org.w3c.dom.kt index 4ed2149f5a8..5a69c30a5ff 100644 --- a/js/js.libraries/src/generated/org.w3c.dom.kt +++ b/js/js.libraries/src/generated/org.w3c.dom.kt @@ -33,7 +33,7 @@ public external open class Document : Node, GlobalEventHandlers, DocumentAndElem open val location: Location? var cookie: String open val lastModified: String - open val readyState: String + open val readyState: DocumentReadyState var dir: String var body: HTMLElement? open val head: HTMLHeadElement? @@ -333,11 +333,11 @@ public external abstract class HTMLBaseElement : HTMLElement { public external abstract class HTMLLinkElement : HTMLElement, LinkStyle { open var scope: String - open var workerType: String + open var workerType: WorkerType open var href: String open var crossOrigin: String? open var rel: String - @JsName("as") open var as_: String + @JsName("as") open var as_: RequestDestination open val relList: DOMTokenList open var media: String open var nonce: String @@ -635,12 +635,12 @@ public external abstract class HTMLMediaElement : HTMLElement { open val videoTracks: VideoTrackList open val textTracks: TextTrackList fun load(): Unit - fun canPlayType(type: String): String + fun canPlayType(type: String): CanPlayTypeResult fun fastSeek(time: Double): Unit fun getStartDate(): dynamic fun play(): Promise fun pause(): Unit - fun addTextTrack(kind: String, label: String = definedExternally, language: String = definedExternally): TextTrack + fun addTextTrack(kind: TextTrackKind, label: String = definedExternally, language: String = definedExternally): TextTrack companion object { val NETWORK_EMPTY: Short @@ -711,12 +711,12 @@ public external abstract class TextTrackList : EventTarget { inline operator fun TextTrackList.get(index: Int): TextTrack? = asDynamic()[index] public external abstract class TextTrack : EventTarget, UnionAudioTrackOrTextTrackOrVideoTrack { - open val kind: String + open val kind: TextTrackKind open val label: String open val language: String open val id: String open val inBandMetadataTrackDispatchType: String - open var mode: String + open var mode: TextTrackMode open val cues: TextTrackCueList? open val activeCues: TextTrackCueList? open var oncuechange: ((Event) -> dynamic)? @@ -946,7 +946,7 @@ public external abstract class HTMLInputElement : HTMLElement { fun setCustomValidity(error: String): Unit fun select(): Unit fun setRangeText(replacement: String): Unit - fun setRangeText(replacement: String, start: Int, end: Int, selectionMode: String = definedExternally): Unit + fun setRangeText(replacement: String, start: Int, end: Int, selectionMode: SelectionMode = definedExternally): Unit fun setSelectionRange(start: Int, end: Int, direction: String = definedExternally): Unit } @@ -1054,7 +1054,7 @@ public external abstract class HTMLTextAreaElement : HTMLElement { fun setCustomValidity(error: String): Unit fun select(): Unit fun setRangeText(replacement: String): Unit - fun setRangeText(replacement: String, start: Int, end: Int, selectionMode: String = definedExternally): Unit + fun setRangeText(replacement: String, start: Int, end: Int, selectionMode: SelectionMode = definedExternally): Unit fun setSelectionRange(start: Int, end: Int, direction: String = definedExternally): Unit } @@ -1275,7 +1275,7 @@ public external interface CanvasCompositing { public external interface CanvasImageSmoothing { var imageSmoothingEnabled: Boolean - var imageSmoothingQuality: String + var imageSmoothingQuality: ImageSmoothingQuality } public external interface CanvasFillStrokeStyles { @@ -1305,15 +1305,15 @@ public external interface CanvasRect { public external interface CanvasDrawPath { fun beginPath(): Unit - fun fill(fillRule: String = definedExternally): Unit - fun fill(path: Path2D, fillRule: String = definedExternally): Unit + fun fill(fillRule: CanvasFillRule = definedExternally): Unit + fun fill(path: Path2D, fillRule: CanvasFillRule = definedExternally): Unit fun stroke(): Unit fun stroke(path: Path2D): Unit - fun clip(fillRule: String = definedExternally): Unit - fun clip(path: Path2D, fillRule: String = definedExternally): Unit + fun clip(fillRule: CanvasFillRule = definedExternally): Unit + fun clip(path: Path2D, fillRule: CanvasFillRule = definedExternally): Unit fun resetClip(): Unit - fun isPointInPath(x: Double, y: Double, fillRule: String = definedExternally): Boolean - fun isPointInPath(path: Path2D, x: Double, y: Double, fillRule: String = definedExternally): Boolean + fun isPointInPath(x: Double, y: Double, fillRule: CanvasFillRule = definedExternally): Boolean + fun isPointInPath(path: Path2D, x: Double, y: Double, fillRule: CanvasFillRule = definedExternally): Boolean fun isPointInStroke(x: Double, y: Double): Boolean fun isPointInStroke(path: Path2D, x: Double, y: Double): Boolean } @@ -1353,8 +1353,8 @@ public external interface CanvasImageData { public external interface CanvasPathDrawingStyles { var lineWidth: Double - var lineCap: String - var lineJoin: String + var lineCap: CanvasLineCap + var lineJoin: CanvasLineJoin var miterLimit: Double var lineDashOffset: Double fun setLineDash(segments: Array): Unit @@ -1363,9 +1363,9 @@ public external interface CanvasPathDrawingStyles { public external interface CanvasTextDrawingStyles { var font: String - var textAlign: String - var textBaseline: String - var direction: String + var textAlign: CanvasTextAlign + var textBaseline: CanvasTextBaseline + var direction: CanvasDirection } public external interface CanvasPath { @@ -1408,7 +1408,7 @@ public external interface HitRegionOptions { var path: Path2D? /* = null */ get() = definedExternally set(value) = definedExternally - var fillRule: String? /* = "nonzero" */ + var fillRule: CanvasFillRule? /* = CanvasFillRule.NONZERO */ get() = definedExternally set(value) = definedExternally var id: String? /* = "" */ @@ -1431,7 +1431,7 @@ public external interface HitRegionOptions { set(value) = definedExternally } -public inline fun HitRegionOptions(path: Path2D? = null, fillRule: String? = "nonzero", id: String? = "", parentID: String? = null, cursor: String? = "inherit", control: Element? = null, label: String? = null, role: String? = null): HitRegionOptions { +public inline fun HitRegionOptions(path: Path2D? = null, fillRule: CanvasFillRule? = CanvasFillRule.NONZERO, id: String? = "", parentID: String? = null, cursor: String? = "inherit", control: Element? = null, label: String? = null, role: String? = null): HitRegionOptions { val o = js("({})") o["path"] = path @@ -1456,7 +1456,7 @@ public external open class ImageData : TexImageSource { public external open class Path2D() : CanvasPath { constructor(path: Path2D) - constructor(paths: Array, fillRule: String = definedExternally) + constructor(paths: Array, fillRule: CanvasFillRule = definedExternally) constructor(d: String) fun addPath(path: Path2D, transform: dynamic = definedExternally): Unit override fun closePath(): Unit @@ -1597,7 +1597,7 @@ public external abstract class BarProp { public external abstract class History { open val length: Int - open var scrollRestoration: String + open var scrollRestoration: ScrollRestoration open val state: Any? fun go(delta: Int = definedExternally): Unit fun back(): Unit @@ -1976,13 +1976,13 @@ public external abstract class ImageBitmap : TexImageSource { } public external interface ImageBitmapOptions { - var imageOrientation: String? /* = "none" */ + var imageOrientation: ImageOrientation? /* = ImageOrientation.NONE */ get() = definedExternally set(value) = definedExternally - var premultiplyAlpha: String? /* = "default" */ + var premultiplyAlpha: PremultiplyAlpha? /* = PremultiplyAlpha.DEFAULT */ get() = definedExternally set(value) = definedExternally - var colorSpaceConversion: String? /* = "default" */ + var colorSpaceConversion: ColorSpaceConversion? /* = ColorSpaceConversion.DEFAULT */ get() = definedExternally set(value) = definedExternally var resizeWidth: Int? @@ -1991,12 +1991,12 @@ public external interface ImageBitmapOptions { var resizeHeight: Int? get() = definedExternally set(value) = definedExternally - var resizeQuality: String? /* = "low" */ + var resizeQuality: ResizeQuality? /* = ResizeQuality.LOW */ get() = definedExternally set(value) = definedExternally } -public inline fun ImageBitmapOptions(imageOrientation: String? = "none", premultiplyAlpha: String? = "default", colorSpaceConversion: String? = "default", resizeWidth: Int? = null, resizeHeight: Int? = null, resizeQuality: String? = "low"): ImageBitmapOptions { +public inline fun ImageBitmapOptions(imageOrientation: ImageOrientation? = ImageOrientation.NONE, premultiplyAlpha: PremultiplyAlpha? = PremultiplyAlpha.DEFAULT, colorSpaceConversion: ColorSpaceConversion? = ColorSpaceConversion.DEFAULT, resizeWidth: Int? = null, resizeHeight: Int? = null, resizeQuality: ResizeQuality? = ResizeQuality.LOW): ImageBitmapOptions { val o = js("({})") o["imageOrientation"] = imageOrientation @@ -2091,7 +2091,7 @@ public external open class WebSocket(url: String, protocols: dynamic = definedEx open val extensions: String open val protocol: String var onmessage: ((Event) -> dynamic)? - var binaryType: String + var binaryType: BinaryType fun close(code: Short = definedExternally, reason: String = definedExternally): Unit fun send(data: String): Unit fun send(data: Blob): Unit @@ -2194,15 +2194,15 @@ public external open class Worker(scriptURL: String, options: WorkerOptions = de } public external interface WorkerOptions { - var type: String? /* = "classic" */ + var type: WorkerType? /* = WorkerType.CLASSIC */ get() = definedExternally set(value) = definedExternally - var credentials: String? /* = "omit" */ + var credentials: RequestCredentials? /* = RequestCredentials.OMIT */ get() = definedExternally set(value) = definedExternally } -public inline fun WorkerOptions(type: String? = "classic", credentials: String? = "omit"): WorkerOptions { +public inline fun WorkerOptions(type: WorkerType? = WorkerType.CLASSIC, credentials: RequestCredentials? = RequestCredentials.OMIT): WorkerOptions { val o = js("({})") o["type"] = type @@ -2663,7 +2663,7 @@ public external open class DocumentFragment : Node, NonElementParentNode, Parent } public external open class ShadowRoot : DocumentFragment, DocumentOrShadowRoot { - open val mode: String + open val mode: ShadowRootMode open val host: Element override val fullscreenElement: Element? override fun getElementById(elementId: String): Element? @@ -2733,12 +2733,12 @@ public external abstract class Element : Node, ParentNode, NonDocumentTypeChildN } public external interface ShadowRootInit { - var mode: String? + var mode: ShadowRootMode? get() = definedExternally set(value) = definedExternally } -public inline fun ShadowRootInit(mode: String?): ShadowRootInit { +public inline fun ShadowRootInit(mode: ShadowRootMode?): ShadowRootInit { val o = js("({})") o["mode"] = mode @@ -3109,12 +3109,12 @@ public external open class DOMMatrix() : DOMMatrixReadOnly { } public external interface ScrollOptions { - var behavior: String? /* = "auto" */ + var behavior: ScrollBehavior? /* = ScrollBehavior.AUTO */ get() = definedExternally set(value) = definedExternally } -public inline fun ScrollOptions(behavior: String? = "auto"): ScrollOptions { +public inline fun ScrollOptions(behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollOptions { val o = js("({})") o["behavior"] = behavior @@ -3131,7 +3131,7 @@ public external interface ScrollToOptions : ScrollOptions { set(value) = definedExternally } -public inline fun ScrollToOptions(left: Double? = null, top: Double? = null, behavior: String? = "auto"): ScrollToOptions { +public inline fun ScrollToOptions(left: Double? = null, top: Double? = null, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollToOptions { val o = js("({})") o["left"] = left @@ -3193,15 +3193,15 @@ public external abstract class CaretPosition { } public external interface ScrollIntoViewOptions : ScrollOptions { - var block: String? /* = "center" */ + var block: ScrollLogicalPosition? /* = ScrollLogicalPosition.CENTER */ get() = definedExternally set(value) = definedExternally - var inline: String? /* = "center" */ + var inline: ScrollLogicalPosition? /* = ScrollLogicalPosition.CENTER */ get() = definedExternally set(value) = definedExternally } -public inline fun ScrollIntoViewOptions(block: String? = "center", inline: String? = "center", behavior: String? = "auto"): ScrollIntoViewOptions { +public inline fun ScrollIntoViewOptions(block: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, inline: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollIntoViewOptions { val o = js("({})") o["block"] = block @@ -3212,7 +3212,7 @@ public inline fun ScrollIntoViewOptions(block: String? = "center", inline: Strin } public external interface BoxQuadOptions { - var box: String? /* = "border" */ + var box: CSSBoxType? /* = CSSBoxType.BORDER */ get() = definedExternally set(value) = definedExternally var relativeTo: dynamic @@ -3220,7 +3220,7 @@ public external interface BoxQuadOptions { set(value) = definedExternally } -public inline fun BoxQuadOptions(box: String? = "border", relativeTo: dynamic = null): BoxQuadOptions { +public inline fun BoxQuadOptions(box: CSSBoxType? = CSSBoxType.BORDER, relativeTo: dynamic = null): BoxQuadOptions { val o = js("({})") o["box"] = box @@ -3230,15 +3230,15 @@ public inline fun BoxQuadOptions(box: String? = "border", relativeTo: dynamic = } public external interface ConvertCoordinateOptions { - var fromBox: String? /* = "border" */ + var fromBox: CSSBoxType? /* = CSSBoxType.BORDER */ get() = definedExternally set(value) = definedExternally - var toBox: String? /* = "border" */ + var toBox: CSSBoxType? /* = CSSBoxType.BORDER */ get() = definedExternally set(value) = definedExternally } -public inline fun ConvertCoordinateOptions(fromBox: String? = "border", toBox: String? = "border"): ConvertCoordinateOptions { +public inline fun ConvertCoordinateOptions(fromBox: CSSBoxType? = CSSBoxType.BORDER, toBox: CSSBoxType? = CSSBoxType.BORDER): ConvertCoordinateOptions { val o = js("({})") o["fromBox"] = fromBox @@ -3287,3 +3287,191 @@ public external @marker interface RenderingContext { public external @marker interface HTMLOrSVGImageElement { } +/* please, don't implement this interface! */ +public external interface DocumentReadyState { + companion object +} +public inline val DocumentReadyState.Companion.LOADING: DocumentReadyState get() = "loading".asDynamic().unsafeCast() +public inline val DocumentReadyState.Companion.INTERACTIVE: DocumentReadyState get() = "interactive".asDynamic().unsafeCast() +public inline val DocumentReadyState.Companion.COMPLETE: DocumentReadyState get() = "complete".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CanPlayTypeResult { + companion object +} +public inline val CanPlayTypeResult.Companion.EMPTY: CanPlayTypeResult get() = "".asDynamic().unsafeCast() +public inline val CanPlayTypeResult.Companion.MAYBE: CanPlayTypeResult get() = "maybe".asDynamic().unsafeCast() +public inline val CanPlayTypeResult.Companion.PROBABLY: CanPlayTypeResult get() = "probably".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface TextTrackMode { + companion object +} +public inline val TextTrackMode.Companion.DISABLED: TextTrackMode get() = "disabled".asDynamic().unsafeCast() +public inline val TextTrackMode.Companion.HIDDEN: TextTrackMode get() = "hidden".asDynamic().unsafeCast() +public inline val TextTrackMode.Companion.SHOWING: TextTrackMode get() = "showing".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface TextTrackKind { + companion object +} +public inline val TextTrackKind.Companion.SUBTITLES: TextTrackKind get() = "subtitles".asDynamic().unsafeCast() +public inline val TextTrackKind.Companion.CAPTIONS: TextTrackKind get() = "captions".asDynamic().unsafeCast() +public inline val TextTrackKind.Companion.DESCRIPTIONS: TextTrackKind get() = "descriptions".asDynamic().unsafeCast() +public inline val TextTrackKind.Companion.CHAPTERS: TextTrackKind get() = "chapters".asDynamic().unsafeCast() +public inline val TextTrackKind.Companion.METADATA: TextTrackKind get() = "metadata".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface SelectionMode { + companion object +} +public inline val SelectionMode.Companion.SELECT: SelectionMode get() = "select".asDynamic().unsafeCast() +public inline val SelectionMode.Companion.START: SelectionMode get() = "start".asDynamic().unsafeCast() +public inline val SelectionMode.Companion.END: SelectionMode get() = "end".asDynamic().unsafeCast() +public inline val SelectionMode.Companion.PRESERVE: SelectionMode get() = "preserve".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CanvasFillRule { + companion object +} +public inline val CanvasFillRule.Companion.NONZERO: CanvasFillRule get() = "nonzero".asDynamic().unsafeCast() +public inline val CanvasFillRule.Companion.EVENODD: CanvasFillRule get() = "evenodd".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ImageSmoothingQuality { + companion object +} +public inline val ImageSmoothingQuality.Companion.LOW: ImageSmoothingQuality get() = "low".asDynamic().unsafeCast() +public inline val ImageSmoothingQuality.Companion.MEDIUM: ImageSmoothingQuality get() = "medium".asDynamic().unsafeCast() +public inline val ImageSmoothingQuality.Companion.HIGH: ImageSmoothingQuality get() = "high".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CanvasLineCap { + companion object +} +public inline val CanvasLineCap.Companion.BUTT: CanvasLineCap get() = "butt".asDynamic().unsafeCast() +public inline val CanvasLineCap.Companion.ROUND: CanvasLineCap get() = "round".asDynamic().unsafeCast() +public inline val CanvasLineCap.Companion.SQUARE: CanvasLineCap get() = "square".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CanvasLineJoin { + companion object +} +public inline val CanvasLineJoin.Companion.ROUND: CanvasLineJoin get() = "round".asDynamic().unsafeCast() +public inline val CanvasLineJoin.Companion.BEVEL: CanvasLineJoin get() = "bevel".asDynamic().unsafeCast() +public inline val CanvasLineJoin.Companion.MITER: CanvasLineJoin get() = "miter".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CanvasTextAlign { + companion object +} +public inline val CanvasTextAlign.Companion.START: CanvasTextAlign get() = "start".asDynamic().unsafeCast() +public inline val CanvasTextAlign.Companion.END: CanvasTextAlign get() = "end".asDynamic().unsafeCast() +public inline val CanvasTextAlign.Companion.LEFT: CanvasTextAlign get() = "left".asDynamic().unsafeCast() +public inline val CanvasTextAlign.Companion.RIGHT: CanvasTextAlign get() = "right".asDynamic().unsafeCast() +public inline val CanvasTextAlign.Companion.CENTER: CanvasTextAlign get() = "center".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CanvasTextBaseline { + companion object +} +public inline val CanvasTextBaseline.Companion.TOP: CanvasTextBaseline get() = "top".asDynamic().unsafeCast() +public inline val CanvasTextBaseline.Companion.HANGING: CanvasTextBaseline get() = "hanging".asDynamic().unsafeCast() +public inline val CanvasTextBaseline.Companion.MIDDLE: CanvasTextBaseline get() = "middle".asDynamic().unsafeCast() +public inline val CanvasTextBaseline.Companion.ALPHABETIC: CanvasTextBaseline get() = "alphabetic".asDynamic().unsafeCast() +public inline val CanvasTextBaseline.Companion.IDEOGRAPHIC: CanvasTextBaseline get() = "ideographic".asDynamic().unsafeCast() +public inline val CanvasTextBaseline.Companion.BOTTOM: CanvasTextBaseline get() = "bottom".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CanvasDirection { + companion object +} +public inline val CanvasDirection.Companion.LTR: CanvasDirection get() = "ltr".asDynamic().unsafeCast() +public inline val CanvasDirection.Companion.RTL: CanvasDirection get() = "rtl".asDynamic().unsafeCast() +public inline val CanvasDirection.Companion.INHERIT: CanvasDirection get() = "inherit".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ScrollRestoration { + companion object +} +public inline val ScrollRestoration.Companion.AUTO: ScrollRestoration get() = "auto".asDynamic().unsafeCast() +public inline val ScrollRestoration.Companion.MANUAL: ScrollRestoration get() = "manual".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ImageOrientation { + companion object +} +public inline val ImageOrientation.Companion.NONE: ImageOrientation get() = "none".asDynamic().unsafeCast() +public inline val ImageOrientation.Companion.FLIPY: ImageOrientation get() = "flipY".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface PremultiplyAlpha { + companion object +} +public inline val PremultiplyAlpha.Companion.NONE: PremultiplyAlpha get() = "none".asDynamic().unsafeCast() +public inline val PremultiplyAlpha.Companion.PREMULTIPLY: PremultiplyAlpha get() = "premultiply".asDynamic().unsafeCast() +public inline val PremultiplyAlpha.Companion.DEFAULT: PremultiplyAlpha get() = "default".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ColorSpaceConversion { + companion object +} +public inline val ColorSpaceConversion.Companion.NONE: ColorSpaceConversion get() = "none".asDynamic().unsafeCast() +public inline val ColorSpaceConversion.Companion.DEFAULT: ColorSpaceConversion get() = "default".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ResizeQuality { + companion object +} +public inline val ResizeQuality.Companion.PIXELATED: ResizeQuality get() = "pixelated".asDynamic().unsafeCast() +public inline val ResizeQuality.Companion.LOW: ResizeQuality get() = "low".asDynamic().unsafeCast() +public inline val ResizeQuality.Companion.MEDIUM: ResizeQuality get() = "medium".asDynamic().unsafeCast() +public inline val ResizeQuality.Companion.HIGH: ResizeQuality get() = "high".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface BinaryType { + companion object +} +public inline val BinaryType.Companion.BLOB: BinaryType get() = "blob".asDynamic().unsafeCast() +public inline val BinaryType.Companion.ARRAYBUFFER: BinaryType get() = "arraybuffer".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface WorkerType { + companion object +} +public inline val WorkerType.Companion.CLASSIC: WorkerType get() = "classic".asDynamic().unsafeCast() +public inline val WorkerType.Companion.MODULE: WorkerType get() = "module".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ShadowRootMode { + companion object +} +public inline val ShadowRootMode.Companion.OPEN: ShadowRootMode get() = "open".asDynamic().unsafeCast() +public inline val ShadowRootMode.Companion.CLOSED: ShadowRootMode get() = "closed".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ScrollBehavior { + companion object +} +public inline val ScrollBehavior.Companion.AUTO: ScrollBehavior get() = "auto".asDynamic().unsafeCast() +public inline val ScrollBehavior.Companion.INSTANT: ScrollBehavior get() = "instant".asDynamic().unsafeCast() +public inline val ScrollBehavior.Companion.SMOOTH: ScrollBehavior get() = "smooth".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ScrollLogicalPosition { + companion object +} +public inline val ScrollLogicalPosition.Companion.START: ScrollLogicalPosition get() = "start".asDynamic().unsafeCast() +public inline val ScrollLogicalPosition.Companion.CENTER: ScrollLogicalPosition get() = "center".asDynamic().unsafeCast() +public inline val ScrollLogicalPosition.Companion.END: ScrollLogicalPosition get() = "end".asDynamic().unsafeCast() +public inline val ScrollLogicalPosition.Companion.NEAREST: ScrollLogicalPosition get() = "nearest".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface CSSBoxType { + companion object +} +public inline val CSSBoxType.Companion.MARGIN: CSSBoxType get() = "margin".asDynamic().unsafeCast() +public inline val CSSBoxType.Companion.BORDER: CSSBoxType get() = "border".asDynamic().unsafeCast() +public inline val CSSBoxType.Companion.PADDING: CSSBoxType get() = "padding".asDynamic().unsafeCast() +public inline val CSSBoxType.Companion.CONTENT: CSSBoxType get() = "content".asDynamic().unsafeCast() + diff --git a/js/js.libraries/src/generated/org.w3c.fetch.kt b/js/js.libraries/src/generated/org.w3c.fetch.kt index 2b00be0909c..9351d692257 100644 --- a/js/js.libraries/src/generated/org.w3c.fetch.kt +++ b/js/js.libraries/src/generated/org.w3c.fetch.kt @@ -41,14 +41,14 @@ public external open class Request(input: dynamic, init: RequestInit = definedEx open val method: String open val url: String open val headers: Headers - open val type: String - open val destination: String + open val type: RequestType + open val destination: RequestDestination open val referrer: String open val referrerPolicy: dynamic - open val mode: String - open val credentials: String - open val cache: String - open val redirect: String + open val mode: RequestMode + open val credentials: RequestCredentials + open val cache: RequestCache + open val redirect: RequestRedirect open val integrity: String open val keepalive: Boolean override val bodyUsed: Boolean @@ -76,16 +76,16 @@ public external interface RequestInit { var referrerPolicy: dynamic get() = definedExternally set(value) = definedExternally - var mode: String? + var mode: RequestMode? get() = definedExternally set(value) = definedExternally - var credentials: String? + var credentials: RequestCredentials? get() = definedExternally set(value) = definedExternally - var cache: String? + var cache: RequestCache? get() = definedExternally set(value) = definedExternally - var redirect: String? + var redirect: RequestRedirect? get() = definedExternally set(value) = definedExternally var integrity: String? @@ -99,7 +99,7 @@ public external interface RequestInit { set(value) = definedExternally } -public inline fun RequestInit(method: String? = null, headers: dynamic = null, body: dynamic = null, referrer: String? = null, referrerPolicy: dynamic = null, mode: String? = null, credentials: String? = null, cache: String? = null, redirect: String? = null, integrity: String? = null, keepalive: Boolean? = null, window: Any? = null): RequestInit { +public inline fun RequestInit(method: String? = null, headers: dynamic = null, body: dynamic = null, referrer: String? = null, referrerPolicy: dynamic = null, mode: RequestMode? = null, credentials: RequestCredentials? = null, cache: RequestCache? = null, redirect: RequestRedirect? = null, integrity: String? = null, keepalive: Boolean? = null, window: Any? = null): RequestInit { val o = js("({})") o["method"] = method @@ -119,7 +119,7 @@ public inline fun RequestInit(method: String? = null, headers: dynamic = null, b } public external open class Response(body: dynamic = definedExternally, init: ResponseInit = definedExternally) : Body { - open val type: String + open val type: ResponseType open val url: String open val redirected: Boolean open val status: Short @@ -164,3 +164,83 @@ public inline fun ResponseInit(status: Short? = 200, statusText: String? = "OK", return o } +/* please, don't implement this interface! */ +public external interface RequestType { + companion object +} +public inline val RequestType.Companion.EMPTY: RequestType get() = "".asDynamic().unsafeCast() +public inline val RequestType.Companion.AUDIO: RequestType get() = "audio".asDynamic().unsafeCast() +public inline val RequestType.Companion.FONT: RequestType get() = "font".asDynamic().unsafeCast() +public inline val RequestType.Companion.IMAGE: RequestType get() = "image".asDynamic().unsafeCast() +public inline val RequestType.Companion.SCRIPT: RequestType get() = "script".asDynamic().unsafeCast() +public inline val RequestType.Companion.STYLE: RequestType get() = "style".asDynamic().unsafeCast() +public inline val RequestType.Companion.TRACK: RequestType get() = "track".asDynamic().unsafeCast() +public inline val RequestType.Companion.VIDEO: RequestType get() = "video".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface RequestDestination { + companion object +} +public inline val RequestDestination.Companion.EMPTY: RequestDestination get() = "".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.DOCUMENT: RequestDestination get() = "document".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.EMBED: RequestDestination get() = "embed".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.FONT: RequestDestination get() = "font".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.IMAGE: RequestDestination get() = "image".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.MANIFEST: RequestDestination get() = "manifest".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.MEDIA: RequestDestination get() = "media".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.OBJECT: RequestDestination get() = "object".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.REPORT: RequestDestination get() = "report".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.SCRIPT: RequestDestination get() = "script".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.SERVICEWORKER: RequestDestination get() = "serviceworker".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.SHAREDWORKER: RequestDestination get() = "sharedworker".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.STYLE: RequestDestination get() = "style".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.WORKER: RequestDestination get() = "worker".asDynamic().unsafeCast() +public inline val RequestDestination.Companion.XSLT: RequestDestination get() = "xslt".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface RequestMode { + companion object +} +public inline val RequestMode.Companion.NAVIGATE: RequestMode get() = "navigate".asDynamic().unsafeCast() +public inline val RequestMode.Companion.SAME_ORIGIN: RequestMode get() = "same-origin".asDynamic().unsafeCast() +public inline val RequestMode.Companion.NO_CORS: RequestMode get() = "no-cors".asDynamic().unsafeCast() +public inline val RequestMode.Companion.CORS: RequestMode get() = "cors".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface RequestCredentials { + companion object +} +public inline val RequestCredentials.Companion.OMIT: RequestCredentials get() = "omit".asDynamic().unsafeCast() +public inline val RequestCredentials.Companion.SAME_ORIGIN: RequestCredentials get() = "same-origin".asDynamic().unsafeCast() +public inline val RequestCredentials.Companion.INCLUDE: RequestCredentials get() = "include".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface RequestCache { + companion object +} +public inline val RequestCache.Companion.DEFAULT: RequestCache get() = "default".asDynamic().unsafeCast() +public inline val RequestCache.Companion.NO_STORE: RequestCache get() = "no-store".asDynamic().unsafeCast() +public inline val RequestCache.Companion.RELOAD: RequestCache get() = "reload".asDynamic().unsafeCast() +public inline val RequestCache.Companion.NO_CACHE: RequestCache get() = "no-cache".asDynamic().unsafeCast() +public inline val RequestCache.Companion.FORCE_CACHE: RequestCache get() = "force-cache".asDynamic().unsafeCast() +public inline val RequestCache.Companion.ONLY_IF_CACHED: RequestCache get() = "only-if-cached".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface RequestRedirect { + companion object +} +public inline val RequestRedirect.Companion.FOLLOW: RequestRedirect get() = "follow".asDynamic().unsafeCast() +public inline val RequestRedirect.Companion.ERROR: RequestRedirect get() = "error".asDynamic().unsafeCast() +public inline val RequestRedirect.Companion.MANUAL: RequestRedirect get() = "manual".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ResponseType { + companion object +} +public inline val ResponseType.Companion.BASIC: ResponseType get() = "basic".asDynamic().unsafeCast() +public inline val ResponseType.Companion.CORS: ResponseType get() = "cors".asDynamic().unsafeCast() +public inline val ResponseType.Companion.DEFAULT: ResponseType get() = "default".asDynamic().unsafeCast() +public inline val ResponseType.Companion.ERROR: ResponseType get() = "error".asDynamic().unsafeCast() +public inline val ResponseType.Companion.OPAQUE: ResponseType get() = "opaque".asDynamic().unsafeCast() +public inline val ResponseType.Companion.OPAQUEREDIRECT: ResponseType get() = "opaqueredirect".asDynamic().unsafeCast() + diff --git a/js/js.libraries/src/generated/org.w3c.notifications.kt b/js/js.libraries/src/generated/org.w3c.notifications.kt index 965d63264f9..5c8e92ac8e2 100644 --- a/js/js.libraries/src/generated/org.w3c.notifications.kt +++ b/js/js.libraries/src/generated/org.w3c.notifications.kt @@ -24,7 +24,7 @@ public external open class Notification(title: String, options: NotificationOpti var onclick: ((Event) -> dynamic)? var onerror: ((Event) -> dynamic)? open val title: String - open val dir: String + open val dir: NotificationDirection open val lang: String open val body: String open val tag: String @@ -44,14 +44,14 @@ public external open class Notification(title: String, options: NotificationOpti fun close(): Unit companion object { - var permission: String + var permission: NotificationPermission var maxActions: Int - fun requestPermission(deprecatedCallback: (String) -> Unit = definedExternally): Promise + fun requestPermission(deprecatedCallback: (NotificationPermission) -> Unit = definedExternally): Promise } } public external interface NotificationOptions { - var dir: String? /* = "auto" */ + var dir: NotificationDirection? /* = NotificationDirection.AUTO */ get() = definedExternally set(value) = definedExternally var lang: String? /* = "" */ @@ -104,7 +104,7 @@ public external interface NotificationOptions { set(value) = definedExternally } -public inline fun NotificationOptions(dir: String? = "auto", lang: String? = "", body: String? = "", tag: String? = "", image: String? = null, icon: String? = null, badge: String? = null, sound: String? = null, vibrate: dynamic = null, timestamp: Number? = null, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: Any? = null, actions: Array? = arrayOf()): NotificationOptions { +public inline fun NotificationOptions(dir: NotificationDirection? = NotificationDirection.AUTO, lang: String? = "", body: String? = "", tag: String? = "", image: String? = null, icon: String? = null, badge: String? = null, sound: String? = null, vibrate: dynamic = null, timestamp: Number? = null, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: Any? = null, actions: Array? = arrayOf()): NotificationOptions { val o = js("({})") o["dir"] = dir @@ -190,3 +190,19 @@ public inline fun NotificationEventInit(notification: Notification?, action: Str return o } +/* please, don't implement this interface! */ +public external interface NotificationPermission { + companion object +} +public inline val NotificationPermission.Companion.DEFAULT: NotificationPermission get() = "default".asDynamic().unsafeCast() +public inline val NotificationPermission.Companion.DENIED: NotificationPermission get() = "denied".asDynamic().unsafeCast() +public inline val NotificationPermission.Companion.GRANTED: NotificationPermission get() = "granted".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface NotificationDirection { + companion object +} +public inline val NotificationDirection.Companion.AUTO: NotificationDirection get() = "auto".asDynamic().unsafeCast() +public inline val NotificationDirection.Companion.LTR: NotificationDirection get() = "ltr".asDynamic().unsafeCast() +public inline val NotificationDirection.Companion.RTL: NotificationDirection get() = "rtl".asDynamic().unsafeCast() + diff --git a/js/js.libraries/src/generated/org.w3c.workers.kt b/js/js.libraries/src/generated/org.w3c.workers.kt index 00eeac7ebea..d0df6ce4233 100644 --- a/js/js.libraries/src/generated/org.w3c.workers.kt +++ b/js/js.libraries/src/generated/org.w3c.workers.kt @@ -50,7 +50,7 @@ public external abstract class ServiceWorkerGlobalScope : WorkerGlobalScope { public external abstract class ServiceWorker : EventTarget, AbstractWorker, UnionMessagePortOrServiceWorker, UnionClientOrMessagePortOrServiceWorker { open val scriptURL: String - open val state: String + open val state: ServiceWorkerState open var onstatechange: ((Event) -> dynamic)? fun postMessage(message: Any?, transfer: Array = definedExternally): Unit } @@ -70,12 +70,12 @@ public external interface RegistrationOptions { var scope: String? get() = definedExternally set(value) = definedExternally - var type: String? /* = "classic" */ + var type: WorkerType? /* = WorkerType.CLASSIC */ get() = definedExternally set(value) = definedExternally } -public inline fun RegistrationOptions(scope: String? = null, type: String? = "classic"): RegistrationOptions { +public inline fun RegistrationOptions(scope: String? = null, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions { val o = js("({})") o["scope"] = scope @@ -127,7 +127,7 @@ public inline fun ServiceWorkerMessageEventInit(data: Any? = null, origin: Strin public external abstract class Client : UnionClientOrMessagePortOrServiceWorker { open val url: String - open val frameType: String + open val frameType: FrameType open val id: String fun postMessage(message: Any?, transfer: Array = definedExternally): Unit } @@ -150,12 +150,12 @@ public external interface ClientQueryOptions { var includeUncontrolled: Boolean? /* = false */ get() = definedExternally set(value) = definedExternally - var type: String? /* = "window" */ + var type: ClientType? /* = ClientType.WINDOW */ get() = definedExternally set(value) = definedExternally } -public inline fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type: String? = "window"): ClientQueryOptions { +public inline fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type: ClientType? = ClientType.WINDOW): ClientQueryOptions { val o = js("({})") o["includeUncontrolled"] = includeUncontrolled @@ -401,3 +401,31 @@ public external open class FunctionalEvent : ExtendableEvent { public external @marker interface UnionClientOrMessagePortOrServiceWorker { } +/* please, don't implement this interface! */ +public external interface ServiceWorkerState { + companion object +} +public inline val ServiceWorkerState.Companion.INSTALLING: ServiceWorkerState get() = "installing".asDynamic().unsafeCast() +public inline val ServiceWorkerState.Companion.INSTALLED: ServiceWorkerState get() = "installed".asDynamic().unsafeCast() +public inline val ServiceWorkerState.Companion.ACTIVATING: ServiceWorkerState get() = "activating".asDynamic().unsafeCast() +public inline val ServiceWorkerState.Companion.ACTIVATED: ServiceWorkerState get() = "activated".asDynamic().unsafeCast() +public inline val ServiceWorkerState.Companion.REDUNDANT: ServiceWorkerState get() = "redundant".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface FrameType { + companion object +} +public inline val FrameType.Companion.AUXILIARY: FrameType get() = "auxiliary".asDynamic().unsafeCast() +public inline val FrameType.Companion.TOP_LEVEL: FrameType get() = "top-level".asDynamic().unsafeCast() +public inline val FrameType.Companion.NESTED: FrameType get() = "nested".asDynamic().unsafeCast() +public inline val FrameType.Companion.NONE: FrameType get() = "none".asDynamic().unsafeCast() + +/* please, don't implement this interface! */ +public external interface ClientType { + companion object +} +public inline val ClientType.Companion.WINDOW: ClientType get() = "window".asDynamic().unsafeCast() +public inline val ClientType.Companion.WORKER: ClientType get() = "worker".asDynamic().unsafeCast() +public inline val ClientType.Companion.SHAREDWORKER: ClientType get() = "sharedworker".asDynamic().unsafeCast() +public inline val ClientType.Companion.ALL: ClientType get() = "all".asDynamic().unsafeCast() + diff --git a/js/js.libraries/src/generated/org.w3c.xhr.kt b/js/js.libraries/src/generated/org.w3c.xhr.kt index eeb63c31554..fb54422501d 100644 --- a/js/js.libraries/src/generated/org.w3c.xhr.kt +++ b/js/js.libraries/src/generated/org.w3c.xhr.kt @@ -42,7 +42,7 @@ public external open class XMLHttpRequest : XMLHttpRequestEventTarget { open val responseURL: String open val status: Short open val statusText: String - var responseType: String + var responseType: XMLHttpRequestResponseType open val response: Any? open val responseText: String open val responseXML: Document? @@ -106,3 +106,14 @@ public inline fun ProgressEventInit(lengthComputable: Boolean? = false, loaded: return o } +/* please, don't implement this interface! */ +public external interface XMLHttpRequestResponseType { + companion object +} +public inline val XMLHttpRequestResponseType.Companion.EMPTY: XMLHttpRequestResponseType get() = "".asDynamic().unsafeCast() +public inline val XMLHttpRequestResponseType.Companion.ARRAYBUFFER: XMLHttpRequestResponseType get() = "arraybuffer".asDynamic().unsafeCast() +public inline val XMLHttpRequestResponseType.Companion.BLOB: XMLHttpRequestResponseType get() = "blob".asDynamic().unsafeCast() +public inline val XMLHttpRequestResponseType.Companion.DOCUMENT: XMLHttpRequestResponseType get() = "document".asDynamic().unsafeCast() +public inline val XMLHttpRequestResponseType.Companion.JSON: XMLHttpRequestResponseType get() = "json".asDynamic().unsafeCast() +public inline val XMLHttpRequestResponseType.Companion.TEXT: XMLHttpRequestResponseType get() = "text".asDynamic().unsafeCast() +