[Wasm] Stop using Dynamic in WebIDL generated code

This commit is contained in:
Svyatoslav Kuzmich
2023-03-20 17:49:29 +01:00
committed by Space Team
parent cafc27aae9
commit 0e54ec5ef6
15 changed files with 1082 additions and 866 deletions
@@ -7,7 +7,3 @@ package kotlin.js
@PublishedApi
internal val undefined: Nothing? = null
@PublishedApi
internal fun newJsObject(): Dynamic =
js("({})")
@@ -924,11 +924,17 @@ public external open class Int8Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Int8Array.get(index: Int): Byte = asDynamic().getByte(index)
@PublishedApi
internal fun getMethodImplForInt8Array(obj: Int8Array, index: Int): Byte { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Int8Array.set(index: Int, value: Byte) { asDynamic()[index] = value }
public inline operator fun Int8Array.get(index: Int): Byte = getMethodImplForInt8Array(this, index)
@PublishedApi
internal fun setMethodImplForInt8Array(obj: Int8Array, index: Int, value: Byte) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Int8Array.set(index: Int, value: Byte) = setMethodImplForInt8Array(this, index, value)
/**
* Exposes the JavaScript [Uint8Array](https://developer.mozilla.org/en/docs/Web/API/Uint8Array) to Kotlin
@@ -951,11 +957,17 @@ public external open class Uint8Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Uint8Array.get(index: Int): Byte = asDynamic().getByte(index)
@PublishedApi
internal fun getMethodImplForUint8Array(obj: Uint8Array, index: Int): Byte { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Uint8Array.set(index: Int, value: Byte) { asDynamic()[index] = value }
public inline operator fun Uint8Array.get(index: Int): Byte = getMethodImplForUint8Array(this, index)
@PublishedApi
internal fun setMethodImplForUint8Array(obj: Uint8Array, index: Int, value: Byte) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Uint8Array.set(index: Int, value: Byte) = setMethodImplForUint8Array(this, index, value)
/**
* Exposes the JavaScript [Uint8ClampedArray](https://developer.mozilla.org/en/docs/Web/API/Uint8ClampedArray) to Kotlin
@@ -978,11 +990,17 @@ public external open class Uint8ClampedArray : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Uint8ClampedArray.get(index: Int): Byte = asDynamic().getByte(index)
@PublishedApi
internal fun getMethodImplForUint8ClampedArray(obj: Uint8ClampedArray, index: Int): Byte { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Uint8ClampedArray.set(index: Int, value: Byte) { asDynamic()[index] = value }
public inline operator fun Uint8ClampedArray.get(index: Int): Byte = getMethodImplForUint8ClampedArray(this, index)
@PublishedApi
internal fun setMethodImplForUint8ClampedArray(obj: Uint8ClampedArray, index: Int, value: Byte) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Uint8ClampedArray.set(index: Int, value: Byte) = setMethodImplForUint8ClampedArray(this, index, value)
/**
* Exposes the JavaScript [Int16Array](https://developer.mozilla.org/en/docs/Web/API/Int16Array) to Kotlin
@@ -1005,11 +1023,17 @@ public external open class Int16Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Int16Array.get(index: Int): Short = asDynamic().getShort(index)
@PublishedApi
internal fun getMethodImplForInt16Array(obj: Int16Array, index: Int): Short { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Int16Array.set(index: Int, value: Short) { asDynamic()[index] = value }
public inline operator fun Int16Array.get(index: Int): Short = getMethodImplForInt16Array(this, index)
@PublishedApi
internal fun setMethodImplForInt16Array(obj: Int16Array, index: Int, value: Short) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Int16Array.set(index: Int, value: Short) = setMethodImplForInt16Array(this, index, value)
/**
* Exposes the JavaScript [Uint16Array](https://developer.mozilla.org/en/docs/Web/API/Uint16Array) to Kotlin
@@ -1032,11 +1056,17 @@ public external open class Uint16Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Uint16Array.get(index: Int): Short = asDynamic().getShort(index)
@PublishedApi
internal fun getMethodImplForUint16Array(obj: Uint16Array, index: Int): Short { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Uint16Array.set(index: Int, value: Short) { asDynamic()[index] = value }
public inline operator fun Uint16Array.get(index: Int): Short = getMethodImplForUint16Array(this, index)
@PublishedApi
internal fun setMethodImplForUint16Array(obj: Uint16Array, index: Int, value: Short) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Uint16Array.set(index: Int, value: Short) = setMethodImplForUint16Array(this, index, value)
/**
* Exposes the JavaScript [Int32Array](https://developer.mozilla.org/en/docs/Web/API/Int32Array) to Kotlin
@@ -1059,11 +1089,17 @@ public external open class Int32Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Int32Array.get(index: Int): Int = asDynamic().getInt(index)
@PublishedApi
internal fun getMethodImplForInt32Array(obj: Int32Array, index: Int): Int { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Int32Array.set(index: Int, value: Int) { asDynamic()[index] = value }
public inline operator fun Int32Array.get(index: Int): Int = getMethodImplForInt32Array(this, index)
@PublishedApi
internal fun setMethodImplForInt32Array(obj: Int32Array, index: Int, value: Int) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Int32Array.set(index: Int, value: Int) = setMethodImplForInt32Array(this, index, value)
/**
* Exposes the JavaScript [Uint32Array](https://developer.mozilla.org/en/docs/Web/API/Uint32Array) to Kotlin
@@ -1086,11 +1122,17 @@ public external open class Uint32Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Uint32Array.get(index: Int): Int = asDynamic().getInt(index)
@PublishedApi
internal fun getMethodImplForUint32Array(obj: Uint32Array, index: Int): Int { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Uint32Array.set(index: Int, value: Int) { asDynamic()[index] = value }
public inline operator fun Uint32Array.get(index: Int): Int = getMethodImplForUint32Array(this, index)
@PublishedApi
internal fun setMethodImplForUint32Array(obj: Uint32Array, index: Int, value: Int) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Uint32Array.set(index: Int, value: Int) = setMethodImplForUint32Array(this, index, value)
/**
* Exposes the JavaScript [Float32Array](https://developer.mozilla.org/en/docs/Web/API/Float32Array) to Kotlin
@@ -1113,11 +1155,17 @@ public external open class Float32Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Float32Array.get(index: Int): Float = asDynamic().getFloat(index)
@PublishedApi
internal fun getMethodImplForFloat32Array(obj: Float32Array, index: Int): Float { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Float32Array.set(index: Int, value: Float) { asDynamic()[index] = value }
public inline operator fun Float32Array.get(index: Int): Float = getMethodImplForFloat32Array(this, index)
@PublishedApi
internal fun setMethodImplForFloat32Array(obj: Float32Array, index: Int, value: Float) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Float32Array.set(index: Int, value: Float) = setMethodImplForFloat32Array(this, index, value)
/**
* Exposes the JavaScript [Float64Array](https://developer.mozilla.org/en/docs/Web/API/Float64Array) to Kotlin
@@ -1140,11 +1188,17 @@ public external open class Float64Array : ArrayBufferView, JsAny {
}
}
@kotlin.internal.InlineOnly
public inline operator fun Float64Array.get(index: Int): Double = asDynamic().getDouble(index)
@PublishedApi
internal fun getMethodImplForFloat64Array(obj: Float64Array, index: Int): Double { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun Float64Array.set(index: Int, value: Double) { asDynamic()[index] = value }
public inline operator fun Float64Array.get(index: Int): Double = getMethodImplForFloat64Array(this, index)
@PublishedApi
internal fun setMethodImplForFloat64Array(obj: Float64Array, index: Int, value: Double) { js("obj[index] = value;") }
@kotlin.internal.InlineOnly
public inline operator fun Float64Array.set(index: Int, value: Double) = setMethodImplForFloat64Array(this, index, value)
/**
* Exposes the JavaScript [DataView](https://developer.mozilla.org/en/docs/Web/API/DataView) to Kotlin
@@ -19,8 +19,11 @@ public external abstract class MediaList : ItemArrayLike<JsString>, JsAny {
override fun item(index: Int): JsString?
}
@PublishedApi
internal fun getMethodImplForMediaList(obj: MediaList, index: Int): String? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun MediaList.get(index: Int): String? = asDynamic().getString(index)
public inline operator fun MediaList.get(index: Int): String? = getMethodImplForMediaList(this, index)
/**
* Exposes the JavaScript [StyleSheet](https://developer.mozilla.org/en/docs/Web/API/StyleSheet) to Kotlin
@@ -52,8 +55,11 @@ public external abstract class StyleSheetList : ItemArrayLike<StyleSheet>, JsAny
override fun item(index: Int): StyleSheet?
}
@PublishedApi
internal fun getMethodImplForStyleSheetList(obj: StyleSheetList, index: Int): StyleSheet? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun StyleSheetList.get(index: Int): StyleSheet? = asDynamic().getAny(index)
public inline operator fun StyleSheetList.get(index: Int): StyleSheet? = getMethodImplForStyleSheetList(this, index)
/**
* Exposes the JavaScript [LinkStyle](https://developer.mozilla.org/en/docs/Web/API/LinkStyle) to Kotlin
@@ -70,8 +76,11 @@ public external abstract class CSSRuleList : ItemArrayLike<CSSRule>, JsAny {
override fun item(index: Int): CSSRule?
}
@PublishedApi
internal fun getMethodImplForCSSRuleList(obj: CSSRuleList, index: Int): CSSRule? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun CSSRuleList.get(index: Int): CSSRule? = asDynamic().getAny(index)
public inline operator fun CSSRuleList.get(index: Int): CSSRule? = getMethodImplForCSSRuleList(this, index)
/**
* Exposes the JavaScript [CSSRule](https://developer.mozilla.org/en/docs/Web/API/CSSRule) to Kotlin
@@ -464,8 +473,11 @@ public external abstract class CSSStyleDeclaration : ItemArrayLike<JsString>, Js
override fun item(index: Int): JsString
}
@PublishedApi
internal fun getMethodImplForCSSStyleDeclaration(obj: CSSStyleDeclaration, index: Int): String? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun CSSStyleDeclaration.get(index: Int): String? = asDynamic().getString(index)
public inline operator fun CSSStyleDeclaration.get(index: Int): String? = getMethodImplForCSSStyleDeclaration(this, index)
public external interface ElementCSSInlineStyle : JsAny {
val style: CSSStyleDeclaration
@@ -80,8 +80,8 @@ public external abstract class MediaKeySession : EventTarget, JsAny {
open val expiration: Double
open val closed: Promise<Nothing?>
open val keyStatuses: MediaKeyStatusMap
open var onkeystatuseschange: ((Event) -> Dynamic?)?
open var onmessage: ((MessageEvent) -> Dynamic?)?
open var onkeystatuseschange: ((Event) -> JsAny?)?
open var onmessage: ((MessageEvent) -> JsAny?)?
fun generateRequest(initDataType: String, initData: JsAny?): Promise<Nothing?>
fun load(sessionId: String): Promise<JsBoolean>
fun update(response: JsAny?): Promise<Nothing?>
@@ -152,11 +152,11 @@ public external interface MediaKeysRequirement : JsAny {
companion object
}
public inline val MediaKeysRequirement.Companion.REQUIRED: MediaKeysRequirement get() = "required".asDynamic().unsafeCast<MediaKeysRequirement>()
public inline val MediaKeysRequirement.Companion.REQUIRED: MediaKeysRequirement get() = "required".toJsString().unsafeCast<MediaKeysRequirement>()
public inline val MediaKeysRequirement.Companion.OPTIONAL: MediaKeysRequirement get() = "optional".asDynamic().unsafeCast<MediaKeysRequirement>()
public inline val MediaKeysRequirement.Companion.OPTIONAL: MediaKeysRequirement get() = "optional".toJsString().unsafeCast<MediaKeysRequirement>()
public inline val MediaKeysRequirement.Companion.NOT_ALLOWED: MediaKeysRequirement get() = "not-allowed".asDynamic().unsafeCast<MediaKeysRequirement>()
public inline val MediaKeysRequirement.Companion.NOT_ALLOWED: MediaKeysRequirement get() = "not-allowed".toJsString().unsafeCast<MediaKeysRequirement>()
/* please, don't implement this interface! */
@JsName("null")
@@ -165,9 +165,9 @@ public external interface MediaKeySessionType : JsAny {
companion object
}
public inline val MediaKeySessionType.Companion.TEMPORARY: MediaKeySessionType get() = "temporary".asDynamic().unsafeCast<MediaKeySessionType>()
public inline val MediaKeySessionType.Companion.TEMPORARY: MediaKeySessionType get() = "temporary".toJsString().unsafeCast<MediaKeySessionType>()
public inline val MediaKeySessionType.Companion.PERSISTENT_LICENSE: MediaKeySessionType get() = "persistent-license".asDynamic().unsafeCast<MediaKeySessionType>()
public inline val MediaKeySessionType.Companion.PERSISTENT_LICENSE: MediaKeySessionType get() = "persistent-license".toJsString().unsafeCast<MediaKeySessionType>()
/* please, don't implement this interface! */
@JsName("null")
@@ -176,19 +176,19 @@ public external interface MediaKeyStatus : JsAny {
companion object
}
public inline val MediaKeyStatus.Companion.USABLE: MediaKeyStatus get() = "usable".asDynamic().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.USABLE: MediaKeyStatus get() = "usable".toJsString().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.EXPIRED: MediaKeyStatus get() = "expired".asDynamic().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.EXPIRED: MediaKeyStatus get() = "expired".toJsString().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.RELEASED: MediaKeyStatus get() = "released".asDynamic().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.RELEASED: MediaKeyStatus get() = "released".toJsString().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.OUTPUT_RESTRICTED: MediaKeyStatus get() = "output-restricted".asDynamic().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.OUTPUT_RESTRICTED: MediaKeyStatus get() = "output-restricted".toJsString().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.OUTPUT_DOWNSCALED: MediaKeyStatus get() = "output-downscaled".asDynamic().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.OUTPUT_DOWNSCALED: MediaKeyStatus get() = "output-downscaled".toJsString().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.STATUS_PENDING: MediaKeyStatus get() = "status-pending".asDynamic().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.STATUS_PENDING: MediaKeyStatus get() = "status-pending".toJsString().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.INTERNAL_ERROR: MediaKeyStatus get() = "internal-error".asDynamic().unsafeCast<MediaKeyStatus>()
public inline val MediaKeyStatus.Companion.INTERNAL_ERROR: MediaKeyStatus get() = "internal-error".toJsString().unsafeCast<MediaKeyStatus>()
/* please, don't implement this interface! */
@JsName("null")
@@ -197,10 +197,10 @@ public external interface MediaKeyMessageType : JsAny {
companion object
}
public inline val MediaKeyMessageType.Companion.LICENSE_REQUEST: MediaKeyMessageType get() = "license-request".asDynamic().unsafeCast<MediaKeyMessageType>()
public inline val MediaKeyMessageType.Companion.LICENSE_REQUEST: MediaKeyMessageType get() = "license-request".toJsString().unsafeCast<MediaKeyMessageType>()
public inline val MediaKeyMessageType.Companion.LICENSE_RENEWAL: MediaKeyMessageType get() = "license-renewal".asDynamic().unsafeCast<MediaKeyMessageType>()
public inline val MediaKeyMessageType.Companion.LICENSE_RENEWAL: MediaKeyMessageType get() = "license-renewal".toJsString().unsafeCast<MediaKeyMessageType>()
public inline val MediaKeyMessageType.Companion.LICENSE_RELEASE: MediaKeyMessageType get() = "license-release".asDynamic().unsafeCast<MediaKeyMessageType>()
public inline val MediaKeyMessageType.Companion.LICENSE_RELEASE: MediaKeyMessageType get() = "license-release".toJsString().unsafeCast<MediaKeyMessageType>()
public inline val MediaKeyMessageType.Companion.INDIVIDUALIZATION_REQUEST: MediaKeyMessageType get() = "individualization-request".asDynamic().unsafeCast<MediaKeyMessageType>()
public inline val MediaKeyMessageType.Companion.INDIVIDUALIZATION_REQUEST: MediaKeyMessageType get() = "individualization-request".toJsString().unsafeCast<MediaKeyMessageType>()
File diff suppressed because it is too large Load Diff
@@ -21,8 +21,8 @@ public external open class MediaStream() : EventTarget, MediaProvider, JsAny {
constructor(tracks: JsArray<MediaStreamTrack>)
open val id: String
open val active: Boolean
var onaddtrack: ((MediaStreamTrackEvent) -> Dynamic?)?
var onremovetrack: ((MediaStreamTrackEvent) -> Dynamic?)?
var onaddtrack: ((MediaStreamTrackEvent) -> JsAny?)?
var onremovetrack: ((MediaStreamTrackEvent) -> JsAny?)?
fun getAudioTracks(): JsArray<MediaStreamTrack>
fun getVideoTracks(): JsArray<MediaStreamTrack>
fun getTracks(): JsArray<MediaStreamTrack>
@@ -41,11 +41,11 @@ public external abstract class MediaStreamTrack : EventTarget, JsAny {
open val label: String
open var enabled: Boolean
open val muted: Boolean
open var onmute: ((Event) -> Dynamic?)?
open var onunmute: ((Event) -> Dynamic?)?
open var onmute: ((Event) -> JsAny?)?
open var onunmute: ((Event) -> JsAny?)?
open val readyState: MediaStreamTrackState
open var onended: ((Event) -> Dynamic?)?
open var onoverconstrained: ((Event) -> Dynamic?)?
open var onended: ((Event) -> JsAny?)?
open var onoverconstrained: ((Event) -> JsAny?)?
fun clone(): MediaStreamTrack
fun stop()
fun getCapabilities(): MediaTrackCapabilities
@@ -333,7 +333,7 @@ public fun OverconstrainedErrorEventInit(error: JsAny? = null, bubbles: Boolean?
* Exposes the JavaScript [MediaDevices](https://developer.mozilla.org/en/docs/Web/API/MediaDevices) to Kotlin
*/
public external abstract class MediaDevices : EventTarget, JsAny {
open var ondevicechange: ((Event) -> Dynamic?)?
open var ondevicechange: ((Event) -> JsAny?)?
fun enumerateDevices(): Promise<JsArray<MediaDeviceInfo>>
fun getSupportedConstraints(): MediaTrackSupportedConstraints
fun getUserMedia(constraints: MediaStreamConstraints = definedExternally): Promise<MediaStream>
@@ -370,7 +370,7 @@ public external interface MediaStreamConstraints : JsAny {
public fun MediaStreamConstraints(video: JsAny? = false.toJsBoolean(), audio: JsAny? = false.toJsBoolean()): MediaStreamConstraints { js("return { video, audio };") }
public external interface ConstrainablePattern : JsAny {
var onoverconstrained: ((Event) -> Dynamic?)?
var onoverconstrained: ((Event) -> JsAny?)?
get() = definedExternally
set(value) = definedExternally
fun getCapabilities(): Capabilities
@@ -491,9 +491,9 @@ public external interface MediaStreamTrackState : JsAny {
companion object
}
public inline val MediaStreamTrackState.Companion.LIVE: MediaStreamTrackState get() = "live".asDynamic().unsafeCast<MediaStreamTrackState>()
public inline val MediaStreamTrackState.Companion.LIVE: MediaStreamTrackState get() = "live".toJsString().unsafeCast<MediaStreamTrackState>()
public inline val MediaStreamTrackState.Companion.ENDED: MediaStreamTrackState get() = "ended".asDynamic().unsafeCast<MediaStreamTrackState>()
public inline val MediaStreamTrackState.Companion.ENDED: MediaStreamTrackState get() = "ended".toJsString().unsafeCast<MediaStreamTrackState>()
/* please, don't implement this interface! */
@JsName("null")
@@ -502,13 +502,13 @@ public external interface VideoFacingModeEnum : JsAny {
companion object
}
public inline val VideoFacingModeEnum.Companion.USER: VideoFacingModeEnum get() = "user".asDynamic().unsafeCast<VideoFacingModeEnum>()
public inline val VideoFacingModeEnum.Companion.USER: VideoFacingModeEnum get() = "user".toJsString().unsafeCast<VideoFacingModeEnum>()
public inline val VideoFacingModeEnum.Companion.ENVIRONMENT: VideoFacingModeEnum get() = "environment".asDynamic().unsafeCast<VideoFacingModeEnum>()
public inline val VideoFacingModeEnum.Companion.ENVIRONMENT: VideoFacingModeEnum get() = "environment".toJsString().unsafeCast<VideoFacingModeEnum>()
public inline val VideoFacingModeEnum.Companion.LEFT: VideoFacingModeEnum get() = "left".asDynamic().unsafeCast<VideoFacingModeEnum>()
public inline val VideoFacingModeEnum.Companion.LEFT: VideoFacingModeEnum get() = "left".toJsString().unsafeCast<VideoFacingModeEnum>()
public inline val VideoFacingModeEnum.Companion.RIGHT: VideoFacingModeEnum get() = "right".asDynamic().unsafeCast<VideoFacingModeEnum>()
public inline val VideoFacingModeEnum.Companion.RIGHT: VideoFacingModeEnum get() = "right".toJsString().unsafeCast<VideoFacingModeEnum>()
/* please, don't implement this interface! */
@JsName("null")
@@ -517,9 +517,9 @@ public external interface VideoResizeModeEnum : JsAny {
companion object
}
public inline val VideoResizeModeEnum.Companion.NONE: VideoResizeModeEnum get() = "none".asDynamic().unsafeCast<VideoResizeModeEnum>()
public inline val VideoResizeModeEnum.Companion.NONE: VideoResizeModeEnum get() = "none".toJsString().unsafeCast<VideoResizeModeEnum>()
public inline val VideoResizeModeEnum.Companion.CROP_AND_SCALE: VideoResizeModeEnum get() = "crop-and-scale".asDynamic().unsafeCast<VideoResizeModeEnum>()
public inline val VideoResizeModeEnum.Companion.CROP_AND_SCALE: VideoResizeModeEnum get() = "crop-and-scale".toJsString().unsafeCast<VideoResizeModeEnum>()
/* please, don't implement this interface! */
@JsName("null")
@@ -528,8 +528,8 @@ public external interface MediaDeviceKind : JsAny {
companion object
}
public inline val MediaDeviceKind.Companion.AUDIOINPUT: MediaDeviceKind get() = "audioinput".asDynamic().unsafeCast<MediaDeviceKind>()
public inline val MediaDeviceKind.Companion.AUDIOINPUT: MediaDeviceKind get() = "audioinput".toJsString().unsafeCast<MediaDeviceKind>()
public inline val MediaDeviceKind.Companion.AUDIOOUTPUT: MediaDeviceKind get() = "audiooutput".asDynamic().unsafeCast<MediaDeviceKind>()
public inline val MediaDeviceKind.Companion.AUDIOOUTPUT: MediaDeviceKind get() = "audiooutput".toJsString().unsafeCast<MediaDeviceKind>()
public inline val MediaDeviceKind.Companion.VIDEOINPUT: MediaDeviceKind get() = "videoinput".asDynamic().unsafeCast<MediaDeviceKind>()
public inline val MediaDeviceKind.Companion.VIDEOINPUT: MediaDeviceKind get() = "videoinput".toJsString().unsafeCast<MediaDeviceKind>()
@@ -21,9 +21,9 @@ public external open class MediaSource : EventTarget, MediaProvider, JsAny {
open val activeSourceBuffers: SourceBufferList
open val readyState: ReadyState
var duration: Double
var onsourceopen: ((Event) -> Dynamic?)?
var onsourceended: ((Event) -> Dynamic?)?
var onsourceclose: ((Event) -> Dynamic?)?
var onsourceopen: ((Event) -> JsAny?)?
var onsourceended: ((Event) -> JsAny?)?
var onsourceclose: ((Event) -> JsAny?)?
fun addSourceBuffer(type: String): SourceBuffer
fun removeSourceBuffer(sourceBuffer: SourceBuffer)
fun endOfStream(error: EndOfStreamError = definedExternally)
@@ -48,11 +48,11 @@ public external abstract class SourceBuffer : EventTarget, JsAny {
open val textTracks: TextTrackList
open var appendWindowStart: Double
open var appendWindowEnd: Double
open var onupdatestart: ((Event) -> Dynamic?)?
open var onupdate: ((Event) -> Dynamic?)?
open var onupdateend: ((Event) -> Dynamic?)?
open var onerror: ((Event) -> Dynamic?)?
open var onabort: ((Event) -> Dynamic?)?
open var onupdatestart: ((Event) -> JsAny?)?
open var onupdate: ((Event) -> JsAny?)?
open var onupdateend: ((Event) -> JsAny?)?
open var onerror: ((Event) -> JsAny?)?
open var onabort: ((Event) -> JsAny?)?
fun appendBuffer(data: JsAny?)
fun abort()
fun remove(start: Double, end: Double)
@@ -63,12 +63,15 @@ public external abstract class SourceBuffer : EventTarget, JsAny {
*/
public external abstract class SourceBufferList : EventTarget, JsAny {
open val length: Int
open var onaddsourcebuffer: ((Event) -> Dynamic?)?
open var onremovesourcebuffer: ((Event) -> Dynamic?)?
open var onaddsourcebuffer: ((Event) -> JsAny?)?
open var onremovesourcebuffer: ((Event) -> JsAny?)?
}
@PublishedApi
internal fun getMethodImplForSourceBufferList(obj: SourceBufferList, index: Int): SourceBuffer? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun SourceBufferList.get(index: Int): SourceBuffer? = asDynamic().getAny(index)
public inline operator fun SourceBufferList.get(index: Int): SourceBuffer? = getMethodImplForSourceBufferList(this, index)
/* please, don't implement this interface! */
@JsName("null")
@@ -77,11 +80,11 @@ public external interface ReadyState : JsAny {
companion object
}
public inline val ReadyState.Companion.CLOSED: ReadyState get() = "closed".asDynamic().unsafeCast<ReadyState>()
public inline val ReadyState.Companion.CLOSED: ReadyState get() = "closed".toJsString().unsafeCast<ReadyState>()
public inline val ReadyState.Companion.OPEN: ReadyState get() = "open".asDynamic().unsafeCast<ReadyState>()
public inline val ReadyState.Companion.OPEN: ReadyState get() = "open".toJsString().unsafeCast<ReadyState>()
public inline val ReadyState.Companion.ENDED: ReadyState get() = "ended".asDynamic().unsafeCast<ReadyState>()
public inline val ReadyState.Companion.ENDED: ReadyState get() = "ended".toJsString().unsafeCast<ReadyState>()
/* please, don't implement this interface! */
@JsName("null")
@@ -90,9 +93,9 @@ public external interface EndOfStreamError : JsAny {
companion object
}
public inline val EndOfStreamError.Companion.NETWORK: EndOfStreamError get() = "network".asDynamic().unsafeCast<EndOfStreamError>()
public inline val EndOfStreamError.Companion.NETWORK: EndOfStreamError get() = "network".toJsString().unsafeCast<EndOfStreamError>()
public inline val EndOfStreamError.Companion.DECODE: EndOfStreamError get() = "decode".asDynamic().unsafeCast<EndOfStreamError>()
public inline val EndOfStreamError.Companion.DECODE: EndOfStreamError get() = "decode".toJsString().unsafeCast<EndOfStreamError>()
/* please, don't implement this interface! */
@JsName("null")
@@ -101,6 +104,6 @@ public external interface AppendMode : JsAny {
companion object
}
public inline val AppendMode.Companion.SEGMENTS: AppendMode get() = "segments".asDynamic().unsafeCast<AppendMode>()
public inline val AppendMode.Companion.SEGMENTS: AppendMode get() = "segments".toJsString().unsafeCast<AppendMode>()
public inline val AppendMode.Companion.SEQUENCE: AppendMode get() = "sequence".asDynamic().unsafeCast<AppendMode>()
public inline val AppendMode.Companion.SEQUENCE: AppendMode get() = "sequence".toJsString().unsafeCast<AppendMode>()
@@ -192,11 +192,17 @@ public external abstract class SVGNameList : JsAny {
fun getItem(index: Int): JsAny?
}
@kotlin.internal.InlineOnly
public inline operator fun SVGNameList.get(index: Int): JsAny? = asDynamic().getAny(index)
@PublishedApi
internal fun getMethodImplForSVGNameList(obj: SVGNameList, index: Int): JsAny? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun SVGNameList.set(index: Int, newItem: JsAny?) { asDynamic()[index] = newItem }
public inline operator fun SVGNameList.get(index: Int): JsAny? = getMethodImplForSVGNameList(this, index)
@PublishedApi
internal fun setMethodImplForSVGNameList(obj: SVGNameList, index: Int, newItem: JsAny?) { js("obj[index] = newItem;") }
@kotlin.internal.InlineOnly
public inline operator fun SVGNameList.set(index: Int, newItem: JsAny?) = setMethodImplForSVGNameList(this, index, newItem)
/**
* Exposes the JavaScript [SVGNumberList](https://developer.mozilla.org/en/docs/Web/API/SVGNumberList) to Kotlin
@@ -213,11 +219,17 @@ public external abstract class SVGNumberList : JsAny {
fun getItem(index: Int): SVGNumber
}
@kotlin.internal.InlineOnly
public inline operator fun SVGNumberList.get(index: Int): SVGNumber? = asDynamic().getAny(index)
@PublishedApi
internal fun getMethodImplForSVGNumberList(obj: SVGNumberList, index: Int): SVGNumber? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun SVGNumberList.set(index: Int, newItem: SVGNumber) { asDynamic()[index] = newItem }
public inline operator fun SVGNumberList.get(index: Int): SVGNumber? = getMethodImplForSVGNumberList(this, index)
@PublishedApi
internal fun setMethodImplForSVGNumberList(obj: SVGNumberList, index: Int, newItem: SVGNumber) { js("obj[index] = newItem;") }
@kotlin.internal.InlineOnly
public inline operator fun SVGNumberList.set(index: Int, newItem: SVGNumber) = setMethodImplForSVGNumberList(this, index, newItem)
/**
* Exposes the JavaScript [SVGLengthList](https://developer.mozilla.org/en/docs/Web/API/SVGLengthList) to Kotlin
@@ -234,11 +246,17 @@ public external abstract class SVGLengthList : JsAny {
fun getItem(index: Int): SVGLength
}
@kotlin.internal.InlineOnly
public inline operator fun SVGLengthList.get(index: Int): SVGLength? = asDynamic().getAny(index)
@PublishedApi
internal fun getMethodImplForSVGLengthList(obj: SVGLengthList, index: Int): SVGLength? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun SVGLengthList.set(index: Int, newItem: SVGLength) { asDynamic()[index] = newItem }
public inline operator fun SVGLengthList.get(index: Int): SVGLength? = getMethodImplForSVGLengthList(this, index)
@PublishedApi
internal fun setMethodImplForSVGLengthList(obj: SVGLengthList, index: Int, newItem: SVGLength) { js("obj[index] = newItem;") }
@kotlin.internal.InlineOnly
public inline operator fun SVGLengthList.set(index: Int, newItem: SVGLength) = setMethodImplForSVGLengthList(this, index, newItem)
/**
* Exposes the JavaScript [SVGAnimatedBoolean](https://developer.mozilla.org/en/docs/Web/API/SVGAnimatedBoolean) to Kotlin
@@ -335,11 +353,17 @@ public external abstract class SVGStringList : JsAny {
fun getItem(index: Int): String
}
@kotlin.internal.InlineOnly
public inline operator fun SVGStringList.get(index: Int): String? = asDynamic().getString(index)
@PublishedApi
internal fun getMethodImplForSVGStringList(obj: SVGStringList, index: Int): String? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun SVGStringList.set(index: Int, newItem: String) { asDynamic()[index] = newItem }
public inline operator fun SVGStringList.get(index: Int): String? = getMethodImplForSVGStringList(this, index)
@PublishedApi
internal fun setMethodImplForSVGStringList(obj: SVGStringList, index: Int, newItem: String) { js("obj[index] = newItem;") }
@kotlin.internal.InlineOnly
public inline operator fun SVGStringList.set(index: Int, newItem: String) = setMethodImplForSVGStringList(this, index, newItem)
/**
* Exposes the JavaScript [SVGUnitTypes](https://developer.mozilla.org/en/docs/Web/API/SVGUnitTypes) to Kotlin
@@ -789,11 +813,17 @@ public external abstract class SVGTransformList : JsAny {
fun getItem(index: Int): SVGTransform
}
@kotlin.internal.InlineOnly
public inline operator fun SVGTransformList.get(index: Int): SVGTransform? = asDynamic().getAny(index)
@PublishedApi
internal fun getMethodImplForSVGTransformList(obj: SVGTransformList, index: Int): SVGTransform? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun SVGTransformList.set(index: Int, newItem: SVGTransform) { asDynamic()[index] = newItem }
public inline operator fun SVGTransformList.get(index: Int): SVGTransform? = getMethodImplForSVGTransformList(this, index)
@PublishedApi
internal fun setMethodImplForSVGTransformList(obj: SVGTransformList, index: Int, newItem: SVGTransform) { js("obj[index] = newItem;") }
@kotlin.internal.InlineOnly
public inline operator fun SVGTransformList.set(index: Int, newItem: SVGTransform) = setMethodImplForSVGTransformList(this, index, newItem)
/**
* Exposes the JavaScript [SVGAnimatedTransformList](https://developer.mozilla.org/en/docs/Web/API/SVGAnimatedTransformList) to Kotlin
@@ -1033,11 +1063,17 @@ public external abstract class SVGPointList : JsAny {
fun getItem(index: Int): DOMPoint
}
@kotlin.internal.InlineOnly
public inline operator fun SVGPointList.get(index: Int): DOMPoint? = asDynamic().getAny(index)
@PublishedApi
internal fun getMethodImplForSVGPointList(obj: SVGPointList, index: Int): DOMPoint? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun SVGPointList.set(index: Int, newItem: DOMPoint) { asDynamic()[index] = newItem }
public inline operator fun SVGPointList.get(index: Int): DOMPoint? = getMethodImplForSVGPointList(this, index)
@PublishedApi
internal fun setMethodImplForSVGPointList(obj: SVGPointList, index: Int, newItem: DOMPoint) { js("obj[index] = newItem;") }
@kotlin.internal.InlineOnly
public inline operator fun SVGPointList.set(index: Int, newItem: DOMPoint) = setMethodImplForSVGPointList(this, index, newItem)
/**
* Exposes the JavaScript [SVGPolylineElement](https://developer.mozilla.org/en/docs/Web/API/SVGPolylineElement) to Kotlin
@@ -153,21 +153,21 @@ public external interface RequestType : JsAny {
companion object
}
public inline val RequestType.Companion.EMPTY: RequestType get() = "".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.EMPTY: RequestType get() = "".toJsString().unsafeCast<RequestType>()
public inline val RequestType.Companion.AUDIO: RequestType get() = "audio".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.AUDIO: RequestType get() = "audio".toJsString().unsafeCast<RequestType>()
public inline val RequestType.Companion.FONT: RequestType get() = "font".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.FONT: RequestType get() = "font".toJsString().unsafeCast<RequestType>()
public inline val RequestType.Companion.IMAGE: RequestType get() = "image".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.IMAGE: RequestType get() = "image".toJsString().unsafeCast<RequestType>()
public inline val RequestType.Companion.SCRIPT: RequestType get() = "script".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.SCRIPT: RequestType get() = "script".toJsString().unsafeCast<RequestType>()
public inline val RequestType.Companion.STYLE: RequestType get() = "style".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.STYLE: RequestType get() = "style".toJsString().unsafeCast<RequestType>()
public inline val RequestType.Companion.TRACK: RequestType get() = "track".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.TRACK: RequestType get() = "track".toJsString().unsafeCast<RequestType>()
public inline val RequestType.Companion.VIDEO: RequestType get() = "video".asDynamic().unsafeCast<RequestType>()
public inline val RequestType.Companion.VIDEO: RequestType get() = "video".toJsString().unsafeCast<RequestType>()
/* please, don't implement this interface! */
@JsName("null")
@@ -176,35 +176,35 @@ public external interface RequestDestination : JsAny {
companion object
}
public inline val RequestDestination.Companion.EMPTY: RequestDestination get() = "".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.EMPTY: RequestDestination get() = "".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.DOCUMENT: RequestDestination get() = "document".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.DOCUMENT: RequestDestination get() = "document".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.EMBED: RequestDestination get() = "embed".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.EMBED: RequestDestination get() = "embed".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.FONT: RequestDestination get() = "font".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.FONT: RequestDestination get() = "font".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.IMAGE: RequestDestination get() = "image".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.IMAGE: RequestDestination get() = "image".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.MANIFEST: RequestDestination get() = "manifest".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.MANIFEST: RequestDestination get() = "manifest".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.MEDIA: RequestDestination get() = "media".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.MEDIA: RequestDestination get() = "media".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.OBJECT: RequestDestination get() = "object".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.OBJECT: RequestDestination get() = "object".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.REPORT: RequestDestination get() = "report".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.REPORT: RequestDestination get() = "report".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.SCRIPT: RequestDestination get() = "script".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.SCRIPT: RequestDestination get() = "script".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.SERVICEWORKER: RequestDestination get() = "serviceworker".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.SERVICEWORKER: RequestDestination get() = "serviceworker".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.SHAREDWORKER: RequestDestination get() = "sharedworker".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.SHAREDWORKER: RequestDestination get() = "sharedworker".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.STYLE: RequestDestination get() = "style".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.STYLE: RequestDestination get() = "style".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.WORKER: RequestDestination get() = "worker".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.WORKER: RequestDestination get() = "worker".toJsString().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.XSLT: RequestDestination get() = "xslt".asDynamic().unsafeCast<RequestDestination>()
public inline val RequestDestination.Companion.XSLT: RequestDestination get() = "xslt".toJsString().unsafeCast<RequestDestination>()
/* please, don't implement this interface! */
@JsName("null")
@@ -213,13 +213,13 @@ public external interface RequestMode : JsAny {
companion object
}
public inline val RequestMode.Companion.NAVIGATE: RequestMode get() = "navigate".asDynamic().unsafeCast<RequestMode>()
public inline val RequestMode.Companion.NAVIGATE: RequestMode get() = "navigate".toJsString().unsafeCast<RequestMode>()
public inline val RequestMode.Companion.SAME_ORIGIN: RequestMode get() = "same-origin".asDynamic().unsafeCast<RequestMode>()
public inline val RequestMode.Companion.SAME_ORIGIN: RequestMode get() = "same-origin".toJsString().unsafeCast<RequestMode>()
public inline val RequestMode.Companion.NO_CORS: RequestMode get() = "no-cors".asDynamic().unsafeCast<RequestMode>()
public inline val RequestMode.Companion.NO_CORS: RequestMode get() = "no-cors".toJsString().unsafeCast<RequestMode>()
public inline val RequestMode.Companion.CORS: RequestMode get() = "cors".asDynamic().unsafeCast<RequestMode>()
public inline val RequestMode.Companion.CORS: RequestMode get() = "cors".toJsString().unsafeCast<RequestMode>()
/* please, don't implement this interface! */
@JsName("null")
@@ -228,11 +228,11 @@ public external interface RequestCredentials : JsAny {
companion object
}
public inline val RequestCredentials.Companion.OMIT: RequestCredentials get() = "omit".asDynamic().unsafeCast<RequestCredentials>()
public inline val RequestCredentials.Companion.OMIT: RequestCredentials get() = "omit".toJsString().unsafeCast<RequestCredentials>()
public inline val RequestCredentials.Companion.SAME_ORIGIN: RequestCredentials get() = "same-origin".asDynamic().unsafeCast<RequestCredentials>()
public inline val RequestCredentials.Companion.SAME_ORIGIN: RequestCredentials get() = "same-origin".toJsString().unsafeCast<RequestCredentials>()
public inline val RequestCredentials.Companion.INCLUDE: RequestCredentials get() = "include".asDynamic().unsafeCast<RequestCredentials>()
public inline val RequestCredentials.Companion.INCLUDE: RequestCredentials get() = "include".toJsString().unsafeCast<RequestCredentials>()
/* please, don't implement this interface! */
@JsName("null")
@@ -241,17 +241,17 @@ public external interface RequestCache : JsAny {
companion object
}
public inline val RequestCache.Companion.DEFAULT: RequestCache get() = "default".asDynamic().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.DEFAULT: RequestCache get() = "default".toJsString().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.NO_STORE: RequestCache get() = "no-store".asDynamic().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.NO_STORE: RequestCache get() = "no-store".toJsString().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.RELOAD: RequestCache get() = "reload".asDynamic().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.RELOAD: RequestCache get() = "reload".toJsString().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.NO_CACHE: RequestCache get() = "no-cache".asDynamic().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.NO_CACHE: RequestCache get() = "no-cache".toJsString().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.FORCE_CACHE: RequestCache get() = "force-cache".asDynamic().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.FORCE_CACHE: RequestCache get() = "force-cache".toJsString().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.ONLY_IF_CACHED: RequestCache get() = "only-if-cached".asDynamic().unsafeCast<RequestCache>()
public inline val RequestCache.Companion.ONLY_IF_CACHED: RequestCache get() = "only-if-cached".toJsString().unsafeCast<RequestCache>()
/* please, don't implement this interface! */
@JsName("null")
@@ -260,11 +260,11 @@ public external interface RequestRedirect : JsAny {
companion object
}
public inline val RequestRedirect.Companion.FOLLOW: RequestRedirect get() = "follow".asDynamic().unsafeCast<RequestRedirect>()
public inline val RequestRedirect.Companion.FOLLOW: RequestRedirect get() = "follow".toJsString().unsafeCast<RequestRedirect>()
public inline val RequestRedirect.Companion.ERROR: RequestRedirect get() = "error".asDynamic().unsafeCast<RequestRedirect>()
public inline val RequestRedirect.Companion.ERROR: RequestRedirect get() = "error".toJsString().unsafeCast<RequestRedirect>()
public inline val RequestRedirect.Companion.MANUAL: RequestRedirect get() = "manual".asDynamic().unsafeCast<RequestRedirect>()
public inline val RequestRedirect.Companion.MANUAL: RequestRedirect get() = "manual".toJsString().unsafeCast<RequestRedirect>()
/* please, don't implement this interface! */
@JsName("null")
@@ -273,14 +273,14 @@ public external interface ResponseType : JsAny {
companion object
}
public inline val ResponseType.Companion.BASIC: ResponseType get() = "basic".asDynamic().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.BASIC: ResponseType get() = "basic".toJsString().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.CORS: ResponseType get() = "cors".asDynamic().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.CORS: ResponseType get() = "cors".toJsString().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.DEFAULT: ResponseType get() = "default".asDynamic().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.DEFAULT: ResponseType get() = "default".toJsString().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.ERROR: ResponseType get() = "error".asDynamic().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.ERROR: ResponseType get() = "error".toJsString().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.OPAQUE: ResponseType get() = "opaque".asDynamic().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.OPAQUE: ResponseType get() = "opaque".toJsString().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.OPAQUEREDIRECT: ResponseType get() = "opaqueredirect".asDynamic().unsafeCast<ResponseType>()
public inline val ResponseType.Companion.OPAQUEREDIRECT: ResponseType get() = "opaqueredirect".toJsString().unsafeCast<ResponseType>()
@@ -58,8 +58,11 @@ public external abstract class FileList : ItemArrayLike<File>, JsAny {
override fun item(index: Int): File?
}
@PublishedApi
internal fun getMethodImplForFileList(obj: FileList, index: Int): File? { js("return obj[index];") }
@kotlin.internal.InlineOnly
public inline operator fun FileList.get(index: Int): File? = asDynamic().getAny(index)
public inline operator fun FileList.get(index: Int): File? = getMethodImplForFileList(this, index)
/**
* Exposes the JavaScript [FileReader](https://developer.mozilla.org/en/docs/Web/API/FileReader) to Kotlin
@@ -68,12 +71,12 @@ public external open class FileReader : EventTarget, JsAny {
open val readyState: Short
open val result: JsAny?
open val error: JsAny?
var onloadstart: ((ProgressEvent) -> Dynamic?)?
var onprogress: ((ProgressEvent) -> Dynamic?)?
var onload: ((Event) -> Dynamic?)?
var onabort: ((Event) -> Dynamic?)?
var onerror: ((Event) -> Dynamic?)?
var onloadend: ((Event) -> Dynamic?)?
var onloadstart: ((ProgressEvent) -> JsAny?)?
var onprogress: ((ProgressEvent) -> JsAny?)?
var onload: ((Event) -> JsAny?)?
var onabort: ((Event) -> JsAny?)?
var onerror: ((Event) -> JsAny?)?
var onloadend: ((Event) -> JsAny?)?
fun readAsArrayBuffer(blob: Blob)
fun readAsBinaryString(blob: Blob)
fun readAsText(blob: Blob, label: String = definedExternally)
@@ -17,8 +17,8 @@ import org.w3c.workers.*
* Exposes the JavaScript [Notification](https://developer.mozilla.org/en/docs/Web/API/Notification) to Kotlin
*/
public external open class Notification(title: String, options: NotificationOptions = definedExternally) : EventTarget, JsAny {
var onclick: ((MouseEvent) -> Dynamic?)?
var onerror: ((Event) -> Dynamic?)?
var onclick: ((MouseEvent) -> JsAny?)?
var onerror: ((Event) -> JsAny?)?
open val title: String
open val dir: NotificationDirection
open val lang: String
@@ -155,11 +155,11 @@ public external interface NotificationPermission : JsAny {
companion object
}
public inline val NotificationPermission.Companion.DEFAULT: NotificationPermission get() = "default".asDynamic().unsafeCast<NotificationPermission>()
public inline val NotificationPermission.Companion.DEFAULT: NotificationPermission get() = "default".toJsString().unsafeCast<NotificationPermission>()
public inline val NotificationPermission.Companion.DENIED: NotificationPermission get() = "denied".asDynamic().unsafeCast<NotificationPermission>()
public inline val NotificationPermission.Companion.DENIED: NotificationPermission get() = "denied".toJsString().unsafeCast<NotificationPermission>()
public inline val NotificationPermission.Companion.GRANTED: NotificationPermission get() = "granted".asDynamic().unsafeCast<NotificationPermission>()
public inline val NotificationPermission.Companion.GRANTED: NotificationPermission get() = "granted".toJsString().unsafeCast<NotificationPermission>()
/* please, don't implement this interface! */
@JsName("null")
@@ -168,8 +168,8 @@ public external interface NotificationDirection : JsAny {
companion object
}
public inline val NotificationDirection.Companion.AUTO: NotificationDirection get() = "auto".asDynamic().unsafeCast<NotificationDirection>()
public inline val NotificationDirection.Companion.AUTO: NotificationDirection get() = "auto".toJsString().unsafeCast<NotificationDirection>()
public inline val NotificationDirection.Companion.LTR: NotificationDirection get() = "ltr".asDynamic().unsafeCast<NotificationDirection>()
public inline val NotificationDirection.Companion.LTR: NotificationDirection get() = "ltr".toJsString().unsafeCast<NotificationDirection>()
public inline val NotificationDirection.Companion.RTL: NotificationDirection get() = "rtl".asDynamic().unsafeCast<NotificationDirection>()
public inline val NotificationDirection.Companion.RTL: NotificationDirection get() = "rtl".toJsString().unsafeCast<NotificationDirection>()
@@ -21,7 +21,7 @@ import org.w3c.notifications.*
public external abstract class ServiceWorker : EventTarget, AbstractWorker, UnionMessagePortOrServiceWorker, UnionClientOrMessagePortOrServiceWorker, JsAny {
open val scriptURL: String
open val state: ServiceWorkerState
open var onstatechange: ((Event) -> Dynamic?)?
open var onstatechange: ((Event) -> JsAny?)?
fun postMessage(message: JsAny?, transfer: JsArray<JsAny> = definedExternally)
}
@@ -33,7 +33,7 @@ public external abstract class ServiceWorkerRegistration : EventTarget, JsAny {
open val waiting: ServiceWorker?
open val active: ServiceWorker?
open val scope: String
open var onupdatefound: ((Event) -> Dynamic?)?
open var onupdatefound: ((Event) -> JsAny?)?
open val APISpace: JsAny?
fun update(): Promise<Nothing?>
fun unregister(): Promise<JsBoolean>
@@ -48,8 +48,8 @@ public external abstract class ServiceWorkerRegistration : EventTarget, JsAny {
public external abstract class ServiceWorkerContainer : EventTarget, JsAny {
open val controller: ServiceWorker?
open val ready: Promise<ServiceWorkerRegistration>
open var oncontrollerchange: ((Event) -> Dynamic?)?
open var onmessage: ((MessageEvent) -> Dynamic?)?
open var oncontrollerchange: ((Event) -> JsAny?)?
open var onmessage: ((MessageEvent) -> JsAny?)?
fun register(scriptURL: String, options: RegistrationOptions = definedExternally): Promise<ServiceWorkerRegistration>
fun getRegistration(clientURL: String = definedExternally): Promise<JsAny?>
fun getRegistrations(): Promise<JsArray<ServiceWorkerRegistration>>
@@ -113,14 +113,14 @@ public fun ServiceWorkerMessageEventInit(data: JsAny? = undefined, origin: Strin
public external abstract class ServiceWorkerGlobalScope : WorkerGlobalScope, JsAny {
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?)?
open var oninstall: ((Event) -> JsAny?)?
open var onactivate: ((Event) -> JsAny?)?
open var onfetch: ((FetchEvent) -> JsAny?)?
open var onforeignfetch: ((Event) -> JsAny?)?
open var onmessage: ((MessageEvent) -> JsAny?)?
open var onnotificationclick: ((NotificationEvent) -> JsAny?)?
open var onnotificationclose: ((NotificationEvent) -> JsAny?)?
open var onfunctionalevent: ((Event) -> JsAny?)?
fun skipWaiting(): Promise<Nothing?>
}
@@ -392,15 +392,15 @@ public external interface ServiceWorkerState : JsAny {
companion object
}
public inline val ServiceWorkerState.Companion.INSTALLING: ServiceWorkerState get() = "installing".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.INSTALLING: ServiceWorkerState get() = "installing".toJsString().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.INSTALLED: ServiceWorkerState get() = "installed".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.INSTALLED: ServiceWorkerState get() = "installed".toJsString().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.ACTIVATING: ServiceWorkerState get() = "activating".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.ACTIVATING: ServiceWorkerState get() = "activating".toJsString().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.ACTIVATED: ServiceWorkerState get() = "activated".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.ACTIVATED: ServiceWorkerState get() = "activated".toJsString().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.REDUNDANT: ServiceWorkerState get() = "redundant".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.REDUNDANT: ServiceWorkerState get() = "redundant".toJsString().unsafeCast<ServiceWorkerState>()
/* please, don't implement this interface! */
@JsName("null")
@@ -409,13 +409,13 @@ public external interface FrameType : JsAny {
companion object
}
public inline val FrameType.Companion.AUXILIARY: FrameType get() = "auxiliary".asDynamic().unsafeCast<FrameType>()
public inline val FrameType.Companion.AUXILIARY: FrameType get() = "auxiliary".toJsString().unsafeCast<FrameType>()
public inline val FrameType.Companion.TOP_LEVEL: FrameType get() = "top-level".asDynamic().unsafeCast<FrameType>()
public inline val FrameType.Companion.TOP_LEVEL: FrameType get() = "top-level".toJsString().unsafeCast<FrameType>()
public inline val FrameType.Companion.NESTED: FrameType get() = "nested".asDynamic().unsafeCast<FrameType>()
public inline val FrameType.Companion.NESTED: FrameType get() = "nested".toJsString().unsafeCast<FrameType>()
public inline val FrameType.Companion.NONE: FrameType get() = "none".asDynamic().unsafeCast<FrameType>()
public inline val FrameType.Companion.NONE: FrameType get() = "none".toJsString().unsafeCast<FrameType>()
/* please, don't implement this interface! */
@JsName("null")
@@ -424,10 +424,10 @@ public external interface ClientType : JsAny {
companion object
}
public inline val ClientType.Companion.WINDOW: ClientType get() = "window".asDynamic().unsafeCast<ClientType>()
public inline val ClientType.Companion.WINDOW: ClientType get() = "window".toJsString().unsafeCast<ClientType>()
public inline val ClientType.Companion.WORKER: ClientType get() = "worker".asDynamic().unsafeCast<ClientType>()
public inline val ClientType.Companion.WORKER: ClientType get() = "worker".toJsString().unsafeCast<ClientType>()
public inline val ClientType.Companion.SHAREDWORKER: ClientType get() = "sharedworker".asDynamic().unsafeCast<ClientType>()
public inline val ClientType.Companion.SHAREDWORKER: ClientType get() = "sharedworker".toJsString().unsafeCast<ClientType>()
public inline val ClientType.Companion.ALL: ClientType get() = "all".asDynamic().unsafeCast<ClientType>()
public inline val ClientType.Companion.ALL: ClientType get() = "all".toJsString().unsafeCast<ClientType>()
@@ -18,13 +18,13 @@ import org.w3c.files.*
* Exposes the JavaScript [XMLHttpRequestEventTarget](https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequestEventTarget) to Kotlin
*/
public external abstract class XMLHttpRequestEventTarget : EventTarget, JsAny {
open var onloadstart: ((ProgressEvent) -> Dynamic?)?
open var onprogress: ((ProgressEvent) -> Dynamic?)?
open var onabort: ((Event) -> Dynamic?)?
open var onerror: ((Event) -> Dynamic?)?
open var onload: ((Event) -> Dynamic?)?
open var ontimeout: ((Event) -> Dynamic?)?
open var onloadend: ((Event) -> Dynamic?)?
open var onloadstart: ((ProgressEvent) -> JsAny?)?
open var onprogress: ((ProgressEvent) -> JsAny?)?
open var onabort: ((Event) -> JsAny?)?
open var onerror: ((Event) -> JsAny?)?
open var onload: ((Event) -> JsAny?)?
open var ontimeout: ((Event) -> JsAny?)?
open var onloadend: ((Event) -> JsAny?)?
}
public external abstract class XMLHttpRequestUpload : XMLHttpRequestEventTarget, JsAny
@@ -33,7 +33,7 @@ public external abstract class XMLHttpRequestUpload : XMLHttpRequestEventTarget,
* Exposes the JavaScript [XMLHttpRequest](https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest) to Kotlin
*/
public external open class XMLHttpRequest : XMLHttpRequestEventTarget, JsAny {
var onreadystatechange: ((Event) -> Dynamic?)?
var onreadystatechange: ((Event) -> JsAny?)?
open val readyState: Short
var timeout: Int
var withCredentials: Boolean
@@ -115,14 +115,14 @@ public external interface XMLHttpRequestResponseType : JsAny {
companion object
}
public inline val XMLHttpRequestResponseType.Companion.EMPTY: XMLHttpRequestResponseType get() = "".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.EMPTY: XMLHttpRequestResponseType get() = "".toJsString().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.ARRAYBUFFER: XMLHttpRequestResponseType get() = "arraybuffer".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.ARRAYBUFFER: XMLHttpRequestResponseType get() = "arraybuffer".toJsString().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.BLOB: XMLHttpRequestResponseType get() = "blob".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.BLOB: XMLHttpRequestResponseType get() = "blob".toJsString().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.DOCUMENT: XMLHttpRequestResponseType get() = "document".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.DOCUMENT: XMLHttpRequestResponseType get() = "document".toJsString().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.JSON: XMLHttpRequestResponseType get() = "json".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.JSON: XMLHttpRequestResponseType get() = "json".toJsString().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.TEXT: XMLHttpRequestResponseType get() = "text".asDynamic().unsafeCast<XMLHttpRequestResponseType>()
public inline val XMLHttpRequestResponseType.Companion.TEXT: XMLHttpRequestResponseType get() = "text".toJsString().unsafeCast<XMLHttpRequestResponseType>()
@@ -37,7 +37,6 @@ import org.jetbrains.dukat.astModel.VariableModel
import org.jetbrains.dukat.astModel.Variance
import org.jetbrains.dukat.astModel.expressions.literals.StringLiteralExpressionModel
import org.jetbrains.dukat.astModel.modifiers.VisibilityModifierModel
import org.jetbrains.dukat.astModel.statements.AssignmentStatementModel
import org.jetbrains.dukat.astModel.statements.BlockStatementModel
import org.jetbrains.dukat.astModel.statements.ExpressionStatementModel
import org.jetbrains.dukat.astModel.statements.ReturnStatementModel
@@ -49,7 +48,6 @@ import org.jetbrains.dukat.idlDeclarations.*
import org.jetbrains.dukat.idlLowerings.IDLLowering
import org.jetbrains.dukat.panic.raiseConcern
import org.jetbrains.dukat.stdlib.TSLIBROOT
import org.jetbrains.dukat.stdlib.isDynamic
import org.jetbrains.dukat.stdlib.isTsStdlibPrefixed
import org.jetbrains.dukat.translator.ROOT_PACKAGENAME
import java.io.File
@@ -82,6 +80,11 @@ private val INLINE_ONLY_ANNOTATION = AnnotationModel(
params = listOf()
)
private val PUBLISHED_API_ANNOTATION = AnnotationModel(
name = IdentifierEntity("PublishedApi"),
params = listOf()
)
private class IdlFileConverter(
private val fileDeclaration: IDLFileDeclaration,
private val typeMap: Map<String, NameEntity?>,
@@ -155,22 +158,6 @@ private class IdlFileConverter(
}
}
private fun createGetterForDynamic(expression: ExpressionModel, type: TypeModel, key: String): ExpressionModel {
val identifierExpression = IdentifierExpressionModel(IdentifierEntity(key))
return if (!true /* Use static getters */) {
IndexExpressionModel(expression, identifierExpression)
} else {
val converter = IdentifierEntity((type as? TypeValueModel)?.value?.staticConverter() ?: "getAny")
PropertyAccessExpressionModel(
left = expression,
right = CallExpressionModel(
expression = IdentifierExpressionModel(converter),
arguments = listOf(identifierExpression),
)
)
}
}
private fun String.stdFqName(): NameEntity? {
val name = toStdMap[this] ?: this
return if (stdLibTypes.contains(name)) {
@@ -219,13 +206,7 @@ private class IdlFileConverter(
}
private fun IDLFunctionTypeDeclaration.convertToModel(): FunctionTypeModel {
val returnTypeModel = if (returnType.name == "any") {
TypeValueModel(IdentifierEntity("dynamic"), listOf(), null, null)
} else {
returnType.convertToModel()
}
val returnTypeModel = returnType.convertToModel()
return FunctionTypeModel(
parameters = arguments.filterNot { it.variadic }.map { it.convertToLambdaParameterModel() },
type = returnTypeModel,
@@ -282,16 +263,51 @@ private class IdlFileConverter(
)
}
private fun IDLSetterDeclaration.processAsTopLevel(ownerName: NameEntity): FunctionModel {
return FunctionModel(
private fun IDLSetterDeclaration.processAsTopLevel(ownerName: NameEntity): List<TopLevelModel> {
val privateSetterName = IdentifierEntity("setMethodImplFor" + (ownerName as IdentifierEntity).value)
val unitType = TypeValueModel(
value = IdentifierEntity("Unit"),
params = listOf(),
metaDescription = null,
fqName = "Unit".stdFqName()
)
val privateSetterImpl = FunctionModel(
name = privateSetterName,
parameters = listOf(
ParameterModel(
"obj",
type = TypeValueModel(ownerName, params = emptyList(), null, null),
initializer = null,
vararg = false,
modifier = null
),
key.convertToParameterModel(),
value.convertToParameterModel(),
),
type = unitType,
typeParameters = listOf(),
export = false,
inline = false,
extend = null,
operator = false,
annotations = mutableListOf(
PUBLISHED_API_ANNOTATION
),
body = BlockStatementModel(
listOf(
ExpressionStatementModel(callJsFunction("obj[${key.name}] = ${value.name};"))
)
),
visibilityModifier = VisibilityModifierModel.INTERNAL,
comment = null,
external = false
)
val publicSetter = FunctionModel(
name = IdentifierEntity("set"),
parameters = listOf(key.convertToParameterModel(), value.convertToParameterModel()),
type = TypeValueModel(
value = IdentifierEntity("Unit"),
params = listOf(),
metaDescription = null,
fqName = "Unit".stdFqName()
),
type = unitType,
typeParameters = listOf(),
annotations = mutableListOf(
INLINE_ONLY_ANNOTATION
@@ -303,28 +319,65 @@ private class IdlFileConverter(
name = ownerName,
typeParameters = listOf()
),
body = BlockStatementModel(listOf(
AssignmentStatementModel(
IndexExpressionModel(
CallExpressionModel(
IdentifierExpressionModel(IdentifierEntity("asDynamic")),
listOf()
body = BlockStatementModel(
listOf(
ReturnStatementModel(
CallExpressionModel(
expression = IdentifierExpressionModel(privateSetterName),
arguments = listOf(
ThisExpressionModel(),
IdentifierExpressionModel(IdentifierEntity(key.name)),
IdentifierExpressionModel(IdentifierEntity(value.name))
),
IdentifierExpressionModel(
IdentifierEntity(key.name)
)
),
IdentifierExpressionModel(IdentifierEntity(value.name))
)
)
)),
visibilityModifier = VisibilityModifierModel.DEFAULT,
)
),
visibilityModifier = VisibilityModifierModel.PUBLIC,
comment = null,
external = true
)
return listOf(privateSetterImpl, publicSetter)
}
private fun IDLGetterDeclaration.processAsTopLevel(ownerName: NameEntity): FunctionModel {
return FunctionModel(
private fun IDLGetterDeclaration.processAsTopLevel(ownerName: NameEntity): List<TopLevelModel> {
val keyExpression = IdentifierExpressionModel(IdentifierEntity(value = key.name))
IdentifierEntity((valueType.toNullableIfNotPrimitive().convertToModel() as? TypeValueModel)?.value?.staticConverter() ?: "getAny")
val privateGetterName = IdentifierEntity("getMethodImplFor" + (ownerName as IdentifierEntity).value)
val privateGetterImpl = FunctionModel(
name = privateGetterName,
parameters = listOf(
ParameterModel(
"obj",
type = TypeValueModel(ownerName, params = emptyList(), null, null),
initializer = null,
vararg = false,
modifier = null
),
key.convertToParameterModel()
),
type = valueType.toNullableIfNotPrimitive().convertToModel(),
typeParameters = listOf(),
export = false,
inline = false,
extend = null,
operator = false,
annotations = mutableListOf(
PUBLISHED_API_ANNOTATION
),
body = BlockStatementModel(
listOf(
ExpressionStatementModel(callJsFunction("return obj[${key.name}];"))
)
),
visibilityModifier = VisibilityModifierModel.INTERNAL,
comment = null,
external = false
)
val publicGetter = FunctionModel(
name = IdentifierEntity("get"),
parameters = listOf(key.convertToParameterModel()),
type = valueType.toNullableIfNotPrimitive().convertToModel(),
@@ -339,24 +392,22 @@ private class IdlFileConverter(
name = ownerName,
typeParameters = listOf()
),
body = BlockStatementModel(listOf(
body = BlockStatementModel(
listOf(
ReturnStatementModel(
createGetterForDynamic(
expression = CallExpressionModel(
IdentifierExpressionModel(
IdentifierEntity("asDynamic")
),
listOf()
),
type = valueType.toNullableIfNotPrimitive().convertToModel(),
key = key.name,
CallExpressionModel(
expression = IdentifierExpressionModel(privateGetterName),
arguments = listOf(ThisExpressionModel(), keyExpression),
)
)
)),
visibilityModifier = VisibilityModifierModel.DEFAULT,
)
),
visibilityModifier = VisibilityModifierModel.PUBLIC,
comment = null,
external = true
)
return listOf(privateGetterImpl, publicGetter)
}
private fun IDLInterfaceDeclaration.convertToModel(): List<TopLevelModel> {
@@ -386,7 +437,7 @@ private class IdlFileConverter(
name = IdentifierEntity(""),
members = staticMemberModels,
parentEntities = listOf(),
visibilityModifier = VisibilityModifierModel.DEFAULT,
visibilityModifier = VisibilityModifierModel.PUBLIC,
comment = null,
external = true
)
@@ -424,7 +475,7 @@ private class IdlFileConverter(
comment = null,
annotations = annotationModels,
external = true,
visibilityModifier = VisibilityModifierModel.DEFAULT
visibilityModifier = VisibilityModifierModel.PUBLIC
)
} else {
ClassModel(
@@ -446,11 +497,11 @@ private class IdlFileConverter(
} else {
InheritanceModifierModel.OPEN
},
visibilityModifier = VisibilityModifierModel.DEFAULT
visibilityModifier = VisibilityModifierModel.PUBLIC
)
}
val getterModels = getters.map { it.processAsTopLevel(declaration.name) }
val setterModels = setters.map { it.processAsTopLevel(declaration.name) }
val getterModels = getters.flatMap { it.processAsTopLevel(declaration.name) }
val setterModels = setters.flatMap { it.processAsTopLevel(declaration.name) }
return listOf(declaration) + getterModels + setterModels
}
@@ -476,22 +527,7 @@ private class IdlFileConverter(
val defaultValueModel = IdentifierExpressionModel(
IdentifierEntity(newDefaultValue!!)
)
if (newDefaultValue != "undefined" && type is TypeValueModel && type.value.isDynamic) {
ExpressionStatementModel(
PropertyAccessExpressionModel(
defaultValueModel,
CallExpressionModel(
IdentifierExpressionModel(
IdentifierEntity("unsafeCast")
),
listOf(),
typeParameters = listOf(type)
)
)
)
} else {
ExpressionStatementModel(defaultValueModel)
}
ExpressionStatementModel(defaultValueModel)
} else {
null
},
@@ -500,20 +536,6 @@ private class IdlFileConverter(
)
}
private fun IDLDictionaryMemberDeclaration.convertToAssignmentStatementModel(): AssignmentStatementModel {
return AssignmentStatementModel(
IndexExpressionModel(
IdentifierExpressionModel(
IdentifierEntity("o")
),
StringLiteralExpressionModel(name)
),
IdentifierExpressionModel(
IdentifierEntity(name)
)
)
}
fun callJsFunction(code: String): CallExpressionModel =
CallExpressionModel(
expression = IdentifierExpressionModel(IdentifierEntity("js")),
@@ -543,7 +565,7 @@ private class IdlFileConverter(
comment = null,
annotations = mutableListOf(),
external = true,
visibilityModifier = VisibilityModifierModel.DEFAULT
visibilityModifier = VisibilityModifierModel.PUBLIC
)
val generatedFunction = FunctionModel(
name = IdentifierEntity(name),
@@ -566,7 +588,7 @@ private class IdlFileConverter(
operator = false,
extend = null,
body = BlockStatementModel(generateFunctionBody()),
visibilityModifier = VisibilityModifierModel.DEFAULT,
visibilityModifier = VisibilityModifierModel.PUBLIC,
comment = null,
external = false
)
@@ -581,7 +603,7 @@ private class IdlFileConverter(
name = IdentifierEntity(""),
members = listOf(),
parentEntities = listOf(),
visibilityModifier = VisibilityModifierModel.DEFAULT,
visibilityModifier = VisibilityModifierModel.PUBLIC,
comment = null,
external = false
),
@@ -607,7 +629,7 @@ private class IdlFileConverter(
)
),
external = true,
visibilityModifier = VisibilityModifierModel.DEFAULT
visibilityModifier = VisibilityModifierModel.PUBLIC
)
val generatedVariables = members.map { memberName ->
val processedName = processEnumMember(memberName)
@@ -631,7 +653,7 @@ private class IdlFileConverter(
memberName.removeSurrounding("\"")
),
CallExpressionModel(
IdentifierExpressionModel(IdentifierEntity("asDynamic")),
IdentifierExpressionModel(IdentifierEntity("toJsString")),
listOf()
)
),
@@ -660,7 +682,7 @@ private class IdlFileConverter(
),
typeParameters = listOf()
),
visibilityModifier = VisibilityModifierModel.DEFAULT,
visibilityModifier = VisibilityModifierModel.PUBLIC,
comment = null,
explicitlyDeclaredType = true
)
@@ -674,7 +696,7 @@ private class IdlFileConverter(
members = attributes.mapNotNull { it.convertToModel() } +
operations.mapNotNull { it.convertToModel() },
parentEntities = listOf(),
visibilityModifier = VisibilityModifierModel.DEFAULT,
visibilityModifier = VisibilityModifierModel.PUBLIC,
comment = null,
external = true
)
@@ -696,7 +718,7 @@ private class IdlFileConverter(
comment = null,
annotations = mutableListOf(),
external = true,
visibilityModifier = VisibilityModifierModel.DEFAULT
visibilityModifier = VisibilityModifierModel.PUBLIC
)
}
@@ -41,7 +41,6 @@ fun translateIdlToSourceSet(fileName: String): SourceSetModel {
.lower(ReplaceDynamics()) // Wasm-specific
.addKDocs()
.relocateDeclarations()
.resolveTopLevelVisibility(alwaysPublic())
.addImportsForUsedPackages()
.omitStdLib()
.lower(WasmPostProcessingHacks())
@@ -97,8 +96,3 @@ class WasmPostProcessingHacks : TopLevelModelLowering {
}
}
}
private fun alwaysPublic(): VisibilityModifierResolver = object : VisibilityModifierResolver {
override fun resolve(): VisibilityModifierModel = VisibilityModifierModel.PUBLIC
}