// // GlobalAttributes.swift // HTMLStandard // // Generated on 09/09/2025. // THIS FILE IS GENERATED. DO NOT EDIT. // import Foundation public enum Autocapitalize : String, CaseIterable { case characters case none case off case on case sentences case words 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 Autocapitalize: \(expect)") } self = value } public init(expect: String) throws { guard let result = Autocapitalize(rawValue: expect) else { throw AppError("Unexpected value for Autocapitalize: \(expect)") } self = result } static func parseList(_ value:String?, _ separator:String = " ") throws -> [Autocapitalize] { guard let value = value else { return [] } var iterator = value.componentsIterator(separatedBy: separator) let result = try iterator.map { input in return try expect(Autocapitalize(rawValue: input), "unexpected value for Autocapitalize: \(input)") } return result } } public enum Dir : String, CaseIterable { case auto case ltr case rtl 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 Dir: \(expect)") } self = value } public init(expect: String) throws { guard let result = Dir(rawValue: expect) else { throw AppError("Unexpected value for Dir: \(expect)") } self = result } static func parseList(_ value:String?, _ separator:String = " ") throws -> [Dir] { guard let value = value else { return [] } var iterator = value.componentsIterator(separatedBy: separator) let result = try iterator.map { input in return try expect(Dir(rawValue: input), "unexpected value for Dir: \(input)") } return result } } public enum Inputmode : String, CaseIterable { case decimal case email case none case numeric case search case tel case text case url 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 Inputmode: \(expect)") } self = value } public init(expect: String) throws { guard let result = Inputmode(rawValue: expect) else { throw AppError("Unexpected value for Inputmode: \(expect)") } self = result } static func parseList(_ value:String?, _ separator:String = " ") throws -> [Inputmode] { guard let value = value else { return [] } var iterator = value.componentsIterator(separatedBy: separator) let result = try iterator.map { input in return try expect(Inputmode(rawValue: input), "unexpected value for Inputmode: \(input)") } return result } } public enum Role : String, CaseIterable { case alert case alertdialog case application case article case associationlist case associationlistitemkey case associationlistitemvalue case banner case blockquote case caption case cell case columnheader case command case comment case complementary case composite case contentinfo case definition case deletion case dialog case directory case document case emphasis case feed case figure case form case generic case gridcell case group case heading case img case input case insertion case label case legend case list case listitem case log case main case mark case marquee case math case meter case navigation case none case note case paragraph case presentation case progressbar case region case row case rowgroup case rowheader case scrollbar case search case separator case status case strong case subscript_ = "subscript" case suggestion case superscript case tab case table case term case time case timer case toolbar case tooltip 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 Role: \(expect)") } self = value } public init(expect: String) throws { guard let result = Role(rawValue: expect) else { throw AppError("Unexpected value for Role: \(expect)") } self = result } static func parseList(_ value:String?, _ separator:String = " ") throws -> [Role] { guard let value = value else { return [] } var iterator = value.componentsIterator(separatedBy: separator) let result = try iterator.map { input in return try expect(Role(rawValue: input), "unexpected value for Role: \(input)") } return result } } public enum Enterkeyhint : String, CaseIterable { case done case enter case go case next case previous case search case send 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 Enterkeyhint: \(expect)") } self = value } public init(expect: String) throws { guard let result = Enterkeyhint(rawValue: expect) else { throw AppError("Unexpected value for Enterkeyhint: \(expect)") } self = result } static func parseList(_ value:String?, _ separator:String = " ") throws -> [Enterkeyhint] { guard let value = value else { return [] } var iterator = value.componentsIterator(separatedBy: separator) let result = try iterator.map { input in return try expect(Enterkeyhint(rawValue: input), "unexpected value for Enterkeyhint: \(input)") } return result } } /// GlobalAttributes public class GlobalAttributes { /// Cryptographic nonce used in Content Security Policy checks [CSP]. public var nonce:String? = nil /// Introduces a microdata item. public var itemscope:Bool = false /// Whether the element is relevant. public var hidden:Bool = false /// Presentational and formatting instructions. CSS declarations. The actual rules are more complicated than indicated. public var style:String? = nil /// Whether the element is editable. public var contenteditable:Bool? = nil /// The element's ID. Text. The actual rules are more complicated than indicated. public var id:String? = nil /// Language of the element. Valid BCP 47 language tag or the empty string. public var lang:String? = nil /// Property names of a microdata item. Unordered set of unique space-separated tokens, case-sensitive, consisting of valid absolute URLs, defined property names, or text. The actual rules are more complicated than indicated. public var itemprop:[String] = [] /// Recommended autocapitalization behavior (for supported input methods). public var autocapitalize:Autocapitalize? = nil /// Classes to which the element belongs. Set of space-separated tokens. public var class_:[String] = [] /// Automatically focus the element when the page is loaded. public var autofocus:Bool = false /// Advisory information for the element. public var title:String? = nil /// The text directionality of the element. public var dir:Dir? = nil /// Referenced elements. Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs. The actual rules are more complicated than indicated. public var itemref:[String] = [] /// Whether the element is focusable and sequentially focusable, and the relative order of the element for the purposes of sequential focus navigation. Valid integer. public var tabindex:Int? = nil /// Global identifier for a microdata item. Valid URL potentially surrounded by spaces. public var itemid:URL? = nil /// Item types of a microdata item. Unordered set of unique space-separated tokens, case-sensitive, consisting of valid absolute URL. The actual rules are more complicated than indicated. public var itemtype:[String] = [] /// Whether the element is draggable. public var draggable:Bool? = nil /// Hint for selecting an input modality. public var inputmode:Inputmode? = nil /// The element's desired slot. public var slot:String? = nil /// Keyboard shortcut to activate or focus element. Ordered set of unique space-separated tokens, case-sensitive, consisting of one code point in length. public var accesskey:[String] = [] /// Whether the element is to have its spelling and grammar checked. public var spellcheck:Bool? = nil /// ARIA semantic role. A concrete ARIA role. public var role:Role? = nil /// Hint for selecting an enter key action. public var enterkeyhint:Enterkeyhint? = nil /// Creates a customized built-in element. Valid custom element name of a defined customized built-in element. public var is_:String? = nil /// Whether the element is to be translated when the page is localized. public var translate:Bool? = nil public func setAttribute(_ key:String, _ attValue:String) throws { switch (key) { case "nonce": nonce = attValue case "itemscope": itemscope = true case "hidden": hidden = true case "style": style = attValue case "contenteditable": contenteditable = try Bool(expect: attValue) case "id": id = attValue case "lang": lang = attValue case "itemprop": itemprop = try String.parseList(attValue, " ") case "autocapitalize": autocapitalize = try Autocapitalize(expect: attValue) case "class": class_ = try String.parseList(attValue, " ") case "autofocus": autofocus = true case "title": title = attValue case "dir": dir = try Dir(expect: attValue) case "itemref": itemref = try String.parseList(attValue, " ") case "tabindex": tabindex = Int(attValue) case "itemid": itemid = try URL(expect: attValue) case "itemtype": itemtype = try String.parseList(attValue, " ") case "draggable": draggable = try Bool(expect: attValue) case "inputmode": inputmode = try Inputmode(expect: attValue) case "slot": slot = attValue case "accesskey": accesskey = try String.parseList(attValue, " ") case "spellcheck": spellcheck = try Bool(expect: attValue) case "role": role = try Role(expect: attValue) case "enterkeyhint": enterkeyhint = try Enterkeyhint(expect: attValue) case "is": is_ = attValue case "translate": translate = try Bool(expectYesOrNo: attValue) default: break } } }