Moved BindingGenerator from gen html project. It makes more sense here.
This commit is contained in:
228
Sources/BindingGenerator/Generated/Elements/Video.swift
Normal file
228
Sources/BindingGenerator/Generated/Elements/Video.swift
Normal file
@@ -0,0 +1,228 @@
|
||||
//
|
||||
// Video.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <video> Video player
|
||||
public class Video : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing {
|
||||
|
||||
public enum Crossorigin : String, CaseIterable {
|
||||
|
||||
case anonymous
|
||||
case useCredentials = "use-credentials"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Crossorigin(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Crossorigin: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Preload : String, CaseIterable {
|
||||
|
||||
case auto
|
||||
case metadata
|
||||
case none
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Preload: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Preload(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Preload: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Preload] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Preload(rawValue: input), "unexpected value for Preload: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Hint that the media resource can be started automatically when the page is loaded.
|
||||
public var autoplay:Bool = false
|
||||
|
||||
/// Show user agent controls.
|
||||
public var controls:Bool = false
|
||||
|
||||
/// How the element handles crossorigin requests.
|
||||
public var crossorigin:Crossorigin? = nil
|
||||
|
||||
/// Vertical dimension. Valid non-negative integer.
|
||||
public var height:UInt? = nil
|
||||
|
||||
/// Whether to loop the media resource.
|
||||
public var loop:Bool = false
|
||||
|
||||
/// Whether to mute the media resource by default.
|
||||
public var muted:Bool = false
|
||||
|
||||
/// Encourage the user agent to display video content within the element's playback area.
|
||||
public var playsinline:Bool = false
|
||||
|
||||
/// Poster frame to show prior to video playback. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var poster:URL? = nil
|
||||
|
||||
/// Hints how much buffering the media resource will likely need.
|
||||
public var preload:Preload? = nil
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
/// Horizontal dimension. Valid non-negative integer.
|
||||
public var width:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "autoplay":
|
||||
autoplay = true
|
||||
continue
|
||||
case "controls":
|
||||
controls = true
|
||||
continue
|
||||
case "crossorigin":
|
||||
crossorigin = try Crossorigin(expect: attValue)
|
||||
continue
|
||||
case "height":
|
||||
height = UInt(attValue)
|
||||
continue
|
||||
case "loop":
|
||||
loop = true
|
||||
continue
|
||||
case "muted":
|
||||
muted = true
|
||||
continue
|
||||
case "playsinline":
|
||||
playsinline = true
|
||||
continue
|
||||
case "poster":
|
||||
poster = try URL(expect: attValue)
|
||||
continue
|
||||
case "preload":
|
||||
preload = try Preload(expect: attValue)
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
case "width":
|
||||
width = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "video", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if autoplay {
|
||||
result += " autoplay"
|
||||
}
|
||||
if controls {
|
||||
result += " controls"
|
||||
}
|
||||
if let crossorigin = crossorigin {
|
||||
result += " crossorigin='\(crossorigin.rawValue)'"
|
||||
}
|
||||
if let height = height {
|
||||
result += " height='\(height)'"
|
||||
}
|
||||
if loop {
|
||||
result += " loop"
|
||||
}
|
||||
if muted {
|
||||
result += " muted"
|
||||
}
|
||||
if playsinline {
|
||||
result += " playsinline"
|
||||
}
|
||||
if let poster = poster {
|
||||
result += " poster='\(poster.absoluteString)'"
|
||||
}
|
||||
if let preload = preload {
|
||||
result += " preload='\(preload.rawValue)'"
|
||||
}
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
if let width = width {
|
||||
result += " width='\(width)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "video"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user