diff --git a/Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift b/Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift
index ae72ad43..c33bf45c 100644
--- a/Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift
+++ b/Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift
@@ -185,7 +185,19 @@ public protocol AutocompleteAttribute: Attribute {
/// - Parameter value: The value to be expected
///
/// - Returns: The element
- func autocomplete(_ value: OrderedSet) -> Self
+ func autocomplete(_ value: Values.Completion) -> Self
+
+ /// Specify an auto completion.
+ ///
+ /// ```swift
+ /// Input()
+ /// .autocomplete([.organization, .organizationTitle])
+ /// ```
+ ///
+ /// - Parameter values: The values to be expected
+ ///
+ /// - Returns: The element
+ func autocomplete(_ values: OrderedSet) -> Self
}
extension AutocompleteAttribute where Self: ContentNode {
diff --git a/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift b/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift
index 9568fbe4..b7278831 100644
--- a/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift
+++ b/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift
@@ -17826,8 +17826,12 @@ extension Form: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttributes, A
return mutate(autocomplete: "off")
}
- public func autocomplete(_ value: OrderedSet) -> Form {
- return mutate(autocomplete: value.map { $0.rawValue }.joined(separator: " "))
+ public func autocomplete(_ value: Values.Completion) -> Form {
+ return mutate(autocomplete: value.rawValue)
+ }
+
+ public func autocomplete(_ values: OrderedSet) -> Form {
+ return mutate(autocomplete: values.map { $0.rawValue }.joined(separator: " "))
}
public func encoding(_ value: Values.Encoding) -> Form {
diff --git a/Sources/HTMLKit/Abstraction/Elements/FormElements.swift b/Sources/HTMLKit/Abstraction/Elements/FormElements.swift
index 7b03ad43..46e79e2a 100644
--- a/Sources/HTMLKit/Abstraction/Elements/FormElements.swift
+++ b/Sources/HTMLKit/Abstraction/Elements/FormElements.swift
@@ -191,8 +191,12 @@ extension Input: GlobalAttributes, GlobalEventAttributes, AcceptAttribute, Alter
return mutate(autocomplete: "off")
}
- public func autocomplete(_ value: OrderedSet) -> Input {
- return mutate(autocomplete: value.map { $0.rawValue }.joined(separator: " "))
+ public func autocomplete(_ value: Values.Completion) -> Input {
+ return mutate(autocomplete: value.rawValue)
+ }
+
+ public func autocomplete(_ values: OrderedSet) -> Input {
+ return mutate(autocomplete: values.map { $0.rawValue }.joined(separator: " "))
}
public func checked() -> Input {
@@ -826,8 +830,12 @@ extension Select: GlobalAttributes, GlobalEventAttributes, AutocompleteAttribute
return mutate(autocomplete: "off")
}
- public func autocomplete(_ value: OrderedSet) -> Select {
- return mutate(autocomplete: value.map { $0.rawValue }.joined(separator: " "))
+ public func autocomplete(_ value: Values.Completion) -> Select {
+ return mutate(autocomplete: value.rawValue)
+ }
+
+ public func autocomplete(_ values: OrderedSet) -> Select {
+ return mutate(autocomplete: values.map { $0.rawValue }.joined(separator: " "))
}
public func disabled() -> Select {
@@ -1081,8 +1089,12 @@ extension TextArea: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttribute
return mutate(autocomplete: "off")
}
- public func autocomplete(_ value: OrderedSet) -> TextArea {
- return mutate(autocomplete: value.map { $0.rawValue }.joined(separator: " "))
+ public func autocomplete(_ value: Values.Completion) -> TextArea {
+ return mutate(autocomplete: value.rawValue)
+ }
+
+ public func autocomplete(_ values: OrderedSet) -> TextArea {
+ return mutate(autocomplete: values.map { $0.rawValue }.joined(separator: " "))
}
public func columns(_ size: Int) -> TextArea {
diff --git a/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift b/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift
index 960da897..6657f9eb 100644
--- a/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift
+++ b/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift
@@ -1024,7 +1024,7 @@ public enum Values {
/// }
/// .autocomplete([.organization, .organizationTitle])
/// ```
- public enum Completion: String, OptionSet {
+ public enum Completion: String {
/// Enables completion
case on
@@ -1189,14 +1189,3 @@ public enum Values {
case messagingProtocol = "impp"
}
}
-
-extension OrderedSet where Element == Values.Completion {
-
- public static var off: OrderedSet {
- return [.off]
- }
-
- public static var on: OrderedSet {
- return [.on]
- }
-}
diff --git a/Sources/HTMLKit/Framework/Extensions/OrderedSet+OptionSet.swift b/Sources/HTMLKit/Framework/Extensions/OrderedSet+OptionSet.swift
deleted file mode 100644
index 6a50e2f3..00000000
--- a/Sources/HTMLKit/Framework/Extensions/OrderedSet+OptionSet.swift
+++ /dev/null
@@ -1,18 +0,0 @@
-import Collections
-
-extension OrderedSet where Element: HTMLKit.OptionSet {
-
- var rawValue: Int {
-
- var rawValue = 0
-
- for (index, element) in Element.allCases.enumerated() {
-
- if self.contains(element) {
- rawValue |= (1 << index)
- }
- }
-
- return rawValue
- }
-}
diff --git a/Sources/HTMLKit/Framework/Primitives/Shared/OptionSet.swift b/Sources/HTMLKit/Framework/Primitives/Shared/OptionSet.swift
deleted file mode 100644
index 3943a584..00000000
--- a/Sources/HTMLKit/Framework/Primitives/Shared/OptionSet.swift
+++ /dev/null
@@ -1,3 +0,0 @@
-/// A type that represents an optionset
-protocol OptionSet: RawRepresentable, Hashable, CaseIterable {
-}
diff --git a/Tests/HTMLKitTests/AttributesTests.swift b/Tests/HTMLKitTests/AttributesTests.swift
index d12d5d38..49b4c143 100644
--- a/Tests/HTMLKitTests/AttributesTests.swift
+++ b/Tests/HTMLKitTests/AttributesTests.swift
@@ -158,8 +158,12 @@ final class AttributesTests: XCTestCase {
return self.mutate(async: "async")
}
- func autocomplete(_ value: OrderedSet) -> Tag {
- return mutate(autocomplete: value.map { $0.rawValue }.joined(separator: " "))
+ func autocomplete(_ value: Values.Completion) -> Tag {
+ return mutate(autocomplete: value.rawValue)
+ }
+
+ func autocomplete(_ values: OrderedSet) -> Tag {
+ return mutate(autocomplete: values.map { $0.rawValue }.joined(separator: " "))
}
func autoplay() -> Tag {