Skip to content

Commit 1535ceb

Browse files
committed
Update to latest IDL specs
1 parent 0fc3378 commit 1535ceb

File tree

4 files changed

+230
-116
lines changed

4 files changed

+230
-116
lines changed

Sources/DOM/Generated.swift

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ public class AbortSignal: EventTarget {
297297
return this[Strings.timeout].function!(this: this, arguments: [_toJSValue(milliseconds)]).fromJSValue()!
298298
}
299299

300+
@inlinable public class func any(signals: [AbortSignal]) -> Self {
301+
let this = constructor!
302+
return this[Strings.any].function!(this: this, arguments: [_toJSValue(signals)]).fromJSValue()!
303+
}
304+
300305
@ReadonlyAttribute
301306
public var aborted: Bool
302307

@@ -6943,9 +6948,9 @@ public class HTMLElement: Element, GlobalEventHandlers, ElementContentEditable,
69436948
_ = this[Strings.hidePopover].function!(this: this, arguments: [])
69446949
}
69456950

6946-
@inlinable public func togglePopover(force: Bool? = nil) {
6951+
@inlinable public func togglePopover(force: Bool? = nil) -> Bool {
69476952
let this = jsObject
6948-
_ = this[Strings.togglePopover].function!(this: this, arguments: [_toJSValue(force)])
6953+
return this[Strings.togglePopover].function!(this: this, arguments: [_toJSValue(force)]).fromJSValue()!
69496954
}
69506955

69516956
@ReadWriteAttribute
@@ -13493,6 +13498,11 @@ public class ReadableStream: JSBridgedClass, AsyncSequence {
1349313498
self.init(unsafelyWrapping: Self.constructor!.new(arguments: [_toJSValue(underlyingSource), _toJSValue(strategy)]))
1349413499
}
1349513500

13501+
@inlinable public class func from(asyncIterable: JSValue) -> Self {
13502+
let this = constructor!
13503+
return this[Strings.from].function!(this: this, arguments: [_toJSValue(asyncIterable)]).fromJSValue()!
13504+
}
13505+
1349613506
@ReadonlyAttribute
1349713507
public var locked: Bool
1349813508

@@ -16858,7 +16868,7 @@ public class VideoFrame: JSBridgedClass {
1685816868
}
1685916869

1686016870
public class VideoFrameBufferInit: BridgedDictionary {
16861-
public convenience init(format: VideoPixelFormat, codedWidth: UInt32, codedHeight: UInt32, timestamp: Int64, duration: UInt64, layout: [PlaneLayout], visibleRect: DOMRectInit, displayWidth: UInt32, displayHeight: UInt32, colorSpace: VideoColorSpaceInit) {
16871+
public convenience init(format: VideoPixelFormat, codedWidth: UInt32, codedHeight: UInt32, timestamp: Int64, duration: UInt64, layout: [PlaneLayout], visibleRect: DOMRectInit, displayWidth: UInt32, displayHeight: UInt32, colorSpace: VideoColorSpaceInit, transfer: [ArrayBuffer]) {
1686216872
let object = JSObject.global[Strings.Object].function!.new()
1686316873
object[Strings.format] = _toJSValue(format)
1686416874
object[Strings.codedWidth] = _toJSValue(codedWidth)
@@ -16870,6 +16880,7 @@ public class VideoFrameBufferInit: BridgedDictionary {
1687016880
object[Strings.displayWidth] = _toJSValue(displayWidth)
1687116881
object[Strings.displayHeight] = _toJSValue(displayHeight)
1687216882
object[Strings.colorSpace] = _toJSValue(colorSpace)
16883+
object[Strings.transfer] = _toJSValue(transfer)
1687316884
self.init(unsafelyWrapping: object)
1687416885
}
1687516886

@@ -16884,6 +16895,7 @@ public class VideoFrameBufferInit: BridgedDictionary {
1688416895
_displayWidth = ReadWriteAttribute(jsObject: object, name: Strings.displayWidth)
1688516896
_displayHeight = ReadWriteAttribute(jsObject: object, name: Strings.displayHeight)
1688616897
_colorSpace = ReadWriteAttribute(jsObject: object, name: Strings.colorSpace)
16898+
_transfer = ReadWriteAttribute(jsObject: object, name: Strings.transfer)
1688716899
super.init(unsafelyWrapping: object)
1688816900
}
1688916901

@@ -16916,6 +16928,9 @@ public class VideoFrameBufferInit: BridgedDictionary {
1691616928

1691716929
@ReadWriteAttribute
1691816930
public var colorSpace: VideoColorSpaceInit
16931+
16932+
@ReadWriteAttribute
16933+
public var transfer: [ArrayBuffer]
1691916934
}
1692016935

1692116936
public class VideoFrameCopyToOptions: BridgedDictionary {
@@ -18703,6 +18718,7 @@ public class XSLTProcessor: JSBridgedClass {
1870318718
@usableFromInline static let ancestorOrigins: JSString = "ancestorOrigins"
1870418719
@usableFromInline static let anchors: JSString = "anchors"
1870518720
@usableFromInline static let animated: JSString = "animated"
18721+
@usableFromInline static let any: JSString = "any"
1870618722
@usableFromInline static let appCodeName: JSString = "appCodeName"
1870718723
@usableFromInline static let appName: JSString = "appName"
1870818724
@usableFromInline static let appVersion: JSString = "appVersion"
@@ -19136,6 +19152,7 @@ public class XSLTProcessor: JSBridgedClass {
1913619152
@usableFromInline static let frameRate: JSString = "frameRate"
1913719153
@usableFromInline static let framerate: JSString = "framerate"
1913819154
@usableFromInline static let frames: JSString = "frames"
19155+
@usableFromInline static let from: JSString = "from"
1913919156
@usableFromInline static let fromBox: JSString = "fromBox"
1914019157
@usableFromInline static let fromFloat32Array: JSString = "fromFloat32Array"
1914119158
@usableFromInline static let fromFloat64Array: JSString = "fromFloat64Array"

Sources/WebAPIBase/Generated.swift

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ public class URLSearchParams: JSBridgedClass, Sequence {
175175
_ = this[Strings.append].function!(this: this, arguments: [_toJSValue(name), _toJSValue(value)])
176176
}
177177

178-
@inlinable public func delete(name: String) {
178+
@inlinable public func delete(name: String, value: String? = nil) {
179179
let this = jsObject
180-
_ = this[Strings.delete].function!(this: this, arguments: [_toJSValue(name)])
180+
_ = this[Strings.delete].function!(this: this, arguments: [_toJSValue(name), _toJSValue(value)])
181181
}
182182

183183
@inlinable public func get(name: String) -> String? {
@@ -190,9 +190,9 @@ public class URLSearchParams: JSBridgedClass, Sequence {
190190
return this[Strings.getAll].function!(this: this, arguments: [_toJSValue(name)]).fromJSValue()!
191191
}
192192

193-
@inlinable public func has(name: String) -> Bool {
193+
@inlinable public func has(name: String, value: String? = nil) -> Bool {
194194
let this = jsObject
195-
return this[Strings.has].function!(this: this, arguments: [_toJSValue(name)]).fromJSValue()!
195+
return this[Strings.has].function!(this: this, arguments: [_toJSValue(name), _toJSValue(value)]).fromJSValue()!
196196
}
197197

198198
@inlinable public func set(name: String, value: String) {
@@ -369,6 +369,77 @@ public enum console {
369369
@usableFromInline static let warn: JSString = "warn"
370370
}
371371

372+
public protocol Any_AllowSharedBufferSource: ConvertibleToJSValue {}
373+
extension ArrayBuffer: Any_AllowSharedBufferSource {}
374+
extension ArrayBufferView: Any_AllowSharedBufferSource {}
375+
extension SharedArrayBuffer: Any_AllowSharedBufferSource {}
376+
377+
public enum AllowSharedBufferSource: JSValueCompatible, Any_AllowSharedBufferSource {
378+
case arrayBuffer(ArrayBuffer)
379+
case arrayBufferView(ArrayBufferView)
380+
case sharedArrayBuffer(SharedArrayBuffer)
381+
382+
init(_ arrayBuffer: ArrayBuffer) {
383+
let val: AllowSharedBufferSource = .arrayBuffer(arrayBuffer)
384+
self = val
385+
}
386+
387+
init(_ arrayBufferView: ArrayBufferView) {
388+
let val: AllowSharedBufferSource = .arrayBufferView(arrayBufferView)
389+
self = val
390+
}
391+
392+
init(_ sharedArrayBuffer: SharedArrayBuffer) {
393+
let val: AllowSharedBufferSource = .sharedArrayBuffer(sharedArrayBuffer)
394+
self = val
395+
}
396+
397+
public var arrayBuffer: ArrayBuffer? {
398+
switch self {
399+
case let .arrayBuffer(arrayBuffer): return arrayBuffer
400+
default: return nil
401+
}
402+
}
403+
404+
public var arrayBufferView: ArrayBufferView? {
405+
switch self {
406+
case let .arrayBufferView(arrayBufferView): return arrayBufferView
407+
default: return nil
408+
}
409+
}
410+
411+
public var sharedArrayBuffer: SharedArrayBuffer? {
412+
switch self {
413+
case let .sharedArrayBuffer(sharedArrayBuffer): return sharedArrayBuffer
414+
default: return nil
415+
}
416+
}
417+
418+
public static func construct(from value: JSValue) -> Self? {
419+
if let arrayBuffer: ArrayBuffer = value.fromJSValue() {
420+
return .arrayBuffer(arrayBuffer)
421+
}
422+
if let arrayBufferView: ArrayBufferView = value.fromJSValue() {
423+
return .arrayBufferView(arrayBufferView)
424+
}
425+
if let sharedArrayBuffer: SharedArrayBuffer = value.fromJSValue() {
426+
return .sharedArrayBuffer(sharedArrayBuffer)
427+
}
428+
return nil
429+
}
430+
431+
public var jsValue: JSValue {
432+
switch self {
433+
case let .arrayBuffer(arrayBuffer):
434+
return arrayBuffer.jsValue
435+
case let .arrayBufferView(arrayBufferView):
436+
return arrayBufferView.jsValue
437+
case let .sharedArrayBuffer(sharedArrayBuffer):
438+
return sharedArrayBuffer.jsValue
439+
}
440+
}
441+
}
442+
372443
public protocol Any_BufferSource: ConvertibleToJSValue {}
373444
extension ArrayBuffer: Any_BufferSource {}
374445
extension ArrayBufferView: Any_BufferSource {}

0 commit comments

Comments
 (0)