Introduce TrackEvent, MediaStreamTrackEvent-related IDL definitions
This commit is contained in:
@@ -0,0 +1,233 @@
|
||||
namespace org.w3c.dom.mediacapture;
|
||||
|
||||
|
||||
// Downloaded from https://w3c.github.io/mediacapture-main/
|
||||
[Exposed=Window,
|
||||
Constructor,
|
||||
Constructor (MediaStream stream),
|
||||
Constructor (sequence<MediaStreamTrack> tracks)]
|
||||
interface MediaStream : EventTarget {
|
||||
readonly attribute DOMString id;
|
||||
sequence<MediaStreamTrack> getAudioTracks ();
|
||||
sequence<MediaStreamTrack> getVideoTracks ();
|
||||
sequence<MediaStreamTrack> getTracks ();
|
||||
MediaStreamTrack? getTrackById (DOMString trackId);
|
||||
void addTrack (MediaStreamTrack track);
|
||||
void removeTrack (MediaStreamTrack track);
|
||||
MediaStream clone ();
|
||||
readonly attribute boolean active;
|
||||
attribute EventHandler onaddtrack;
|
||||
attribute EventHandler onremovetrack;
|
||||
};
|
||||
[Exposed=Window]
|
||||
interface MediaStreamTrack : EventTarget {
|
||||
readonly attribute DOMString kind;
|
||||
readonly attribute DOMString id;
|
||||
readonly attribute DOMString label;
|
||||
attribute boolean enabled;
|
||||
readonly attribute boolean muted;
|
||||
attribute EventHandler onmute;
|
||||
attribute EventHandler onunmute;
|
||||
readonly attribute MediaStreamTrackState readyState;
|
||||
attribute EventHandler onended;
|
||||
MediaStreamTrack clone ();
|
||||
void stop ();
|
||||
MediaTrackCapabilities getCapabilities ();
|
||||
MediaTrackConstraints getConstraints ();
|
||||
MediaTrackSettings getSettings ();
|
||||
Promise<void> applyConstraints (optional MediaTrackConstraints constraints);
|
||||
attribute EventHandler onoverconstrained;
|
||||
};
|
||||
enum MediaStreamTrackState {
|
||||
"live",
|
||||
"ended"
|
||||
};
|
||||
dictionary MediaTrackSupportedConstraints {
|
||||
boolean width = true;
|
||||
boolean height = true;
|
||||
boolean aspectRatio = true;
|
||||
boolean frameRate = true;
|
||||
boolean facingMode = true;
|
||||
boolean resizeMode = true;
|
||||
boolean volume = true;
|
||||
boolean sampleRate = true;
|
||||
boolean sampleSize = true;
|
||||
boolean echoCancellation = true;
|
||||
boolean autoGainControl = true;
|
||||
boolean noiseSuppression = true;
|
||||
boolean latency = true;
|
||||
boolean channelCount = true;
|
||||
boolean deviceId = true;
|
||||
boolean groupId = true;
|
||||
};
|
||||
dictionary MediaTrackCapabilities {
|
||||
ULongRange width;
|
||||
ULongRange height;
|
||||
DoubleRange aspectRatio;
|
||||
DoubleRange frameRate;
|
||||
sequence<DOMString> facingMode;
|
||||
sequence<DOMString> resizeMode;
|
||||
DoubleRange volume;
|
||||
ULongRange sampleRate;
|
||||
ULongRange sampleSize;
|
||||
sequence<boolean> echoCancellation;
|
||||
sequence<boolean> autoGainControl;
|
||||
sequence<boolean> noiseSuppression;
|
||||
DoubleRange latency;
|
||||
ULongRange channelCount;
|
||||
DOMString deviceId;
|
||||
DOMString groupId;
|
||||
};
|
||||
dictionary MediaTrackConstraints : MediaTrackConstraintSet {
|
||||
sequence<MediaTrackConstraintSet> advanced;
|
||||
};
|
||||
dictionary MediaTrackConstraintSet {
|
||||
ConstrainULong width;
|
||||
ConstrainULong height;
|
||||
ConstrainDouble aspectRatio;
|
||||
ConstrainDouble frameRate;
|
||||
ConstrainDOMString facingMode;
|
||||
ConstrainDOMString resizeMode;
|
||||
ConstrainDouble volume;
|
||||
ConstrainULong sampleRate;
|
||||
ConstrainULong sampleSize;
|
||||
ConstrainBoolean echoCancellation;
|
||||
ConstrainBoolean autoGainControl;
|
||||
ConstrainBoolean noiseSuppression;
|
||||
ConstrainDouble latency;
|
||||
ConstrainULong channelCount;
|
||||
ConstrainDOMString deviceId;
|
||||
ConstrainDOMString groupId;
|
||||
};
|
||||
dictionary MediaTrackSettings {
|
||||
long width;
|
||||
long height;
|
||||
double aspectRatio;
|
||||
double frameRate;
|
||||
DOMString facingMode;
|
||||
DOMString resizeMode;
|
||||
double volume;
|
||||
long sampleRate;
|
||||
long sampleSize;
|
||||
boolean echoCancellation;
|
||||
boolean autoGainControl;
|
||||
boolean noiseSuppression;
|
||||
double latency;
|
||||
long channelCount;
|
||||
DOMString deviceId;
|
||||
DOMString groupId;
|
||||
};
|
||||
enum VideoFacingModeEnum {
|
||||
"user",
|
||||
"environment",
|
||||
"left",
|
||||
"right"
|
||||
};
|
||||
enum VideoResizeModeEnum {
|
||||
"none",
|
||||
"crop-and-scale"
|
||||
};
|
||||
[Exposed=Window,
|
||||
Constructor (DOMString type, MediaStreamTrackEventInit eventInitDict)]
|
||||
interface MediaStreamTrackEvent : Event {
|
||||
[SameObject]
|
||||
readonly attribute MediaStreamTrack track;
|
||||
};
|
||||
dictionary MediaStreamTrackEventInit : EventInit {
|
||||
required MediaStreamTrack track;
|
||||
};
|
||||
[Exposed=Window,
|
||||
Constructor (DOMString type, OverconstrainedErrorEventInit eventInitDict)]
|
||||
interface OverconstrainedErrorEvent : Event {
|
||||
readonly attribute OverconstrainedError? error;
|
||||
};
|
||||
dictionary OverconstrainedErrorEventInit : EventInit {
|
||||
OverconstrainedError? error = null;
|
||||
};
|
||||
partial interface Navigator {
|
||||
[SameObject, SecureContext]
|
||||
readonly attribute MediaDevices mediaDevices;
|
||||
};
|
||||
[Exposed=Window,
|
||||
SecureContext]
|
||||
interface MediaDevices : EventTarget {
|
||||
attribute EventHandler ondevicechange;
|
||||
Promise<sequence<MediaDeviceInfo>> enumerateDevices ();
|
||||
};
|
||||
[Exposed=Window]
|
||||
interface MediaDeviceInfo {
|
||||
readonly attribute DOMString deviceId;
|
||||
readonly attribute MediaDeviceKind kind;
|
||||
readonly attribute DOMString label;
|
||||
readonly attribute DOMString groupId;
|
||||
[Default] object toJSON();
|
||||
};
|
||||
enum MediaDeviceKind {
|
||||
"audioinput",
|
||||
"audiooutput",
|
||||
"videoinput"
|
||||
};
|
||||
[Exposed=Window] interface InputDeviceInfo : MediaDeviceInfo {
|
||||
MediaTrackCapabilities getCapabilities ();
|
||||
};
|
||||
partial interface Navigator {
|
||||
[SecureContext]
|
||||
void getUserMedia (MediaStreamConstraints constraints, NavigatorUserMediaSuccessCallback successCallback, NavigatorUserMediaErrorCallback errorCallback);
|
||||
};
|
||||
partial interface MediaDevices {
|
||||
MediaTrackSupportedConstraints getSupportedConstraints ();
|
||||
Promise<MediaStream> getUserMedia (optional MediaStreamConstraints constraints);
|
||||
};
|
||||
dictionary MediaStreamConstraints {
|
||||
(boolean or MediaTrackConstraints) video = false;
|
||||
(boolean or MediaTrackConstraints) audio = false;
|
||||
};
|
||||
callback NavigatorUserMediaSuccessCallback = void (MediaStream stream);
|
||||
callback NavigatorUserMediaErrorCallback = void (MediaStreamError error);
|
||||
typedef object MediaStreamError;
|
||||
[NoInterfaceObject]
|
||||
interface ConstrainablePattern {
|
||||
Capabilities getCapabilities ();
|
||||
Constraints getConstraints ();
|
||||
Settings getSettings ();
|
||||
Promise<void> applyConstraints (optional Constraints constraints);
|
||||
attribute EventHandler onoverconstrained;
|
||||
};
|
||||
dictionary DoubleRange {
|
||||
double max;
|
||||
double min;
|
||||
};
|
||||
dictionary ConstrainDoubleRange : DoubleRange {
|
||||
double exact;
|
||||
double ideal;
|
||||
};
|
||||
dictionary ULongRange {
|
||||
[Clamp] unsigned long max;
|
||||
[Clamp] unsigned long min;
|
||||
};
|
||||
dictionary ConstrainULongRange : ULongRange {
|
||||
[Clamp] unsigned long exact;
|
||||
[Clamp] unsigned long ideal;
|
||||
};
|
||||
dictionary ConstrainBooleanParameters {
|
||||
boolean exact;
|
||||
boolean ideal;
|
||||
};
|
||||
dictionary ConstrainDOMStringParameters {
|
||||
(DOMString or sequence<DOMString>) exact;
|
||||
(DOMString or sequence<DOMString>) ideal;
|
||||
};
|
||||
typedef ([Clamp] unsigned long or ConstrainULongRange) ConstrainULong;
|
||||
typedef (double or ConstrainDoubleRange) ConstrainDouble;
|
||||
typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean;
|
||||
typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString;
|
||||
dictionary Capabilities {
|
||||
};
|
||||
dictionary Settings {
|
||||
};
|
||||
dictionary ConstraintSet {
|
||||
};
|
||||
dictionary Constraints : ConstraintSet {
|
||||
sequence<ConstraintSet> advanced;
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.khronos.webgl.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.khronos.webgl.*
|
||||
import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.khronos.webgl.*
|
||||
import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.khronos.webgl.*
|
||||
import org.w3c.css.masking.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
@@ -823,8 +824,8 @@ public external abstract class MediaError {
|
||||
public external abstract class AudioTrackList : EventTarget {
|
||||
open val length: Int
|
||||
open var onchange: ((Event) -> dynamic)?
|
||||
open var onaddtrack: ((Event) -> dynamic)?
|
||||
open var onremovetrack: ((Event) -> dynamic)?
|
||||
open var onaddtrack: ((TrackEvent) -> dynamic)?
|
||||
open var onremovetrack: ((TrackEvent) -> dynamic)?
|
||||
fun getTrackById(id: String): AudioTrack?
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun AudioTrackList.get(index: Int): AudioTrack? = asDynamic()[index]
|
||||
@@ -847,8 +848,8 @@ public external abstract class VideoTrackList : EventTarget {
|
||||
open val length: Int
|
||||
open val selectedIndex: Int
|
||||
open var onchange: ((Event) -> dynamic)?
|
||||
open var onaddtrack: ((Event) -> dynamic)?
|
||||
open var onremovetrack: ((Event) -> dynamic)?
|
||||
open var onaddtrack: ((TrackEvent) -> dynamic)?
|
||||
open var onremovetrack: ((TrackEvent) -> dynamic)?
|
||||
fun getTrackById(id: String): VideoTrack?
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun VideoTrackList.get(index: Int): VideoTrack? = asDynamic()[index]
|
||||
@@ -867,8 +868,8 @@ public external abstract class VideoTrack : UnionAudioTrackOrTextTrackOrVideoTra
|
||||
public external abstract class TextTrackList : EventTarget {
|
||||
open val length: Int
|
||||
open var onchange: ((Event) -> dynamic)?
|
||||
open var onaddtrack: ((Event) -> dynamic)?
|
||||
open var onremovetrack: ((Event) -> dynamic)?
|
||||
open var onaddtrack: ((TrackEvent) -> dynamic)?
|
||||
open var onremovetrack: ((TrackEvent) -> dynamic)?
|
||||
fun getTrackById(id: String): TextTrack?
|
||||
}
|
||||
@kotlin.internal.InlineOnly inline operator fun TextTrackList.get(index: Int): TextTrack? = asDynamic()[index]
|
||||
@@ -2260,7 +2261,9 @@ public external interface WindowOrWorkerGlobalScope {
|
||||
public external abstract class Navigator : NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorContentUtils, NavigatorCookies, NavigatorPlugins, NavigatorConcurrentHardware {
|
||||
open val serviceWorker: ServiceWorkerContainer
|
||||
open val maxTouchPoints: Int
|
||||
open val mediaDevices: MediaDevices
|
||||
fun vibrate(pattern: dynamic): Boolean
|
||||
fun getUserMedia(constraints: MediaStreamConstraints, successCallback: (MediaStream) -> Unit, errorCallback: (dynamic) -> Unit): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,717 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. 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
|
||||
|
||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||
package org.w3c.dom.mediacapture
|
||||
|
||||
import kotlin.js.*
|
||||
import org.khronos.webgl.*
|
||||
import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.dom.url.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaStream](https://developer.mozilla.org/en/docs/Web/API/MediaStream) to Kotlin
|
||||
*/
|
||||
public external open class MediaStream() : EventTarget {
|
||||
constructor(stream: MediaStream)
|
||||
constructor(tracks: Array<MediaStreamTrack>)
|
||||
open val id: String
|
||||
open val active: Boolean
|
||||
var onaddtrack: ((MediaStreamTrackEvent) -> dynamic)?
|
||||
var onremovetrack: ((MediaStreamTrackEvent) -> dynamic)?
|
||||
fun getAudioTracks(): Array<MediaStreamTrack>
|
||||
fun getVideoTracks(): Array<MediaStreamTrack>
|
||||
fun getTracks(): Array<MediaStreamTrack>
|
||||
fun getTrackById(trackId: String): MediaStreamTrack?
|
||||
fun addTrack(track: MediaStreamTrack): Unit
|
||||
fun removeTrack(track: MediaStreamTrack): Unit
|
||||
fun clone(): MediaStream
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaStreamTrack](https://developer.mozilla.org/en/docs/Web/API/MediaStreamTrack) to Kotlin
|
||||
*/
|
||||
public external abstract class MediaStreamTrack : EventTarget {
|
||||
open val kind: String
|
||||
open val id: String
|
||||
open val label: String
|
||||
open var enabled: Boolean
|
||||
open val muted: Boolean
|
||||
open var onmute: ((Event) -> dynamic)?
|
||||
open var onunmute: ((Event) -> dynamic)?
|
||||
open val readyState: MediaStreamTrackState
|
||||
open var onended: ((Event) -> dynamic)?
|
||||
open var onoverconstrained: ((Event) -> dynamic)?
|
||||
fun clone(): MediaStreamTrack
|
||||
fun stop(): Unit
|
||||
fun getCapabilities(): MediaTrackCapabilities
|
||||
fun getConstraints(): MediaTrackConstraints
|
||||
fun getSettings(): MediaTrackSettings
|
||||
fun applyConstraints(constraints: MediaTrackConstraints = definedExternally): Promise<Unit>
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaTrackSupportedConstraints](https://developer.mozilla.org/en/docs/Web/API/MediaTrackSupportedConstraints) to Kotlin
|
||||
*/
|
||||
public external interface MediaTrackSupportedConstraints {
|
||||
var width: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var height: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var aspectRatio: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var frameRate: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var facingMode: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var resizeMode: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var volume: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleRate: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleSize: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var echoCancellation: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var autoGainControl: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var noiseSuppression: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var latency: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var channelCount: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var deviceId: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var groupId: Boolean? /* = true */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
o["frameRate"] = frameRate
|
||||
o["facingMode"] = facingMode
|
||||
o["resizeMode"] = resizeMode
|
||||
o["volume"] = volume
|
||||
o["sampleRate"] = sampleRate
|
||||
o["sampleSize"] = sampleSize
|
||||
o["echoCancellation"] = echoCancellation
|
||||
o["autoGainControl"] = autoGainControl
|
||||
o["noiseSuppression"] = noiseSuppression
|
||||
o["latency"] = latency
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface MediaTrackCapabilities {
|
||||
var width: ULongRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var height: ULongRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var aspectRatio: DoubleRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var frameRate: DoubleRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var facingMode: Array<String>?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var resizeMode: Array<String>?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var volume: DoubleRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleRate: ULongRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleSize: ULongRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var echoCancellation: Array<Boolean>?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var autoGainControl: Array<Boolean>?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var noiseSuppression: Array<Boolean>?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var latency: DoubleRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var channelCount: ULongRange?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var deviceId: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var groupId: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
o["frameRate"] = frameRate
|
||||
o["facingMode"] = facingMode
|
||||
o["resizeMode"] = resizeMode
|
||||
o["volume"] = volume
|
||||
o["sampleRate"] = sampleRate
|
||||
o["sampleSize"] = sampleSize
|
||||
o["echoCancellation"] = echoCancellation
|
||||
o["autoGainControl"] = autoGainControl
|
||||
o["noiseSuppression"] = noiseSuppression
|
||||
o["latency"] = latency
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaTrackConstraints](https://developer.mozilla.org/en/docs/Web/API/MediaTrackConstraints) to Kotlin
|
||||
*/
|
||||
public external interface MediaTrackConstraints : MediaTrackConstraintSet {
|
||||
var advanced: Array<MediaTrackConstraintSet>?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
o["aspectRatio"] = aspectRatio
|
||||
o["frameRate"] = frameRate
|
||||
o["facingMode"] = facingMode
|
||||
o["resizeMode"] = resizeMode
|
||||
o["volume"] = volume
|
||||
o["sampleRate"] = sampleRate
|
||||
o["sampleSize"] = sampleSize
|
||||
o["echoCancellation"] = echoCancellation
|
||||
o["autoGainControl"] = autoGainControl
|
||||
o["noiseSuppression"] = noiseSuppression
|
||||
o["latency"] = latency
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface MediaTrackConstraintSet {
|
||||
var width: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var height: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var aspectRatio: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var frameRate: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var facingMode: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var resizeMode: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var volume: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleRate: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleSize: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var echoCancellation: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var autoGainControl: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var noiseSuppression: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var latency: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var channelCount: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var deviceId: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var groupId: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
o["frameRate"] = frameRate
|
||||
o["facingMode"] = facingMode
|
||||
o["resizeMode"] = resizeMode
|
||||
o["volume"] = volume
|
||||
o["sampleRate"] = sampleRate
|
||||
o["sampleSize"] = sampleSize
|
||||
o["echoCancellation"] = echoCancellation
|
||||
o["autoGainControl"] = autoGainControl
|
||||
o["noiseSuppression"] = noiseSuppression
|
||||
o["latency"] = latency
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaTrackSettings](https://developer.mozilla.org/en/docs/Web/API/MediaTrackSettings) to Kotlin
|
||||
*/
|
||||
public external interface MediaTrackSettings {
|
||||
var width: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var height: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var aspectRatio: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var frameRate: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var facingMode: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var resizeMode: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var volume: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleRate: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var sampleSize: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var echoCancellation: Boolean?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var autoGainControl: Boolean?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var noiseSuppression: Boolean?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var latency: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var channelCount: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var deviceId: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var groupId: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
o["frameRate"] = frameRate
|
||||
o["facingMode"] = facingMode
|
||||
o["resizeMode"] = resizeMode
|
||||
o["volume"] = volume
|
||||
o["sampleRate"] = sampleRate
|
||||
o["sampleSize"] = sampleSize
|
||||
o["echoCancellation"] = echoCancellation
|
||||
o["autoGainControl"] = autoGainControl
|
||||
o["noiseSuppression"] = noiseSuppression
|
||||
o["latency"] = latency
|
||||
o["channelCount"] = channelCount
|
||||
o["deviceId"] = deviceId
|
||||
o["groupId"] = groupId
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaStreamTrackEvent](https://developer.mozilla.org/en/docs/Web/API/MediaStreamTrackEvent) to Kotlin
|
||||
*/
|
||||
public external open class MediaStreamTrackEvent(type: String, eventInitDict: MediaStreamTrackEventInit) : Event {
|
||||
open val track: MediaStreamTrack
|
||||
}
|
||||
|
||||
public external interface MediaStreamTrackEventInit : EventInit {
|
||||
var track: MediaStreamTrack?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
public external interface OverconstrainedErrorEventInit : EventInit {
|
||||
var error: dynamic /* = null */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaDevices](https://developer.mozilla.org/en/docs/Web/API/MediaDevices) to Kotlin
|
||||
*/
|
||||
public external abstract class MediaDevices : EventTarget {
|
||||
open var ondevicechange: ((Event) -> dynamic)?
|
||||
fun enumerateDevices(): Promise<dynamic>
|
||||
fun getSupportedConstraints(): MediaTrackSupportedConstraints
|
||||
fun getUserMedia(constraints: MediaStreamConstraints = definedExternally): Promise<MediaStream>
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaDeviceInfo](https://developer.mozilla.org/en/docs/Web/API/MediaDeviceInfo) to Kotlin
|
||||
*/
|
||||
public external abstract class MediaDeviceInfo {
|
||||
open val deviceId: String
|
||||
open val kind: MediaDeviceKind
|
||||
open val label: String
|
||||
open val groupId: String
|
||||
fun toJSON(): dynamic
|
||||
}
|
||||
|
||||
public external abstract class InputDeviceInfo : MediaDeviceInfo {
|
||||
fun getCapabilities(): MediaTrackCapabilities
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [MediaStreamConstraints](https://developer.mozilla.org/en/docs/Web/API/MediaStreamConstraints) to Kotlin
|
||||
*/
|
||||
public external interface MediaStreamConstraints {
|
||||
var video: dynamic /* = false */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var audio: dynamic /* = false */
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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)?
|
||||
fun getCapabilities(): Capabilities
|
||||
fun getConstraints(): Constraints
|
||||
fun getSettings(): Settings
|
||||
fun applyConstraints(constraints: Constraints = definedExternally): Promise<Unit>
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [DoubleRange](https://developer.mozilla.org/en/docs/Web/API/DoubleRange) to Kotlin
|
||||
*/
|
||||
public external interface DoubleRange {
|
||||
var max: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var min: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
public external interface ConstrainDoubleRange : DoubleRange {
|
||||
var exact: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var ideal: Double?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
public external interface ULongRange {
|
||||
var max: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var min: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
public external interface ConstrainULongRange : ULongRange {
|
||||
var exact: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var ideal: Int?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [ConstrainBooleanParameters](https://developer.mozilla.org/en/docs/Web/API/ConstrainBooleanParameters) to Kotlin
|
||||
*/
|
||||
public external interface ConstrainBooleanParameters {
|
||||
var exact: Boolean?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var ideal: Boolean?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the JavaScript [ConstrainDOMStringParameters](https://developer.mozilla.org/en/docs/Web/API/ConstrainDOMStringParameters) to Kotlin
|
||||
*/
|
||||
public external interface ConstrainDOMStringParameters {
|
||||
var exact: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var ideal: dynamic
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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 {
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Capabilities(): Capabilities {
|
||||
val o = js("({})")
|
||||
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface Settings {
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Settings(): Settings {
|
||||
val o = js("({})")
|
||||
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface ConstraintSet {
|
||||
}
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ConstraintSet(): ConstraintSet {
|
||||
val o = js("({})")
|
||||
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
public external interface Constraints : ConstraintSet {
|
||||
var advanced: Array<ConstraintSet>?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
}
|
||||
|
||||
@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! */
|
||||
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! */
|
||||
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! */
|
||||
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! */
|
||||
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>()
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.dom.url.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.dom.url.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.url.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.w3c.css.masking.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.mediacapture.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.pointerevents.*
|
||||
import org.w3c.dom.svg.*
|
||||
|
||||
@@ -38,7 +38,7 @@ class BuildWebIdl(val mdnCacheFile: File, val srcDir: File) {
|
||||
val repository =
|
||||
repositoryPre.copy(typeDefs = repositoryPre.typeDefs.mapValues { it.value.copy(mapType(repositoryPre, it.value.types)) })
|
||||
|
||||
val definitions = mapDefinitions(repository, repository.interfaces.values).map {
|
||||
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
|
||||
@@ -46,12 +46,9 @@ class BuildWebIdl(val mdnCacheFile: File, val srcDir: File) {
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
val unions = generateUnions(definitions, repository.typeDefs.values)
|
||||
})
|
||||
|
||||
init {
|
||||
implementInterfaces(definitions)
|
||||
}
|
||||
val unions = generateUnions(definitions, repository.typeDefs.values)
|
||||
|
||||
val allPackages = (definitions.asSequence().map { it.namespace } + repository.enums.values.map { it.namespace }).distinct().sorted()
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ val urls = listOf(
|
||||
"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",
|
||||
"http://www.w3.org/TR/DOM-Parsing/" to "org.w3c.dom.parsing",
|
||||
"https://raw.githubusercontent.com/whatwg/url/master/url.html" to "org.w3c.dom.url",
|
||||
|
||||
@@ -95,69 +96,84 @@ val kotlinBuiltinInterfaces = mapOf(
|
||||
)
|
||||
)
|
||||
|
||||
val specifyEventMapper = mapOf<String, String>(
|
||||
"onbeforeunload" to "BeforeUnloadEvent",
|
||||
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",
|
||||
"ondrag" to "DragEvent",
|
||||
"ondragend" to "DragEvent",
|
||||
"ondragenter" to "DragEvent",
|
||||
"ondragexit" to "DragEvent",
|
||||
"ondragleave" to "DragEvent",
|
||||
"ondragover" to "DragEvent",
|
||||
"ondragstart" to "DragEvent",
|
||||
"ondrop" to "DragEvent",
|
||||
|
||||
"onfetch" to "FetchEvent",
|
||||
"onfetch" to "FetchEvent",
|
||||
|
||||
"onblur" to "FocusEvent",
|
||||
"onfocus" to "FocusEvent",
|
||||
"onblur" to "FocusEvent",
|
||||
"onfocus" to "FocusEvent",
|
||||
|
||||
"onhashchange" to "HashChangeEvent",
|
||||
"onhashchange" to "HashChangeEvent",
|
||||
|
||||
"oninput" to "InputEvent",
|
||||
"oninput" to "InputEvent",
|
||||
|
||||
"onkeydown" to "KeyboardEvent",
|
||||
"onkeypress" to "KeyboardEvent",
|
||||
"onkeyup" to "KeyboardEvent",
|
||||
"onkeydown" to "KeyboardEvent",
|
||||
"onkeypress" to "KeyboardEvent",
|
||||
"onkeyup" to "KeyboardEvent",
|
||||
|
||||
"onmessage" to "MessageEvent",
|
||||
"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",
|
||||
"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",
|
||||
"onnotificationclick" to "NotificationEvent",
|
||||
"onnotificationclose" to "NotificationEvent",
|
||||
|
||||
"onpagehide" to "PageTransitionEvent",
|
||||
"onpageshow" to "PageTransitionEvent",
|
||||
"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",
|
||||
"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",
|
||||
"onpopstate" to "PopStateEvent",
|
||||
|
||||
"onloadstart" to "ProgressEvent",
|
||||
"onprogress" to "ProgressEvent",
|
||||
"onloadstart" to "ProgressEvent",
|
||||
"onprogress" to "ProgressEvent",
|
||||
|
||||
"onunhandledrejection" to "PromiseRejectionEvent",
|
||||
"onunhandledrejection" to "PromiseRejectionEvent",
|
||||
|
||||
"onstorage" to "StorageEvent",
|
||||
"onstorage" to "StorageEvent",
|
||||
|
||||
"onwheel" to "WheelEvent"
|
||||
"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"
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ fun generateFunctions(repository: Repository, function: Operation): List<Generat
|
||||
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 = generalizeType(attribute.name, mappedType),
|
||||
type = mappedType,
|
||||
initializer =
|
||||
if (putNoImpl && !attribute.static) {
|
||||
mapLiteral(attribute.defaultValue, mapType(repository, attribute.type), repository.enums)
|
||||
@@ -260,9 +260,10 @@ private fun mapLiteral(literal: String?, expectedType: Type = DynamicType, enums
|
||||
}
|
||||
|
||||
|
||||
private fun specifyType(name: String, type: Type): Type {
|
||||
private fun specifyType(name: String, type: Type, context: String): Type {
|
||||
|
||||
if ((type is SimpleType) && (type.type == "Event")) {
|
||||
specifyEventMapper[name]?.let {
|
||||
(eventSpecifierMapper[name] ?: eventSpecifierMapperWithContext[EventMapKey(name, context)])?.let {
|
||||
return type.copy(type = it)
|
||||
}
|
||||
}
|
||||
@@ -270,27 +271,34 @@ private fun specifyType(name: String, type: Type): Type {
|
||||
return type
|
||||
}
|
||||
|
||||
private fun generalizeType(name: String, type: Type): 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))))
|
||||
return type.copy(parameterTypes = listOf(paramAttribute.copy(type = specifyType(name, paramAttribute.type, context))))
|
||||
}
|
||||
return type
|
||||
}
|
||||
|
||||
fun implementInterfaces(declarations: List<GenerateTraitOrClass>) {
|
||||
fun implementInterfaces(declarations: List<GenerateTraitOrClass>) : List<GenerateTraitOrClass> {
|
||||
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, type = generalizeType(attribute.name, attribute.type))
|
||||
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<GenerateTraitOrClass>): Map<String, UnimplementedMembers> {
|
||||
|
||||
Reference in New Issue
Block a user