Generate Kotlin/JS stdlib dependencies via dukat
This commit is contained in:
committed by
Shagen Ogandzhanian
parent
83bb07e5ac
commit
b30537de0e
@@ -51,6 +51,7 @@ val mirroredUrls = listOf(
|
||||
"https://jetbrains.bintray.com/test-discovery",
|
||||
"https://jetbrains.bintray.com/wormhole",
|
||||
"https://jitpack.io",
|
||||
"https://kotlin.bintray.com/dukat",
|
||||
"https://kotlin.bintray.com/kotlin-dependencies",
|
||||
"https://oss.sonatype.org/content/repositories/releases",
|
||||
"https://oss.sonatype.org/content/repositories/snapshots",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.khronos.webgl;
|
||||
package org.khronos.webgl;
|
||||
|
||||
|
||||
// Downloaded from https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.css.masking;
|
||||
package org.w3c.css.masking;
|
||||
|
||||
|
||||
// Downloaded from https://www.w3.org/TR/css-masking-1/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.clipboard;
|
||||
package org.w3c.dom.clipboard;
|
||||
|
||||
|
||||
// Downloaded from https://w3c.github.io/clipboard-apis
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.css;
|
||||
package org.w3c.dom.css;
|
||||
|
||||
/* written by CSS3 spec */
|
||||
partial interface CSSStyleDeclaration {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.css;
|
||||
package org.w3c.dom.css;
|
||||
|
||||
|
||||
// Downloaded from https://drafts.csswg.org/cssom/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.events;
|
||||
package org.w3c.dom.events;
|
||||
|
||||
|
||||
// Downloaded from http://www.w3.org/TR/uievents/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom;
|
||||
package org.w3c.dom;
|
||||
|
||||
|
||||
// Downloaded from https://raw.githubusercontent.com/whatwg/html-mirror/master/source
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.mediacapture;
|
||||
package org.w3c.dom.mediacapture;
|
||||
|
||||
|
||||
// Downloaded from https://w3c.github.io/mediacapture-main/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.parsing;
|
||||
package org.w3c.dom.parsing;
|
||||
|
||||
|
||||
// Downloaded from http://www.w3.org/TR/DOM-Parsing/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.pointerevents;
|
||||
package org.w3c.dom.pointerevents;
|
||||
|
||||
|
||||
// Downloaded from http://www.w3.org/TR/pointerevents/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.svg;
|
||||
package org.w3c.dom.svg;
|
||||
|
||||
|
||||
// Downloaded from https://www.w3.org/TR/SVG2/single-page.html
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.dom.url;
|
||||
package org.w3c.dom.url;
|
||||
|
||||
|
||||
// Downloaded from https://raw.githubusercontent.com/whatwg/url/master/url.html
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.fetch;
|
||||
package org.w3c.fetch;
|
||||
|
||||
|
||||
// Downloaded from https://raw.githubusercontent.com/whatwg/fetch/master/Overview.src.html
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.files;
|
||||
package org.w3c.files;
|
||||
|
||||
|
||||
// Downloaded from https://raw.githubusercontent.com/w3c/FileAPI/gh-pages/index.html
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.fullscreen;
|
||||
package org.w3c.fullscreen;
|
||||
|
||||
|
||||
// Downloaded from https://raw.githubusercontent.com/whatwg/fullscreen/master/fullscreen.html
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.notifications;
|
||||
package org.w3c.notifications;
|
||||
|
||||
|
||||
// Downloaded from https://raw.githubusercontent.com/whatwg/notifications/master/notifications.html
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.performance;
|
||||
package org.w3c.performance;
|
||||
|
||||
|
||||
// Downloaded from http://www.w3.org/TR/hr-time/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.vibration;
|
||||
package org.w3c.vibration;
|
||||
|
||||
|
||||
// Downloaded from http://www.w3.org/TR/vibration/
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
namespace org.w3c.webidl;
|
||||
package org.w3c.webidl;
|
||||
|
||||
/** written by WebIDL spec */
|
||||
|
||||
typedef unsigned long long DOMTimeStamp;
|
||||
callback Function = any (any... arguments);
|
||||
callback VoidFunction = void ();
|
||||
|
||||
typedef Window WindowProxy;
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.workers;
|
||||
package org.w3c.workers;
|
||||
|
||||
|
||||
// Downloaded from https://w3c.github.io/ServiceWorker/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace org.w3c.xhr;
|
||||
package org.w3c.xhr;
|
||||
|
||||
|
||||
// Downloaded from https://raw.githubusercontent.com/whatwg/xhr/master/Overview.src.html
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*.kt eol=lf
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.khronos.webgl
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -57,7 +56,6 @@ public external interface WebGLContextAttributes {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun WebGLContextAttributes(alpha: Boolean? = true, depth: Boolean? = true, stencil: Boolean? = false, antialias: Boolean? = true, premultipliedAlpha: Boolean? = true, preserveDrawingBuffer: Boolean? = false, preferLowPowerToHighPerformance: Boolean? = false, failIfMajorPerformanceCaveat: Boolean? = false): WebGLContextAttributes {
|
||||
val o = js("({})")
|
||||
|
||||
o["alpha"] = alpha
|
||||
o["depth"] = depth
|
||||
o["stencil"] = stencil
|
||||
@@ -66,54 +64,45 @@ public inline fun WebGLContextAttributes(alpha: Boolean? = true, depth: Boolean?
|
||||
o["preserveDrawingBuffer"] = preserveDrawingBuffer
|
||||
o["preferLowPowerToHighPerformance"] = preferLowPowerToHighPerformance
|
||||
o["failIfMajorPerformanceCaveat"] = failIfMajorPerformanceCaveat
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external abstract class WebGLObject {
|
||||
}
|
||||
public external abstract class WebGLObject
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLBuffer](https://developer.mozilla.org/en/docs/Web/API/WebGLBuffer) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLBuffer : WebGLObject {
|
||||
}
|
||||
public external abstract class WebGLBuffer : WebGLObject
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLFramebuffer](https://developer.mozilla.org/en/docs/Web/API/WebGLFramebuffer) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLFramebuffer : WebGLObject {
|
||||
}
|
||||
public external abstract class WebGLFramebuffer : WebGLObject
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLProgram](https://developer.mozilla.org/en/docs/Web/API/WebGLProgram) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLProgram : WebGLObject {
|
||||
}
|
||||
public external abstract class WebGLProgram : WebGLObject
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLRenderbuffer](https://developer.mozilla.org/en/docs/Web/API/WebGLRenderbuffer) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLRenderbuffer : WebGLObject {
|
||||
}
|
||||
public external abstract class WebGLRenderbuffer : WebGLObject
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLShader](https://developer.mozilla.org/en/docs/Web/API/WebGLShader) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLShader : WebGLObject {
|
||||
}
|
||||
public external abstract class WebGLShader : WebGLObject
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLTexture](https://developer.mozilla.org/en/docs/Web/API/WebGLTexture) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLTexture : WebGLObject {
|
||||
}
|
||||
public external abstract class WebGLTexture : WebGLObject
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLUniformLocation](https://developer.mozilla.org/en/docs/Web/API/WebGLUniformLocation) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLUniformLocation {
|
||||
}
|
||||
public external abstract class WebGLUniformLocation
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [WebGLActiveInfo](https://developer.mozilla.org/en/docs/Web/API/WebGLActiveInfo) to Kotlin
|
||||
@@ -133,6 +122,7 @@ public external abstract class WebGLShaderPrecisionFormat {
|
||||
open val precision: Int
|
||||
}
|
||||
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface WebGLRenderingContextBase {
|
||||
val canvas: HTMLCanvasElement
|
||||
val drawingBufferWidth: Int
|
||||
@@ -141,61 +131,61 @@ public external interface WebGLRenderingContextBase {
|
||||
fun isContextLost(): Boolean
|
||||
fun getSupportedExtensions(): Array<String>?
|
||||
fun getExtension(name: String): dynamic
|
||||
fun activeTexture(texture: Int): Unit
|
||||
fun attachShader(program: WebGLProgram?, shader: WebGLShader?): Unit
|
||||
fun bindAttribLocation(program: WebGLProgram?, index: Int, name: String): Unit
|
||||
fun bindBuffer(target: Int, buffer: WebGLBuffer?): Unit
|
||||
fun bindFramebuffer(target: Int, framebuffer: WebGLFramebuffer?): Unit
|
||||
fun bindRenderbuffer(target: Int, renderbuffer: WebGLRenderbuffer?): Unit
|
||||
fun bindTexture(target: Int, texture: WebGLTexture?): Unit
|
||||
fun blendColor(red: Float, green: Float, blue: Float, alpha: Float): Unit
|
||||
fun blendEquation(mode: Int): Unit
|
||||
fun blendEquationSeparate(modeRGB: Int, modeAlpha: Int): Unit
|
||||
fun blendFunc(sfactor: Int, dfactor: Int): Unit
|
||||
fun blendFuncSeparate(srcRGB: Int, dstRGB: Int, srcAlpha: Int, dstAlpha: Int): Unit
|
||||
fun bufferData(target: Int, size: Int, usage: Int): Unit
|
||||
fun bufferData(target: Int, data: BufferDataSource?, usage: Int): Unit
|
||||
fun bufferSubData(target: Int, offset: Int, data: BufferDataSource?): Unit
|
||||
fun activeTexture(texture: Int)
|
||||
fun attachShader(program: WebGLProgram?, shader: WebGLShader?)
|
||||
fun bindAttribLocation(program: WebGLProgram?, index: Int, name: String)
|
||||
fun bindBuffer(target: Int, buffer: WebGLBuffer?)
|
||||
fun bindFramebuffer(target: Int, framebuffer: WebGLFramebuffer?)
|
||||
fun bindRenderbuffer(target: Int, renderbuffer: WebGLRenderbuffer?)
|
||||
fun bindTexture(target: Int, texture: WebGLTexture?)
|
||||
fun blendColor(red: Float, green: Float, blue: Float, alpha: Float)
|
||||
fun blendEquation(mode: Int)
|
||||
fun blendEquationSeparate(modeRGB: Int, modeAlpha: Int)
|
||||
fun blendFunc(sfactor: Int, dfactor: Int)
|
||||
fun blendFuncSeparate(srcRGB: Int, dstRGB: Int, srcAlpha: Int, dstAlpha: Int)
|
||||
fun bufferData(target: Int, size: Int, usage: Int)
|
||||
fun bufferData(target: Int, data: BufferDataSource?, usage: Int)
|
||||
fun bufferSubData(target: Int, offset: Int, data: BufferDataSource?)
|
||||
fun checkFramebufferStatus(target: Int): Int
|
||||
fun clear(mask: Int): Unit
|
||||
fun clearColor(red: Float, green: Float, blue: Float, alpha: Float): Unit
|
||||
fun clearDepth(depth: Float): Unit
|
||||
fun clearStencil(s: Int): Unit
|
||||
fun colorMask(red: Boolean, green: Boolean, blue: Boolean, alpha: Boolean): Unit
|
||||
fun compileShader(shader: WebGLShader?): Unit
|
||||
fun compressedTexImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, data: ArrayBufferView): Unit
|
||||
fun compressedTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, data: ArrayBufferView): Unit
|
||||
fun copyTexImage2D(target: Int, level: Int, internalformat: Int, x: Int, y: Int, width: Int, height: Int, border: Int): Unit
|
||||
fun copyTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, x: Int, y: Int, width: Int, height: Int): Unit
|
||||
fun clear(mask: Int)
|
||||
fun clearColor(red: Float, green: Float, blue: Float, alpha: Float)
|
||||
fun clearDepth(depth: Float)
|
||||
fun clearStencil(s: Int)
|
||||
fun colorMask(red: Boolean, green: Boolean, blue: Boolean, alpha: Boolean)
|
||||
fun compileShader(shader: WebGLShader?)
|
||||
fun compressedTexImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, data: ArrayBufferView)
|
||||
fun compressedTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, data: ArrayBufferView)
|
||||
fun copyTexImage2D(target: Int, level: Int, internalformat: Int, x: Int, y: Int, width: Int, height: Int, border: Int)
|
||||
fun copyTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, x: Int, y: Int, width: Int, height: Int)
|
||||
fun createBuffer(): WebGLBuffer?
|
||||
fun createFramebuffer(): WebGLFramebuffer?
|
||||
fun createProgram(): WebGLProgram?
|
||||
fun createRenderbuffer(): WebGLRenderbuffer?
|
||||
fun createShader(type: Int): WebGLShader?
|
||||
fun createTexture(): WebGLTexture?
|
||||
fun cullFace(mode: Int): Unit
|
||||
fun deleteBuffer(buffer: WebGLBuffer?): Unit
|
||||
fun deleteFramebuffer(framebuffer: WebGLFramebuffer?): Unit
|
||||
fun deleteProgram(program: WebGLProgram?): Unit
|
||||
fun deleteRenderbuffer(renderbuffer: WebGLRenderbuffer?): Unit
|
||||
fun deleteShader(shader: WebGLShader?): Unit
|
||||
fun deleteTexture(texture: WebGLTexture?): Unit
|
||||
fun depthFunc(func: Int): Unit
|
||||
fun depthMask(flag: Boolean): Unit
|
||||
fun depthRange(zNear: Float, zFar: Float): Unit
|
||||
fun detachShader(program: WebGLProgram?, shader: WebGLShader?): Unit
|
||||
fun disable(cap: Int): Unit
|
||||
fun disableVertexAttribArray(index: Int): Unit
|
||||
fun drawArrays(mode: Int, first: Int, count: Int): Unit
|
||||
fun drawElements(mode: Int, count: Int, type: Int, offset: Int): Unit
|
||||
fun enable(cap: Int): Unit
|
||||
fun enableVertexAttribArray(index: Int): Unit
|
||||
fun finish(): Unit
|
||||
fun flush(): Unit
|
||||
fun framebufferRenderbuffer(target: Int, attachment: Int, renderbuffertarget: Int, renderbuffer: WebGLRenderbuffer?): Unit
|
||||
fun framebufferTexture2D(target: Int, attachment: Int, textarget: Int, texture: WebGLTexture?, level: Int): Unit
|
||||
fun frontFace(mode: Int): Unit
|
||||
fun generateMipmap(target: Int): Unit
|
||||
fun cullFace(mode: Int)
|
||||
fun deleteBuffer(buffer: WebGLBuffer?)
|
||||
fun deleteFramebuffer(framebuffer: WebGLFramebuffer?)
|
||||
fun deleteProgram(program: WebGLProgram?)
|
||||
fun deleteRenderbuffer(renderbuffer: WebGLRenderbuffer?)
|
||||
fun deleteShader(shader: WebGLShader?)
|
||||
fun deleteTexture(texture: WebGLTexture?)
|
||||
fun depthFunc(func: Int)
|
||||
fun depthMask(flag: Boolean)
|
||||
fun depthRange(zNear: Float, zFar: Float)
|
||||
fun detachShader(program: WebGLProgram?, shader: WebGLShader?)
|
||||
fun disable(cap: Int)
|
||||
fun disableVertexAttribArray(index: Int)
|
||||
fun drawArrays(mode: Int, first: Int, count: Int)
|
||||
fun drawElements(mode: Int, count: Int, type: Int, offset: Int)
|
||||
fun enable(cap: Int)
|
||||
fun enableVertexAttribArray(index: Int)
|
||||
fun finish()
|
||||
fun flush()
|
||||
fun framebufferRenderbuffer(target: Int, attachment: Int, renderbuffertarget: Int, renderbuffer: WebGLRenderbuffer?)
|
||||
fun framebufferTexture2D(target: Int, attachment: Int, textarget: Int, texture: WebGLTexture?, level: Int)
|
||||
fun frontFace(mode: Int)
|
||||
fun generateMipmap(target: Int)
|
||||
fun getActiveAttrib(program: WebGLProgram?, index: Int): WebGLActiveInfo?
|
||||
fun getActiveUniform(program: WebGLProgram?, index: Int): WebGLActiveInfo?
|
||||
fun getAttachedShaders(program: WebGLProgram?): Array<WebGLShader>?
|
||||
@@ -216,7 +206,7 @@ public external interface WebGLRenderingContextBase {
|
||||
fun getUniformLocation(program: WebGLProgram?, name: String): WebGLUniformLocation?
|
||||
fun getVertexAttrib(index: Int, pname: Int): Any?
|
||||
fun getVertexAttribOffset(index: Int, pname: Int): Int
|
||||
fun hint(target: Int, mode: Int): Unit
|
||||
fun hint(target: Int, mode: Int)
|
||||
fun isBuffer(buffer: WebGLBuffer?): Boolean
|
||||
fun isEnabled(cap: Int): Boolean
|
||||
fun isFramebuffer(framebuffer: WebGLFramebuffer?): Boolean
|
||||
@@ -224,69 +214,69 @@ public external interface WebGLRenderingContextBase {
|
||||
fun isRenderbuffer(renderbuffer: WebGLRenderbuffer?): Boolean
|
||||
fun isShader(shader: WebGLShader?): Boolean
|
||||
fun isTexture(texture: WebGLTexture?): Boolean
|
||||
fun lineWidth(width: Float): Unit
|
||||
fun linkProgram(program: WebGLProgram?): Unit
|
||||
fun pixelStorei(pname: Int, param: Int): Unit
|
||||
fun polygonOffset(factor: Float, units: Float): Unit
|
||||
fun readPixels(x: Int, y: Int, width: Int, height: Int, format: Int, type: Int, pixels: ArrayBufferView?): Unit
|
||||
fun renderbufferStorage(target: Int, internalformat: Int, width: Int, height: Int): Unit
|
||||
fun sampleCoverage(value: Float, invert: Boolean): Unit
|
||||
fun scissor(x: Int, y: Int, width: Int, height: Int): Unit
|
||||
fun shaderSource(shader: WebGLShader?, source: String): Unit
|
||||
fun stencilFunc(func: Int, ref: Int, mask: Int): Unit
|
||||
fun stencilFuncSeparate(face: Int, func: Int, ref: Int, mask: Int): Unit
|
||||
fun stencilMask(mask: Int): Unit
|
||||
fun stencilMaskSeparate(face: Int, mask: Int): Unit
|
||||
fun stencilOp(fail: Int, zfail: Int, zpass: Int): Unit
|
||||
fun stencilOpSeparate(face: Int, fail: Int, zfail: Int, zpass: Int): Unit
|
||||
fun texImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, format: Int, type: Int, pixels: ArrayBufferView?): Unit
|
||||
fun texImage2D(target: Int, level: Int, internalformat: Int, format: Int, type: Int, source: TexImageSource?): Unit
|
||||
fun texParameterf(target: Int, pname: Int, param: Float): Unit
|
||||
fun texParameteri(target: Int, pname: Int, param: Int): Unit
|
||||
fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, type: Int, pixels: ArrayBufferView?): Unit
|
||||
fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, format: Int, type: Int, source: TexImageSource?): Unit
|
||||
fun uniform1f(location: WebGLUniformLocation?, x: Float): Unit
|
||||
fun uniform1fv(location: WebGLUniformLocation?, v: Float32Array): Unit
|
||||
fun uniform1fv(location: WebGLUniformLocation?, v: Array<Float>): Unit
|
||||
fun uniform1i(location: WebGLUniformLocation?, x: Int): Unit
|
||||
fun uniform1iv(location: WebGLUniformLocation?, v: Int32Array): Unit
|
||||
fun uniform1iv(location: WebGLUniformLocation?, v: Array<Int>): Unit
|
||||
fun uniform2f(location: WebGLUniformLocation?, x: Float, y: Float): Unit
|
||||
fun uniform2fv(location: WebGLUniformLocation?, v: Float32Array): Unit
|
||||
fun uniform2fv(location: WebGLUniformLocation?, v: Array<Float>): Unit
|
||||
fun uniform2i(location: WebGLUniformLocation?, x: Int, y: Int): Unit
|
||||
fun uniform2iv(location: WebGLUniformLocation?, v: Int32Array): Unit
|
||||
fun uniform2iv(location: WebGLUniformLocation?, v: Array<Int>): Unit
|
||||
fun uniform3f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float): Unit
|
||||
fun uniform3fv(location: WebGLUniformLocation?, v: Float32Array): Unit
|
||||
fun uniform3fv(location: WebGLUniformLocation?, v: Array<Float>): Unit
|
||||
fun uniform3i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int): Unit
|
||||
fun uniform3iv(location: WebGLUniformLocation?, v: Int32Array): Unit
|
||||
fun uniform3iv(location: WebGLUniformLocation?, v: Array<Int>): Unit
|
||||
fun uniform4f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float, w: Float): Unit
|
||||
fun uniform4fv(location: WebGLUniformLocation?, v: Float32Array): Unit
|
||||
fun uniform4fv(location: WebGLUniformLocation?, v: Array<Float>): Unit
|
||||
fun uniform4i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int, w: Int): Unit
|
||||
fun uniform4iv(location: WebGLUniformLocation?, v: Int32Array): Unit
|
||||
fun uniform4iv(location: WebGLUniformLocation?, v: Array<Int>): Unit
|
||||
fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array): Unit
|
||||
fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array<Float>): Unit
|
||||
fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array): Unit
|
||||
fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array<Float>): Unit
|
||||
fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array): Unit
|
||||
fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array<Float>): Unit
|
||||
fun useProgram(program: WebGLProgram?): Unit
|
||||
fun validateProgram(program: WebGLProgram?): Unit
|
||||
fun vertexAttrib1f(index: Int, x: Float): Unit
|
||||
fun vertexAttrib1fv(index: Int, values: dynamic): Unit
|
||||
fun vertexAttrib2f(index: Int, x: Float, y: Float): Unit
|
||||
fun vertexAttrib2fv(index: Int, values: dynamic): Unit
|
||||
fun vertexAttrib3f(index: Int, x: Float, y: Float, z: Float): Unit
|
||||
fun vertexAttrib3fv(index: Int, values: dynamic): Unit
|
||||
fun vertexAttrib4f(index: Int, x: Float, y: Float, z: Float, w: Float): Unit
|
||||
fun vertexAttrib4fv(index: Int, values: dynamic): Unit
|
||||
fun vertexAttribPointer(index: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int): Unit
|
||||
fun viewport(x: Int, y: Int, width: Int, height: Int): Unit
|
||||
fun lineWidth(width: Float)
|
||||
fun linkProgram(program: WebGLProgram?)
|
||||
fun pixelStorei(pname: Int, param: Int)
|
||||
fun polygonOffset(factor: Float, units: Float)
|
||||
fun readPixels(x: Int, y: Int, width: Int, height: Int, format: Int, type: Int, pixels: ArrayBufferView?)
|
||||
fun renderbufferStorage(target: Int, internalformat: Int, width: Int, height: Int)
|
||||
fun sampleCoverage(value: Float, invert: Boolean)
|
||||
fun scissor(x: Int, y: Int, width: Int, height: Int)
|
||||
fun shaderSource(shader: WebGLShader?, source: String)
|
||||
fun stencilFunc(func: Int, ref: Int, mask: Int)
|
||||
fun stencilFuncSeparate(face: Int, func: Int, ref: Int, mask: Int)
|
||||
fun stencilMask(mask: Int)
|
||||
fun stencilMaskSeparate(face: Int, mask: Int)
|
||||
fun stencilOp(fail: Int, zfail: Int, zpass: Int)
|
||||
fun stencilOpSeparate(face: Int, fail: Int, zfail: Int, zpass: Int)
|
||||
fun texImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, format: Int, type: Int, pixels: ArrayBufferView?)
|
||||
fun texImage2D(target: Int, level: Int, internalformat: Int, format: Int, type: Int, source: TexImageSource?)
|
||||
fun texParameterf(target: Int, pname: Int, param: Float)
|
||||
fun texParameteri(target: Int, pname: Int, param: Int)
|
||||
fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, type: Int, pixels: ArrayBufferView?)
|
||||
fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, format: Int, type: Int, source: TexImageSource?)
|
||||
fun uniform1f(location: WebGLUniformLocation?, x: Float)
|
||||
fun uniform1fv(location: WebGLUniformLocation?, v: Float32Array)
|
||||
fun uniform1fv(location: WebGLUniformLocation?, v: Array<Float>)
|
||||
fun uniform1i(location: WebGLUniformLocation?, x: Int)
|
||||
fun uniform1iv(location: WebGLUniformLocation?, v: Int32Array)
|
||||
fun uniform1iv(location: WebGLUniformLocation?, v: Array<Int>)
|
||||
fun uniform2f(location: WebGLUniformLocation?, x: Float, y: Float)
|
||||
fun uniform2fv(location: WebGLUniformLocation?, v: Float32Array)
|
||||
fun uniform2fv(location: WebGLUniformLocation?, v: Array<Float>)
|
||||
fun uniform2i(location: WebGLUniformLocation?, x: Int, y: Int)
|
||||
fun uniform2iv(location: WebGLUniformLocation?, v: Int32Array)
|
||||
fun uniform2iv(location: WebGLUniformLocation?, v: Array<Int>)
|
||||
fun uniform3f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float)
|
||||
fun uniform3fv(location: WebGLUniformLocation?, v: Float32Array)
|
||||
fun uniform3fv(location: WebGLUniformLocation?, v: Array<Float>)
|
||||
fun uniform3i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int)
|
||||
fun uniform3iv(location: WebGLUniformLocation?, v: Int32Array)
|
||||
fun uniform3iv(location: WebGLUniformLocation?, v: Array<Int>)
|
||||
fun uniform4f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float, w: Float)
|
||||
fun uniform4fv(location: WebGLUniformLocation?, v: Float32Array)
|
||||
fun uniform4fv(location: WebGLUniformLocation?, v: Array<Float>)
|
||||
fun uniform4i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int, w: Int)
|
||||
fun uniform4iv(location: WebGLUniformLocation?, v: Int32Array)
|
||||
fun uniform4iv(location: WebGLUniformLocation?, v: Array<Int>)
|
||||
fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array)
|
||||
fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array<Float>)
|
||||
fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array)
|
||||
fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array<Float>)
|
||||
fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array)
|
||||
fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array<Float>)
|
||||
fun useProgram(program: WebGLProgram?)
|
||||
fun validateProgram(program: WebGLProgram?)
|
||||
fun vertexAttrib1f(index: Int, x: Float)
|
||||
fun vertexAttrib1fv(index: Int, values: dynamic)
|
||||
fun vertexAttrib2f(index: Int, x: Float, y: Float)
|
||||
fun vertexAttrib2fv(index: Int, values: dynamic)
|
||||
fun vertexAttrib3f(index: Int, x: Float, y: Float, z: Float)
|
||||
fun vertexAttrib3fv(index: Int, values: dynamic)
|
||||
fun vertexAttrib4f(index: Int, x: Float, y: Float, z: Float, w: Float)
|
||||
fun vertexAttrib4fv(index: Int, values: dynamic)
|
||||
fun vertexAttribPointer(index: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int)
|
||||
fun viewport(x: Int, y: Int, width: Int, height: Int)
|
||||
|
||||
companion object {
|
||||
val DEPTH_BUFFER_BIT: Int
|
||||
@@ -593,7 +583,6 @@ public external interface WebGLRenderingContextBase {
|
||||
* Exposes the JavaScript [WebGLRenderingContext](https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext) to Kotlin
|
||||
*/
|
||||
public external abstract class WebGLRenderingContext : WebGLRenderingContextBase, RenderingContext {
|
||||
|
||||
companion object {
|
||||
val DEPTH_BUFFER_BIT: Int
|
||||
val STENCIL_BUFFER_BIT: Int
|
||||
@@ -900,6 +889,13 @@ public external abstract class WebGLRenderingContext : WebGLRenderingContextBase
|
||||
*/
|
||||
public external open class WebGLContextEvent(type: String, eventInit: WebGLContextEventInit = definedExternally) : Event {
|
||||
open val statusMessage: String
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface WebGLContextEventInit : EventInit {
|
||||
@@ -911,12 +907,10 @@ public external interface WebGLContextEventInit : EventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun WebGLContextEventInit(statusMessage: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WebGLContextEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["statusMessage"] = statusMessage
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -953,16 +947,20 @@ public external open class Int8Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Int8Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Byte>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Int8Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Byte>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Int8Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Int8Array.get(index: Int): Byte = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Int8Array.set(index: Int, value: Byte): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Int8Array.get(index: Int): Byte = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Int8Array.set(index: Int, value: Byte) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Uint8Array](https://developer.mozilla.org/en/docs/Web/API/Uint8Array) to Kotlin
|
||||
@@ -976,16 +974,20 @@ public external open class Uint8Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Uint8Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Byte>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Uint8Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Byte>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Uint8Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint8Array.get(index: Int): Byte = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint8Array.set(index: Int, value: Byte): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint8Array.get(index: Int): Byte = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint8Array.set(index: Int, value: Byte) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Uint8ClampedArray](https://developer.mozilla.org/en/docs/Web/API/Uint8ClampedArray) to Kotlin
|
||||
@@ -999,16 +1001,20 @@ public external open class Uint8ClampedArray : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Uint8ClampedArray, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Byte>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Uint8ClampedArray, offset: Int = definedExternally)
|
||||
fun set(array: Array<Byte>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Uint8ClampedArray
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint8ClampedArray.get(index: Int): Byte = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint8ClampedArray.set(index: Int, value: Byte): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint8ClampedArray.get(index: Int): Byte = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint8ClampedArray.set(index: Int, value: Byte) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Int16Array](https://developer.mozilla.org/en/docs/Web/API/Int16Array) to Kotlin
|
||||
@@ -1022,16 +1028,20 @@ public external open class Int16Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Int16Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Short>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Int16Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Short>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Int16Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Int16Array.get(index: Int): Short = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Int16Array.set(index: Int, value: Short): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Int16Array.get(index: Int): Short = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Int16Array.set(index: Int, value: Short) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Uint16Array](https://developer.mozilla.org/en/docs/Web/API/Uint16Array) to Kotlin
|
||||
@@ -1045,16 +1055,20 @@ public external open class Uint16Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Uint16Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Short>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Uint16Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Short>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Uint16Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint16Array.get(index: Int): Short = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint16Array.set(index: Int, value: Short): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint16Array.get(index: Int): Short = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint16Array.set(index: Int, value: Short) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Int32Array](https://developer.mozilla.org/en/docs/Web/API/Int32Array) to Kotlin
|
||||
@@ -1068,16 +1082,20 @@ public external open class Int32Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Int32Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Int>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Int32Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Int>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Int32Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Int32Array.get(index: Int): Int = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Int32Array.set(index: Int, value: Int): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Int32Array.get(index: Int): Int = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Int32Array.set(index: Int, value: Int) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Uint32Array](https://developer.mozilla.org/en/docs/Web/API/Uint32Array) to Kotlin
|
||||
@@ -1091,16 +1109,20 @@ public external open class Uint32Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Uint32Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Int>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Uint32Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Int>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Uint32Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint32Array.get(index: Int): Int = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Uint32Array.set(index: Int, value: Int): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint32Array.get(index: Int): Int = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Uint32Array.set(index: Int, value: Int) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Float32Array](https://developer.mozilla.org/en/docs/Web/API/Float32Array) to Kotlin
|
||||
@@ -1114,16 +1136,20 @@ public external open class Float32Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Float32Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Float>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Float32Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Float>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Float32Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Float32Array.get(index: Int): Float = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Float32Array.set(index: Int, value: Float): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Float32Array.get(index: Int): Float = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Float32Array.set(index: Int, value: Float) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Float64Array](https://developer.mozilla.org/en/docs/Web/API/Float64Array) to Kotlin
|
||||
@@ -1137,16 +1163,20 @@ public external open class Float64Array : ArrayBufferView {
|
||||
override val buffer: ArrayBuffer
|
||||
override val byteOffset: Int
|
||||
override val byteLength: Int
|
||||
fun set(array: Float64Array, offset: Int = definedExternally): Unit
|
||||
fun set(array: Array<Double>, offset: Int = definedExternally): Unit
|
||||
fun set(array: Float64Array, offset: Int = definedExternally)
|
||||
fun set(array: Array<Double>, offset: Int = definedExternally)
|
||||
fun subarray(start: Int, end: Int): Float64Array
|
||||
|
||||
companion object {
|
||||
val BYTES_PER_ELEMENT: Int
|
||||
}
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun Float64Array.get(index: Int): Double = asDynamic()[index]
|
||||
@kotlin.internal.InlineOnly inline operator fun Float64Array.set(index: Int, value: Double): Unit { asDynamic()[index] = value; }
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Float64Array.get(index: Int): Double = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun Float64Array.set(index: Int, value: Double) { asDynamic()[index] = value }
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [DataView](https://developer.mozilla.org/en/docs/Web/API/DataView) to Kotlin
|
||||
@@ -1163,19 +1193,16 @@ public external open class DataView(buffer: ArrayBuffer, byteOffset: Int = defin
|
||||
fun getUint32(byteOffset: Int, littleEndian: Boolean = definedExternally): Int
|
||||
fun getFloat32(byteOffset: Int, littleEndian: Boolean = definedExternally): Float
|
||||
fun getFloat64(byteOffset: Int, littleEndian: Boolean = definedExternally): Double
|
||||
fun setInt8(byteOffset: Int, value: Byte): Unit
|
||||
fun setUint8(byteOffset: Int, value: Byte): Unit
|
||||
fun setInt16(byteOffset: Int, value: Short, littleEndian: Boolean = definedExternally): Unit
|
||||
fun setUint16(byteOffset: Int, value: Short, littleEndian: Boolean = definedExternally): Unit
|
||||
fun setInt32(byteOffset: Int, value: Int, littleEndian: Boolean = definedExternally): Unit
|
||||
fun setUint32(byteOffset: Int, value: Int, littleEndian: Boolean = definedExternally): Unit
|
||||
fun setFloat32(byteOffset: Int, value: Float, littleEndian: Boolean = definedExternally): Unit
|
||||
fun setFloat64(byteOffset: Int, value: Double, littleEndian: Boolean = definedExternally): Unit
|
||||
fun setInt8(byteOffset: Int, value: Byte)
|
||||
fun setUint8(byteOffset: Int, value: Byte)
|
||||
fun setInt16(byteOffset: Int, value: Short, littleEndian: Boolean = definedExternally)
|
||||
fun setUint16(byteOffset: Int, value: Short, littleEndian: Boolean = definedExternally)
|
||||
fun setInt32(byteOffset: Int, value: Int, littleEndian: Boolean = definedExternally)
|
||||
fun setUint32(byteOffset: Int, value: Int, littleEndian: Boolean = definedExternally)
|
||||
fun setFloat32(byteOffset: Int, value: Float, littleEndian: Boolean = definedExternally)
|
||||
fun setFloat64(byteOffset: Int, value: Double, littleEndian: Boolean = definedExternally)
|
||||
}
|
||||
|
||||
public external @marker interface BufferDataSource {
|
||||
}
|
||||
|
||||
public external @marker interface TexImageSource {
|
||||
}
|
||||
public external interface BufferDataSource
|
||||
|
||||
public external interface TexImageSource
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.css.masking
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -38,6 +37,24 @@ public external abstract class SVGClipPathElement : SVGElement, SVGUnitTypes {
|
||||
val SVG_UNIT_TYPE_UNKNOWN: Short
|
||||
val SVG_UNIT_TYPE_USERSPACEONUSE: Short
|
||||
val SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: Short
|
||||
val ELEMENT_NODE: Short
|
||||
val ATTRIBUTE_NODE: Short
|
||||
val TEXT_NODE: Short
|
||||
val CDATA_SECTION_NODE: Short
|
||||
val ENTITY_REFERENCE_NODE: Short
|
||||
val ENTITY_NODE: Short
|
||||
val PROCESSING_INSTRUCTION_NODE: Short
|
||||
val COMMENT_NODE: Short
|
||||
val DOCUMENT_NODE: Short
|
||||
val DOCUMENT_TYPE_NODE: Short
|
||||
val DOCUMENT_FRAGMENT_NODE: Short
|
||||
val NOTATION_NODE: Short
|
||||
val DOCUMENT_POSITION_DISCONNECTED: Short
|
||||
val DOCUMENT_POSITION_PRECEDING: Short
|
||||
val DOCUMENT_POSITION_FOLLOWING: Short
|
||||
val DOCUMENT_POSITION_CONTAINS: Short
|
||||
val DOCUMENT_POSITION_CONTAINED_BY: Short
|
||||
val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: Short
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +73,23 @@ public external abstract class SVGMaskElement : SVGElement, SVGUnitTypes {
|
||||
val SVG_UNIT_TYPE_UNKNOWN: Short
|
||||
val SVG_UNIT_TYPE_USERSPACEONUSE: Short
|
||||
val SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: Short
|
||||
val ELEMENT_NODE: Short
|
||||
val ATTRIBUTE_NODE: Short
|
||||
val TEXT_NODE: Short
|
||||
val CDATA_SECTION_NODE: Short
|
||||
val ENTITY_REFERENCE_NODE: Short
|
||||
val ENTITY_NODE: Short
|
||||
val PROCESSING_INSTRUCTION_NODE: Short
|
||||
val COMMENT_NODE: Short
|
||||
val DOCUMENT_NODE: Short
|
||||
val DOCUMENT_TYPE_NODE: Short
|
||||
val DOCUMENT_FRAGMENT_NODE: Short
|
||||
val NOTATION_NODE: Short
|
||||
val DOCUMENT_POSITION_DISCONNECTED: Short
|
||||
val DOCUMENT_POSITION_PRECEDING: Short
|
||||
val DOCUMENT_POSITION_FOLLOWING: Short
|
||||
val DOCUMENT_POSITION_CONTAINS: Short
|
||||
val DOCUMENT_POSITION_CONTAINED_BY: Short
|
||||
val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: Short
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.clipboard
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -36,12 +35,10 @@ public external interface ClipboardEventInit : EventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ClipboardEventInit(clipboardData: DataTransfer? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ClipboardEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["clipboardData"] = clipboardData
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -50,6 +47,13 @@ public inline fun ClipboardEventInit(clipboardData: DataTransfer? = null, bubble
|
||||
*/
|
||||
public external open class ClipboardEvent(type: String, eventInitDict: ClipboardEventInit = definedExternally) : Event {
|
||||
open val clipboardData: DataTransfer?
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,9 +75,6 @@ public external interface ClipboardPermissionDescriptor {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ClipboardPermissionDescriptor(allowWithoutGesture: Boolean? = false): ClipboardPermissionDescriptor {
|
||||
val o = js("({})")
|
||||
|
||||
o["allowWithoutGesture"] = allowWithoutGesture
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.css
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -27,17 +26,223 @@ import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
public external abstract class MediaList : ItemArrayLike<String> {
|
||||
open var mediaText: String
|
||||
fun appendMedium(medium: String)
|
||||
fun deleteMedium(medium: String)
|
||||
override fun item(index: Int): String?
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun MediaList.get(index: Int): String? = asDynamic()[index]
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [StyleSheet](https://developer.mozilla.org/en/docs/Web/API/StyleSheet) to Kotlin
|
||||
*/
|
||||
public external abstract class StyleSheet {
|
||||
open val type: String
|
||||
open val href: String?
|
||||
open val ownerNode: UnionElementOrProcessingInstruction?
|
||||
open val parentStyleSheet: StyleSheet?
|
||||
open val title: String?
|
||||
open val media: MediaList
|
||||
open var disabled: Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSStyleSheet](https://developer.mozilla.org/en/docs/Web/API/CSSStyleSheet) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSStyleSheet : StyleSheet {
|
||||
open val ownerRule: CSSRule?
|
||||
open val cssRules: CSSRuleList
|
||||
fun insertRule(rule: String, index: Int): Int
|
||||
fun deleteRule(index: Int)
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [StyleSheetList](https://developer.mozilla.org/en/docs/Web/API/StyleSheetList) to Kotlin
|
||||
*/
|
||||
public external abstract class StyleSheetList : ItemArrayLike<StyleSheet> {
|
||||
override fun item(index: Int): StyleSheet?
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun StyleSheetList.get(index: Int): StyleSheet? = asDynamic()[index]
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [LinkStyle](https://developer.mozilla.org/en/docs/Web/API/LinkStyle) to Kotlin
|
||||
*/
|
||||
public external interface LinkStyle {
|
||||
val sheet: StyleSheet?
|
||||
get() = definedExternally
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSRuleList](https://developer.mozilla.org/en/docs/Web/API/CSSRuleList) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSRuleList : ItemArrayLike<CSSRule> {
|
||||
override fun item(index: Int): CSSRule?
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun CSSRuleList.get(index: Int): CSSRule? = asDynamic()[index]
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSRule](https://developer.mozilla.org/en/docs/Web/API/CSSRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSRule {
|
||||
open val type: Short
|
||||
open var cssText: String
|
||||
open val parentRule: CSSRule?
|
||||
open val parentStyleSheet: CSSStyleSheet?
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSStyleRule](https://developer.mozilla.org/en/docs/Web/API/CSSStyleRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSStyleRule : CSSRule {
|
||||
open var selectorText: String
|
||||
open val style: CSSStyleDeclaration
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external abstract class CSSImportRule : CSSRule {
|
||||
open val href: String
|
||||
open val media: MediaList
|
||||
open val styleSheet: CSSStyleSheet
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSGroupingRule](https://developer.mozilla.org/en/docs/Web/API/CSSGroupingRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSGroupingRule : CSSRule {
|
||||
open val cssRules: CSSRuleList
|
||||
fun insertRule(rule: String, index: Int): Int
|
||||
fun deleteRule(index: Int)
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSMediaRule](https://developer.mozilla.org/en/docs/Web/API/CSSMediaRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSMediaRule : CSSGroupingRule {
|
||||
open val media: MediaList
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSPageRule](https://developer.mozilla.org/en/docs/Web/API/CSSPageRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSPageRule : CSSGroupingRule {
|
||||
open var selectorText: String
|
||||
open val style: CSSStyleDeclaration
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external abstract class CSSMarginRule : CSSRule {
|
||||
open val name: String
|
||||
open val style: CSSStyleDeclaration
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSNamespaceRule](https://developer.mozilla.org/en/docs/Web/API/CSSNamespaceRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSNamespaceRule : CSSRule {
|
||||
open val namespaceURI: String
|
||||
open val prefix: String
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSStyleDeclaration](https://developer.mozilla.org/en/docs/Web/API/CSSStyleDeclaration) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSStyleDeclaration : ItemArrayLike<String> {
|
||||
open var cssText: String
|
||||
override val length: Int
|
||||
open val parentRule: CSSRule?
|
||||
open var cssFloat: String
|
||||
open var _dashed_attribute: String
|
||||
open var _camel_cased_attribute: String
|
||||
open var _webkit_cased_attribute: String
|
||||
open var alignContent: String
|
||||
open var alignItems: String
|
||||
open var alignSelf: String
|
||||
@@ -261,144 +466,20 @@ public external abstract class CSSStyleDeclaration : ItemArrayLike<String> {
|
||||
open var wordWrap: String
|
||||
open var writingMode: String
|
||||
open var zIndex: String
|
||||
override fun item(index: Int): String
|
||||
open var _dashed_attribute: String
|
||||
open var _camel_cased_attribute: String
|
||||
open var _webkit_cased_attribute: String
|
||||
fun getPropertyValue(property: String): String
|
||||
fun getPropertyPriority(property: String): String
|
||||
fun setProperty(property: String, value: String, priority: String = definedExternally): Unit
|
||||
fun setPropertyValue(property: String, value: String): Unit
|
||||
fun setPropertyPriority(property: String, priority: String): Unit
|
||||
fun setProperty(property: String, value: String, priority: String = definedExternally)
|
||||
fun setPropertyValue(property: String, value: String)
|
||||
fun setPropertyPriority(property: String, priority: String)
|
||||
fun removeProperty(property: String): String
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun CSSStyleDeclaration.get(index: Int): String? = asDynamic()[index]
|
||||
|
||||
public external abstract class MediaList : ItemArrayLike<String> {
|
||||
open var mediaText: String
|
||||
override val length: Int
|
||||
override fun item(index: Int): String?
|
||||
fun appendMedium(medium: String): Unit
|
||||
fun deleteMedium(medium: String): Unit
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun MediaList.get(index: Int): String? = asDynamic()[index]
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [StyleSheet](https://developer.mozilla.org/en/docs/Web/API/StyleSheet) to Kotlin
|
||||
*/
|
||||
public external abstract class StyleSheet {
|
||||
open val type: String
|
||||
open val href: String?
|
||||
open val ownerNode: UnionElementOrProcessingInstruction?
|
||||
open val parentStyleSheet: StyleSheet?
|
||||
open val title: String?
|
||||
open val media: MediaList
|
||||
open var disabled: Boolean
|
||||
override fun item(index: Int): String
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSStyleSheet](https://developer.mozilla.org/en/docs/Web/API/CSSStyleSheet) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSStyleSheet : StyleSheet {
|
||||
open val ownerRule: CSSRule?
|
||||
open val cssRules: CSSRuleList
|
||||
fun insertRule(rule: String, index: Int): Int
|
||||
fun deleteRule(index: Int): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [StyleSheetList](https://developer.mozilla.org/en/docs/Web/API/StyleSheetList) to Kotlin
|
||||
*/
|
||||
public external abstract class StyleSheetList : ItemArrayLike<StyleSheet> {
|
||||
override val length: Int
|
||||
override fun item(index: Int): StyleSheet?
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun StyleSheetList.get(index: Int): StyleSheet? = asDynamic()[index]
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [LinkStyle](https://developer.mozilla.org/en/docs/Web/API/LinkStyle) to Kotlin
|
||||
*/
|
||||
public external interface LinkStyle {
|
||||
val sheet: StyleSheet?
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSRuleList](https://developer.mozilla.org/en/docs/Web/API/CSSRuleList) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSRuleList : ItemArrayLike<CSSRule> {
|
||||
override val length: Int
|
||||
override fun item(index: Int): CSSRule?
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun CSSRuleList.get(index: Int): CSSRule? = asDynamic()[index]
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSRule](https://developer.mozilla.org/en/docs/Web/API/CSSRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSRule {
|
||||
open val type: Short
|
||||
open var cssText: String
|
||||
open val parentRule: CSSRule?
|
||||
open val parentStyleSheet: CSSStyleSheet?
|
||||
|
||||
companion object {
|
||||
val STYLE_RULE: Short
|
||||
val CHARSET_RULE: Short
|
||||
val IMPORT_RULE: Short
|
||||
val MEDIA_RULE: Short
|
||||
val FONT_FACE_RULE: Short
|
||||
val PAGE_RULE: Short
|
||||
val MARGIN_RULE: Short
|
||||
val NAMESPACE_RULE: Short
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSStyleRule](https://developer.mozilla.org/en/docs/Web/API/CSSStyleRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSStyleRule : CSSRule {
|
||||
open var selectorText: String
|
||||
open val style: CSSStyleDeclaration
|
||||
}
|
||||
|
||||
public external abstract class CSSImportRule : CSSRule {
|
||||
open val href: String
|
||||
open val media: MediaList
|
||||
open val styleSheet: CSSStyleSheet
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSGroupingRule](https://developer.mozilla.org/en/docs/Web/API/CSSGroupingRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSGroupingRule : CSSRule {
|
||||
open val cssRules: CSSRuleList
|
||||
fun insertRule(rule: String, index: Int): Int
|
||||
fun deleteRule(index: Int): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSMediaRule](https://developer.mozilla.org/en/docs/Web/API/CSSMediaRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSMediaRule : CSSGroupingRule {
|
||||
open val media: MediaList
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSPageRule](https://developer.mozilla.org/en/docs/Web/API/CSSPageRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSPageRule : CSSGroupingRule {
|
||||
open var selectorText: String
|
||||
open val style: CSSStyleDeclaration
|
||||
}
|
||||
|
||||
public external abstract class CSSMarginRule : CSSRule {
|
||||
open val name: String
|
||||
open val style: CSSStyleDeclaration
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [CSSNamespaceRule](https://developer.mozilla.org/en/docs/Web/API/CSSNamespaceRule) to Kotlin
|
||||
*/
|
||||
public external abstract class CSSNamespaceRule : CSSRule {
|
||||
open val namespaceURI: String
|
||||
open val prefix: String
|
||||
}
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun CSSStyleDeclaration.get(index: Int): String? = asDynamic()[index]
|
||||
|
||||
public external interface ElementCSSInlineStyle {
|
||||
val style: CSSStyleDeclaration
|
||||
@@ -408,9 +489,9 @@ public external interface ElementCSSInlineStyle {
|
||||
* Exposes the JavaScript [CSS](https://developer.mozilla.org/en/docs/Web/API/CSS) to Kotlin
|
||||
*/
|
||||
public external abstract class CSS {
|
||||
|
||||
companion object {
|
||||
fun escape(ident: String): String
|
||||
}
|
||||
}
|
||||
|
||||
public external interface UnionElementOrProcessingInstruction
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.events
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -33,6 +32,13 @@ import org.w3c.xhr.*
|
||||
public external open class UIEvent(type: String, eventInitDict: UIEventInit = definedExternally) : Event {
|
||||
open val view: Window?
|
||||
open val detail: Int
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface UIEventInit : EventInit {
|
||||
@@ -47,13 +53,11 @@ public external interface UIEventInit : EventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UIEventInit(view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): UIEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["view"] = view
|
||||
o["detail"] = detail
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -62,6 +66,13 @@ public inline fun UIEventInit(view: Window? = null, detail: Int? = 0, bubbles: B
|
||||
*/
|
||||
public external open class FocusEvent(type: String, eventInitDict: FocusEventInit = definedExternally) : UIEvent {
|
||||
open val relatedTarget: EventTarget?
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface FocusEventInit : UIEventInit {
|
||||
@@ -73,14 +84,12 @@ public external interface FocusEventInit : UIEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun FocusEventInit(relatedTarget: EventTarget? = null, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FocusEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["relatedTarget"] = relatedTarget
|
||||
o["view"] = view
|
||||
o["detail"] = detail
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -88,15 +97,10 @@ public inline fun FocusEventInit(relatedTarget: EventTarget? = null, view: Windo
|
||||
* Exposes the JavaScript [MouseEvent](https://developer.mozilla.org/en/docs/Web/API/MouseEvent) to Kotlin
|
||||
*/
|
||||
public external open class MouseEvent(type: String, eventInitDict: MouseEventInit = definedExternally) : UIEvent, UnionElementOrMouseEvent {
|
||||
open val region: String?
|
||||
open val screenX: Int
|
||||
open val screenY: Int
|
||||
open val pageX: Double
|
||||
open val pageY: Double
|
||||
open val clientX: Int
|
||||
open val clientY: Int
|
||||
open val offsetX: Double
|
||||
open val offsetY: Double
|
||||
open val ctrlKey: Boolean
|
||||
open val shiftKey: Boolean
|
||||
open val altKey: Boolean
|
||||
@@ -104,7 +108,21 @@ public external open class MouseEvent(type: String, eventInitDict: MouseEventIni
|
||||
open val button: Short
|
||||
open val buttons: Short
|
||||
open val relatedTarget: EventTarget?
|
||||
open val region: String?
|
||||
open val pageX: Double
|
||||
open val pageY: Double
|
||||
open val x: Double
|
||||
open val y: Double
|
||||
open val offsetX: Double
|
||||
open val offsetY: Double
|
||||
fun getModifierState(keyArg: String): Boolean
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface MouseEventInit : EventModifierInit {
|
||||
@@ -129,12 +147,14 @@ public external interface MouseEventInit : EventModifierInit {
|
||||
var relatedTarget: EventTarget? /* = null */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var region: String? /* = null */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MouseEventInit(screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MouseEventInit {
|
||||
public inline fun MouseEventInit(screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MouseEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["screenX"] = screenX
|
||||
o["screenY"] = screenY
|
||||
o["clientX"] = clientX
|
||||
@@ -142,6 +162,7 @@ public inline fun MouseEventInit(screenX: Int? = 0, screenY: Int? = 0, clientX:
|
||||
o["button"] = button
|
||||
o["buttons"] = buttons
|
||||
o["relatedTarget"] = relatedTarget
|
||||
o["region"] = region
|
||||
o["ctrlKey"] = ctrlKey
|
||||
o["shiftKey"] = shiftKey
|
||||
o["altKey"] = altKey
|
||||
@@ -161,7 +182,6 @@ public inline fun MouseEventInit(screenX: Int? = 0, screenY: Int? = 0, clientX:
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -213,7 +233,6 @@ public external interface EventModifierInit : UIEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun EventModifierInit(ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): EventModifierInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["ctrlKey"] = ctrlKey
|
||||
o["shiftKey"] = shiftKey
|
||||
o["altKey"] = altKey
|
||||
@@ -233,7 +252,6 @@ public inline fun EventModifierInit(ctrlKey: Boolean? = false, shiftKey: Boolean
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -250,6 +268,10 @@ public external open class WheelEvent(type: String, eventInitDict: WheelEventIni
|
||||
val DOM_DELTA_PIXEL: Int
|
||||
val DOM_DELTA_LINE: Int
|
||||
val DOM_DELTA_PAGE: Int
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,9 +291,8 @@ public external interface WheelEventInit : MouseEventInit {
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, deltaZ: Double? = 0.0, deltaMode: Int? = 0, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WheelEventInit {
|
||||
public inline fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, deltaZ: Double? = 0.0, deltaMode: Int? = 0, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WheelEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["deltaX"] = deltaX
|
||||
o["deltaY"] = deltaY
|
||||
o["deltaZ"] = deltaZ
|
||||
@@ -283,6 +304,7 @@ public inline fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, d
|
||||
o["button"] = button
|
||||
o["buttons"] = buttons
|
||||
o["relatedTarget"] = relatedTarget
|
||||
o["region"] = region
|
||||
o["ctrlKey"] = ctrlKey
|
||||
o["shiftKey"] = shiftKey
|
||||
o["altKey"] = altKey
|
||||
@@ -302,7 +324,6 @@ public inline fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, d
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -312,6 +333,13 @@ public inline fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, d
|
||||
public external open class InputEvent(type: String, eventInitDict: InputEventInit = definedExternally) : UIEvent {
|
||||
open val data: String
|
||||
open val isComposing: Boolean
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface InputEventInit : UIEventInit {
|
||||
@@ -326,7 +354,6 @@ public external interface InputEventInit : UIEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun InputEventInit(data: String? = "", isComposing: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): InputEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["data"] = data
|
||||
o["isComposing"] = isComposing
|
||||
o["view"] = view
|
||||
@@ -334,7 +361,6 @@ public inline fun InputEventInit(data: String? = "", isComposing: Boolean? = fal
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -361,6 +387,10 @@ public external open class KeyboardEvent(type: String, eventInitDict: KeyboardEv
|
||||
val DOM_KEY_LOCATION_LEFT: Int
|
||||
val DOM_KEY_LOCATION_RIGHT: Int
|
||||
val DOM_KEY_LOCATION_NUMPAD: Int
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +415,6 @@ public external interface KeyboardEventInit : EventModifierInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun KeyboardEventInit(key: String? = "", code: String? = "", location: Int? = 0, repeat: Boolean? = false, isComposing: Boolean? = false, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): KeyboardEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["key"] = key
|
||||
o["code"] = code
|
||||
o["location"] = location
|
||||
@@ -410,7 +439,6 @@ public inline fun KeyboardEventInit(key: String? = "", code: String? = "", locat
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -419,6 +447,13 @@ public inline fun KeyboardEventInit(key: String? = "", code: String? = "", locat
|
||||
*/
|
||||
public external open class CompositionEvent(type: String, eventInitDict: CompositionEventInit = definedExternally) : UIEvent {
|
||||
open val data: String
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface CompositionEventInit : UIEventInit {
|
||||
@@ -430,14 +465,12 @@ public external interface CompositionEventInit : UIEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun CompositionEventInit(data: String? = "", view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CompositionEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["data"] = data
|
||||
o["view"] = view
|
||||
o["detail"] = detail
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -456,10 +489,10 @@ public external open class Event(type: String, eventInitDict: EventInit = define
|
||||
open val isTrusted: Boolean
|
||||
open val timeStamp: Number
|
||||
fun composedPath(): Array<EventTarget>
|
||||
fun stopPropagation(): Unit
|
||||
fun stopImmediatePropagation(): Unit
|
||||
fun preventDefault(): Unit
|
||||
fun initEvent(type: String, bubbles: Boolean, cancelable: Boolean): Unit
|
||||
fun stopPropagation()
|
||||
fun stopImmediatePropagation()
|
||||
fun preventDefault()
|
||||
fun initEvent(type: String, bubbles: Boolean, cancelable: Boolean)
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
@@ -473,10 +506,10 @@ public external open class Event(type: String, eventInitDict: EventInit = define
|
||||
* Exposes the JavaScript [EventTarget](https://developer.mozilla.org/en/docs/Web/API/EventTarget) to Kotlin
|
||||
*/
|
||||
public external abstract class EventTarget {
|
||||
fun addEventListener(type: String, callback: EventListener?, options: dynamic = definedExternally): Unit
|
||||
fun addEventListener(type: String, callback: ((Event) -> Unit)?, options: dynamic = definedExternally): Unit
|
||||
fun removeEventListener(type: String, callback: EventListener?, options: dynamic = definedExternally): Unit
|
||||
fun removeEventListener(type: String, callback: ((Event) -> Unit)?, options: dynamic = definedExternally): Unit
|
||||
fun addEventListener(type: String, callback: EventListener?, options: dynamic = definedExternally)
|
||||
fun addEventListener(type: String, callback: ((Event) -> Unit)?, options: dynamic = definedExternally)
|
||||
fun removeEventListener(type: String, callback: EventListener?, options: dynamic = definedExternally)
|
||||
fun removeEventListener(type: String, callback: ((Event) -> Unit)?, options: dynamic = definedExternally)
|
||||
fun dispatchEvent(event: Event): Boolean
|
||||
}
|
||||
|
||||
@@ -484,6 +517,5 @@ public external abstract class EventTarget {
|
||||
* Exposes the JavaScript [EventListener](https://developer.mozilla.org/en/docs/Web/API/EventListener) to Kotlin
|
||||
*/
|
||||
public external interface EventListener {
|
||||
fun handleEvent(event: Event): Unit
|
||||
}
|
||||
|
||||
fun handleEvent(event: Event)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.mediacapture
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -41,8 +40,8 @@ public external open class MediaStream() : EventTarget {
|
||||
fun getVideoTracks(): Array<MediaStreamTrack>
|
||||
fun getTracks(): Array<MediaStreamTrack>
|
||||
fun getTrackById(trackId: String): MediaStreamTrack?
|
||||
fun addTrack(track: MediaStreamTrack): Unit
|
||||
fun removeTrack(track: MediaStreamTrack): Unit
|
||||
fun addTrack(track: MediaStreamTrack)
|
||||
fun removeTrack(track: MediaStreamTrack)
|
||||
fun clone(): MediaStream
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ public external abstract class MediaStreamTrack : EventTarget {
|
||||
open var onended: ((Event) -> dynamic)?
|
||||
open var onoverconstrained: ((Event) -> dynamic)?
|
||||
fun clone(): MediaStreamTrack
|
||||
fun stop(): Unit
|
||||
fun stop()
|
||||
fun getCapabilities(): MediaTrackCapabilities
|
||||
fun getConstraints(): MediaTrackConstraints
|
||||
fun getSettings(): MediaTrackSettings
|
||||
@@ -125,7 +124,6 @@ public external interface MediaTrackSupportedConstraints {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MediaTrackSupportedConstraints(width: Boolean? = true, height: Boolean? = true, aspectRatio: Boolean? = true, frameRate: Boolean? = true, facingMode: Boolean? = true, resizeMode: Boolean? = true, volume: Boolean? = true, sampleRate: Boolean? = true, sampleSize: Boolean? = true, echoCancellation: Boolean? = true, autoGainControl: Boolean? = true, noiseSuppression: Boolean? = true, latency: Boolean? = true, channelCount: Boolean? = true, deviceId: Boolean? = true, groupId: Boolean? = true): MediaTrackSupportedConstraints {
|
||||
val o = js("({})")
|
||||
|
||||
o["width"] = width
|
||||
o["height"] = height
|
||||
o["aspectRatio"] = aspectRatio
|
||||
@@ -142,7 +140,6 @@ public inline fun MediaTrackSupportedConstraints(width: Boolean? = true, height:
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -200,7 +197,6 @@ public external interface MediaTrackCapabilities {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MediaTrackCapabilities(width: ULongRange? = undefined, height: ULongRange? = undefined, aspectRatio: DoubleRange? = undefined, frameRate: DoubleRange? = undefined, facingMode: Array<String>? = undefined, resizeMode: Array<String>? = undefined, volume: DoubleRange? = undefined, sampleRate: ULongRange? = undefined, sampleSize: ULongRange? = undefined, echoCancellation: Array<Boolean>? = undefined, autoGainControl: Array<Boolean>? = undefined, noiseSuppression: Array<Boolean>? = undefined, latency: DoubleRange? = undefined, channelCount: ULongRange? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackCapabilities {
|
||||
val o = js("({})")
|
||||
|
||||
o["width"] = width
|
||||
o["height"] = height
|
||||
o["aspectRatio"] = aspectRatio
|
||||
@@ -217,7 +213,6 @@ public inline fun MediaTrackCapabilities(width: ULongRange? = undefined, height:
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -233,7 +228,6 @@ public external interface MediaTrackConstraints : MediaTrackConstraintSet {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MediaTrackConstraints(advanced: Array<MediaTrackConstraintSet>? = undefined, width: dynamic = undefined, height: dynamic = undefined, aspectRatio: dynamic = undefined, frameRate: dynamic = undefined, facingMode: dynamic = undefined, resizeMode: dynamic = undefined, volume: dynamic = undefined, sampleRate: dynamic = undefined, sampleSize: dynamic = undefined, echoCancellation: dynamic = undefined, autoGainControl: dynamic = undefined, noiseSuppression: dynamic = undefined, latency: dynamic = undefined, channelCount: dynamic = undefined, deviceId: dynamic = undefined, groupId: dynamic = undefined): MediaTrackConstraints {
|
||||
val o = js("({})")
|
||||
|
||||
o["advanced"] = advanced
|
||||
o["width"] = width
|
||||
o["height"] = height
|
||||
@@ -251,7 +245,6 @@ public inline fun MediaTrackConstraints(advanced: Array<MediaTrackConstraintSet>
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -309,7 +302,6 @@ public external interface MediaTrackConstraintSet {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MediaTrackConstraintSet(width: dynamic = undefined, height: dynamic = undefined, aspectRatio: dynamic = undefined, frameRate: dynamic = undefined, facingMode: dynamic = undefined, resizeMode: dynamic = undefined, volume: dynamic = undefined, sampleRate: dynamic = undefined, sampleSize: dynamic = undefined, echoCancellation: dynamic = undefined, autoGainControl: dynamic = undefined, noiseSuppression: dynamic = undefined, latency: dynamic = undefined, channelCount: dynamic = undefined, deviceId: dynamic = undefined, groupId: dynamic = undefined): MediaTrackConstraintSet {
|
||||
val o = js("({})")
|
||||
|
||||
o["width"] = width
|
||||
o["height"] = height
|
||||
o["aspectRatio"] = aspectRatio
|
||||
@@ -326,7 +318,6 @@ public inline fun MediaTrackConstraintSet(width: dynamic = undefined, height: dy
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -387,7 +378,6 @@ public external interface MediaTrackSettings {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MediaTrackSettings(width: Int? = undefined, height: Int? = undefined, aspectRatio: Double? = undefined, frameRate: Double? = undefined, facingMode: String? = undefined, resizeMode: String? = undefined, volume: Double? = undefined, sampleRate: Int? = undefined, sampleSize: Int? = undefined, echoCancellation: Boolean? = undefined, autoGainControl: Boolean? = undefined, noiseSuppression: Boolean? = undefined, latency: Double? = undefined, channelCount: Int? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackSettings {
|
||||
val o = js("({})")
|
||||
|
||||
o["width"] = width
|
||||
o["height"] = height
|
||||
o["aspectRatio"] = aspectRatio
|
||||
@@ -404,7 +394,6 @@ public inline fun MediaTrackSettings(width: Int? = undefined, height: Int? = und
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -413,6 +402,13 @@ public inline fun MediaTrackSettings(width: Int? = undefined, height: Int? = und
|
||||
*/
|
||||
public external open class MediaStreamTrackEvent(type: String, eventInitDict: MediaStreamTrackEventInit) : Event {
|
||||
open val track: MediaStreamTrack
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface MediaStreamTrackEventInit : EventInit {
|
||||
@@ -424,17 +420,22 @@ public external interface MediaStreamTrackEventInit : EventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MediaStreamTrackEventInit(track: MediaStreamTrack?, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaStreamTrackEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["track"] = track
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external open class OverconstrainedErrorEvent(type: String, eventInitDict: OverconstrainedErrorEventInit) : Event {
|
||||
open val error: dynamic
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface OverconstrainedErrorEventInit : EventInit {
|
||||
@@ -446,12 +447,10 @@ public external interface OverconstrainedErrorEventInit : EventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun OverconstrainedErrorEventInit(error: dynamic = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): OverconstrainedErrorEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["error"] = error
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -460,7 +459,7 @@ public inline fun OverconstrainedErrorEventInit(error: dynamic = null, bubbles:
|
||||
*/
|
||||
public external abstract class MediaDevices : EventTarget {
|
||||
open var ondevicechange: ((Event) -> dynamic)?
|
||||
fun enumerateDevices(): Promise<dynamic>
|
||||
fun enumerateDevices(): Promise<Array<MediaDeviceInfo>>
|
||||
fun getSupportedConstraints(): MediaTrackSupportedConstraints
|
||||
fun getUserMedia(constraints: MediaStreamConstraints = definedExternally): Promise<MediaStream>
|
||||
}
|
||||
@@ -495,15 +494,15 @@ public external interface MediaStreamConstraints {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun MediaStreamConstraints(video: dynamic = false, audio: dynamic = false): MediaStreamConstraints {
|
||||
val o = js("({})")
|
||||
|
||||
o["video"] = video
|
||||
o["audio"] = audio
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface ConstrainablePattern {
|
||||
var onoverconstrained: ((Event) -> dynamic)?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
fun getCapabilities(): Capabilities
|
||||
fun getConstraints(): Constraints
|
||||
fun getSettings(): Settings
|
||||
@@ -525,10 +524,8 @@ public external interface DoubleRange {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun DoubleRange(max: Double? = undefined, min: Double? = undefined): DoubleRange {
|
||||
val o = js("({})")
|
||||
|
||||
o["max"] = max
|
||||
o["min"] = min
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -544,12 +541,10 @@ public external interface ConstrainDoubleRange : DoubleRange {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ConstrainDoubleRange(exact: Double? = undefined, ideal: Double? = undefined, max: Double? = undefined, min: Double? = undefined): ConstrainDoubleRange {
|
||||
val o = js("({})")
|
||||
|
||||
o["exact"] = exact
|
||||
o["ideal"] = ideal
|
||||
o["max"] = max
|
||||
o["min"] = min
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -565,10 +560,8 @@ public external interface ULongRange {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULongRange(max: Int? = undefined, min: Int? = undefined): ULongRange {
|
||||
val o = js("({})")
|
||||
|
||||
o["max"] = max
|
||||
o["min"] = min
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -584,12 +577,10 @@ public external interface ConstrainULongRange : ULongRange {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ConstrainULongRange(exact: Int? = undefined, ideal: Int? = undefined, max: Int? = undefined, min: Int? = undefined): ConstrainULongRange {
|
||||
val o = js("({})")
|
||||
|
||||
o["exact"] = exact
|
||||
o["ideal"] = ideal
|
||||
o["max"] = max
|
||||
o["min"] = min
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -608,10 +599,8 @@ public external interface ConstrainBooleanParameters {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ConstrainBooleanParameters(exact: Boolean? = undefined, ideal: Boolean? = undefined): ConstrainBooleanParameters {
|
||||
val o = js("({})")
|
||||
|
||||
o["exact"] = exact
|
||||
o["ideal"] = ideal
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -630,43 +619,32 @@ public external interface ConstrainDOMStringParameters {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ConstrainDOMStringParameters(exact: dynamic = undefined, ideal: dynamic = undefined): ConstrainDOMStringParameters {
|
||||
val o = js("({})")
|
||||
|
||||
o["exact"] = exact
|
||||
o["ideal"] = ideal
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface Capabilities {
|
||||
}
|
||||
public external interface Capabilities
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Capabilities(): Capabilities {
|
||||
val o = js("({})")
|
||||
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface Settings {
|
||||
}
|
||||
public external interface Settings
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Settings(): Settings {
|
||||
val o = js("({})")
|
||||
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface ConstraintSet {
|
||||
}
|
||||
public external interface ConstraintSet
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ConstraintSet(): ConstraintSet {
|
||||
val o = js("({})")
|
||||
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -679,40 +657,52 @@ public external interface Constraints : ConstraintSet {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Constraints(advanced: Array<ConstraintSet>? = undefined): Constraints {
|
||||
val o = js("({})")
|
||||
|
||||
o["advanced"] = advanced
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface MediaStreamTrackState {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val MediaStreamTrackState.Companion.LIVE: MediaStreamTrackState get() = "live".asDynamic().unsafeCast<MediaStreamTrackState>()
|
||||
|
||||
public inline val MediaStreamTrackState.Companion.ENDED: MediaStreamTrackState get() = "ended".asDynamic().unsafeCast<MediaStreamTrackState>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface VideoFacingModeEnum {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val VideoFacingModeEnum.Companion.USER: VideoFacingModeEnum get() = "user".asDynamic().unsafeCast<VideoFacingModeEnum>()
|
||||
|
||||
public inline val VideoFacingModeEnum.Companion.ENVIRONMENT: VideoFacingModeEnum get() = "environment".asDynamic().unsafeCast<VideoFacingModeEnum>()
|
||||
|
||||
public inline val VideoFacingModeEnum.Companion.LEFT: VideoFacingModeEnum get() = "left".asDynamic().unsafeCast<VideoFacingModeEnum>()
|
||||
|
||||
public inline val VideoFacingModeEnum.Companion.RIGHT: VideoFacingModeEnum get() = "right".asDynamic().unsafeCast<VideoFacingModeEnum>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface VideoResizeModeEnum {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val VideoResizeModeEnum.Companion.NONE: VideoResizeModeEnum get() = "none".asDynamic().unsafeCast<VideoResizeModeEnum>()
|
||||
|
||||
public inline val VideoResizeModeEnum.Companion.CROP_AND_SCALE: VideoResizeModeEnum get() = "crop-and-scale".asDynamic().unsafeCast<VideoResizeModeEnum>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface MediaDeviceKind {
|
||||
companion object
|
||||
}
|
||||
public inline val MediaDeviceKind.Companion.AUDIOINPUT: MediaDeviceKind get() = "audioinput".asDynamic().unsafeCast<MediaDeviceKind>()
|
||||
public inline val MediaDeviceKind.Companion.AUDIOOUTPUT: MediaDeviceKind get() = "audiooutput".asDynamic().unsafeCast<MediaDeviceKind>()
|
||||
public inline val MediaDeviceKind.Companion.VIDEOINPUT: MediaDeviceKind get() = "videoinput".asDynamic().unsafeCast<MediaDeviceKind>()
|
||||
|
||||
public inline val MediaDeviceKind.Companion.AUDIOINPUT: MediaDeviceKind get() = "audioinput".asDynamic().unsafeCast<MediaDeviceKind>()
|
||||
|
||||
public inline val MediaDeviceKind.Companion.AUDIOOUTPUT: MediaDeviceKind get() = "audiooutput".asDynamic().unsafeCast<MediaDeviceKind>()
|
||||
|
||||
public inline val MediaDeviceKind.Companion.VIDEOINPUT: MediaDeviceKind get() = "videoinput".asDynamic().unsafeCast<MediaDeviceKind>()
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.parsing
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -39,5 +38,4 @@ public external open class DOMParser {
|
||||
*/
|
||||
public external open class XMLSerializer {
|
||||
fun serializeToString(root: Node): String
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.pointerevents
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -61,9 +60,8 @@ public external interface PointerEventInit : MouseEventInit {
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun PointerEventInit(pointerId: Int? = 0, width: Double? = 1.0, height: Double? = 1.0, pressure: Float? = 0f, tangentialPressure: Float? = 0f, tiltX: Int? = 0, tiltY: Int? = 0, twist: Int? = 0, pointerType: String? = "", isPrimary: Boolean? = false, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PointerEventInit {
|
||||
public inline fun PointerEventInit(pointerId: Int? = 0, width: Double? = 1.0, height: Double? = 1.0, pressure: Float? = 0f, tangentialPressure: Float? = 0f, tiltX: Int? = 0, tiltY: Int? = 0, twist: Int? = 0, pointerType: String? = "", isPrimary: Boolean? = false, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PointerEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["pointerId"] = pointerId
|
||||
o["width"] = width
|
||||
o["height"] = height
|
||||
@@ -81,6 +79,7 @@ public inline fun PointerEventInit(pointerId: Int? = 0, width: Double? = 1.0, he
|
||||
o["button"] = button
|
||||
o["buttons"] = buttons
|
||||
o["relatedTarget"] = relatedTarget
|
||||
o["region"] = region
|
||||
o["ctrlKey"] = ctrlKey
|
||||
o["shiftKey"] = shiftKey
|
||||
o["altKey"] = altKey
|
||||
@@ -100,7 +99,6 @@ public inline fun PointerEventInit(pointerId: Int? = 0, width: Double? = 1.0, he
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -118,5 +116,11 @@ public external open class PointerEvent(type: String, eventInitDict: PointerEven
|
||||
open val twist: Int
|
||||
open val pointerType: String
|
||||
open val isPrimary: Boolean
|
||||
}
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.url
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -45,11 +44,11 @@ public external open class URL(url: String, base: String = definedExternally) {
|
||||
var hash: String
|
||||
|
||||
companion object {
|
||||
fun createObjectURL(blob: Blob): String
|
||||
fun createFor(blob: Blob): String
|
||||
fun revokeObjectURL(url: String): Unit
|
||||
fun domainToASCII(domain: String): String
|
||||
fun domainToUnicode(domain: String): String
|
||||
fun createObjectURL(blob: Blob): String
|
||||
fun createFor(blob: Blob): String
|
||||
fun revokeObjectURL(url: String)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,11 +56,10 @@ public external open class URL(url: String, base: String = definedExternally) {
|
||||
* Exposes the JavaScript [URLSearchParams](https://developer.mozilla.org/en/docs/Web/API/URLSearchParams) to Kotlin
|
||||
*/
|
||||
public external open class URLSearchParams(init: dynamic = definedExternally) {
|
||||
fun append(name: String, value: String): Unit
|
||||
fun delete(name: String): Unit
|
||||
fun append(name: String, value: String)
|
||||
fun delete(name: String)
|
||||
fun get(name: String): String?
|
||||
fun getAll(name: String): Array<String>
|
||||
fun has(name: String): Boolean
|
||||
fun set(name: String, value: String): Unit
|
||||
}
|
||||
|
||||
fun set(name: String, value: String)
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.fetch
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -31,11 +30,11 @@ import org.w3c.xhr.*
|
||||
* Exposes the JavaScript [Headers](https://developer.mozilla.org/en/docs/Web/API/Headers) to Kotlin
|
||||
*/
|
||||
public external open class Headers(init: dynamic = definedExternally) {
|
||||
fun append(name: String, value: String): Unit
|
||||
fun delete(name: String): Unit
|
||||
fun append(name: String, value: String)
|
||||
fun delete(name: String)
|
||||
fun get(name: String): String?
|
||||
fun has(name: String): Boolean
|
||||
fun set(name: String, value: String): Unit
|
||||
fun set(name: String, value: String)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +117,6 @@ public external interface RequestInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun RequestInit(method: String? = undefined, headers: dynamic = undefined, body: dynamic = undefined, referrer: String? = undefined, referrerPolicy: dynamic = undefined, mode: RequestMode? = undefined, credentials: RequestCredentials? = undefined, cache: RequestCache? = undefined, redirect: RequestRedirect? = undefined, integrity: String? = undefined, keepalive: Boolean? = undefined, window: Any? = undefined): RequestInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["method"] = method
|
||||
o["headers"] = headers
|
||||
o["body"] = body
|
||||
@@ -131,7 +129,6 @@ public inline fun RequestInit(method: String? = undefined, headers: dynamic = un
|
||||
o["integrity"] = integrity
|
||||
o["keepalive"] = keepalive
|
||||
o["window"] = window
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -177,91 +174,140 @@ public external interface ResponseInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ResponseInit(status: Short? = 200, statusText: String? = "OK", headers: dynamic = undefined): ResponseInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["status"] = status
|
||||
o["statusText"] = statusText
|
||||
o["headers"] = headers
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface RequestType {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val RequestType.Companion.EMPTY: RequestType get() = "".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
public inline val RequestType.Companion.AUDIO: RequestType get() = "audio".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
public inline val RequestType.Companion.FONT: RequestType get() = "font".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
public inline val RequestType.Companion.IMAGE: RequestType get() = "image".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
public inline val RequestType.Companion.SCRIPT: RequestType get() = "script".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
public inline val RequestType.Companion.STYLE: RequestType get() = "style".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
public inline val RequestType.Companion.TRACK: RequestType get() = "track".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
public inline val RequestType.Companion.VIDEO: RequestType get() = "video".asDynamic().unsafeCast<RequestType>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface RequestDestination {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val RequestDestination.Companion.EMPTY: RequestDestination get() = "".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.DOCUMENT: RequestDestination get() = "document".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.EMBED: RequestDestination get() = "embed".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.FONT: RequestDestination get() = "font".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.IMAGE: RequestDestination get() = "image".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.MANIFEST: RequestDestination get() = "manifest".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.MEDIA: RequestDestination get() = "media".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.OBJECT: RequestDestination get() = "object".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.REPORT: RequestDestination get() = "report".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.SCRIPT: RequestDestination get() = "script".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.SERVICEWORKER: RequestDestination get() = "serviceworker".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.SHAREDWORKER: RequestDestination get() = "sharedworker".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.STYLE: RequestDestination get() = "style".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.WORKER: RequestDestination get() = "worker".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
public inline val RequestDestination.Companion.XSLT: RequestDestination get() = "xslt".asDynamic().unsafeCast<RequestDestination>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface RequestMode {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val RequestMode.Companion.NAVIGATE: RequestMode get() = "navigate".asDynamic().unsafeCast<RequestMode>()
|
||||
|
||||
public inline val RequestMode.Companion.SAME_ORIGIN: RequestMode get() = "same-origin".asDynamic().unsafeCast<RequestMode>()
|
||||
|
||||
public inline val RequestMode.Companion.NO_CORS: RequestMode get() = "no-cors".asDynamic().unsafeCast<RequestMode>()
|
||||
|
||||
public inline val RequestMode.Companion.CORS: RequestMode get() = "cors".asDynamic().unsafeCast<RequestMode>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface RequestCredentials {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val RequestCredentials.Companion.OMIT: RequestCredentials get() = "omit".asDynamic().unsafeCast<RequestCredentials>()
|
||||
|
||||
public inline val RequestCredentials.Companion.SAME_ORIGIN: RequestCredentials get() = "same-origin".asDynamic().unsafeCast<RequestCredentials>()
|
||||
|
||||
public inline val RequestCredentials.Companion.INCLUDE: RequestCredentials get() = "include".asDynamic().unsafeCast<RequestCredentials>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface RequestCache {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val RequestCache.Companion.DEFAULT: RequestCache get() = "default".asDynamic().unsafeCast<RequestCache>()
|
||||
|
||||
public inline val RequestCache.Companion.NO_STORE: RequestCache get() = "no-store".asDynamic().unsafeCast<RequestCache>()
|
||||
|
||||
public inline val RequestCache.Companion.RELOAD: RequestCache get() = "reload".asDynamic().unsafeCast<RequestCache>()
|
||||
|
||||
public inline val RequestCache.Companion.NO_CACHE: RequestCache get() = "no-cache".asDynamic().unsafeCast<RequestCache>()
|
||||
|
||||
public inline val RequestCache.Companion.FORCE_CACHE: RequestCache get() = "force-cache".asDynamic().unsafeCast<RequestCache>()
|
||||
|
||||
public inline val RequestCache.Companion.ONLY_IF_CACHED: RequestCache get() = "only-if-cached".asDynamic().unsafeCast<RequestCache>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface RequestRedirect {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val RequestRedirect.Companion.FOLLOW: RequestRedirect get() = "follow".asDynamic().unsafeCast<RequestRedirect>()
|
||||
|
||||
public inline val RequestRedirect.Companion.ERROR: RequestRedirect get() = "error".asDynamic().unsafeCast<RequestRedirect>()
|
||||
|
||||
public inline val RequestRedirect.Companion.MANUAL: RequestRedirect get() = "manual".asDynamic().unsafeCast<RequestRedirect>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface ResponseType {
|
||||
companion object
|
||||
}
|
||||
public inline val ResponseType.Companion.BASIC: ResponseType get() = "basic".asDynamic().unsafeCast<ResponseType>()
|
||||
public inline val ResponseType.Companion.CORS: ResponseType get() = "cors".asDynamic().unsafeCast<ResponseType>()
|
||||
public inline val ResponseType.Companion.DEFAULT: ResponseType get() = "default".asDynamic().unsafeCast<ResponseType>()
|
||||
public inline val ResponseType.Companion.ERROR: ResponseType get() = "error".asDynamic().unsafeCast<ResponseType>()
|
||||
public inline val ResponseType.Companion.OPAQUE: ResponseType get() = "opaque".asDynamic().unsafeCast<ResponseType>()
|
||||
public inline val ResponseType.Companion.OPAQUEREDIRECT: ResponseType get() = "opaqueredirect".asDynamic().unsafeCast<ResponseType>()
|
||||
|
||||
public inline val ResponseType.Companion.BASIC: ResponseType get() = "basic".asDynamic().unsafeCast<ResponseType>()
|
||||
|
||||
public inline val ResponseType.Companion.CORS: ResponseType get() = "cors".asDynamic().unsafeCast<ResponseType>()
|
||||
|
||||
public inline val ResponseType.Companion.DEFAULT: ResponseType get() = "default".asDynamic().unsafeCast<ResponseType>()
|
||||
|
||||
public inline val ResponseType.Companion.ERROR: ResponseType get() = "error".asDynamic().unsafeCast<ResponseType>()
|
||||
|
||||
public inline val ResponseType.Companion.OPAQUE: ResponseType get() = "opaque".asDynamic().unsafeCast<ResponseType>()
|
||||
|
||||
public inline val ResponseType.Companion.OPAQUEREDIRECT: ResponseType get() = "opaqueredirect".asDynamic().unsafeCast<ResponseType>()
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.files
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -30,12 +29,12 @@ import org.w3c.xhr.*
|
||||
/**
|
||||
* Exposes the JavaScript [Blob](https://developer.mozilla.org/en/docs/Web/API/Blob) to Kotlin
|
||||
*/
|
||||
public external open class Blob(blobParts: Array<dynamic> = definedExternally, options: BlobPropertyBag = definedExternally) {
|
||||
open val size: Int
|
||||
public external open class Blob(blobParts: Array<dynamic> = definedExternally, options: BlobPropertyBag = definedExternally) : ImageBitmapSource {
|
||||
open val size: Number
|
||||
open val type: String
|
||||
open val isClosed: Boolean
|
||||
fun slice(start: Int = definedExternally, end: Int = definedExternally, contentType: String = definedExternally): Blob
|
||||
fun close(): Unit
|
||||
fun close()
|
||||
}
|
||||
|
||||
public external interface BlobPropertyBag {
|
||||
@@ -47,9 +46,7 @@ public external interface BlobPropertyBag {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun BlobPropertyBag(type: String? = ""): BlobPropertyBag {
|
||||
val o = js("({})")
|
||||
|
||||
o["type"] = type
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -70,10 +67,8 @@ public external interface FilePropertyBag : BlobPropertyBag {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun FilePropertyBag(lastModified: Int? = undefined, type: String? = ""): FilePropertyBag {
|
||||
val o = js("({})")
|
||||
|
||||
o["lastModified"] = lastModified
|
||||
o["type"] = type
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -81,10 +76,11 @@ public inline fun FilePropertyBag(lastModified: Int? = undefined, type: String?
|
||||
* Exposes the JavaScript [FileList](https://developer.mozilla.org/en/docs/Web/API/FileList) to Kotlin
|
||||
*/
|
||||
public external abstract class FileList : ItemArrayLike<File> {
|
||||
override val length: Int
|
||||
override fun item(index: Int): File?
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun FileList.get(index: Int): File? = asDynamic()[index]
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun FileList.get(index: Int): File? = asDynamic()[index]
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [FileReader](https://developer.mozilla.org/en/docs/Web/API/FileReader) to Kotlin
|
||||
@@ -99,11 +95,11 @@ public external open class FileReader : EventTarget {
|
||||
var onabort: ((Event) -> dynamic)?
|
||||
var onerror: ((Event) -> dynamic)?
|
||||
var onloadend: ((Event) -> dynamic)?
|
||||
fun readAsArrayBuffer(blob: Blob): Unit
|
||||
fun readAsBinaryString(blob: Blob): Unit
|
||||
fun readAsText(blob: Blob, label: String = definedExternally): Unit
|
||||
fun readAsDataURL(blob: Blob): Unit
|
||||
fun abort(): Unit
|
||||
fun readAsArrayBuffer(blob: Blob)
|
||||
fun readAsBinaryString(blob: Blob)
|
||||
fun readAsText(blob: Blob, label: String = definedExternally)
|
||||
fun readAsDataURL(blob: Blob)
|
||||
fun abort()
|
||||
|
||||
companion object {
|
||||
val EMPTY: Short
|
||||
@@ -120,5 +116,4 @@ public external open class FileReaderSync {
|
||||
fun readAsBinaryString(blob: Blob): String
|
||||
fun readAsText(blob: Blob, label: String = definedExternally): String
|
||||
fun readAsDataURL(blob: Blob): String
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.notifications
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -51,11 +50,11 @@ public external open class Notification(title: String, options: NotificationOpti
|
||||
open val sticky: Boolean
|
||||
open val data: Any?
|
||||
open val actions: Array<out NotificationAction>
|
||||
fun close(): Unit
|
||||
fun close()
|
||||
|
||||
companion object {
|
||||
var permission: NotificationPermission
|
||||
var maxActions: Int
|
||||
val permission: NotificationPermission
|
||||
val maxActions: Int
|
||||
fun requestPermission(deprecatedCallback: (NotificationPermission) -> Unit = definedExternally): Promise<NotificationPermission>
|
||||
}
|
||||
}
|
||||
@@ -117,7 +116,6 @@ public external interface NotificationOptions {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun NotificationOptions(dir: NotificationDirection? = NotificationDirection.AUTO, lang: String? = "", body: String? = "", tag: String? = "", image: String? = undefined, icon: String? = undefined, badge: String? = undefined, sound: String? = undefined, vibrate: dynamic = undefined, timestamp: Number? = undefined, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: Any? = null, actions: Array<NotificationAction>? = arrayOf()): NotificationOptions {
|
||||
val o = js("({})")
|
||||
|
||||
o["dir"] = dir
|
||||
o["lang"] = lang
|
||||
o["body"] = body
|
||||
@@ -135,7 +133,6 @@ public inline fun NotificationOptions(dir: NotificationDirection? = Notification
|
||||
o["sticky"] = sticky
|
||||
o["data"] = data
|
||||
o["actions"] = actions
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -154,11 +151,9 @@ public external interface NotificationAction {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun NotificationAction(action: String?, title: String?, icon: String? = undefined): NotificationAction {
|
||||
val o = js("({})")
|
||||
|
||||
o["action"] = action
|
||||
o["title"] = title
|
||||
o["icon"] = icon
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -171,9 +166,7 @@ public external interface GetNotificationOptions {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun GetNotificationOptions(tag: String? = ""): GetNotificationOptions {
|
||||
val o = js("({})")
|
||||
|
||||
o["tag"] = tag
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -183,6 +176,13 @@ public inline fun GetNotificationOptions(tag: String? = ""): GetNotificationOpti
|
||||
public external open class NotificationEvent(type: String, eventInitDict: NotificationEventInit) : ExtendableEvent {
|
||||
open val notification: Notification
|
||||
open val action: String
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface NotificationEventInit : ExtendableEventInit {
|
||||
@@ -197,29 +197,34 @@ public external interface NotificationEventInit : ExtendableEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun NotificationEventInit(notification: Notification?, action: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): NotificationEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["notification"] = notification
|
||||
o["action"] = action
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface NotificationPermission {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val NotificationPermission.Companion.DEFAULT: NotificationPermission get() = "default".asDynamic().unsafeCast<NotificationPermission>()
|
||||
|
||||
public inline val NotificationPermission.Companion.DENIED: NotificationPermission get() = "denied".asDynamic().unsafeCast<NotificationPermission>()
|
||||
|
||||
public inline val NotificationPermission.Companion.GRANTED: NotificationPermission get() = "granted".asDynamic().unsafeCast<NotificationPermission>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface NotificationDirection {
|
||||
companion object
|
||||
}
|
||||
public inline val NotificationDirection.Companion.AUTO: NotificationDirection get() = "auto".asDynamic().unsafeCast<NotificationDirection>()
|
||||
public inline val NotificationDirection.Companion.LTR: NotificationDirection get() = "ltr".asDynamic().unsafeCast<NotificationDirection>()
|
||||
public inline val NotificationDirection.Companion.RTL: NotificationDirection get() = "rtl".asDynamic().unsafeCast<NotificationDirection>()
|
||||
|
||||
public inline val NotificationDirection.Companion.AUTO: NotificationDirection get() = "auto".asDynamic().unsafeCast<NotificationDirection>()
|
||||
|
||||
public inline val NotificationDirection.Companion.LTR: NotificationDirection get() = "ltr".asDynamic().unsafeCast<NotificationDirection>()
|
||||
|
||||
public inline val NotificationDirection.Companion.RTL: NotificationDirection get() = "rtl".asDynamic().unsafeCast<NotificationDirection>()
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.performance
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -44,27 +43,27 @@ public external interface GlobalPerformance {
|
||||
* Exposes the JavaScript [PerformanceTiming](https://developer.mozilla.org/en/docs/Web/API/PerformanceTiming) to Kotlin
|
||||
*/
|
||||
public external abstract class PerformanceTiming {
|
||||
open val navigationStart: Int
|
||||
open val unloadEventStart: Int
|
||||
open val unloadEventEnd: Int
|
||||
open val redirectStart: Int
|
||||
open val redirectEnd: Int
|
||||
open val fetchStart: Int
|
||||
open val domainLookupStart: Int
|
||||
open val domainLookupEnd: Int
|
||||
open val connectStart: Int
|
||||
open val connectEnd: Int
|
||||
open val secureConnectionStart: Int
|
||||
open val requestStart: Int
|
||||
open val responseStart: Int
|
||||
open val responseEnd: Int
|
||||
open val domLoading: Int
|
||||
open val domInteractive: Int
|
||||
open val domContentLoadedEventStart: Int
|
||||
open val domContentLoadedEventEnd: Int
|
||||
open val domComplete: Int
|
||||
open val loadEventStart: Int
|
||||
open val loadEventEnd: Int
|
||||
open val navigationStart: Number
|
||||
open val unloadEventStart: Number
|
||||
open val unloadEventEnd: Number
|
||||
open val redirectStart: Number
|
||||
open val redirectEnd: Number
|
||||
open val fetchStart: Number
|
||||
open val domainLookupStart: Number
|
||||
open val domainLookupEnd: Number
|
||||
open val connectStart: Number
|
||||
open val connectEnd: Number
|
||||
open val secureConnectionStart: Number
|
||||
open val requestStart: Number
|
||||
open val responseStart: Number
|
||||
open val responseEnd: Number
|
||||
open val domLoading: Number
|
||||
open val domInteractive: Number
|
||||
open val domContentLoadedEventStart: Number
|
||||
open val domContentLoadedEventEnd: Number
|
||||
open val domComplete: Number
|
||||
open val loadEventStart: Number
|
||||
open val loadEventEnd: Number
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,5 +79,4 @@ public external abstract class PerformanceNavigation {
|
||||
val TYPE_BACK_FORWARD: Short
|
||||
val TYPE_RESERVED: Short
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.workers
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -27,6 +26,16 @@ import org.w3c.notifications.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [ServiceWorker](https://developer.mozilla.org/en/docs/Web/API/ServiceWorker) to Kotlin
|
||||
*/
|
||||
public external abstract class ServiceWorker : EventTarget, AbstractWorker, UnionMessagePortOrServiceWorker, UnionClientOrMessagePortOrServiceWorker {
|
||||
open val scriptURL: String
|
||||
open val state: ServiceWorkerState
|
||||
open var onstatechange: ((Event) -> dynamic)?
|
||||
fun postMessage(message: Any?, transfer: Array<dynamic> = definedExternally)
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [ServiceWorkerRegistration](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerRegistration) to Kotlin
|
||||
*/
|
||||
@@ -39,36 +48,9 @@ public external abstract class ServiceWorkerRegistration : EventTarget {
|
||||
open val APISpace: dynamic
|
||||
fun update(): Promise<Unit>
|
||||
fun unregister(): Promise<Boolean>
|
||||
fun methodName(): Promise<dynamic>
|
||||
fun showNotification(title: String, options: NotificationOptions = definedExternally): Promise<Unit>
|
||||
fun getNotifications(filter: GetNotificationOptions = definedExternally): Promise<dynamic>
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [ServiceWorkerGlobalScope](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerGlobalScope) to Kotlin
|
||||
*/
|
||||
public external abstract class ServiceWorkerGlobalScope : WorkerGlobalScope {
|
||||
open val clients: Clients
|
||||
open val registration: ServiceWorkerRegistration
|
||||
open var oninstall: ((Event) -> dynamic)?
|
||||
open var onactivate: ((Event) -> dynamic)?
|
||||
open var onfetch: ((FetchEvent) -> dynamic)?
|
||||
open var onforeignfetch: ((Event) -> dynamic)?
|
||||
open var onmessage: ((MessageEvent) -> dynamic)?
|
||||
open var onfunctionalevent: ((Event) -> dynamic)?
|
||||
open var onnotificationclick: ((NotificationEvent) -> dynamic)?
|
||||
open var onnotificationclose: ((NotificationEvent) -> dynamic)?
|
||||
fun skipWaiting(): Promise<Unit>
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [ServiceWorker](https://developer.mozilla.org/en/docs/Web/API/ServiceWorker) to Kotlin
|
||||
*/
|
||||
public external abstract class ServiceWorker : EventTarget, AbstractWorker, UnionMessagePortOrServiceWorker, UnionClientOrMessagePortOrServiceWorker {
|
||||
open val scriptURL: String
|
||||
open val state: ServiceWorkerState
|
||||
open var onstatechange: ((Event) -> dynamic)?
|
||||
fun postMessage(message: Any?, transfer: Array<dynamic> = definedExternally): Unit
|
||||
fun getNotifications(filter: GetNotificationOptions = definedExternally): Promise<Array<Notification>>
|
||||
fun methodName(): Promise<dynamic>
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,8 +63,8 @@ public external abstract class ServiceWorkerContainer : EventTarget {
|
||||
open var onmessage: ((MessageEvent) -> dynamic)?
|
||||
fun register(scriptURL: String, options: RegistrationOptions = definedExternally): Promise<ServiceWorkerRegistration>
|
||||
fun getRegistration(clientURL: String = definedExternally): Promise<Any?>
|
||||
fun getRegistrations(): Promise<dynamic>
|
||||
fun startMessages(): Unit
|
||||
fun getRegistrations(): Promise<Array<ServiceWorkerRegistration>>
|
||||
fun startMessages()
|
||||
}
|
||||
|
||||
public external interface RegistrationOptions {
|
||||
@@ -97,10 +79,8 @@ public external interface RegistrationOptions {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun RegistrationOptions(scope: String? = undefined, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions {
|
||||
val o = js("({})")
|
||||
|
||||
o["scope"] = scope
|
||||
o["type"] = type
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -113,6 +93,13 @@ public external open class ServiceWorkerMessageEvent(type: String, eventInitDict
|
||||
open val lastEventId: String
|
||||
open val source: UnionMessagePortOrServiceWorker?
|
||||
open val ports: Array<out MessagePort>?
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface ServiceWorkerMessageEventInit : EventInit {
|
||||
@@ -136,7 +123,6 @@ public external interface ServiceWorkerMessageEventInit : EventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ServiceWorkerMessageEventInit(data: Any? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionMessagePortOrServiceWorker? = undefined, ports: Array<MessagePort>? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ServiceWorkerMessageEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["data"] = data
|
||||
o["origin"] = origin
|
||||
o["lastEventId"] = lastEventId
|
||||
@@ -145,10 +131,26 @@ public inline fun ServiceWorkerMessageEventInit(data: Any? = undefined, origin:
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [ServiceWorkerGlobalScope](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerGlobalScope) to Kotlin
|
||||
*/
|
||||
public external abstract class ServiceWorkerGlobalScope : WorkerGlobalScope {
|
||||
open val clients: Clients
|
||||
open val registration: ServiceWorkerRegistration
|
||||
open var oninstall: ((Event) -> dynamic)?
|
||||
open var onactivate: ((Event) -> dynamic)?
|
||||
open var onfetch: ((FetchEvent) -> dynamic)?
|
||||
open var onforeignfetch: ((Event) -> dynamic)?
|
||||
open var onmessage: ((MessageEvent) -> dynamic)?
|
||||
open var onnotificationclick: ((NotificationEvent) -> dynamic)?
|
||||
open var onnotificationclose: ((NotificationEvent) -> dynamic)?
|
||||
open var onfunctionalevent: ((Event) -> dynamic)?
|
||||
fun skipWaiting(): Promise<Unit>
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [Client](https://developer.mozilla.org/en/docs/Web/API/Client) to Kotlin
|
||||
*/
|
||||
@@ -156,7 +158,7 @@ public external abstract class Client : UnionClientOrMessagePortOrServiceWorker
|
||||
open val url: String
|
||||
open val frameType: FrameType
|
||||
open val id: String
|
||||
fun postMessage(message: Any?, transfer: Array<dynamic> = definedExternally): Unit
|
||||
fun postMessage(message: Any?, transfer: Array<dynamic> = definedExternally)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,7 +176,7 @@ public external abstract class WindowClient : Client {
|
||||
*/
|
||||
public external abstract class Clients {
|
||||
fun get(id: String): Promise<Any?>
|
||||
fun matchAll(options: ClientQueryOptions = definedExternally): Promise<dynamic>
|
||||
fun matchAll(options: ClientQueryOptions = definedExternally): Promise<Array<Client>>
|
||||
fun openWindow(url: String): Promise<WindowClient?>
|
||||
fun claim(): Promise<Unit>
|
||||
}
|
||||
@@ -191,10 +193,8 @@ public external interface ClientQueryOptions {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type: ClientType? = ClientType.WINDOW): ClientQueryOptions {
|
||||
val o = js("({})")
|
||||
|
||||
o["includeUncontrolled"] = includeUncontrolled
|
||||
o["type"] = type
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -202,20 +202,24 @@ public inline fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type
|
||||
* Exposes the JavaScript [ExtendableEvent](https://developer.mozilla.org/en/docs/Web/API/ExtendableEvent) to Kotlin
|
||||
*/
|
||||
public external open class ExtendableEvent(type: String, eventInitDict: ExtendableEventInit = definedExternally) : Event {
|
||||
fun waitUntil(f: Promise<Any?>): Unit
|
||||
fun waitUntil(f: Promise<Any?>)
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface ExtendableEventInit : EventInit {
|
||||
}
|
||||
public external interface ExtendableEventInit : EventInit
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ExtendableEventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -223,7 +227,14 @@ public inline fun ExtendableEventInit(bubbles: Boolean? = false, cancelable: Boo
|
||||
* Exposes the JavaScript [InstallEvent](https://developer.mozilla.org/en/docs/Web/API/InstallEvent) to Kotlin
|
||||
*/
|
||||
public external open class InstallEvent(type: String, eventInitDict: ExtendableEventInit = definedExternally) : ExtendableEvent {
|
||||
fun registerForeignFetch(options: ForeignFetchOptions): Unit
|
||||
fun registerForeignFetch(options: ForeignFetchOptions)
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface ForeignFetchOptions {
|
||||
@@ -238,10 +249,8 @@ public external interface ForeignFetchOptions {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ForeignFetchOptions(scopes: Array<String>?, origins: Array<String>?): ForeignFetchOptions {
|
||||
val o = js("({})")
|
||||
|
||||
o["scopes"] = scopes
|
||||
o["origins"] = origins
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -252,7 +261,14 @@ public external open class FetchEvent(type: String, eventInitDict: FetchEventIni
|
||||
open val request: Request
|
||||
open val clientId: String?
|
||||
open val isReload: Boolean
|
||||
fun respondWith(r: Promise<Response>): Unit
|
||||
fun respondWith(r: Promise<Response>)
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface FetchEventInit : ExtendableEventInit {
|
||||
@@ -270,21 +286,26 @@ public external interface FetchEventInit : ExtendableEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun FetchEventInit(request: Request?, clientId: String? = null, isReload: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FetchEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["request"] = request
|
||||
o["clientId"] = clientId
|
||||
o["isReload"] = isReload
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external open class ForeignFetchEvent(type: String, eventInitDict: ForeignFetchEventInit) : ExtendableEvent {
|
||||
open val request: Request
|
||||
open val origin: String
|
||||
fun respondWith(r: Promise<ForeignFetchResponse>): Unit
|
||||
fun respondWith(r: Promise<ForeignFetchResponse>)
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface ForeignFetchEventInit : ExtendableEventInit {
|
||||
@@ -299,13 +320,11 @@ public external interface ForeignFetchEventInit : ExtendableEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ForeignFetchEventInit(request: Request?, origin: String? = "null", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ForeignFetchEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["request"] = request
|
||||
o["origin"] = origin
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -324,11 +343,9 @@ public external interface ForeignFetchResponse {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ForeignFetchResponse(response: Response?, origin: String? = undefined, headers: Array<String>? = undefined): ForeignFetchResponse {
|
||||
val o = js("({})")
|
||||
|
||||
o["response"] = response
|
||||
o["origin"] = origin
|
||||
o["headers"] = headers
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -341,6 +358,13 @@ public external open class ExtendableMessageEvent(type: String, eventInitDict: E
|
||||
open val lastEventId: String
|
||||
open val source: UnionClientOrMessagePortOrServiceWorker?
|
||||
open val ports: Array<out MessagePort>?
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface ExtendableMessageEventInit : ExtendableEventInit {
|
||||
@@ -364,7 +388,6 @@ public external interface ExtendableMessageEventInit : ExtendableEventInit {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ExtendableMessageEventInit(data: Any? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionClientOrMessagePortOrServiceWorker? = undefined, ports: Array<MessagePort>? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableMessageEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["data"] = data
|
||||
o["origin"] = origin
|
||||
o["lastEventId"] = lastEventId
|
||||
@@ -373,7 +396,6 @@ public inline fun ExtendableMessageEventInit(data: Any? = undefined, origin: Str
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -382,12 +404,12 @@ public inline fun ExtendableMessageEventInit(data: Any? = undefined, origin: Str
|
||||
*/
|
||||
public external abstract class Cache {
|
||||
fun match(request: dynamic, options: CacheQueryOptions = definedExternally): Promise<Any?>
|
||||
fun matchAll(request: dynamic = definedExternally, options: CacheQueryOptions = definedExternally): Promise<dynamic>
|
||||
fun matchAll(request: dynamic = definedExternally, options: CacheQueryOptions = definedExternally): Promise<Array<Response>>
|
||||
fun add(request: dynamic): Promise<Unit>
|
||||
fun addAll(requests: Array<dynamic>): Promise<Unit>
|
||||
fun put(request: dynamic, response: Response): Promise<Unit>
|
||||
fun delete(request: dynamic, options: CacheQueryOptions = definedExternally): Promise<Boolean>
|
||||
fun keys(request: dynamic = definedExternally, options: CacheQueryOptions = definedExternally): Promise<dynamic>
|
||||
fun keys(request: dynamic = definedExternally, options: CacheQueryOptions = definedExternally): Promise<Array<Request>>
|
||||
}
|
||||
|
||||
public external interface CacheQueryOptions {
|
||||
@@ -408,12 +430,10 @@ public external interface CacheQueryOptions {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun CacheQueryOptions(ignoreSearch: Boolean? = false, ignoreMethod: Boolean? = false, ignoreVary: Boolean? = false, cacheName: String? = undefined): CacheQueryOptions {
|
||||
val o = js("({})")
|
||||
|
||||
o["ignoreSearch"] = ignoreSearch
|
||||
o["ignoreMethod"] = ignoreMethod
|
||||
o["ignoreVary"] = ignoreVary
|
||||
o["cacheName"] = cacheName
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -435,12 +455,10 @@ public external interface CacheBatchOperation {
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun CacheBatchOperation(type: String? = undefined, request: Request? = undefined, response: Response? = undefined, options: CacheQueryOptions? = undefined): CacheBatchOperation {
|
||||
val o = js("({})")
|
||||
|
||||
o["type"] = type
|
||||
o["request"] = request
|
||||
o["response"] = response
|
||||
o["options"] = options
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -452,40 +470,62 @@ public external abstract class CacheStorage {
|
||||
fun has(cacheName: String): Promise<Boolean>
|
||||
fun open(cacheName: String): Promise<Cache>
|
||||
fun delete(cacheName: String): Promise<Boolean>
|
||||
fun keys(): Promise<dynamic>
|
||||
fun keys(): Promise<Array<String>>
|
||||
}
|
||||
|
||||
public external open class FunctionalEvent : ExtendableEvent {
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external @marker interface UnionClientOrMessagePortOrServiceWorker {
|
||||
}
|
||||
public external interface UnionMessagePortOrServiceWorker
|
||||
|
||||
public external interface UnionClientOrMessagePortOrServiceWorker
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface ServiceWorkerState {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val ServiceWorkerState.Companion.INSTALLING: ServiceWorkerState get() = "installing".asDynamic().unsafeCast<ServiceWorkerState>()
|
||||
|
||||
public inline val ServiceWorkerState.Companion.INSTALLED: ServiceWorkerState get() = "installed".asDynamic().unsafeCast<ServiceWorkerState>()
|
||||
|
||||
public inline val ServiceWorkerState.Companion.ACTIVATING: ServiceWorkerState get() = "activating".asDynamic().unsafeCast<ServiceWorkerState>()
|
||||
|
||||
public inline val ServiceWorkerState.Companion.ACTIVATED: ServiceWorkerState get() = "activated".asDynamic().unsafeCast<ServiceWorkerState>()
|
||||
|
||||
public inline val ServiceWorkerState.Companion.REDUNDANT: ServiceWorkerState get() = "redundant".asDynamic().unsafeCast<ServiceWorkerState>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface FrameType {
|
||||
companion object
|
||||
}
|
||||
|
||||
public inline val FrameType.Companion.AUXILIARY: FrameType get() = "auxiliary".asDynamic().unsafeCast<FrameType>()
|
||||
|
||||
public inline val FrameType.Companion.TOP_LEVEL: FrameType get() = "top-level".asDynamic().unsafeCast<FrameType>()
|
||||
|
||||
public inline val FrameType.Companion.NESTED: FrameType get() = "nested".asDynamic().unsafeCast<FrameType>()
|
||||
|
||||
public inline val FrameType.Companion.NONE: FrameType get() = "none".asDynamic().unsafeCast<FrameType>()
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface ClientType {
|
||||
companion object
|
||||
}
|
||||
public inline val ClientType.Companion.WINDOW: ClientType get() = "window".asDynamic().unsafeCast<ClientType>()
|
||||
public inline val ClientType.Companion.WORKER: ClientType get() = "worker".asDynamic().unsafeCast<ClientType>()
|
||||
public inline val ClientType.Companion.SHAREDWORKER: ClientType get() = "sharedworker".asDynamic().unsafeCast<ClientType>()
|
||||
public inline val ClientType.Companion.ALL: ClientType get() = "all".asDynamic().unsafeCast<ClientType>()
|
||||
|
||||
public inline val ClientType.Companion.WINDOW: ClientType get() = "window".asDynamic().unsafeCast<ClientType>()
|
||||
|
||||
public inline val ClientType.Companion.WORKER: ClientType get() = "worker".asDynamic().unsafeCast<ClientType>()
|
||||
|
||||
public inline val ClientType.Companion.SHAREDWORKER: ClientType get() = "sharedworker".asDynamic().unsafeCast<ClientType>()
|
||||
|
||||
public inline val ClientType.Companion.ALL: ClientType get() = "all".asDynamic().unsafeCast<ClientType>()
|
||||
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||
// See libraries/tools/idl2k for details
|
||||
// See github.com/kotlin/dukat for details
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.xhr
|
||||
|
||||
import kotlin.js.*
|
||||
@@ -40,8 +39,7 @@ public external abstract class XMLHttpRequestEventTarget : EventTarget {
|
||||
open var onloadend: ((Event) -> dynamic)?
|
||||
}
|
||||
|
||||
public external abstract class XMLHttpRequestUpload : XMLHttpRequestEventTarget {
|
||||
}
|
||||
public external abstract class XMLHttpRequestUpload : XMLHttpRequestEventTarget
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [XMLHttpRequest](https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest) to Kotlin
|
||||
@@ -59,14 +57,14 @@ public external open class XMLHttpRequest : XMLHttpRequestEventTarget {
|
||||
open val response: Any?
|
||||
open val responseText: String
|
||||
open val responseXML: Document?
|
||||
fun open(method: String, url: String): Unit
|
||||
fun open(method: String, url: String, async: Boolean, username: String? = definedExternally, password: String? = definedExternally): Unit
|
||||
fun setRequestHeader(name: String, value: String): Unit
|
||||
fun send(body: dynamic = definedExternally): Unit
|
||||
fun abort(): Unit
|
||||
fun open(method: String, url: String)
|
||||
fun open(method: String, url: String, async: Boolean, username: String? = definedExternally, password: String? = definedExternally)
|
||||
fun setRequestHeader(name: String, value: String)
|
||||
fun send(body: dynamic = definedExternally)
|
||||
fun abort()
|
||||
fun getResponseHeader(name: String): String?
|
||||
fun getAllResponseHeaders(): String
|
||||
fun overrideMimeType(mime: String): Unit
|
||||
fun overrideMimeType(mime: String)
|
||||
|
||||
companion object {
|
||||
val UNSENT: Short
|
||||
@@ -81,14 +79,14 @@ public external open class XMLHttpRequest : XMLHttpRequestEventTarget {
|
||||
* Exposes the JavaScript [FormData](https://developer.mozilla.org/en/docs/Web/API/FormData) to Kotlin
|
||||
*/
|
||||
public external open class FormData(form: HTMLFormElement = definedExternally) {
|
||||
fun append(name: String, value: String): Unit
|
||||
fun append(name: String, value: Blob, filename: String = definedExternally): Unit
|
||||
fun delete(name: String): Unit
|
||||
fun append(name: String, value: String)
|
||||
fun append(name: String, value: Blob, filename: String = definedExternally)
|
||||
fun delete(name: String)
|
||||
fun get(name: String): dynamic
|
||||
fun getAll(name: String): Array<dynamic>
|
||||
fun has(name: String): Boolean
|
||||
fun set(name: String, value: String): Unit
|
||||
fun set(name: String, value: Blob, filename: String = definedExternally): Unit
|
||||
fun set(name: String, value: String)
|
||||
fun set(name: String, value: Blob, filename: String = definedExternally)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,44 +94,55 @@ public external open class FormData(form: HTMLFormElement = definedExternally) {
|
||||
*/
|
||||
public external open class ProgressEvent(type: String, eventInitDict: ProgressEventInit = definedExternally) : Event {
|
||||
open val lengthComputable: Boolean
|
||||
open val loaded: Int
|
||||
open val total: Int
|
||||
open val loaded: Number
|
||||
open val total: Number
|
||||
|
||||
companion object {
|
||||
val NONE: Short
|
||||
val CAPTURING_PHASE: Short
|
||||
val AT_TARGET: Short
|
||||
val BUBBLING_PHASE: Short
|
||||
}
|
||||
}
|
||||
|
||||
public external interface ProgressEventInit : EventInit {
|
||||
var lengthComputable: Boolean? /* = false */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var loaded: Int? /* = 0 */
|
||||
var loaded: Number? /* = 0 */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var total: Int? /* = 0 */
|
||||
var total: Number? /* = 0 */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ProgressEventInit(lengthComputable: Boolean? = false, loaded: Int? = 0, total: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ProgressEventInit {
|
||||
public inline fun ProgressEventInit(lengthComputable: Boolean? = false, loaded: Number? = 0, total: Number? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ProgressEventInit {
|
||||
val o = js("({})")
|
||||
|
||||
o["lengthComputable"] = lengthComputable
|
||||
o["loaded"] = loaded
|
||||
o["total"] = total
|
||||
o["bubbles"] = bubbles
|
||||
o["cancelable"] = cancelable
|
||||
o["composed"] = composed
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/* please, don't implement this interface! */
|
||||
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
public external interface XMLHttpRequestResponseType {
|
||||
companion object
|
||||
}
|
||||
public inline val XMLHttpRequestResponseType.Companion.EMPTY: XMLHttpRequestResponseType get() = "".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
public inline val XMLHttpRequestResponseType.Companion.ARRAYBUFFER: XMLHttpRequestResponseType get() = "arraybuffer".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
public inline val XMLHttpRequestResponseType.Companion.BLOB: XMLHttpRequestResponseType get() = "blob".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
public inline val XMLHttpRequestResponseType.Companion.DOCUMENT: XMLHttpRequestResponseType get() = "document".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
public inline val XMLHttpRequestResponseType.Companion.JSON: XMLHttpRequestResponseType get() = "json".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
public inline val XMLHttpRequestResponseType.Companion.TEXT: XMLHttpRequestResponseType get() = "text".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
|
||||
public inline val XMLHttpRequestResponseType.Companion.EMPTY: XMLHttpRequestResponseType get() = "".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
|
||||
public inline val XMLHttpRequestResponseType.Companion.ARRAYBUFFER: XMLHttpRequestResponseType get() = "arraybuffer".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
|
||||
public inline val XMLHttpRequestResponseType.Companion.BLOB: XMLHttpRequestResponseType get() = "blob".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
|
||||
public inline val XMLHttpRequestResponseType.Companion.DOCUMENT: XMLHttpRequestResponseType get() = "document".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
|
||||
public inline val XMLHttpRequestResponseType.Companion.JSON: XMLHttpRequestResponseType get() = "json".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
|
||||
public inline val XMLHttpRequestResponseType.Companion.TEXT: XMLHttpRequestResponseType get() = "text".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
|
||||
@@ -0,0 +1,26 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://kotlin.bintray.com/dukat")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlinStdlib())
|
||||
implementation("org.jetbrains.dukat:dukat:0.0.20.1")
|
||||
implementation("org.jsoup:jsoup:1.8.2")
|
||||
}
|
||||
|
||||
task("downloadIDL", JavaExec::class) {
|
||||
main = "org.jetbrains.kotlin.tools.dukat.DownloadKt"
|
||||
classpath = sourceSets["main"].runtimeClasspath
|
||||
dependsOn(":dukat:build")
|
||||
}
|
||||
|
||||
task("generateStdlibFromIDL", JavaExec::class) {
|
||||
main = "org.jetbrains.kotlin.tools.dukat.LaunchKt"
|
||||
classpath = sourceSets["main"].runtimeClasspath
|
||||
dependsOn(":dukat:build")
|
||||
systemProperty("line.separator", "\n")
|
||||
}
|
||||
+41
-16
@@ -1,22 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idl2k.dl
|
||||
package org.jetbrains.kotlin.tools.dukat
|
||||
|
||||
import org.jetbrains.idl2k.urls
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
import org.jsoup.parser.Tag
|
||||
@@ -45,7 +33,7 @@ fun main(args: Array<String>) {
|
||||
val pkg = e.value.first().second
|
||||
|
||||
File(dir, fileName).bufferedWriter().use { w ->
|
||||
w.appendln("namespace $pkg;")
|
||||
w.appendln("package $pkg;")
|
||||
w.appendln()
|
||||
w.appendln()
|
||||
|
||||
@@ -104,3 +92,40 @@ private fun extractIDLText(rawContent: String, out: Appendable) {
|
||||
soup.select("code.idl-code").attachTo(out)
|
||||
soup.select("spec-idl").attachTo(out)
|
||||
}
|
||||
|
||||
private val urls = listOf(
|
||||
"https://raw.githubusercontent.com/whatwg/html-mirror/master/source" to "org.w3c.dom",
|
||||
"https://html.spec.whatwg.org/" to "org.w3c.dom",
|
||||
"https://raw.githubusercontent.com/whatwg/dom/master/dom.html" to "org.w3c.dom",
|
||||
"https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/animation-timing/" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/geometry-1/" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/cssom-view/" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/uievents/" to "org.w3c.dom.events",
|
||||
"https://www.w3.org/TR/pointerevents/" to "org.w3c.dom.pointerevents",
|
||||
|
||||
"https://drafts.csswg.org/cssom/" to "org.w3c.dom.css",
|
||||
"https://www.w3.org/TR/css-masking-1/" to "org.w3c.css.masking",
|
||||
|
||||
"https://w3c.github.io/mediacapture-main/" to "org.w3c.dom.mediacapture",
|
||||
"https://www.w3.org/TR/DOM-Parsing/" to "org.w3c.dom.parsing",
|
||||
"https://w3c.github.io/clipboard-apis" to "org.w3c.dom.clipboard",
|
||||
"https://raw.githubusercontent.com/whatwg/url/master/url.html" to "org.w3c.dom.url",
|
||||
|
||||
"https://www.w3.org/TR/SVG2/single-page.html" to "org.w3c.dom.svg",
|
||||
"https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl" to "org.khronos.webgl",
|
||||
"https://www.khronos.org/registry/typedarray/specs/latest/typedarray.idl" to "org.khronos.webgl",
|
||||
|
||||
"https://raw.githubusercontent.com/whatwg/xhr/master/Overview.src.html" to "org.w3c.xhr",
|
||||
"https://raw.githubusercontent.com/whatwg/fetch/master/Overview.src.html" to "org.w3c.fetch",
|
||||
"https://raw.githubusercontent.com/w3c/FileAPI/gh-pages/index.html" to "org.w3c.files",
|
||||
|
||||
"https://raw.githubusercontent.com/whatwg/notifications/master/notifications.html" to "org.w3c.notifications",
|
||||
"https://raw.githubusercontent.com/whatwg/fullscreen/master/fullscreen.html" to "org.w3c.fullscreen",
|
||||
"https://www.w3.org/TR/vibration/" to "org.w3c.vibration",
|
||||
|
||||
"https://www.w3.org/TR/hr-time/" to "org.w3c.performance",
|
||||
"https://www.w3.org/TR/2012/REC-navigation-timing-20121217/" to "org.w3c.performance",
|
||||
|
||||
"https://w3c.github.io/ServiceWorker/" to "org.w3c.workers"
|
||||
)
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.tools.dukat
|
||||
|
||||
import org.xml.sax.InputSource
|
||||
import java.io.File
|
||||
import javax.xml.xpath.XPathFactory
|
||||
|
||||
private val LINE_SEPARATOR = System.lineSeparator()
|
||||
|
||||
private fun readCopyrightNoticeFromProfile(copyrightProfile: File): String {
|
||||
val template = copyrightProfile.reader().use { reader ->
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"/component/copyright/option[@name='notice']/@value",
|
||||
InputSource(reader)
|
||||
)
|
||||
}
|
||||
val yearTemplate = "$today.year"
|
||||
val year = java.time.LocalDate.now().year.toString()
|
||||
assert(yearTemplate in template)
|
||||
|
||||
return template.replace(yearTemplate, year).lines()
|
||||
.joinToString("", prefix = "/*$LINE_SEPARATOR", postfix = " */$LINE_SEPARATOR") {
|
||||
" * $it$LINE_SEPARATOR"
|
||||
}
|
||||
}
|
||||
|
||||
private fun getHeader(): String {
|
||||
val copyrightNotice = readCopyrightNoticeFromProfile(
|
||||
File("../../../.idea/copyright/apache.xml")
|
||||
)
|
||||
val note = "// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!$LINE_SEPARATOR" +
|
||||
"// See github.com/kotlin/dukat for details$LINE_SEPARATOR"
|
||||
return copyrightNotice + LINE_SEPARATOR + note + LINE_SEPARATOR
|
||||
}
|
||||
|
||||
fun main() {
|
||||
|
||||
val input = "../../stdlib/js/idl/org.w3c.dom.idl"
|
||||
val outputDirectory = "../../stdlib/js/src/org.w3c/"
|
||||
|
||||
org.jetbrains.dukat.cli.main("-d", outputDirectory, input)
|
||||
|
||||
for (file in File(outputDirectory).listFiles { name ->
|
||||
name.extension == "kt"
|
||||
}.orEmpty()) {
|
||||
file.writeBytes((getHeader() + file.readText()).toByteArray())
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
buildscript {
|
||||
ext.antlr4_version = '4.7.1'
|
||||
}
|
||||
|
||||
apply plugin: "antlr"
|
||||
apply plugin: "kotlin"
|
||||
|
||||
if (project.findProperty("idl2k.deploy")?.toBoolean()) {
|
||||
configurePublishing(project)
|
||||
}
|
||||
|
||||
project.sourceSets.main.antlr.srcDirs = ["src/main/antlr4"]
|
||||
|
||||
dependencies {
|
||||
antlr "org.antlr:antlr4:$antlr4_version"
|
||||
implementation "org.antlr:antlr4-runtime:$antlr4_version"
|
||||
implementation kotlinStdlib()
|
||||
implementation "org.jsoup:jsoup:1.8.2"
|
||||
|
||||
testImplementation "junit:junit:4.12"
|
||||
}
|
||||
|
||||
sourceSets.main.kotlin.srcDirs += file("$buildDir/generated-src/antlr/main/")
|
||||
|
||||
generateGrammarSource {
|
||||
arguments += ["-visitor", "-long-messages", "-package", "org.antlr.webidl"]
|
||||
}
|
||||
|
||||
|
||||
compileKotlin.dependsOn generateGrammarSource
|
||||
compileTestKotlin.dependsOn generateTestGrammarSource
|
||||
|
||||
task downloadIDL(type: JavaExec) {
|
||||
main = "org.jetbrains.idl2k.dl.DownloadKt"
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
|
||||
task idl2k(type: JavaExec) {
|
||||
main = "org.jetbrains.idl2k.MainKt"
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
@@ -1,595 +0,0 @@
|
||||
/*
|
||||
BSD License
|
||||
|
||||
Copyright (c) 2013, 2015 Rainer Schuster
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of Rainer Schuster nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Web IDL grammar derived from:
|
||||
|
||||
http://heycam.github.io/webidl/
|
||||
|
||||
Web IDL (Second Edition)
|
||||
W3C Editor's Draft 13 November 2014
|
||||
*/
|
||||
grammar WebIDL;
|
||||
|
||||
// Note: Replaced keywords: const, default, enum, interface, null.
|
||||
// Note: Added "wrapper" rule webIDL with EOF token.
|
||||
|
||||
webIDL
|
||||
: namespace? definitions EOF
|
||||
;
|
||||
|
||||
namespaceScope
|
||||
: '*' | 'cpp' | 'java' | 'py' | 'perl' | 'rb' | 'cocoa' | 'csharp'
|
||||
;
|
||||
|
||||
namespaceRest
|
||||
: IDENTIFIER_WEBIDL ( '.' IDENTIFIER_WEBIDL )*
|
||||
;
|
||||
|
||||
namespace
|
||||
: 'namespace' namespaceScope? namespaceRest ';';
|
||||
|
||||
definitions
|
||||
: extendedAttributeList definition definitions
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
definition
|
||||
: callbackOrInterface
|
||||
| partial
|
||||
| dictionary
|
||||
| enum_
|
||||
| typedef
|
||||
| exception_
|
||||
| const_
|
||||
| module
|
||||
| implementsStatement
|
||||
;
|
||||
|
||||
module
|
||||
: 'module' IDENTIFIER_WEBIDL '{' definitions '}' ';'
|
||||
;
|
||||
|
||||
callbackOrInterface
|
||||
: 'callback' callbackRestOrInterface
|
||||
| interface_
|
||||
;
|
||||
|
||||
exception_
|
||||
: 'exception' IDENTIFIER_WEBIDL inheritance '{' dictionaryMembers '}' ';'
|
||||
;
|
||||
|
||||
callbackRestOrInterface
|
||||
: callbackRest
|
||||
| interface_
|
||||
;
|
||||
|
||||
interface_
|
||||
: 'interface' IDENTIFIER_WEBIDL inheritance '{' interfaceMembers '}' ';'
|
||||
;
|
||||
|
||||
partial
|
||||
: 'partial' partialDefinition
|
||||
;
|
||||
|
||||
partialDefinition
|
||||
: partialInterface
|
||||
| partialDictionary
|
||||
;
|
||||
|
||||
partialInterface
|
||||
: 'interface' IDENTIFIER_WEBIDL '{' interfaceMembers '}' ';'
|
||||
;
|
||||
|
||||
interfaceMembers
|
||||
: extendedAttributeList interfaceMember interfaceMembers
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
interfaceMember
|
||||
: const_
|
||||
| operation
|
||||
| serializer
|
||||
| stringifier
|
||||
| staticMember
|
||||
| iterable
|
||||
| readonlyMember
|
||||
| readWriteAttribute
|
||||
| readWriteMaplike
|
||||
| readWriteSetlike
|
||||
| typedef
|
||||
;
|
||||
|
||||
dictionary
|
||||
: 'dictionary' IDENTIFIER_WEBIDL inheritance '{' dictionaryMembers '}' ';'
|
||||
;
|
||||
|
||||
dictionaryMembers
|
||||
: extendedAttributeList dictionaryMember dictionaryMembers
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
dictionaryMember
|
||||
: required type IDENTIFIER_WEBIDL default_ ';'
|
||||
;
|
||||
|
||||
required
|
||||
: 'required'
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
partialDictionary
|
||||
: 'dictionary' IDENTIFIER_WEBIDL '{' dictionaryMembers '}' ';'
|
||||
;
|
||||
|
||||
default_
|
||||
: '=' defaultValue
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
defaultValue
|
||||
: constValue
|
||||
| STRING_WEBIDL
|
||||
| '[' ']'
|
||||
;
|
||||
|
||||
inheritance
|
||||
: ':' IDENTIFIER_WEBIDL ( ',' IDENTIFIER_WEBIDL )*
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
enum_
|
||||
: 'enum' IDENTIFIER_WEBIDL '{' enumValueList '}' ';'
|
||||
;
|
||||
|
||||
enumValueList
|
||||
: STRING_WEBIDL enumValueListComma
|
||||
;
|
||||
|
||||
enumValueListComma
|
||||
: ',' enumValueListString
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
enumValueListString
|
||||
: STRING_WEBIDL enumValueListComma
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
callbackRest
|
||||
: IDENTIFIER_WEBIDL '=' returnType '(' argumentList ')' ';'
|
||||
;
|
||||
|
||||
typedef
|
||||
: 'typedef' type IDENTIFIER_WEBIDL ';'
|
||||
;
|
||||
|
||||
implementsStatement
|
||||
: IDENTIFIER_WEBIDL 'implements' IDENTIFIER_WEBIDL ';'
|
||||
;
|
||||
|
||||
const_
|
||||
: 'const' constType IDENTIFIER_WEBIDL '=' constValue ';'
|
||||
;
|
||||
|
||||
constValue
|
||||
: booleanLiteral
|
||||
| floatLiteral
|
||||
| INTEGER_WEBIDL
|
||||
| 'null'
|
||||
;
|
||||
|
||||
booleanLiteral
|
||||
: 'true'
|
||||
| 'false'
|
||||
;
|
||||
|
||||
floatLiteral
|
||||
: FLOAT_WEBIDL
|
||||
| '-Infinity'
|
||||
| 'Infinity'
|
||||
| 'NaN'
|
||||
;
|
||||
|
||||
serializer
|
||||
: 'serializer' serializerRest
|
||||
;
|
||||
|
||||
serializerRest
|
||||
: operationRest
|
||||
| '=' serializationPattern
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
serializationPattern
|
||||
: '{' serializationPatternMap '}'
|
||||
| '[' serializationPatternList ']'
|
||||
| IDENTIFIER_WEBIDL
|
||||
;
|
||||
|
||||
serializationPatternMap
|
||||
: 'getter'
|
||||
| 'inherit' identifiers
|
||||
| IDENTIFIER_WEBIDL identifiers
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
serializationPatternList
|
||||
: 'getter'
|
||||
| IDENTIFIER_WEBIDL identifiers
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
stringifier
|
||||
: 'stringifier' stringifierRest
|
||||
;
|
||||
|
||||
stringifierRest
|
||||
: readOnly attributeRest
|
||||
| returnType operationRest
|
||||
| ';'
|
||||
;
|
||||
|
||||
staticMember
|
||||
: 'static' staticMemberRest
|
||||
;
|
||||
|
||||
staticMemberRest
|
||||
: readOnly attributeRest
|
||||
| returnType operationRest
|
||||
;
|
||||
|
||||
readonlyMember
|
||||
: 'readonly' readonlyMemberRest
|
||||
;
|
||||
|
||||
readonlyMemberRest
|
||||
: attributeRest
|
||||
| maplikeRest
|
||||
| setlikeRest
|
||||
;
|
||||
|
||||
readWriteAttribute
|
||||
: 'inherit' readOnly attributeRest
|
||||
| attributeRest
|
||||
;
|
||||
|
||||
attributeRest
|
||||
: 'attribute' type (IDENTIFIER_WEBIDL | 'required') attributeAnnotations* ';'
|
||||
;
|
||||
|
||||
attributeAnnotations
|
||||
: IDENTIFIER_WEBIDL ( '(' type (',' type)* ')' )?
|
||||
;
|
||||
|
||||
inherit
|
||||
: 'inherit'
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
readOnly
|
||||
: 'readonly'
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
operation
|
||||
: returnType operationRest
|
||||
| specialOperation
|
||||
;
|
||||
|
||||
specialOperation
|
||||
: special specials returnType operationRest
|
||||
;
|
||||
|
||||
specials
|
||||
: special specials
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
special
|
||||
: 'getter'
|
||||
| 'setter'
|
||||
| 'creator'
|
||||
| 'deleter'
|
||||
| 'legacycaller'
|
||||
;
|
||||
|
||||
operationRest
|
||||
: optionalIdentifier '(' argumentList ')' attributeAnnotations* ';'
|
||||
;
|
||||
|
||||
optionalIdentifier
|
||||
: IDENTIFIER_WEBIDL
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
argumentList
|
||||
: argument arguments
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
arguments
|
||||
: ',' argument arguments
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
argument
|
||||
: extendedAttributeList optionalOrRequiredArgument
|
||||
;
|
||||
|
||||
optionalOrRequiredArgument
|
||||
: 'optional'? ('in'|'out')? type ellipsis argumentName default_
|
||||
;
|
||||
|
||||
argumentName
|
||||
: argumentNameKeyword
|
||||
| IDENTIFIER_WEBIDL
|
||||
;
|
||||
|
||||
ellipsis
|
||||
: '...'
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
iterable
|
||||
: 'iterable' '<' type optionalType '>' ';'
|
||||
| 'legacyiterable' '<' type '>' ';'
|
||||
;
|
||||
|
||||
optionalType
|
||||
: ',' type
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
readWriteMaplike
|
||||
: maplikeRest
|
||||
;
|
||||
|
||||
readWriteSetlike
|
||||
: setlikeRest
|
||||
;
|
||||
|
||||
maplikeRest
|
||||
: 'maplike' '<' type ',' type '>' ';'
|
||||
;
|
||||
|
||||
setlikeRest
|
||||
: 'setlike' '<' type '>' ';'
|
||||
;
|
||||
|
||||
extendedAttributeList
|
||||
: '[' extendedAttribute extendedAttributes ']'
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
extendedAttributes
|
||||
: ',' extendedAttribute extendedAttributes
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
extendedAttribute
|
||||
: extendedAttributeNamePart? IDENTIFIER_WEBIDL ('(' argumentList ')')?
|
||||
| extendedAttributeNamePart? IDENTIFIER_WEBIDL? '(' argumentList ')'
|
||||
| extendedAttributeNamePart? IDENTIFIER_WEBIDL? '(' identifierList ')'
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
extendedAttributeNamePart
|
||||
: IDENTIFIER_WEBIDL '='
|
||||
;
|
||||
|
||||
argumentNameKeyword
|
||||
: 'attribute'
|
||||
| 'callback'
|
||||
| 'const'
|
||||
| 'creator'
|
||||
| 'deleter'
|
||||
| 'dictionary'
|
||||
| 'enum'
|
||||
| 'getter'
|
||||
| 'implements'
|
||||
| 'inherit'
|
||||
| 'interface'
|
||||
| 'iterable'
|
||||
| 'legacycaller'
|
||||
| 'legacyiterable'
|
||||
| 'maplike'
|
||||
| 'partial'
|
||||
| 'required'
|
||||
| 'serializer'
|
||||
| 'setlike'
|
||||
| 'setter'
|
||||
| 'static'
|
||||
| 'stringifier'
|
||||
| 'typedef'
|
||||
| 'unrestricted'
|
||||
| 'namespace'
|
||||
;
|
||||
|
||||
type
|
||||
: singleType
|
||||
| unionType typeSuffix
|
||||
;
|
||||
|
||||
singleType
|
||||
: nonAnyType
|
||||
| 'any' typeSuffixStartingWithArray
|
||||
;
|
||||
|
||||
unionType
|
||||
: '(' unionMemberType ( 'or' unionMemberType )* ')'
|
||||
;
|
||||
|
||||
unionMemberType
|
||||
: nonAnyType
|
||||
| unionType typeSuffix
|
||||
| 'any' '[' ']' typeSuffix
|
||||
;
|
||||
|
||||
unionMemberTypes
|
||||
: 'or' unionMemberType unionMemberTypes
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
nonAnyType
|
||||
: primitiveType typeSuffix
|
||||
| promiseType null_
|
||||
| 'ByteString' typeSuffix
|
||||
| 'DOMString' typeSuffix
|
||||
| 'USVString' typeSuffix
|
||||
| IDENTIFIER_WEBIDL typeSuffix
|
||||
| sequenceType null_
|
||||
| 'object' typeSuffix
|
||||
| 'Date' typeSuffix
|
||||
| 'RegExp' typeSuffix
|
||||
| 'DOMException' typeSuffix
|
||||
| IDENTIFIER_WEBIDL '<' type '>' null_
|
||||
;
|
||||
|
||||
constType
|
||||
: primitiveType null_
|
||||
| IDENTIFIER_WEBIDL null_
|
||||
;
|
||||
|
||||
primitiveType
|
||||
: unsignedIntegerType
|
||||
| unrestrictedFloatType
|
||||
| 'boolean'
|
||||
| 'byte'
|
||||
| 'octet'
|
||||
;
|
||||
|
||||
unrestrictedFloatType
|
||||
: 'unrestricted' floatType
|
||||
| floatType
|
||||
;
|
||||
|
||||
floatType
|
||||
: 'float'
|
||||
| 'double'
|
||||
;
|
||||
|
||||
unsignedIntegerType
|
||||
: 'unsigned' integerType
|
||||
| integerType
|
||||
;
|
||||
|
||||
integerType
|
||||
: 'short'
|
||||
| 'long'+
|
||||
;
|
||||
|
||||
sequenceType
|
||||
: 'sequence' '<' type '>'
|
||||
| 'FrozenArray' '<' type '>'
|
||||
;
|
||||
|
||||
promiseType
|
||||
: 'Promise' '<' returnType '>'
|
||||
;
|
||||
|
||||
typeSuffix
|
||||
: '[' ']' typeSuffix
|
||||
| '?' typeSuffixStartingWithArray
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
typeSuffixStartingWithArray
|
||||
: '[' ']' typeSuffix
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
null_
|
||||
: '?'
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
returnType
|
||||
: type
|
||||
| 'void'
|
||||
;
|
||||
|
||||
identifierList
|
||||
: IDENTIFIER_WEBIDL identifiers
|
||||
;
|
||||
|
||||
identifiers
|
||||
: ',' IDENTIFIER_WEBIDL identifiers
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
extendedAttributeNoArgs
|
||||
: IDENTIFIER_WEBIDL
|
||||
;
|
||||
|
||||
extendedAttributeArgList
|
||||
: IDENTIFIER_WEBIDL '(' argumentList ')'
|
||||
;
|
||||
|
||||
extendedAttributeIdent
|
||||
: IDENTIFIER_WEBIDL '=' IDENTIFIER_WEBIDL
|
||||
;
|
||||
|
||||
extendedAttributeIdentList
|
||||
: IDENTIFIER_WEBIDL '=' '(' identifierList ')'
|
||||
;
|
||||
|
||||
extendedAttributeNamedArgList
|
||||
: IDENTIFIER_WEBIDL '=' IDENTIFIER_WEBIDL '(' argumentList ')'
|
||||
;
|
||||
|
||||
|
||||
INTEGER_WEBIDL
|
||||
: '-'?('0'([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)
|
||||
;
|
||||
|
||||
FLOAT_WEBIDL
|
||||
: '-'?(([0-9]+'.'[0-9]*|[0-9]*'.'[0-9]+)([Ee][+\-]?[0-9]+)?|[0-9]+[Ee][+\-]?[0-9]+)
|
||||
;
|
||||
|
||||
IDENTIFIER_WEBIDL
|
||||
: [A-Z_a-z][0-9A-Z_a-z]*
|
||||
;
|
||||
|
||||
STRING_WEBIDL
|
||||
: '"' ~["]* '"'
|
||||
;
|
||||
|
||||
WHITESPACE_WEBIDL
|
||||
: [\t\n\r ]+ -> channel(HIDDEN)
|
||||
;
|
||||
|
||||
COMMENT_WEBIDL
|
||||
: ('//'~[\n\r]*|'/*'(.|'\n')*?'*/')+ -> channel(HIDDEN)
|
||||
; // Note: '/''/'~[\n\r]* instead of '/''/'.* (non-greedy because of wildcard).
|
||||
|
||||
OTHER_WEBIDL
|
||||
: ~[\t\n\r 0-9A-Z_a-z]
|
||||
;
|
||||
@@ -1,124 +0,0 @@
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import org.antlr.v4.runtime.CharStreams
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.net.URL
|
||||
import java.util.ArrayList
|
||||
import java.util.LinkedHashMap
|
||||
|
||||
class BuildWebIdl(val mdnCacheFile: File, val srcDir: File) {
|
||||
val repositoryPre = loadPreliminaryRepository()
|
||||
|
||||
fun loadPreliminaryRepository(): Repository {
|
||||
if (!srcDir.exists()) {
|
||||
System.err?.println("Directory ${srcDir.absolutePath} doesn't exist")
|
||||
System.exit(1)
|
||||
}
|
||||
|
||||
return srcDir.walkTopDown().filter { it.isDirectory || it.extension == "idl" }.asSequence().filter { it.isFile }.toList()
|
||||
.sortedBy { it.absolutePath }.fold(Repository(emptyMap(), emptyMap(), emptyMap(), emptyMap())) { acc, e ->
|
||||
System.err.flush()
|
||||
System.err.println("Parsing ${e.absolutePath}")
|
||||
val fileRepository = parseIDL(CharStreams.fromFileName(e.absolutePath, Charsets.UTF_8))
|
||||
|
||||
Repository(
|
||||
interfaces = acc.interfaces.mergeReduce(fileRepository.interfaces, ::merge),
|
||||
typeDefs = acc.typeDefs + fileRepository.typeDefs,
|
||||
externals = acc.externals.merge(fileRepository.externals),
|
||||
enums = acc.enums + fileRepository.enums
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
println("Prepare...")
|
||||
}
|
||||
|
||||
val repository =
|
||||
repositoryPre.copy(typeDefs = repositoryPre.typeDefs.mapValues { it.value.copy(mapType(repositoryPre, it.value.types)) })
|
||||
|
||||
val definitions = implementInterfaces(mapDefinitions(repository, repository.interfaces.values).map {
|
||||
if (it.name in relocations) {
|
||||
// we need this to get interfaces listed in the relocations in valid package
|
||||
// to keep compatibility with DOM Java API
|
||||
it.copy(namespace = relocations[it.name]!!)
|
||||
} else {
|
||||
it
|
||||
}
|
||||
})
|
||||
|
||||
val unions = generateUnions(definitions, repository.typeDefs.values)
|
||||
|
||||
val allPackages = (definitions.asSequence().map { it.namespace } + repository.enums.values.map { it.namespace }).distinct().sorted()
|
||||
|
||||
val mdnCache by lazy { updateMdnCache() }
|
||||
|
||||
fun updateMdnCache(): MDNDocumentationCache {
|
||||
println("Processing MDN")
|
||||
|
||||
val oldMdnCache = if (mdnCacheFile.canRead()) MDNDocumentationCache.read(mdnCacheFile) else MDNDocumentationCache.Empty
|
||||
val newMdnCacheExisting = HashSet(oldMdnCache.existing)
|
||||
val newMdnCacheNonExisting = HashSet(oldMdnCache.nonExisting)
|
||||
|
||||
for (iface in definitions) {
|
||||
val url = "https://developer.mozilla.org/en/docs/Web/API/${iface.name}"
|
||||
val addUrl = when (oldMdnCache.checkInCache(url)) {
|
||||
true -> true
|
||||
false -> false
|
||||
else -> try {
|
||||
val text = URL(url).openStream().reader().use { it.readText() }
|
||||
text.contains(iface.name, ignoreCase = true)
|
||||
} catch (ignore: IOException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
if (addUrl)
|
||||
newMdnCacheExisting.add(url)
|
||||
else
|
||||
newMdnCacheNonExisting.add(url)
|
||||
}
|
||||
|
||||
val mdnCache = MDNDocumentationCache(newMdnCacheExisting, newMdnCacheNonExisting)
|
||||
MDNDocumentationCache.writeTo(mdnCache, mdnCacheFile)
|
||||
|
||||
return mdnCache
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal fun <K, V> Map<K, List<V>>.reduceValues(reduce: (V, V) -> V = { _, b -> b }): Map<K, V> = mapValues { it.value.reduce(reduce) }
|
||||
|
||||
internal fun <K, V> Map<K, V>.mergeReduce(other: Map<K, V>, reduce: (V, V) -> V = { _, b -> b }): Map<K, V> {
|
||||
val result = LinkedHashMap<K, V>(this.size + other.size)
|
||||
result.putAll(this)
|
||||
other.forEach { e ->
|
||||
val existing = result[e.key]
|
||||
|
||||
if (existing == null) {
|
||||
result[e.key] = e.value
|
||||
} else {
|
||||
result[e.key] = reduce(e.value, existing)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
internal fun <K, V> Map<K, List<V>>.merge(other: Map<K, List<V>>): Map<K, List<V>> {
|
||||
val result = LinkedHashMap<K, MutableList<V>>(size + other.size)
|
||||
this.forEach {
|
||||
result[it.key] = ArrayList(it.value)
|
||||
}
|
||||
other.forEach {
|
||||
val list = result[it.key]
|
||||
if (list == null) {
|
||||
result[it.key] = ArrayList(it.value)
|
||||
} else {
|
||||
list.addAll(it.value)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
val urls = listOf(
|
||||
"https://raw.githubusercontent.com/whatwg/html-mirror/master/source" to "org.w3c.dom",
|
||||
"https://html.spec.whatwg.org/" to "org.w3c.dom",
|
||||
"https://raw.githubusercontent.com/whatwg/dom/master/dom.html" to "org.w3c.dom",
|
||||
"https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/animation-timing/" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/geometry-1/" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/cssom-view/" to "org.w3c.dom",
|
||||
"https://www.w3.org/TR/uievents/" to "org.w3c.dom.events",
|
||||
"https://www.w3.org/TR/pointerevents/" to "org.w3c.dom.pointerevents",
|
||||
|
||||
"https://drafts.csswg.org/cssom/" to "org.w3c.dom.css",
|
||||
"https://www.w3.org/TR/css-masking-1/" to "org.w3c.css.masking",
|
||||
|
||||
"https://w3c.github.io/mediacapture-main/" to "org.w3c.dom.mediacapture",
|
||||
"https://www.w3.org/TR/DOM-Parsing/" to "org.w3c.dom.parsing",
|
||||
"https://w3c.github.io/clipboard-apis" to "org.w3c.dom.clipboard",
|
||||
"https://raw.githubusercontent.com/whatwg/url/master/url.html" to "org.w3c.dom.url",
|
||||
|
||||
"https://www.w3.org/TR/SVG2/single-page.html" to "org.w3c.dom.svg",
|
||||
"https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl" to "org.khronos.webgl",
|
||||
"https://www.khronos.org/registry/typedarray/specs/latest/typedarray.idl" to "org.khronos.webgl",
|
||||
|
||||
"https://raw.githubusercontent.com/whatwg/xhr/master/Overview.src.html" to "org.w3c.xhr",
|
||||
"https://raw.githubusercontent.com/whatwg/fetch/master/Overview.src.html" to "org.w3c.fetch",
|
||||
"https://raw.githubusercontent.com/w3c/FileAPI/gh-pages/index.html" to "org.w3c.files",
|
||||
|
||||
"https://raw.githubusercontent.com/whatwg/notifications/master/notifications.html" to "org.w3c.notifications",
|
||||
"https://raw.githubusercontent.com/whatwg/fullscreen/master/fullscreen.html" to "org.w3c.fullscreen",
|
||||
"https://www.w3.org/TR/vibration/" to "org.w3c.vibration",
|
||||
|
||||
"https://www.w3.org/TR/hr-time/" to "org.w3c.performance",
|
||||
"https://www.w3.org/TR/2012/REC-navigation-timing-20121217/" to "org.w3c.performance",
|
||||
|
||||
"https://w3c.github.io/ServiceWorker/" to "org.w3c.workers"
|
||||
)
|
||||
|
||||
val relocations = mapOf(
|
||||
"Event" to "org.w3c.dom.events",
|
||||
"EventTarget" to "org.w3c.dom.events",
|
||||
"EventListener" to "org.w3c.dom.events"
|
||||
)
|
||||
|
||||
val commentOutDeclarations = setOf(
|
||||
"MouseEvent.screenX: Double", "MouseEvent.screenY: Double",
|
||||
"MouseEvent.clientX: Double", "MouseEvent.clientY: Double",
|
||||
"MouseEvent.x: Double", "MouseEvent.y: Double",
|
||||
|
||||
"HTMLAllCollection.namedItem",
|
||||
"HTMLAllCollection.get",
|
||||
|
||||
"HTMLFormControlsCollection.namedItem",
|
||||
"HTMLFormControlsCollection.get",
|
||||
|
||||
"HTMLPropertiesCollection.namedItem",
|
||||
"HTMLPropertiesCollection.get",
|
||||
|
||||
"SVGElement.id"
|
||||
)
|
||||
|
||||
val requiredArguments = setOf(
|
||||
"DOMPoint.constructor.point",
|
||||
"DOMQuad.constructor.rect"
|
||||
)
|
||||
|
||||
val inheritanceExclude = mapOf(
|
||||
"SVGAElement" to setOf("HTMLHyperlinkElementUtils")
|
||||
)
|
||||
|
||||
val kotlinBuiltinInterfaces = mapOf(
|
||||
"ItemArrayLike" to GenerateClass("ItemArrayLike", "org.w3c.dom", GenerateDefinitionKind.INTERFACE, emptyList(),
|
||||
memberAttributes = mutableListOf(GenerateAttribute("length", SimpleType("Int", false), null, false, AttributeKind.VAL, false, false, false, false)),
|
||||
memberFunctions = mutableListOf(GenerateFunction("item", DynamicType, listOf(
|
||||
GenerateAttribute("index", SimpleType("Int", false), null, false, AttributeKind.ARGUMENT, false, false, false, false)
|
||||
), NativeGetterOrSetter.NONE, false, false)),
|
||||
constants = emptyList(),
|
||||
generateBuilderFunction = false,
|
||||
primaryConstructor = null,
|
||||
secondaryConstructors = emptyList()
|
||||
)
|
||||
)
|
||||
|
||||
val eventSpecifierMapper = mapOf<String, String>(
|
||||
"onbeforeunload" to "BeforeUnloadEvent",
|
||||
|
||||
"ondrag" to "DragEvent",
|
||||
"ondragend" to "DragEvent",
|
||||
"ondragenter" to "DragEvent",
|
||||
"ondragexit" to "DragEvent",
|
||||
"ondragleave" to "DragEvent",
|
||||
"ondragover" to "DragEvent",
|
||||
"ondragstart" to "DragEvent",
|
||||
"ondrop" to "DragEvent",
|
||||
|
||||
"oncopy" to "ClipboardEvent",
|
||||
"oncut" to "ClipboardEvent",
|
||||
"onpaste" to "ClipboardEvent",
|
||||
|
||||
|
||||
"onfetch" to "FetchEvent",
|
||||
|
||||
"onblur" to "FocusEvent",
|
||||
"onfocus" to "FocusEvent",
|
||||
|
||||
"onhashchange" to "HashChangeEvent",
|
||||
|
||||
"oninput" to "InputEvent",
|
||||
|
||||
"onkeydown" to "KeyboardEvent",
|
||||
"onkeypress" to "KeyboardEvent",
|
||||
"onkeyup" to "KeyboardEvent",
|
||||
|
||||
"onmessage" to "MessageEvent",
|
||||
|
||||
"onclick" to "MouseEvent",
|
||||
"oncontextmenu" to "MouseEvent",
|
||||
"ondblclick" to "MouseEvent",
|
||||
"onmousedown" to "MouseEvent",
|
||||
"onmouseenter" to "MouseEvent",
|
||||
"onmouseleave" to "MouseEvent",
|
||||
"onmousemove" to "MouseEvent",
|
||||
"onmouseout" to "MouseEvent",
|
||||
"onmouseover" to "MouseEvent",
|
||||
"onmouseup" to "MouseEvent",
|
||||
|
||||
"onnotificationclick" to "NotificationEvent",
|
||||
"onnotificationclose" to "NotificationEvent",
|
||||
|
||||
"onpagehide" to "PageTransitionEvent",
|
||||
"onpageshow" to "PageTransitionEvent",
|
||||
|
||||
"ongotpointercapture" to "PointerEvent",
|
||||
"onlostpointercapture" to "PointerEvent",
|
||||
"onpointercancel" to "PointerEvent",
|
||||
"onpointerdown" to "PointerEvent",
|
||||
"onpointerenter" to "PointerEvent",
|
||||
"onpointerleave" to "PointerEvent",
|
||||
"onpointermove" to "PointerEvent",
|
||||
"onpointerout" to "PointerEvent",
|
||||
"onpointerover" to "PointerEvent",
|
||||
"onpointerup" to "PointerEvent",
|
||||
|
||||
"onpopstate" to "PopStateEvent",
|
||||
|
||||
"onloadstart" to "ProgressEvent",
|
||||
"onprogress" to "ProgressEvent",
|
||||
|
||||
"onunhandledrejection" to "PromiseRejectionEvent",
|
||||
|
||||
"onstorage" to "StorageEvent",
|
||||
|
||||
"onwheel" to "WheelEvent"
|
||||
)
|
||||
|
||||
|
||||
data class EventMapKey(val name: String, val context: String)
|
||||
|
||||
val eventSpecifierMapperWithContext = mapOf<EventMapKey, String>(
|
||||
EventMapKey("onaddtrack", "MediaStream") to "MediaStreamTrackEvent",
|
||||
EventMapKey("onremovetrack", "MediaStream") to "MediaStreamTrackEvent",
|
||||
|
||||
EventMapKey("onaddtrack", "AudioTrackList") to "TrackEvent",
|
||||
EventMapKey("onaddtrack", "TextTrackList") to "TrackEvent",
|
||||
EventMapKey("onaddtrack", "VideoTrackList") to "TrackEvent",
|
||||
EventMapKey("onremovetrack", "AudioTrackList") to "TrackEvent",
|
||||
EventMapKey("onremovetrack", "TextTrackList") to "TrackEvent",
|
||||
EventMapKey("onremovetrack", "VideoTrackList") to "TrackEvent"
|
||||
)
|
||||
@@ -1,368 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import org.jetbrains.idl2k.util.mapEnumConstant
|
||||
|
||||
private fun Operation.getterOrSetter() = this.attributes.map { it.call }.toSet().let { attributes ->
|
||||
when {
|
||||
"getter" in attributes -> NativeGetterOrSetter.GETTER
|
||||
"setter" in attributes -> NativeGetterOrSetter.SETTER
|
||||
else -> NativeGetterOrSetter.NONE
|
||||
}
|
||||
}
|
||||
|
||||
fun generateFunction(repository: Repository, function: Operation, functionName: String, nativeGetterOrSetter: NativeGetterOrSetter = function.getterOrSetter()): GenerateFunction =
|
||||
function.attributes.map { it.call }.toSet().let {
|
||||
GenerateFunction(
|
||||
name = functionName,
|
||||
returnType = mapType(repository, function.returnType).let { mapped -> if (nativeGetterOrSetter == NativeGetterOrSetter.GETTER) mapped.toNullableIfNonPrimitive() else mapped },
|
||||
arguments = function.parameters.map {
|
||||
val mappedType = mapType(repository, it.type)
|
||||
|
||||
GenerateAttribute(
|
||||
name = it.name,
|
||||
type = mappedType,
|
||||
initializer = if (it.defaultValue != null) "definedExternally" else null,
|
||||
getterSetterNoImpl = false,
|
||||
override = false,
|
||||
kind = AttributeKind.ARGUMENT,
|
||||
vararg = it.vararg,
|
||||
static = it.static,
|
||||
required = it.required
|
||||
)
|
||||
},
|
||||
nativeGetterOrSetter = nativeGetterOrSetter,
|
||||
static = function.static,
|
||||
override = false
|
||||
)
|
||||
}
|
||||
|
||||
fun generateFunctions(repository: Repository, function: Operation): List<GenerateFunction> {
|
||||
val realFunction = when {
|
||||
function.name == "" -> null
|
||||
function.getterOrSetter() == NativeGetterOrSetter.NONE -> generateFunction(repository, function, function.name, NativeGetterOrSetter.NONE)
|
||||
function.name == "get" || function.name == "set" -> null
|
||||
else -> generateFunction(repository, function, function.name, NativeGetterOrSetter.NONE)
|
||||
}
|
||||
val getterOrSetterFunction = when (function.getterOrSetter()) {
|
||||
NativeGetterOrSetter.NONE -> null
|
||||
NativeGetterOrSetter.GETTER -> generateFunction(repository, function, "get")
|
||||
NativeGetterOrSetter.SETTER -> generateFunction(repository, function, "set")
|
||||
}
|
||||
val callbackArgumentsAsLambdas = function.parameters.map {
|
||||
val parameterType = mapType(repository, it.type) as? SimpleType
|
||||
val interfaceType = repository.interfaces[parameterType?.type]
|
||||
when {
|
||||
interfaceType == null -> it
|
||||
interfaceType.operations.size != 1 -> it
|
||||
interfaceType.callback -> interfaceType.operations.single().let { callbackFunction ->
|
||||
it.copy(type = FunctionType(callbackFunction.parameters.map { it.copy(type = mapType(repository, it.type)) }, mapType(repository, callbackFunction.returnType), parameterType?.nullable ?: false))
|
||||
}
|
||||
else -> it
|
||||
}
|
||||
}
|
||||
|
||||
val functionWithCallbackOrNull = when {
|
||||
callbackArgumentsAsLambdas == function.parameters -> null
|
||||
realFunction != null -> generateFunction(repository, function.copy(parameters = callbackArgumentsAsLambdas), function.name, NativeGetterOrSetter.NONE)
|
||||
else -> null
|
||||
}
|
||||
|
||||
return listOf(realFunction, getterOrSetterFunction, functionWithCallbackOrNull).filterNotNull()
|
||||
}
|
||||
|
||||
fun generateAttribute(putNoImpl: Boolean, repository: Repository, attribute: Attribute, nullableAttributes: Boolean): GenerateAttribute {
|
||||
val mappedType = mapType(repository, attribute.type).let { if (nullableAttributes) it.toNullable() else it }
|
||||
return GenerateAttribute(attribute.name,
|
||||
type = mappedType,
|
||||
initializer =
|
||||
if (putNoImpl && !attribute.static) {
|
||||
mapLiteral(attribute.defaultValue, mapType(repository, attribute.type), repository.enums)
|
||||
} else if (attribute.defaultValue != null) {
|
||||
"definedExternally"
|
||||
} else {
|
||||
null
|
||||
},
|
||||
getterSetterNoImpl = putNoImpl,
|
||||
kind = if (attribute.readOnly) AttributeKind.VAL else AttributeKind.VAR,
|
||||
override = false,
|
||||
vararg = attribute.vararg,
|
||||
static = attribute.static,
|
||||
required = attribute.required
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun InterfaceDefinition.isInterface() : Boolean {
|
||||
return when {
|
||||
dictionary -> true
|
||||
extendedAttributes.any { it.call == "NoInterfaceObject" } -> true
|
||||
callback -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
private fun InterfaceDefinition.superTypes(repository: Repository) = superTypes.map { repository.interfaces[it] }.filterNotNull()
|
||||
private fun resolveDefinitionKind(repository: Repository, iface: InterfaceDefinition, constructors: List<ExtendedAttribute> = iface.findConstructors()): GenerateDefinitionKind =
|
||||
when {
|
||||
iface.isInterface() -> GenerateDefinitionKind.INTERFACE
|
||||
constructors.isNotEmpty() || iface.superTypes(repository).any { resolveDefinitionKind(repository, it) == GenerateDefinitionKind.CLASS } -> {
|
||||
GenerateDefinitionKind.CLASS
|
||||
}
|
||||
else -> GenerateDefinitionKind.ABSTRACT_CLASS
|
||||
}
|
||||
|
||||
private fun InterfaceDefinition.mapAttributes(repository: Repository)
|
||||
= attributes.map { generateAttribute(putNoImpl = dictionary, repository = repository, attribute = it, nullableAttributes = dictionary) }
|
||||
private fun InterfaceDefinition.mapOperations(repository: Repository) = operations.flatMap { generateFunctions(repository, it) }
|
||||
private fun Constant.mapConstant(repository : Repository) = GenerateAttribute(name, mapType(repository, type), null, false, AttributeKind.VAL, false, false, true, false)
|
||||
private val EMPTY_CONSTRUCTOR = ExtendedAttribute(null, "Constructor", emptyList())
|
||||
|
||||
fun generateTrait(repository: Repository, iface: InterfaceDefinition): List<GenerateClass> {
|
||||
val superClasses = iface.superTypes
|
||||
.mapNotNull { repository.interfaces[it] }
|
||||
.filter {
|
||||
when (resolveDefinitionKind(repository, it)) {
|
||||
GenerateDefinitionKind.CLASS,
|
||||
GenerateDefinitionKind.ABSTRACT_CLASS -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
assert(superClasses.size <= 1) { "Type ${iface.name} should have one or zero super classes but found ${superClasses.map { it.name }}" }
|
||||
|
||||
val declaredConstructors = iface.findConstructors()
|
||||
val entityKind = resolveDefinitionKind(repository, iface, declaredConstructors)
|
||||
val extensions = repository.externals[iface.name]?.mapNotNull { repository.interfaces[it] } ?: emptyList()
|
||||
|
||||
val primaryConstructor = when {
|
||||
declaredConstructors.size == 1 -> declaredConstructors.single()
|
||||
declaredConstructors.isEmpty() && (entityKind == GenerateDefinitionKind.CLASS || entityKind == GenerateDefinitionKind.ABSTRACT_CLASS) -> EMPTY_CONSTRUCTOR
|
||||
else -> declaredConstructors.firstOrNull { it.arguments.isEmpty() }
|
||||
}
|
||||
val secondaryConstructors = declaredConstructors.filter { it != primaryConstructor }
|
||||
|
||||
val primaryConstructorWithCall = primaryConstructor?.let { constructor ->
|
||||
val constructorAsFunction = generateConstructorAsFunction(repository, constructor)
|
||||
|
||||
ConstructorWithSuperTypeCall(constructorAsFunction, constructor)
|
||||
}
|
||||
|
||||
val secondaryConstructorsWithCall = secondaryConstructors.map { secondaryConstructor ->
|
||||
val constructorAsFunction = generateConstructorAsFunction(repository, secondaryConstructor)
|
||||
|
||||
ConstructorWithSuperTypeCall(constructorAsFunction, secondaryConstructor)
|
||||
}
|
||||
|
||||
val memberAttributes = iface.mapAttributes(repository)
|
||||
val memberFunctions = iface.mapOperations(repository)
|
||||
|
||||
val extensionsNames = extensions.map { it.name }
|
||||
|
||||
val namedConstructors =
|
||||
iface.findExtendedAttributes("NamedConstructor").map { namedConstructor ->
|
||||
GenerateClass(
|
||||
name = namedConstructor.call,
|
||||
namespace = iface.namespace,
|
||||
kind = GenerateDefinitionKind.CLASS,
|
||||
superTypes = listOf(iface.name) + extensionsNames,
|
||||
memberAttributes = memberAttributes.toMutableList(),
|
||||
memberFunctions = memberFunctions.toMutableList(),
|
||||
constants = emptyList(),
|
||||
primaryConstructor = ConstructorWithSuperTypeCall(generateConstructorAsFunction(repository, namedConstructor), namedConstructor),
|
||||
secondaryConstructors = emptyList(),
|
||||
generateBuilderFunction = false
|
||||
)
|
||||
}
|
||||
|
||||
return (listOf(GenerateClass(iface.name, iface.namespace, entityKind, (iface.superTypes + extensionsNames).distinct(),
|
||||
memberAttributes = memberAttributes.toMutableList(),
|
||||
memberFunctions = memberFunctions.toMutableList(),
|
||||
constants = (iface.constants.map { it.mapConstant(repository) } + extensions.flatMap { it.constants.map { it.mapConstant(repository) } }.distinct().toList()),
|
||||
primaryConstructor = primaryConstructorWithCall,
|
||||
secondaryConstructors = secondaryConstructorsWithCall,
|
||||
generateBuilderFunction = iface.dictionary
|
||||
)) + namedConstructors).map(::markAsArrayLikeIfApplicable)
|
||||
}
|
||||
|
||||
fun markAsArrayLikeIfApplicable(iface: GenerateClass): GenerateClass {
|
||||
fun isInt(type: Type) = type is SimpleType && type.type == "Int"
|
||||
|
||||
val lengthProperty = iface.memberAttributes.singleOrNull { it.name == "length" && isInt(it.type) }
|
||||
val itemAccessFunction = iface.memberFunctions.singleOrNull { it.name == "item" && it.arguments.map { isInt(it.type) } == listOf(true) && it.returnType != UnitType }
|
||||
|
||||
if (lengthProperty == null || itemAccessFunction == null) return iface
|
||||
|
||||
return iface.copy(superTypes = iface.superTypes + "ItemArrayLike<${itemAccessFunction.returnType.dropNullable().render()}>")
|
||||
}
|
||||
|
||||
fun generateConstructorAsFunction(repository: Repository, constructor: ExtendedAttribute) = generateFunction(
|
||||
repository,
|
||||
Operation("constructor", UnitType, constructor.arguments, emptyList(), false),
|
||||
functionName = "constructor",
|
||||
nativeGetterOrSetter = NativeGetterOrSetter.NONE)
|
||||
|
||||
|
||||
fun mapUnionType(it: UnionType) = GenerateClass(
|
||||
name = it.name,
|
||||
namespace = it.namespace,
|
||||
kind = GenerateDefinitionKind.INTERFACE,
|
||||
superTypes = emptyList(),
|
||||
memberAttributes = mutableListOf(),
|
||||
memberFunctions = mutableListOf(),
|
||||
constants = emptyList(),
|
||||
primaryConstructor = null,
|
||||
secondaryConstructors = emptyList(),
|
||||
generateBuilderFunction = false
|
||||
)
|
||||
|
||||
fun generateUnionTypeTraits(allUnionTypes: Sequence<UnionType>): Sequence<GenerateClass> = allUnionTypes.map(::mapUnionType)
|
||||
|
||||
fun mapDefinitions(repository: Repository, definitions: Iterable<InterfaceDefinition>) =
|
||||
definitions.flatMap { generateTrait(repository, it) }
|
||||
|
||||
fun generateUnions(ifaces: List<GenerateClass>, typedefs: Iterable<TypedefDefinition>): GenerateUnionTypes {
|
||||
val declaredTypes = ifaces.associateBy { it.name }
|
||||
|
||||
val anonymousUnionTypes = collectUnionTypes(declaredTypes)
|
||||
val anonymousUnionTypeTraits = generateUnionTypeTraits(anonymousUnionTypes)
|
||||
val anonymousUnionsMap = anonymousUnionTypeTraits.associateBy { it.name }
|
||||
|
||||
val typedefsToBeGenerated = typedefs.filter { it.types is UnionType }
|
||||
.map { NamedValue(it.name, it.types as UnionType) }
|
||||
.filter { it.value.memberTypes.all { type -> type is SimpleType && type.type in declaredTypes } }
|
||||
|
||||
val typedefsMarkersMap = typedefsToBeGenerated.groupBy { it.name }.mapValues { mapUnionType(it.value.first().value).copy(name = it.key) }
|
||||
|
||||
val typeNamesToUnions = anonymousUnionTypes
|
||||
.toList()
|
||||
.flatMap { unionType ->
|
||||
unionType.memberTypes
|
||||
.filterIsInstance<SimpleType>()
|
||||
.map { unionMember -> unionMember.type to unionType.name }
|
||||
}.toMultiMap()
|
||||
.merge(typedefsToBeGenerated
|
||||
.flatMap { typedef ->
|
||||
typedef.value.memberTypes
|
||||
.filterIsInstance<SimpleType>()
|
||||
.map { unionMember -> unionMember.type to typedef.name }
|
||||
}.toMultiMap())
|
||||
|
||||
return GenerateUnionTypes(
|
||||
typeNamesToUnionsMap = typeNamesToUnions,
|
||||
anonymousUnionsMap = anonymousUnionsMap,
|
||||
typedefsMarkersMap = typedefsMarkersMap
|
||||
)
|
||||
}
|
||||
|
||||
private fun mapLiteral(literal: String?, expectedType: Type = DynamicType, enums: Map<String, EnumDefinition>) =
|
||||
if (literal != null && expectedType is SimpleType && expectedType.type in enums.keys) {
|
||||
expectedType.type + "." + mapEnumConstant(literal.removeSurrounding("\"", "\""))
|
||||
}
|
||||
else {
|
||||
when (literal) {
|
||||
"[]" -> when {
|
||||
expectedType == DynamicType -> "arrayOf<dynamic>()"
|
||||
expectedType is AnyType -> "arrayOf<dynamic>()"
|
||||
expectedType is UnionType -> "arrayOf<dynamic>()"
|
||||
else -> "arrayOf()"
|
||||
}
|
||||
else -> literal
|
||||
}
|
||||
}
|
||||
|
||||
private fun specifyType(name: String, type: Type, context: String): Type {
|
||||
|
||||
if ((type is SimpleType) && (type.type == "Event")) {
|
||||
(eventSpecifierMapper[name] ?: eventSpecifierMapperWithContext[EventMapKey(name, context)])?.let {
|
||||
return type.copy(type = it)
|
||||
}
|
||||
}
|
||||
|
||||
return type
|
||||
}
|
||||
|
||||
private fun generalizeType(name: String, type: Type, context: String): Type {
|
||||
if ((type is FunctionType) && (type.parameterTypes.size == 1)) {
|
||||
val paramAttribute = type.parameterTypes[0]
|
||||
return type.copy(parameterTypes = listOf(paramAttribute.copy(type = specifyType(name, paramAttribute.type, context))))
|
||||
}
|
||||
return type
|
||||
}
|
||||
|
||||
fun implementInterfaces(declarations: List<GenerateClass>) : List<GenerateClass> {
|
||||
val unimplementedMemberMap = getUnimplementedMembers(declarations)
|
||||
val nonAbstractDeclarations = declarations.filter { it.kind == GenerateDefinitionKind.CLASS }
|
||||
for (declaration in nonAbstractDeclarations) {
|
||||
val unimplementedMembers = unimplementedMemberMap[declaration.name] ?: continue
|
||||
|
||||
for (attribute in unimplementedMembers.attributes) {
|
||||
declaration.memberAttributes += attribute.copy(override = true)
|
||||
}
|
||||
for (function in unimplementedMembers.functions) {
|
||||
declaration.memberFunctions += function.copy(override = true)
|
||||
}
|
||||
}
|
||||
|
||||
return declarations.map { declaration ->
|
||||
declaration.copy(
|
||||
memberAttributes = declaration
|
||||
.memberAttributes.map { attribute -> attribute.copy(type = generalizeType(attribute.name, attribute.type, declaration.name)) }.toMutableList()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getUnimplementedMembers(declarations: List<GenerateClass>): Map<String, UnimplementedMembers> {
|
||||
val declarationMap = declarations.associate { it.name to it }
|
||||
val unimplementedMemberCache = mutableMapOf<String, UnimplementedMembers>()
|
||||
|
||||
fun getForClass(className: String): UnimplementedMembers = unimplementedMemberCache.getOrPut(className) {
|
||||
val declaration = declarationMap[className] ?: return@getOrPut UnimplementedMembers(emptyList(), emptyList())
|
||||
val unimplementedInSuperClasses = declaration.superTypes.map { getForClass(it) }
|
||||
val attributeMap = unimplementedInSuperClasses
|
||||
.flatMap { it.attributes }
|
||||
.associate { it.name to it }
|
||||
.toMutableMap()
|
||||
val functionMap = unimplementedInSuperClasses
|
||||
.flatMap { it.functions }
|
||||
.associate { "${it.name}(${it.signature})" to it }
|
||||
.toMutableMap()
|
||||
|
||||
val (implementedAttributes, unimplementedAttributes) = declaration.memberAttributes
|
||||
.filter { !it.static }
|
||||
.partition { declaration.kind != GenerateDefinitionKind.INTERFACE && !it.getterSetterNoImpl }
|
||||
val (implementedFunctions, unimplementedFunctions) = declaration.memberFunctions
|
||||
.filter { !it.static }
|
||||
.partition { declaration.kind != GenerateDefinitionKind.INTERFACE }
|
||||
|
||||
attributeMap += unimplementedAttributes.map { it.name to it }
|
||||
attributeMap.keys -= implementedAttributes.map { it.name }
|
||||
functionMap += unimplementedFunctions.map { "${it.name}(${it.signature})" to it }
|
||||
functionMap.keys -= implementedFunctions.map { "${it.name}(${it.signature})" }
|
||||
|
||||
UnimplementedMembers(attributeMap.values.toList(), functionMap.values.toList())
|
||||
}
|
||||
|
||||
for (declaration in declarations) {
|
||||
getForClass(declaration.name)
|
||||
}
|
||||
|
||||
return unimplementedMemberCache
|
||||
}
|
||||
|
||||
private class UnimplementedMembers(val attributes: List<GenerateAttribute>, val functions: List<GenerateFunction>)
|
||||
@@ -1,31 +0,0 @@
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import java.io.File
|
||||
|
||||
fun BuildWebIdl.jsGenerator(outDir: File, copyrightNotice: String) {
|
||||
|
||||
outDir.deleteRecursively()
|
||||
outDir.mkdirs()
|
||||
|
||||
allPackages.forEach { pkg ->
|
||||
File(outDir, pkg + ".kt").bufferedWriter().use { w ->
|
||||
println("Generating for package $pkg...")
|
||||
w.appendln(copyrightNotice)
|
||||
w.appendln("// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!")
|
||||
w.appendln("// See libraries/tools/idl2k for details")
|
||||
|
||||
w.appendln()
|
||||
w.appendln("@file:Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")")
|
||||
w.appendln("package $pkg")
|
||||
w.appendln()
|
||||
|
||||
w.appendln("import kotlin.js.*")
|
||||
allPackages.filter { it != pkg }.forEach { import ->
|
||||
w.appendln("import $import.*")
|
||||
}
|
||||
w.appendln()
|
||||
|
||||
w.render(pkg, definitions, unions, repository.enums.values.toList(), mdnCache)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,612 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import org.antlr.v4.runtime.CharStream
|
||||
import org.antlr.v4.runtime.CommonTokenStream
|
||||
import org.antlr.v4.runtime.ParserRuleContext
|
||||
import org.antlr.v4.runtime.tree.ParseTree
|
||||
import org.antlr.v4.runtime.tree.TerminalNode
|
||||
import org.antlr.webidl.WebIDLBaseVisitor
|
||||
import org.antlr.webidl.WebIDLLexer
|
||||
import org.antlr.webidl.WebIDLParser
|
||||
import org.antlr.webidl.WebIDLParser.*
|
||||
import java.util.*
|
||||
|
||||
data class ExtendedAttribute(val name: String?, val call: String, val arguments: List<Attribute>)
|
||||
data class Operation(val name: String, val returnType: Type, val parameters: List<Attribute>, val attributes: List<ExtendedAttribute>, val static: Boolean)
|
||||
data class Attribute(val name: String, val type: Type, val readOnly: Boolean = true, val defaultValue: String? = null, val vararg: Boolean, val static: Boolean, val required: Boolean)
|
||||
data class Constant(val name: String, val type: Type, val value: String?)
|
||||
|
||||
enum class DefinitionKind {
|
||||
INTERFACE,
|
||||
TYPEDEF,
|
||||
EXTENSION_INTERFACE,
|
||||
ENUM,
|
||||
DICTIONARY
|
||||
}
|
||||
|
||||
interface Definition
|
||||
data class TypedefDefinition(val types: Type, val namespace: String, val name: String) : Definition
|
||||
data class InterfaceDefinition(
|
||||
val name: String,
|
||||
val namespace: String,
|
||||
val extendedAttributes: List<ExtendedAttribute>,
|
||||
val operations: List<Operation>,
|
||||
val attributes: List<Attribute>,
|
||||
val superTypes: List<String>,
|
||||
val constants: List<Constant>,
|
||||
val dictionary: Boolean = false,
|
||||
val partial: Boolean,
|
||||
val callback: Boolean
|
||||
) : Definition
|
||||
|
||||
data class ExtensionInterfaceDefinition(val namespace: String, val name: String, val implements: String) : Definition
|
||||
data class EnumDefinition(val namespace: String, val name: String, val entries: List<String>) : Definition
|
||||
|
||||
class ExtendedAttributeArgumentsParser(private val namespace: String) : WebIDLBaseVisitor<List<Attribute>>() {
|
||||
private val arguments = ArrayList<Attribute>()
|
||||
|
||||
override fun defaultResult(): List<Attribute> = arguments
|
||||
|
||||
override fun visitOptionalOrRequiredArgument(ctx: WebIDLParser.OptionalOrRequiredArgumentContext): List<Attribute> {
|
||||
val attributeVisitor = AttributeVisitor(namespace = namespace)
|
||||
attributeVisitor.visit(ctx)
|
||||
val parameter = attributeVisitor.visitChildren(ctx)
|
||||
|
||||
arguments.add(parameter)
|
||||
|
||||
visitChildren(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
}
|
||||
|
||||
// [Constructor]
|
||||
// [Constructor(any, Int)]
|
||||
// [Constructor(Int arg, String arg2 = "a")]
|
||||
// [name = Constructor]
|
||||
class ExtendedAttributeParser(private val namespace: String) : WebIDLBaseVisitor<ExtendedAttribute>() {
|
||||
private var name: String? = null
|
||||
private var call: String = ""
|
||||
private val arguments = ArrayList<Attribute>()
|
||||
|
||||
override fun defaultResult(): ExtendedAttribute = ExtendedAttribute(name, call, arguments)
|
||||
|
||||
override fun visitExtendedAttribute(ctx: WebIDLParser.ExtendedAttributeContext): ExtendedAttribute {
|
||||
call = ctx.children.filterIdentifiers().firstOrNull()?.text ?: ""
|
||||
|
||||
visitChildren(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitArgumentList(ctx: WebIDLParser.ArgumentListContext): ExtendedAttribute {
|
||||
arguments.addAll(ExtendedAttributeArgumentsParser(namespace).visitChildren(ctx))
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitIdentifierList(ctx: IdentifierListContext): ExtendedAttribute {
|
||||
object : WebIDLBaseVisitor<Unit>() {
|
||||
override fun visitTerminal(node: TerminalNode) {
|
||||
if (node.symbol.type == WebIDLLexer.IDENTIFIER_WEBIDL) {
|
||||
arguments.add(Attribute(node.text, AnyType(), true, vararg = false, static = false, required = false))
|
||||
}
|
||||
}
|
||||
}.visitChildren(ctx)
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitExtendedAttributeNamePart(ctx: WebIDLParser.ExtendedAttributeNamePartContext): ExtendedAttribute {
|
||||
name = getName(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
}
|
||||
|
||||
class UnionTypeVisitor(val namespace: String) : WebIDLBaseVisitor<List<Type>>() {
|
||||
val list = ArrayList<Type>()
|
||||
|
||||
override fun defaultResult() = list
|
||||
|
||||
override fun visitUnionMemberType(ctx: WebIDLParser.UnionMemberTypeContext): List<Type> {
|
||||
list.add(TypeVisitor(namespace).visitChildren(ctx))
|
||||
|
||||
return list
|
||||
}
|
||||
}
|
||||
|
||||
class TypeVisitor(val namespace: String) : WebIDLBaseVisitor<Type>() {
|
||||
private var type: Type = AnyType()
|
||||
private var awaitingSimpleType = false
|
||||
|
||||
override fun defaultResult() = type
|
||||
|
||||
override fun visitType(ctx: TypeContext?): Type {
|
||||
type = super.visitType(ctx)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitReturnType(ctx: ReturnTypeContext?): Type {
|
||||
awaitingSimpleType = true
|
||||
type = super.visitReturnType(ctx)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitNonAnyType(ctx: WebIDLParser.NonAnyTypeContext): Type {
|
||||
awaitingSimpleType = true
|
||||
type = super.visitNonAnyType(ctx)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitUnionType(ctx: WebIDLParser.UnionTypeContext): Type {
|
||||
type = UnionType(namespace, UnionTypeVisitor(namespace).visitChildren(ctx), false)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitPromiseType(ctx: PromiseTypeContext): Type {
|
||||
type = PromiseType(TypeVisitor(namespace).visitChildren(ctx), false)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitSequenceType(ctx: SequenceTypeContext): Type {
|
||||
val mutable = ctx.getChild(0).text == "sequence"
|
||||
type = ArrayType(TypeVisitor(namespace).visitChildren(ctx), mutable = mutable, nullable = false)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitTypeSuffix(ctx: TypeSuffixContext): Type {
|
||||
when (ctx.text?.trim()) {
|
||||
"?" -> type = type.toNullable()
|
||||
"[]" -> type = ArrayType(type, mutable = true, nullable = false)
|
||||
"[]?" -> type = ArrayType(type, mutable = true, nullable = false)
|
||||
"?[]" -> type = ArrayType(type.toNullable(), mutable = true, nullable = false)
|
||||
}
|
||||
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitNull_(ctx: Null_Context): Type {
|
||||
if (ctx.text?.trim() == "?") {
|
||||
type = type.toNullable()
|
||||
}
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitTerminal(node: TerminalNode): Type {
|
||||
if (awaitingSimpleType) {
|
||||
type = SimpleType(node.text, false)
|
||||
awaitingSimpleType = false
|
||||
}
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitUnsignedIntegerType(ctx: UnsignedIntegerTypeContext): Type {
|
||||
awaitingSimpleType = false
|
||||
type = super.visitUnsignedIntegerType(ctx)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitUnrestrictedFloatType(ctx: UnrestrictedFloatTypeContext): Type {
|
||||
awaitingSimpleType = false
|
||||
type = super.visitUnrestrictedFloatType(ctx)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitFloatType(ctx: FloatTypeContext): Type {
|
||||
type = SimpleType(ctx.text, false)
|
||||
return type
|
||||
}
|
||||
|
||||
override fun visitIntegerType(ctx: IntegerTypeContext): Type {
|
||||
type = SimpleType(ctx.text, false)
|
||||
return type
|
||||
}
|
||||
}
|
||||
|
||||
class OperationVisitor(private val attributes: List<ExtendedAttribute>, private val static: Boolean, private val namespace: String) : WebIDLBaseVisitor<Operation>() {
|
||||
private var name: String = ""
|
||||
private var returnType: Type = UnitType
|
||||
private val parameters = ArrayList<Attribute>()
|
||||
private val exts = ArrayList<ExtendedAttribute>()
|
||||
|
||||
override fun defaultResult() = Operation(name, returnType, parameters, attributes + exts, static)
|
||||
|
||||
override fun visitOptionalIdentifier(ctx: OptionalIdentifierContext): Operation {
|
||||
name = ctx.text
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitSpecial(ctx: WebIDLParser.SpecialContext): Operation {
|
||||
if (ctx.children != null) {
|
||||
exts.add(ExtendedAttribute(call = ctx.text, name = null, arguments = emptyList()))
|
||||
}
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitReturnType(ctx: ReturnTypeContext): Operation {
|
||||
returnType = TypeVisitor(namespace).visit(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitOptionalOrRequiredArgument(ctx: WebIDLParser.OptionalOrRequiredArgumentContext): Operation {
|
||||
val attributeVisitor = AttributeVisitor(static = false, namespace = namespace)
|
||||
attributeVisitor.visit(ctx)
|
||||
val parameter = attributeVisitor.visitChildren(ctx)
|
||||
|
||||
parameters.add(parameter)
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
}
|
||||
|
||||
class AttributeVisitor(private val readOnly: Boolean = false, private val static: Boolean = false, private val namespace: String) : WebIDLBaseVisitor<Attribute>() {
|
||||
private var type: Type = AnyType(true)
|
||||
private var name: String = ""
|
||||
private var defaultValue: String? = null
|
||||
private var vararg: Boolean = false
|
||||
private var required: Boolean = false
|
||||
|
||||
override fun defaultResult(): Attribute = Attribute(name, type, readOnly, defaultValue, vararg, static, required)
|
||||
|
||||
override fun visitType(ctx: WebIDLParser.TypeContext): Attribute {
|
||||
type = TypeVisitor(namespace).visit(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitOptionalOrRequiredArgument(ctx: WebIDLParser.OptionalOrRequiredArgumentContext): Attribute {
|
||||
if (ctx.children?.any { it is TerminalNode && it.text == "optional" } ?: false) {
|
||||
defaultValue = "definedExternally"
|
||||
}
|
||||
if (ctx.children?.any { it is TerminalNode && it.text == "required" } ?: false) {
|
||||
required = true
|
||||
}
|
||||
return visitChildren(ctx)
|
||||
}
|
||||
|
||||
override fun visitAttributeRest(ctx: WebIDLParser.AttributeRestContext): Attribute {
|
||||
name = getNameOrNull(ctx) ?: ctx.children.filter { it is TerminalNode }.filter { it.text != ";" }.last().text
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitArgumentName(ctx: WebIDLParser.ArgumentNameContext): Attribute {
|
||||
name = getNameOrNull(ctx) ?: ctx.text
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitDefaultValue(ctx: WebIDLParser.DefaultValueContext): Attribute {
|
||||
defaultValue = ctx.text
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitEllipsis(ctx: WebIDLParser.EllipsisContext): Attribute {
|
||||
vararg = vararg || "..." in ctx.text
|
||||
return defaultResult()
|
||||
}
|
||||
}
|
||||
|
||||
class ConstantVisitor : WebIDLBaseVisitor<Constant>() {
|
||||
private var type: Type = AnyType(false)
|
||||
private var name: String = ""
|
||||
private var value: String? = null
|
||||
|
||||
override fun defaultResult(): Constant = Constant(name, type, value)
|
||||
|
||||
override fun visitConst_(ctx: WebIDLParser.Const_Context): Constant {
|
||||
name = getName(ctx)
|
||||
|
||||
return visitChildren(ctx)
|
||||
}
|
||||
|
||||
override fun visitConstType(ctx: WebIDLParser.ConstTypeContext): Constant {
|
||||
type = SimpleType(ctx.text, false)
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitConstValue(ctx: WebIDLParser.ConstValueContext): Constant {
|
||||
value = ctx.text
|
||||
return defaultResult()
|
||||
}
|
||||
}
|
||||
|
||||
class DefinitionVisitor(val extendedAttributes: List<ExtendedAttribute>, val namespace: String, val declarations: MutableList<Definition>) : WebIDLBaseVisitor<Definition>() {
|
||||
private var kind = DefinitionKind.INTERFACE
|
||||
private var name = ""
|
||||
private val memberAttributes = ArrayList<ExtendedAttribute>()
|
||||
private val operations = ArrayList<Operation>()
|
||||
private val attributes = ArrayList<Attribute>()
|
||||
private var readOnly: Boolean = false
|
||||
private var static: Boolean = false
|
||||
private val inherited = ArrayList<String>()
|
||||
private var typedefType: Type? = null
|
||||
private var implements: String? = null
|
||||
private val constants = ArrayList<Constant>()
|
||||
private var partial = false
|
||||
private var callback = false
|
||||
private val enumEntries = mutableListOf<String>()
|
||||
private var enumEntryExpected = false
|
||||
|
||||
override fun defaultResult(): Definition = when (kind) {
|
||||
DefinitionKind.INTERFACE -> InterfaceDefinition(name, namespace, extendedAttributes, operations, attributes, inherited, constants, false, partial, callback)
|
||||
DefinitionKind.DICTIONARY -> InterfaceDefinition(name, namespace, extendedAttributes, operations, attributes, inherited, constants, /* dictionary = */ true, partial, callback)
|
||||
DefinitionKind.EXTENSION_INTERFACE -> ExtensionInterfaceDefinition(namespace, name, implements ?: "")
|
||||
DefinitionKind.TYPEDEF -> TypedefDefinition(typedefType ?: AnyType(true), namespace, name)
|
||||
DefinitionKind.ENUM -> EnumDefinition(namespace, name, enumEntries)
|
||||
}
|
||||
|
||||
override fun visitCallbackRestOrInterface(ctx: WebIDLParser.CallbackRestOrInterfaceContext): Definition {
|
||||
callback = true
|
||||
return visitChildren(ctx)
|
||||
}
|
||||
|
||||
override fun visitCallbackRest(ctx: WebIDLParser.CallbackRestContext): Definition {
|
||||
kind = DefinitionKind.TYPEDEF
|
||||
name = getName(ctx)
|
||||
|
||||
val function = OperationVisitor(memberAttributes.toList(), static, namespace).visit(ctx)
|
||||
typedefType = FunctionType(function.parameters, function.returnType, false)
|
||||
|
||||
memberAttributes.clear()
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitModule(ctx: ModuleContext): Definition {
|
||||
val moduleName = getName(ctx)
|
||||
val namespace = if (this.namespace.endsWith(moduleName)) this.namespace else this.namespace + "." + moduleName
|
||||
|
||||
ModuleVisitor(declarations, namespace).visitChildren(ctx)
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitInterface_(ctx: Interface_Context): Definition {
|
||||
name = getName(ctx)
|
||||
visitChildren(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitPartialInterface(ctx: WebIDLParser.PartialInterfaceContext): Definition {
|
||||
name = getName(ctx)
|
||||
partial = true
|
||||
visitChildren(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitTypedef(ctx: WebIDLParser.TypedefContext): Definition {
|
||||
if (name != "") {
|
||||
// TODO temporary workaround for local typedefs
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
kind = DefinitionKind.TYPEDEF
|
||||
name = getName(ctx)
|
||||
|
||||
typedefType = ctx.accept(object : WebIDLBaseVisitor<Type>() {
|
||||
private var foundType: Type = AnyType(false)
|
||||
|
||||
override fun defaultResult(): Type = foundType
|
||||
|
||||
override fun visitType(ctx: WebIDLParser.TypeContext): Type {
|
||||
foundType = TypeVisitor(namespace).visit(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
})
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitEnum_(ctx: Enum_Context): Definition {
|
||||
enumEntryExpected = true
|
||||
kind = DefinitionKind.ENUM
|
||||
name = getName(ctx)
|
||||
|
||||
super.visitEnum_(ctx)
|
||||
|
||||
enumEntryExpected = false
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitTerminal(node: TerminalNode): Definition {
|
||||
if (enumEntryExpected && node.symbol.type == WebIDLParser.STRING_WEBIDL) {
|
||||
enumEntries += node.symbol.text.removeSurrounding("\"", "\"")
|
||||
}
|
||||
return super.visitTerminal(node)
|
||||
}
|
||||
|
||||
override fun visitDictionary(ctx: DictionaryContext): Definition {
|
||||
kind = DefinitionKind.DICTIONARY
|
||||
name = getName(ctx)
|
||||
|
||||
return visitChildren(ctx)
|
||||
}
|
||||
|
||||
override fun visitDictionaryMember(ctx: DictionaryMemberContext): Definition {
|
||||
val name = ctx.children
|
||||
.filterIdentifiers()
|
||||
.firstOrNull { it.text != "" }
|
||||
?.text
|
||||
|
||||
val type = TypeVisitor(namespace).visit(ctx.children.first { it is TypeContext })
|
||||
var required = false
|
||||
val defaultValue = object : WebIDLBaseVisitor<String?>() {
|
||||
private var value: String? = null
|
||||
|
||||
override fun defaultResult() = value
|
||||
|
||||
override fun visitDefaultValue(ctx2: DefaultValueContext): String? {
|
||||
value = ctx2.text
|
||||
return value
|
||||
}
|
||||
|
||||
override fun visitRequired(ctx: RequiredContext?): String? {
|
||||
if (ctx?.children?.any { it is TerminalNode && it.text == "required" } ?: false) {
|
||||
required = true
|
||||
}
|
||||
return super.visitRequired(ctx)
|
||||
}
|
||||
}.visit(ctx)
|
||||
|
||||
attributes.add(Attribute(name ?: "", type, false, defaultValue, false, static, required))
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitImplementsStatement(ctx: ImplementsStatementContext): Definition {
|
||||
val identifiers = ctx.children.filterIdentifiers().map { it.text }
|
||||
|
||||
if (identifiers.size == 2) {
|
||||
kind = DefinitionKind.EXTENSION_INTERFACE
|
||||
name = identifiers[0]
|
||||
implements = identifiers[1]
|
||||
visitChildren(ctx)
|
||||
}
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitOperation(ctx: OperationContext): Definition {
|
||||
visitOperationImpl(ctx)
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
private fun visitOperationImpl(ctx: ParserRuleContext) {
|
||||
operations.add(OperationVisitor(memberAttributes.toList(), static, namespace).visit(ctx))
|
||||
memberAttributes.clear()
|
||||
}
|
||||
|
||||
override fun visitInheritance(ctx: WebIDLParser.InheritanceContext): Definition {
|
||||
if (ctx.children != null) {
|
||||
inherited.addAll(ctx.children.filterIdentifiers().map { it.text.trim() }.filter { it != "" })
|
||||
}
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitReadOnly(ctx: WebIDLParser.ReadOnlyContext): Definition {
|
||||
return visitReadOnlyImpl(ctx)
|
||||
}
|
||||
|
||||
override fun visitReadonlyMemberRest(ctx: ReadonlyMemberRestContext): Definition? {
|
||||
return visitReadOnlyImpl(ctx)
|
||||
}
|
||||
|
||||
private fun visitReadOnlyImpl(ctx: ParserRuleContext): Definition {
|
||||
readOnly = true
|
||||
visitChildren(ctx)
|
||||
readOnly = false
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitStaticMember(ctx: WebIDLParser.StaticMemberContext): Definition {
|
||||
static = true
|
||||
visitChildren(ctx)
|
||||
static = false
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitStaticMemberRest(ctx: WebIDLParser.StaticMemberRestContext): Definition {
|
||||
if (ctx.children?.any { it is OperationRestContext } ?: false) {
|
||||
visitOperationImpl(ctx)
|
||||
} else {
|
||||
visitChildren(ctx)
|
||||
}
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitAttributeRest(ctx: WebIDLParser.AttributeRestContext): Definition {
|
||||
with(AttributeVisitor(readOnly, static, namespace)) {
|
||||
visit(ctx)
|
||||
this@DefinitionVisitor.attributes.add(visitChildren(ctx))
|
||||
}
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitConst_(ctx: WebIDLParser.Const_Context): Definition {
|
||||
constants.add(ConstantVisitor().visit(ctx))
|
||||
memberAttributes.clear()
|
||||
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
override fun visitExtendedAttribute(ctx: ExtendedAttributeContext): Definition {
|
||||
memberAttributes.add(ExtendedAttributeParser(namespace).visit(ctx))
|
||||
return defaultResult()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ModuleVisitor(val declarations: MutableList<Definition>, var namespace: String = "") : WebIDLBaseVisitor<Unit>() {
|
||||
val extendedAttributes = ArrayList<ExtendedAttribute>()
|
||||
|
||||
override fun visitDefinition(ctx: WebIDLParser.DefinitionContext) {
|
||||
val declaration = DefinitionVisitor(extendedAttributes.toList(), namespace, declarations).visitChildren(ctx)
|
||||
extendedAttributes.clear()
|
||||
declarations.add(declaration)
|
||||
}
|
||||
|
||||
override fun visitExtendedAttribute(ctx: ExtendedAttributeContext?) {
|
||||
val att = with(ExtendedAttributeParser(namespace)) {
|
||||
visit(ctx)
|
||||
}
|
||||
|
||||
extendedAttributes.add(att)
|
||||
}
|
||||
|
||||
override fun visitNamespaceRest(ctx: NamespaceRestContext) {
|
||||
this.namespace = ctx.text
|
||||
}
|
||||
}
|
||||
|
||||
private fun List<ParseTree>?.filterIdentifiers(): List<ParseTree> = this?.filter { it is TerminalNode && it.symbol.type == WebIDLLexer.IDENTIFIER_WEBIDL } ?: emptyList()
|
||||
private fun getName(ctx: ParserRuleContext) = ctx.children.filterIdentifiers().first().text
|
||||
private fun getNameOrNull(ctx: ParserRuleContext) = ctx.children.filterIdentifiers().firstOrNull()?.text
|
||||
|
||||
fun parseIDL(reader: CharStream): Repository {
|
||||
val ll = WebIDLLexer(reader)
|
||||
val pp = WebIDLParser(CommonTokenStream(ll))
|
||||
|
||||
val idl = pp.webIDL()
|
||||
val declarations = ArrayList<Definition>()
|
||||
ModuleVisitor(declarations).visit(idl)
|
||||
|
||||
return Repository(
|
||||
declarations.filterIsInstance<InterfaceDefinition>().filter { it.name.isEmpty().not() }.groupBy { it.name }.mapValues { it.value.reduce(::merge) },
|
||||
declarations.filterIsInstance<TypedefDefinition>().groupBy { it.name }.mapValues { it.value.first() },
|
||||
declarations.filterIsInstance<ExtensionInterfaceDefinition>().groupBy { it.name }.mapValues { it.value.map { it.implements } },
|
||||
declarations.filterIsInstance<EnumDefinition>().groupBy { it.name }.mapValues { it.value.reduce { a, _ -> a } }
|
||||
)
|
||||
}
|
||||
|
||||
fun merge(i1: InterfaceDefinition, i2: InterfaceDefinition): InterfaceDefinition {
|
||||
require(i1.name == i2.name)
|
||||
|
||||
return InterfaceDefinition(i1.name,
|
||||
namespace = if (i1.partial) i2.namespace else i1.namespace,
|
||||
extendedAttributes = i1.extendedAttributes merge i2.extendedAttributes,
|
||||
operations = i1.operations merge i2.operations,
|
||||
attributes = i1.attributes merge i2.attributes,
|
||||
superTypes = i1.superTypes merge i2.superTypes,
|
||||
constants = i1.constants merge i2.constants,
|
||||
dictionary = i1.dictionary || i2.dictionary,
|
||||
partial = i1.partial && i2.partial,
|
||||
callback = i1.callback && i2.callback
|
||||
)
|
||||
}
|
||||
|
||||
infix fun <T> List<T>.merge(other: List<T>) = (this + other).distinct()
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import org.jetbrains.idl2k.util.readCopyrightNoticeFromProfile
|
||||
import java.io.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val webIdl = BuildWebIdl(
|
||||
mdnCacheFile = File("target/mdn-cache.txt"),
|
||||
srcDir = File("../../stdlib/js/idl"))
|
||||
|
||||
println("Generating...")
|
||||
|
||||
val copyrightNotice = readCopyrightNoticeFromProfile(File("../../../.idea/copyright/apache.xml"))
|
||||
webIdl.jsGenerator(File("../../stdlib/js/src/org.w3c"), copyrightNotice)
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import java.io.*
|
||||
|
||||
class MDNDocumentationCache(val existing: Set<String>, val nonExisting: Set<String>) {
|
||||
|
||||
fun checkInCache(url: String): Boolean? = when (url) {
|
||||
in existing -> true
|
||||
in nonExisting -> false
|
||||
else -> null
|
||||
}
|
||||
|
||||
companion object {
|
||||
val Empty = MDNDocumentationCache(emptySet(), emptySet())
|
||||
|
||||
fun read(file: File): MDNDocumentationCache {
|
||||
val existing = HashSet<String>()
|
||||
val nonExisting = HashSet<String>()
|
||||
|
||||
file.forEachLine { line ->
|
||||
val parts = line.split("|")
|
||||
if (parts.size == 2) {
|
||||
val url = parts[0]
|
||||
if (parts[1] == "Y") existing.add(url)
|
||||
else if (parts[1] == "N") nonExisting.add(url)
|
||||
}
|
||||
}
|
||||
|
||||
return MDNDocumentationCache(existing, nonExisting)
|
||||
}
|
||||
|
||||
fun writeTo(c: MDNDocumentationCache, file: File) {
|
||||
file.bufferedWriter().use {
|
||||
(c.existing + c.nonExisting).sorted().joinTo(it, separator = "\n") { "$it|${if (it in c.existing) "Y" else "N"}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
data class NamedValue<V>(val name: String, val value: V)
|
||||
|
||||
data class Repository(
|
||||
val interfaces: Map<String, InterfaceDefinition>,
|
||||
val typeDefs: Map<String, TypedefDefinition>,
|
||||
val externals: Map<String, List<String>>,
|
||||
val enums: Map<String, EnumDefinition>
|
||||
)
|
||||
|
||||
enum class AttributeKind {
|
||||
VAL, VAR, ARGUMENT
|
||||
}
|
||||
data class GenerateAttribute(val name: String, val type: Type, val initializer: String?, val getterSetterNoImpl: Boolean, val kind: AttributeKind, val override: Boolean, var vararg: Boolean, val static: Boolean, val required: Boolean)
|
||||
|
||||
val GenerateAttribute.getterNoImpl: Boolean
|
||||
get() = getterSetterNoImpl
|
||||
val GenerateAttribute.setterNoImpl: Boolean
|
||||
get() = getterSetterNoImpl && kind == AttributeKind.VAR
|
||||
val GenerateAttribute.isVal: Boolean
|
||||
get() = kind == AttributeKind.VAL
|
||||
val GenerateAttribute.isVar: Boolean
|
||||
get() = kind == AttributeKind.VAR
|
||||
|
||||
val Type.typeSignature: String
|
||||
get() = when {
|
||||
this is FunctionType -> "Function$arity"
|
||||
else -> this.toString()
|
||||
}
|
||||
|
||||
val GenerateAttribute.signature: String
|
||||
get() = "$name:${type.typeSignature}"
|
||||
|
||||
fun GenerateAttribute.dynamicIfUnknownType(allTypes : Set<String>, standardTypes : Set<Type> = standardTypes()) = copy(type = type.dynamicIfUnknownType(allTypes, standardTypes))
|
||||
fun List<GenerateAttribute>.dynamicIfUnknownType(allTypes : Set<String>, standardTypes : Set<Type> = standardTypes()) = map { it.dynamicIfUnknownType(allTypes, standardTypes) }
|
||||
|
||||
enum class NativeGetterOrSetter {
|
||||
NONE,
|
||||
GETTER,
|
||||
SETTER
|
||||
}
|
||||
|
||||
enum class GenerateDefinitionKind {
|
||||
INTERFACE,
|
||||
CLASS,
|
||||
ABSTRACT_CLASS
|
||||
}
|
||||
|
||||
data class GenerateFunction(
|
||||
val name: String,
|
||||
val returnType: Type,
|
||||
val arguments: List<GenerateAttribute>,
|
||||
val nativeGetterOrSetter: NativeGetterOrSetter,
|
||||
val static: Boolean,
|
||||
val override: Boolean
|
||||
)
|
||||
|
||||
data class ConstructorWithSuperTypeCall(val constructor: GenerateFunction, val constructorAttribute: ExtendedAttribute)
|
||||
|
||||
data class GenerateClass(
|
||||
val name: String,
|
||||
val namespace: String,
|
||||
val kind: GenerateDefinitionKind,
|
||||
val superTypes: List<String>,
|
||||
val memberAttributes: MutableList<GenerateAttribute>,
|
||||
val memberFunctions: MutableList<GenerateFunction>,
|
||||
val constants: List<GenerateAttribute>,
|
||||
val primaryConstructor: ConstructorWithSuperTypeCall?,
|
||||
val secondaryConstructors: List<ConstructorWithSuperTypeCall>,
|
||||
val generateBuilderFunction: Boolean
|
||||
)
|
||||
|
||||
val GenerateFunction.signature: String
|
||||
get() = arguments.map { it.type.typeSignature }.joinToString(", ", "$name(", ")")
|
||||
|
||||
fun GenerateFunction.dynamicIfUnknownType(allTypes : Set<String>) = standardTypes().let { standardTypes ->
|
||||
copy(returnType = returnType.dynamicIfUnknownType(allTypes, standardTypes), arguments = arguments.map { it.dynamicIfUnknownType(allTypes, standardTypes) })
|
||||
}
|
||||
|
||||
fun InterfaceDefinition.findExtendedAttributes(name: String) = extendedAttributes.filter { it.name == name }
|
||||
fun InterfaceDefinition.findConstructors() = extendedAttributes.filter { it.call == "Constructor" }
|
||||
|
||||
data class GenerateUnionTypes(
|
||||
val typeNamesToUnionsMap: Map<String, List<String>>,
|
||||
val anonymousUnionsMap: Map<String, GenerateClass>,
|
||||
val typedefsMarkersMap: Map<String, GenerateClass>
|
||||
)
|
||||
@@ -1,428 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import org.jetbrains.idl2k.util.mapEnumConstant
|
||||
import java.math.BigInteger
|
||||
|
||||
private fun <O : Appendable> O.indent(commented: Boolean = false, level: Int) {
|
||||
if (commented) {
|
||||
append("//")
|
||||
}
|
||||
for (i in 1..level) {
|
||||
append(" ")
|
||||
}
|
||||
}
|
||||
|
||||
private fun Appendable.renderAttributeDeclaration(arg: GenerateAttribute, modality: MemberModality, omitDefaults: Boolean = false) {
|
||||
if (arg.vararg) {
|
||||
append("vararg ")
|
||||
}
|
||||
else {
|
||||
when (modality) {
|
||||
MemberModality.OVERRIDE -> append("override ")
|
||||
MemberModality.ABSTRACT -> append("abstract ")
|
||||
MemberModality.OPEN -> append("open ")
|
||||
MemberModality.FINAL -> {}
|
||||
}
|
||||
}
|
||||
|
||||
append(when(arg.kind) {
|
||||
AttributeKind.VAL -> "val "
|
||||
AttributeKind.VAR -> "var "
|
||||
AttributeKind.ARGUMENT -> ""
|
||||
})
|
||||
append(arg.name.replaceKeywords())
|
||||
append(": ")
|
||||
append(arg.type.render())
|
||||
if (arg.initializer != null) {
|
||||
if (omitDefaults) {
|
||||
append(" /*")
|
||||
}
|
||||
|
||||
append(" = ")
|
||||
append(arg.initializer.specifyInitializerConstant(arg.type))
|
||||
|
||||
if (omitDefaults) {
|
||||
append(" */")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Appendable.renderAttributeDeclarationAsProperty(arg: GenerateAttribute, modality: MemberModality, commented: Boolean, level: Int, omitDefaults: Boolean = false) {
|
||||
indent(commented, level)
|
||||
|
||||
if (arg.name in keywords) {
|
||||
append("@JsName(\"${arg.name}\") ")
|
||||
}
|
||||
|
||||
renderAttributeDeclaration(arg, modality, omitDefaults)
|
||||
|
||||
appendln()
|
||||
if (arg.getterNoImpl) {
|
||||
indent(commented, level + 1)
|
||||
appendln("get() = definedExternally")
|
||||
}
|
||||
if (arg.setterNoImpl) {
|
||||
indent(commented, level + 1)
|
||||
appendln("set(value) = definedExternally")
|
||||
}
|
||||
}
|
||||
|
||||
private val keywords = setOf("interface", "is", "as")
|
||||
|
||||
private fun String.parse() = if (this.startsWith("0x")) BigInteger(this.substring(2), 16) else BigInteger(this)
|
||||
private fun String.specifyInitializerConstant(type: Type) = when {
|
||||
this == "undefined" && type.nullable -> "undefined"
|
||||
this == "definedExternally" || type is SimpleType && type.type == "Int" && parse() > BigInteger.valueOf(Int.MAX_VALUE.toLong()) -> "definedExternally"
|
||||
type is SimpleType && type.type == "Double" && this.matches("[0-9]+".toRegex()) -> "${this}.0"
|
||||
type is SimpleType && type.type == "Float" -> "${this}f"
|
||||
else -> this
|
||||
}
|
||||
private fun String.replaceKeywords() = if (this in keywords) this + "_" else this
|
||||
|
||||
private fun Appendable.renderArgumentsDeclaration(args: List<GenerateAttribute>, omitDefaults: Boolean = false) =
|
||||
args.joinTo(this, ", ", "(", ")") {
|
||||
StringBuilder().apply { renderAttributeDeclaration(it, if (it.override) MemberModality.OVERRIDE else MemberModality.FINAL, omitDefaults) }
|
||||
}
|
||||
|
||||
private fun Appendable.renderFunctionDeclaration(owner: String, f: GenerateFunction, override: Boolean, commented: Boolean, level: Int = 1) {
|
||||
indent(commented, level)
|
||||
|
||||
if (f.nativeGetterOrSetter != NativeGetterOrSetter.NONE) {
|
||||
append("@kotlin.internal.InlineOnly ")
|
||||
}
|
||||
if (override) {
|
||||
append("override ")
|
||||
}
|
||||
if (f.nativeGetterOrSetter != NativeGetterOrSetter.NONE) {
|
||||
append("inline operator ")
|
||||
}
|
||||
|
||||
if (f.name in keywords) {
|
||||
append("@JsName(\"${f.name}\") ")
|
||||
}
|
||||
append("fun ")
|
||||
if (f.nativeGetterOrSetter != NativeGetterOrSetter.NONE) {
|
||||
append("$owner.")
|
||||
}
|
||||
append(f.name.replaceKeywords())
|
||||
renderArgumentsDeclaration(f.arguments, override)
|
||||
append(": ${f.returnType.render()}")
|
||||
|
||||
when (f.nativeGetterOrSetter) {
|
||||
NativeGetterOrSetter.GETTER -> {
|
||||
append(" = asDynamic()[${f.arguments[0].name}]")
|
||||
}
|
||||
NativeGetterOrSetter.SETTER -> {
|
||||
append(" { asDynamic()[${f.arguments[0].name}] = ${f.arguments[1].name}; }")
|
||||
}
|
||||
NativeGetterOrSetter.NONE -> {}
|
||||
}
|
||||
|
||||
appendln()
|
||||
}
|
||||
|
||||
private fun List<GenerateAttribute>.hasNoVars() = none { it.isVar }
|
||||
|
||||
private fun GenerateAttribute.isCommented(parent: String) = "$parent.$name" in commentOutDeclarations || "$parent.$name: ${type.render()}" in commentOutDeclarations
|
||||
private fun GenerateFunction.isCommented(parent: String) =
|
||||
"$parent.$name" in commentOutDeclarations || "$parent.$name(${arguments.size})" in commentOutDeclarations
|
||||
private fun GenerateAttribute.isRequiredFunctionArgument(owner: String, functionName: String) = "$owner.$functionName.$name" in requiredArguments
|
||||
private fun GenerateFunction.fixRequiredArguments(parent: String) = copy(arguments = arguments.map { arg -> arg.copy(initializer = if (arg.isRequiredFunctionArgument(parent, name)) null else arg.initializer) })
|
||||
|
||||
fun Appendable.render(allTypes: Map<String, GenerateClass>, enums: List<EnumDefinition>, typeNamesToUnions: Map<String, List<String>>, iface: GenerateClass, markerAnnotation: Boolean = false, mdnCache: MDNDocumentationCache? = null) {
|
||||
|
||||
val url = "https://developer.mozilla.org/en/docs/Web/API/${iface.name}"
|
||||
if (mdnCache?.checkInCache(url) == true) {
|
||||
appendln("/**")
|
||||
appendln(" * Exposes the JavaScript [${iface.name}]($url) to Kotlin")
|
||||
appendln(" */")
|
||||
}
|
||||
|
||||
val allTypesAndEnums = allTypes.keys + enums.map { it.name }
|
||||
|
||||
append("public external ")
|
||||
if (markerAnnotation) {
|
||||
append("@marker ")
|
||||
}
|
||||
when (iface.kind) {
|
||||
GenerateDefinitionKind.CLASS -> append("open class ")
|
||||
GenerateDefinitionKind.ABSTRACT_CLASS -> append("abstract class ")
|
||||
GenerateDefinitionKind.INTERFACE -> append("interface ")
|
||||
}
|
||||
|
||||
val allSuperTypes = iface.allSuperTypes(allTypes + kotlinBuiltinInterfaces)
|
||||
val allSuperTypesNames = allSuperTypes.map { it.name }.toSet()
|
||||
|
||||
append(iface.name)
|
||||
val primary = iface.primaryConstructor
|
||||
if (primary != null && (primary.constructor.arguments.isNotEmpty() || iface.secondaryConstructors.isNotEmpty())) {
|
||||
renderArgumentsDeclaration(primary.constructor.fixRequiredArguments(iface.name).arguments.dynamicIfUnknownType(allTypesAndEnums), false)
|
||||
}
|
||||
|
||||
val superTypesExclude = inheritanceExclude[iface.name] ?: emptySet()
|
||||
val superTypesWithCalls =
|
||||
iface.superTypes.filter { it in allSuperTypesNames }.filter { it !in superTypesExclude } +
|
||||
(typeNamesToUnions[iface.name] ?: emptyList()) +
|
||||
(iface.superTypes.filter { it.substringBefore("<") in kotlinBuiltinInterfaces }) // TODO in theory we have to parse type but for now it is the only place needs it so let's just cut string
|
||||
|
||||
|
||||
if (superTypesWithCalls.isNotEmpty()) {
|
||||
superTypesWithCalls.joinTo(this, ", ", " : ")
|
||||
}
|
||||
|
||||
appendln (" {")
|
||||
|
||||
iface.secondaryConstructors.forEach { secondary ->
|
||||
indent(false, 1)
|
||||
append("constructor")
|
||||
renderArgumentsDeclaration(secondary.constructor.fixRequiredArguments(iface.name).arguments.dynamicIfUnknownType(allTypesAndEnums), false)
|
||||
|
||||
appendln()
|
||||
}
|
||||
|
||||
val superAttributes = allSuperTypes.flatMap { it.memberAttributes }.distinct()
|
||||
val superAttributesByName = superAttributes.groupBy { it.name }
|
||||
val superFunctions = allSuperTypes.flatMap { it.memberFunctions }.distinct()
|
||||
val superSignatures = superAttributes.map { it.signature } merge superFunctions.map { it.signature }
|
||||
|
||||
iface.memberAttributes
|
||||
.filter {
|
||||
!it.static
|
||||
&& (it.isVar || (it.isVal && superAttributesByName[it.name]?.hasNoVars() ?: true))
|
||||
}
|
||||
.map { it.dynamicIfUnknownType(allTypesAndEnums) }
|
||||
.groupBy { it.name }
|
||||
.mapValues { it.value.filter { "${iface.name}.${it.name}" !in commentOutDeclarations && "${iface.name}.${it.name}: ${it.type.render()}" !in commentOutDeclarations } }
|
||||
.filterValues { it.isNotEmpty() }
|
||||
.reduceValues(::merge).values.forEach { attribute ->
|
||||
val modality = when {
|
||||
attribute.signature in superSignatures -> MemberModality.OVERRIDE
|
||||
iface.kind == GenerateDefinitionKind.CLASS && attribute.isVal -> MemberModality.OPEN
|
||||
iface.kind == GenerateDefinitionKind.ABSTRACT_CLASS -> MemberModality.OPEN
|
||||
else -> MemberModality.FINAL
|
||||
}
|
||||
|
||||
val skipAttributeDeclaration = modality == MemberModality.OVERRIDE
|
||||
&& attribute.kindNotChanged(superAttributesByName)
|
||||
&& (iface.kind == GenerateDefinitionKind.INTERFACE || attribute.hasSuperImplementation(allSuperTypes))
|
||||
|
||||
if (attribute.name in superAttributesByName && attribute.signature !in superSignatures) {
|
||||
System.err.println("Property ${iface.name}.${attribute.name} has different type in super type(s) so will not be generated: ")
|
||||
for ((superTypeName, attributes) in allSuperTypes.map { it.name to it.memberAttributes.filter { it.name == attribute.name }.distinct() }) {
|
||||
for (superAttribute in attributes) {
|
||||
System.err.println(" $superTypeName.${attribute.name}: ${superAttribute.type.render()}")
|
||||
}
|
||||
}
|
||||
} else if (skipAttributeDeclaration) {
|
||||
// then don't generate
|
||||
} else {
|
||||
renderAttributeDeclarationAsProperty(attribute,
|
||||
modality = modality,
|
||||
commented = attribute.isCommented(iface.name),
|
||||
omitDefaults = iface.kind == GenerateDefinitionKind.INTERFACE,
|
||||
level = 1
|
||||
)
|
||||
}
|
||||
}
|
||||
val memberFunctions= iface.memberFunctions.filter {
|
||||
(it !in superFunctions || it.override) && !it.static
|
||||
}.map { it.dynamicIfUnknownType(allTypesAndEnums) }.groupBy { it.signature }.reduceValues(::betterFunction).values
|
||||
|
||||
fun doRenderFunction(function: GenerateFunction, level: Int = 1) {
|
||||
renderFunctionDeclaration(
|
||||
iface.name, function.fixRequiredArguments(iface.name),
|
||||
function.signature in superSignatures || function.override,
|
||||
commented = function.isCommented(iface.name),
|
||||
level = level
|
||||
)
|
||||
}
|
||||
|
||||
memberFunctions.filter { it.nativeGetterOrSetter == NativeGetterOrSetter.NONE }.forEach { doRenderFunction(it) }
|
||||
|
||||
val staticAttributes = iface.memberAttributes.filter { it.static }
|
||||
val staticFunctions = iface.memberFunctions.filter { it.static }
|
||||
|
||||
if (iface.constants.isNotEmpty() || staticAttributes.isNotEmpty() || staticFunctions.isNotEmpty()) {
|
||||
appendln()
|
||||
indent(false, 1)
|
||||
appendln("companion object {")
|
||||
iface.constants.forEach {
|
||||
renderAttributeDeclarationAsProperty(it, MemberModality.FINAL, level = 2, commented = it.isCommented(iface.name))
|
||||
}
|
||||
staticAttributes.forEach {
|
||||
renderAttributeDeclarationAsProperty(it, MemberModality.FINAL, level = 2, commented = it.isCommented(iface.name))
|
||||
}
|
||||
staticFunctions.forEach {
|
||||
renderFunctionDeclaration(iface.name, it.fixRequiredArguments(iface.name), override = false, level = 2, commented = it.isCommented(iface.name))
|
||||
}
|
||||
indent(false, 1)
|
||||
appendln("}")
|
||||
}
|
||||
|
||||
appendln("}")
|
||||
memberFunctions.filter { it.nativeGetterOrSetter != NativeGetterOrSetter.NONE }.forEach { doRenderFunction(it, 0) }
|
||||
appendln()
|
||||
|
||||
if (iface.generateBuilderFunction) {
|
||||
renderBuilderFunction(iface, allSuperTypes, allTypesAndEnums)
|
||||
}
|
||||
}
|
||||
|
||||
private fun GenerateAttribute.kindNotChanged(superAttributesByName: Map<String, List<GenerateAttribute>>) = superAttributesByName[name].orEmpty().all { it.kind == kind }
|
||||
|
||||
private fun GenerateAttribute.hasSuperImplementation(allSuperTypes: List<GenerateClass>) = allSuperTypes.any { st -> st.kind != GenerateDefinitionKind.INTERFACE && st.memberAttributes.any { it.signature == signature } }
|
||||
|
||||
private fun GenerateAttribute.hasNoDefaultValue() =
|
||||
this.initializer == null && (this.type.nullable || this.type == DynamicType) && !this.required
|
||||
|
||||
fun Appendable.renderBuilderFunction(dictionary: GenerateClass, allSuperTypes: List<GenerateClass>, allTypes: Set<String>) {
|
||||
val fields = (dictionary.memberAttributes + allSuperTypes.flatMap { it.memberAttributes })
|
||||
.distinctBy { it.signature }
|
||||
.map { it.copy(kind = AttributeKind.ARGUMENT) }
|
||||
.dynamicIfUnknownType(allTypes)
|
||||
.map { if (it.hasNoDefaultValue()) it.copy(initializer = "undefined") else it }
|
||||
|
||||
appendln("@kotlin.internal.InlineOnly")
|
||||
append("public inline fun ${dictionary.name}")
|
||||
renderArgumentsDeclaration(fields)
|
||||
appendln(": ${dictionary.name} {")
|
||||
|
||||
indent(level = 1)
|
||||
appendln("val o = js(\"({})\")")
|
||||
appendln()
|
||||
|
||||
for (field in fields) {
|
||||
indent(level = 1)
|
||||
|
||||
val escapedFieldName = field.name.replaceKeywords()
|
||||
val nullGuardedAssignment = field.hasNoDefaultValue()
|
||||
|
||||
if (nullGuardedAssignment) {
|
||||
appendln("if ($escapedFieldName !== undefined) {")
|
||||
indent(level = 2)
|
||||
}
|
||||
|
||||
appendln("o[\"${field.name}\"] = $escapedFieldName")
|
||||
|
||||
if (nullGuardedAssignment) {
|
||||
indent(level = 1)
|
||||
appendln("}")
|
||||
}
|
||||
}
|
||||
|
||||
appendln()
|
||||
|
||||
indent(level = 1)
|
||||
appendln("return o")
|
||||
|
||||
appendln("}")
|
||||
appendln()
|
||||
}
|
||||
|
||||
fun betterFunction(f1: GenerateFunction, f2: GenerateFunction): GenerateFunction =
|
||||
f1.copy(
|
||||
arguments = f1.arguments
|
||||
.zip(f2.arguments)
|
||||
.map { it.first.copy(type = it.map { it.type }.betterType(), name = it.map { it.name }.betterName()) },
|
||||
nativeGetterOrSetter = listOf(f1.nativeGetterOrSetter, f2.nativeGetterOrSetter)
|
||||
.firstOrNull { it != NativeGetterOrSetter.NONE } ?: NativeGetterOrSetter.NONE
|
||||
)
|
||||
|
||||
private fun <F, T> Pair<F, F>.map(block: (F) -> T) = block(first) to block(second)
|
||||
private fun Pair<Type, Type>.betterType() = if (first is DynamicType || first is AnyType) first else second
|
||||
private fun Pair<String, String>.betterName() = if (((0..9).map(Int::toString) + listOf("arg")).none { first.toLowerCase().contains(it) }) first else second
|
||||
|
||||
private fun merge(a: AttributeKind, b: AttributeKind): AttributeKind {
|
||||
if (a == b) {
|
||||
return a
|
||||
}
|
||||
|
||||
if (a == AttributeKind.VAR || b == AttributeKind.VAR) {
|
||||
return AttributeKind.VAR
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
private fun merge(a: GenerateAttribute, b: GenerateAttribute): GenerateAttribute {
|
||||
require(a.name == b.name)
|
||||
|
||||
val type = when {
|
||||
a.type.dropNullable() == b.type.dropNullable() -> a.type.withNullability(a.type.nullable || b.type.nullable)
|
||||
else -> DynamicType
|
||||
}
|
||||
|
||||
return GenerateAttribute(
|
||||
a.name,
|
||||
type,
|
||||
a.initializer ?: b.initializer,
|
||||
a.getterSetterNoImpl || b.getterSetterNoImpl,
|
||||
merge(a.kind, b.kind),
|
||||
a.override,
|
||||
a.vararg,
|
||||
a.static,
|
||||
a.required || b.required
|
||||
)
|
||||
}
|
||||
|
||||
fun <K, V> List<Pair<K, V>>.toMultiMap(): Map<K, List<V>> = groupBy { it.first }.mapValues { it.value.map { it.second } }
|
||||
|
||||
fun Appendable.render(enumDefinition: EnumDefinition) {
|
||||
appendln("/* please, don't implement this interface! */")
|
||||
appendln("public external interface ${enumDefinition.name} {")
|
||||
indent(level = 1)
|
||||
appendln("companion object")
|
||||
appendln("}")
|
||||
|
||||
for (entry in enumDefinition.entries) {
|
||||
val entryName = mapEnumConstant(entry)
|
||||
appendln("public inline val ${enumDefinition.name}.Companion.$entryName: ${enumDefinition.name} " +
|
||||
"get() = \"$entry\".asDynamic().unsafeCast<${enumDefinition.name}>()")
|
||||
}
|
||||
|
||||
appendln()
|
||||
}
|
||||
|
||||
fun Appendable.render(namespace: String, ifaces: List<GenerateClass>, unions: GenerateUnionTypes, enums: List<EnumDefinition>, mdnCache: MDNDocumentationCache) {
|
||||
val declaredTypes = ifaces.associateBy { it.name }
|
||||
|
||||
val allTypes = declaredTypes + unions.anonymousUnionsMap + unions.typedefsMarkersMap
|
||||
|
||||
declaredTypes.values.filter { it.namespace == namespace }.forEach {
|
||||
render(allTypes, enums, unions.typeNamesToUnionsMap, it, mdnCache = mdnCache)
|
||||
}
|
||||
|
||||
unions.anonymousUnionsMap.values.filter { it.namespace == "" || it.namespace == namespace }.forEach {
|
||||
render(allTypes, enums, emptyMap(), it, markerAnnotation = true)
|
||||
}
|
||||
|
||||
unions.typedefsMarkersMap.values.filter { it.namespace == "" || it.namespace == namespace }.forEach {
|
||||
render(allTypes, enums, emptyMap(), it, markerAnnotation = true)
|
||||
}
|
||||
|
||||
enums.filter { it.namespace == namespace }
|
||||
.forEach { render(it) }
|
||||
}
|
||||
|
||||
enum class MemberModality {
|
||||
OPEN,
|
||||
ABSTRACT,
|
||||
OVERRIDE,
|
||||
FINAL
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import java.util.*
|
||||
|
||||
private val typeMapper = mapOf(
|
||||
"unsignedlong" to SimpleType("Int", false),
|
||||
"unsignedlonglong" to SimpleType("Int", false),
|
||||
"longlong" to SimpleType("Int", false),
|
||||
"unsignedshort" to SimpleType("Short", false),
|
||||
"unsignedbyte" to SimpleType("Byte", false),
|
||||
"octet" to SimpleType("Byte", false),
|
||||
"void" to UnitType,
|
||||
"boolean" to SimpleType("Boolean", false),
|
||||
"byte" to SimpleType("Byte", false),
|
||||
"short" to SimpleType("Short", false),
|
||||
"long" to SimpleType("Int", false),
|
||||
"float" to SimpleType("Float", false),
|
||||
"double" to SimpleType("Double", false),
|
||||
"any" to AnyType(true),
|
||||
"DOMTimeStamp" to SimpleType("Number", false),
|
||||
"object" to DynamicType, // TODO map to Any?
|
||||
"WindowProxy" to SimpleType("Window", false),
|
||||
"USVString" to SimpleType("String", false),
|
||||
"DOMString" to SimpleType("String", false),
|
||||
"ByteString" to SimpleType("String", false),
|
||||
"DOMError" to DynamicType,
|
||||
"Elements" to DynamicType,
|
||||
"Date" to SimpleType("Date", false),
|
||||
"" to DynamicType
|
||||
)
|
||||
|
||||
|
||||
fun GenerateClass.allSuperTypes(all: Map<String, GenerateClass>) = LinkedHashSet<GenerateClass>().let { result -> allSuperTypesImpl(listOf(this), all, result); result.toList() }
|
||||
|
||||
tailrec fun allSuperTypesImpl(roots: List<GenerateClass>, all: Map<String, GenerateClass>, result: MutableSet<GenerateClass>) {
|
||||
if (roots.isNotEmpty()) {
|
||||
allSuperTypesImpl(roots.flatMap { it.superTypes }.map {
|
||||
all[it] ?: all[it.substringBefore("<")]
|
||||
}.filterNotNull().filter { result.add(it) }, all, result)
|
||||
}
|
||||
}
|
||||
|
||||
fun standardTypes() = typeMapper.values.map { it.dropNullable() }.toSet()
|
||||
fun Type.dynamicIfUnknownType(allTypes: Set<String>, standardTypes: Set<Type> = standardTypes()): Type = when {
|
||||
this is DynamicType || this is UnitType -> this
|
||||
|
||||
this is SimpleType && this.type in allTypes -> this
|
||||
this.dropNullable() in standardTypes -> this
|
||||
this is ArrayType -> copy(memberType = this.memberType.dynamicIfUnknownType(allTypes, standardTypes))
|
||||
this is UnionType -> if (this.name !in allTypes) DynamicType else this
|
||||
this is FunctionType -> copy(
|
||||
returnType = returnType.dynamicIfUnknownType(allTypes, standardTypes),
|
||||
parameterTypes = parameterTypes.map {
|
||||
it.copy(
|
||||
type = it.type.dynamicIfUnknownType(
|
||||
allTypes,
|
||||
standardTypes
|
||||
)
|
||||
)
|
||||
})
|
||||
this is PromiseType ->
|
||||
copy(valueType = valueType.dynamicIfUnknownType(allTypes, standardTypes))
|
||||
|
||||
else -> DynamicType
|
||||
}
|
||||
|
||||
private fun Type.dynamicIfAnyType(): Type = if (this is AnyType && this.nullable) DynamicType else this
|
||||
|
||||
internal fun mapType(repository: Repository, type: Type): Type = when (type) {
|
||||
is SimpleType -> {
|
||||
val typeName = type.type
|
||||
when {
|
||||
typeName in typeMapper -> typeMapper[typeName]!!.withNullability(type.nullable)
|
||||
typeName in repository.interfaces -> type
|
||||
typeName in repository.typeDefs -> mapTypedef(repository, type)
|
||||
|
||||
else -> type
|
||||
}
|
||||
}
|
||||
is PromiseType -> type.copy(valueType = mapType(repository, type.valueType))
|
||||
is ArrayType -> type.copy(memberType = mapType(repository, type.memberType))
|
||||
is UnionType -> UnionType(
|
||||
type.namespace,
|
||||
type.memberTypes.map { mt -> mapType(repository, mt) },
|
||||
type.nullable
|
||||
).toSingleTypeIfPossible()
|
||||
is FunctionType -> type.copy(
|
||||
// TODO: Remove takeWhile { !vararg } when we have varargs supported. See KT-3115
|
||||
returnType = mapType(repository, type.returnType).dynamicIfAnyType(),
|
||||
parameterTypes = type.parameterTypes.takeWhile { !it.vararg }.map { it.copy(type = mapType(repository, it.type)) }
|
||||
)
|
||||
|
||||
is AnyType,
|
||||
is UnitType,
|
||||
is DynamicType -> type
|
||||
}
|
||||
|
||||
private fun mapTypedef(repository: Repository, type: SimpleType): Type {
|
||||
val typedef = repository.typeDefs[type.type]!!
|
||||
|
||||
return when {
|
||||
typedef.types is UnionType && typedef.types.memberTypes.size == 1 -> mapType(
|
||||
repository,
|
||||
typedef.types.memberTypes.single().withNullability(type.nullable)
|
||||
)
|
||||
typedef.types is UnionType -> SimpleType(typedef.name, type.nullable)
|
||||
else -> mapType(repository, typedef.types.withNullability(type.nullable))
|
||||
}
|
||||
}
|
||||
|
||||
private fun GenerateFunction?.allTypes() =
|
||||
if (this != null) sequenceOf(returnType) + arguments.asSequence().map { it.type } else emptySequence()
|
||||
|
||||
internal fun collectUnionTypes(allTypes: Map<String, GenerateClass>) =
|
||||
allTypes.values.asSequence()
|
||||
.flatMap {
|
||||
it.secondaryConstructors.asSequence().flatMap { it.constructor.allTypes() } +
|
||||
sequenceOf(it.primaryConstructor).filterNotNull().flatMap { it.constructor.allTypes() } +
|
||||
it.memberAttributes.asSequence().map { it.type } +
|
||||
it.memberFunctions.asSequence().flatMap { it.allTypes() }
|
||||
}
|
||||
.filterIsInstance<UnionType>()
|
||||
.map { it.dropNullable() }
|
||||
.filter { it.memberTypes.all { unionMember -> unionMember is SimpleType && unionMember.type in allTypes } }
|
||||
.distinct()
|
||||
.map { it.copy(namespace = guessPackage(it.memberTypes.filterIsInstance<SimpleType>().map { it.type }, allTypes), types = it.memberTypes) }
|
||||
|
||||
private fun guessPackage(types : List<String>, allTypes: Map<String, GenerateClass>) =
|
||||
types.map { allTypes[it] }
|
||||
.map { it?.namespace }
|
||||
.filterNotNull()
|
||||
.filter { it.isNotEmpty() }
|
||||
.distinct()
|
||||
.minBy { it.split('.').size } ?: ""
|
||||
@@ -1,92 +0,0 @@
|
||||
package org.jetbrains.idl2k
|
||||
|
||||
import java.util.*
|
||||
|
||||
sealed class Type {
|
||||
abstract val nullable: Boolean
|
||||
abstract fun render(): String
|
||||
}
|
||||
|
||||
private fun String.appendNullabilitySuffix(type: Type) = if (type.nullable) "$this?" else this
|
||||
|
||||
object UnitType : Type() {
|
||||
override val nullable: Boolean
|
||||
get() = false
|
||||
|
||||
override fun render() = "Unit"
|
||||
}
|
||||
object DynamicType : Type() {
|
||||
override val nullable: Boolean
|
||||
get() = false
|
||||
|
||||
override fun render() = "dynamic"
|
||||
}
|
||||
data class AnyType(override val nullable: Boolean = true) : Type() {
|
||||
override fun render() = "Any".appendNullabilitySuffix(this)
|
||||
}
|
||||
data class SimpleType(val type: String, override val nullable: Boolean) : Type() {
|
||||
override fun render() = type.appendNullabilitySuffix(this)
|
||||
}
|
||||
data class FunctionType(val parameterTypes : List<Attribute>, val returnType : Type, override val nullable: Boolean) : Type() {
|
||||
override fun render() = if (nullable) "(${renderImpl()})?" else renderImpl()
|
||||
private fun renderImpl() = "(${parameterTypes.joinToString(", ") { it.type.render() }}) -> ${returnType.render()}"
|
||||
}
|
||||
data class PromiseType(val valueType: Type, override val nullable: Boolean) : Type() {
|
||||
override fun render() = "Promise<${valueType.render()}>".appendNullabilitySuffix(this)
|
||||
}
|
||||
|
||||
val FunctionType.arity : Int
|
||||
get() = parameterTypes.size
|
||||
|
||||
class UnionType(val namespace: String, types: Collection<Type>, override val nullable: Boolean) : Type() {
|
||||
val memberTypes: Set<Type> = LinkedHashSet(types.sortedBy { it.toString() })
|
||||
val name = "Union${this.memberTypes.map { it.render() }.joinToString("Or")}"
|
||||
|
||||
operator fun contains(type: Type) = type in memberTypes
|
||||
override fun equals(other: Any?): Boolean = other is UnionType && memberTypes == other.memberTypes
|
||||
override fun hashCode(): Int = memberTypes.hashCode()
|
||||
override fun toString(): String = memberTypes.joinToString(", ", "Union<", ">")
|
||||
|
||||
override fun render(): String = name.appendNullabilitySuffix(this)
|
||||
|
||||
fun copy(namespace: String = this.namespace, types: Collection<Type> = this.memberTypes, nullable: Boolean = this.nullable) =
|
||||
UnionType(namespace, types, nullable)
|
||||
}
|
||||
|
||||
fun UnionType.toSingleTypeIfPossible() = if (this.memberTypes.size == 1) this.memberTypes.single().withNullability(nullable) else this
|
||||
|
||||
data class ArrayType(val memberType: Type, val mutable: Boolean, override val nullable: Boolean) : Type() {
|
||||
override fun render(): String = "Array<${if (mutable) "" else "out "}${memberType.render()}>".appendNullabilitySuffix(this)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun <T: Type> T.copyWithNullability(nullable: Boolean): T = when (this) {
|
||||
is UnitType -> UnitType
|
||||
is DynamicType -> this
|
||||
|
||||
is AnyType -> this.copy(nullable = nullable)
|
||||
is SimpleType -> this.copy(nullable = nullable)
|
||||
is FunctionType -> this.copy(nullable = nullable)
|
||||
is UnionType -> this.copy(types = this.memberTypes, nullable = nullable)
|
||||
is ArrayType -> this.copy(nullable = nullable)
|
||||
is PromiseType -> this.copy(nullable = nullable)
|
||||
else -> throw UnsupportedOperationException()
|
||||
} as T
|
||||
|
||||
|
||||
private fun <T: Type> T.withNullabilityImpl(nullable: Boolean): T = if (this.nullable == nullable) this else copyWithNullability(nullable)
|
||||
fun <T: Type> T.withNullability(nullable: Boolean): T = withNullabilityImpl(this.nullable or nullable)
|
||||
fun <T: Type> T.toNullable(): T = withNullabilityImpl(true)
|
||||
fun <T: Type> T.dropNullable(): T = withNullabilityImpl(false)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <T: Type> T.toNullableIfNonPrimitive(): T = when (this) {
|
||||
is UnitType -> UnitType
|
||||
is DynamicType -> DynamicType
|
||||
|
||||
is SimpleType -> when (this.type) {
|
||||
"Int", "Short", "Byte", "Float", "Double", "Boolean", "Long" -> this
|
||||
else -> this.toNullable()
|
||||
}
|
||||
else -> this.toNullable()
|
||||
} as T
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idl2k.util
|
||||
|
||||
import org.xml.sax.InputSource
|
||||
import java.io.File
|
||||
import javax.xml.xpath.XPathFactory
|
||||
|
||||
fun readCopyrightNoticeFromProfile(copyrightProfile: File): String {
|
||||
val template = copyrightProfile.reader().use { reader ->
|
||||
XPathFactory.newInstance().newXPath().evaluate("/component/copyright/option[@name='notice']/@value", InputSource(reader))
|
||||
}
|
||||
val yearTemplate = "$today.year"
|
||||
val year = java.time.LocalDate.now().year.toString()
|
||||
assert(yearTemplate in template)
|
||||
|
||||
return template.replace(yearTemplate, year).lines().joinToString("", prefix = "/*\n", postfix = " */\n") { " * $it\n" }
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package org.jetbrains.idl2k.util
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun List<List<*>>.mutationsCount() = if (isEmpty()) 0 else fold(1) { acc, e -> acc * e.size }
|
||||
|
||||
fun <T> List<List<T>>.mutations() : List<List<T>> {
|
||||
val indices = IntArray(size)
|
||||
val sizes = map { it.size }
|
||||
|
||||
fun next() : Boolean {
|
||||
var carry = 1
|
||||
|
||||
for (pos in size - 1 downTo 0) {
|
||||
var index = indices[pos]
|
||||
val size = sizes[pos]
|
||||
|
||||
index += carry
|
||||
carry = (index - size + 1).coerceAtLeast(0)
|
||||
|
||||
if (index >= size) {
|
||||
indices[pos] = index - size
|
||||
} else {
|
||||
indices[pos] = index
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return carry == 0
|
||||
}
|
||||
|
||||
val count = mutationsCount()
|
||||
if (count == 0) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val result = ArrayList<List<T>>(count)
|
||||
do {
|
||||
result.add(indices.mapIndexed { pos, index -> this[pos][index] })
|
||||
} while (next())
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
fun mapEnumConstant(entry: String) = if (entry.isEmpty()) "EMPTY" else entry.toUpperCase().replace("-", "_")
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p ~/tmp/ca
|
||||
cd ~/tmp/ca
|
||||
|
||||
curl http://www.startssl.com/certs/ca.crt -O
|
||||
curl http://www.startssl.com/certs/sub.class1.server.ca.crt -O
|
||||
curl http://www.startssl.com/certs/sub.class2.server.ca.crt -O
|
||||
curl http://www.startssl.com/certs/sub.class3.server.ca.crt -O
|
||||
curl http://www.startssl.com/certs/sub.class4.server.ca.crt -O
|
||||
|
||||
for crt in *.crt; do
|
||||
keytool -import -trustcacerts -keystore ${JAVA_HOME}/jre/lib/security/cacerts -storepass changeit -noprompt -alias ${crt} -file ${crt};
|
||||
done
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
|
||||
import org.jetbrains.idl2k.BuildWebIdl
|
||||
import org.jetbrains.idl2k.render
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
import java.io.StringWriter
|
||||
import java.io.Writer
|
||||
|
||||
|
||||
class Idl2kTests {
|
||||
|
||||
|
||||
private fun convertIdlToWriter(file: File): Writer {
|
||||
val nonExistentCache = File.createTempFile("mdnCache", System.nanoTime().toString())
|
||||
val buildWebIdl = BuildWebIdl(nonExistentCache, file)
|
||||
|
||||
val stringWriter = StringWriter()
|
||||
stringWriter.render(
|
||||
"",
|
||||
buildWebIdl.definitions,
|
||||
buildWebIdl.unions,
|
||||
buildWebIdl.repository.enums.values.toList(),
|
||||
buildWebIdl.mdnCache
|
||||
)
|
||||
|
||||
nonExistentCache.delete()
|
||||
return stringWriter
|
||||
}
|
||||
|
||||
private fun assertIdlCompiledTo(fileName: String, expectedOutputName: String) {
|
||||
val testResourcePrefix = "src/test/resources/"
|
||||
|
||||
assertEquals(
|
||||
File(testResourcePrefix).resolve(expectedOutputName).readText(),
|
||||
convertIdlToWriter(File(testResourcePrefix).resolve(fileName)).toString()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun basicTest() {
|
||||
assertIdlCompiledTo(
|
||||
"SomethingNotInCache.idl",
|
||||
"SomethingNotInCache.kt"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
[Constructor]
|
||||
interface SomethingNotInCache {
|
||||
DOMString someEmptyMethod ();
|
||||
DOMString someMethod (SomethingUnknown root);
|
||||
USVString? optionalUsvStringFetcher(USVString name);
|
||||
readonly attribute WhateverUknownParam someReadOnlyParam;
|
||||
attribute WhateverUknownParam someWriteableParam;
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
public external open class SomethingNotInCache {
|
||||
open val someReadOnlyParam: dynamic
|
||||
var someWriteableParam: dynamic
|
||||
fun someEmptyMethod(): String
|
||||
fun someMethod(root: dynamic): String
|
||||
fun optionalUsvStringFetcher(name: String): String?
|
||||
}
|
||||
|
||||
+2
-2
@@ -75,6 +75,7 @@ include ":kotlin-build-common",
|
||||
":compiler:android-tests",
|
||||
":compiler:tests-common",
|
||||
":compiler:tests-common-jvm6",
|
||||
":dukat",
|
||||
":js:js.ast",
|
||||
":js:js.serializer",
|
||||
":js:js.parser",
|
||||
@@ -268,8 +269,6 @@ if (flags.inJpsBuildIdeaSync) {
|
||||
project(":kotlin-stdlib:jps-build").projectDir = "$rootDir/libraries/stdlib/jps-build" as File
|
||||
} else {
|
||||
// modules that we are currently cannot compile with jps
|
||||
include ":kotlin-idl2k"
|
||||
project(':kotlin-idl2k').projectDir = file("$rootDir/libraries/tools/idl2k")
|
||||
|
||||
include ":core:builtins",
|
||||
":kotlin-stdlib-common",
|
||||
@@ -414,6 +413,7 @@ project(':kotlin-imports-dumper-compiler-plugin').projectDir = "$rootDir/plugins
|
||||
project(':libraries:kotlin-prepush-hook').projectDir = "$rootDir/libraries/tools/kotlin-prepush-hook" as File
|
||||
project(':plugins:jvm-abi-gen').projectDir = "$rootDir/plugins/jvm-abi-gen" as File
|
||||
project(':plugins:jvm-abi-gen-embeddable').projectDir = "$rootDir/plugins/jvm-abi-gen/embeddable" as File
|
||||
project(":dukat").projectDir = "$rootDir/libraries/tools/dukat" as File
|
||||
|
||||
project(':js:js.tests').projectDir = "$rootDir/js/js.tests" as File
|
||||
project(':js:js.engines').projectDir = "$rootDir/js/js.engines" as File
|
||||
|
||||
Reference in New Issue
Block a user