Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ extension ContentAttribute where Self: EmptyNode {
}
}

/// A type that provides the `isEditable` modifier.
/// A type that provides the `editable` modifier.
@_documentation(visibility: internal)
public protocol EditAttribute: Attribute {

Expand All @@ -690,13 +690,13 @@ public protocol EditAttribute: Attribute {
/// Blockquote {
/// "Lorem ipsum..."
/// }
/// .isEditable(false)
/// .editable(false)
/// ```
///
/// - Parameter condition: Whether the element should be editable.
/// - Parameter value: Whether the element should be editable.
///
/// - Returns: The element
func isEditable(_ condition: Bool) -> Self
func editable(_ value: Bool) -> Self
}

extension EditAttribute where Self: ContentNode {
Expand Down Expand Up @@ -1028,7 +1028,7 @@ extension DownloadAttribute where Self: EmptyNode {
}
}

/// A type that provides the `isDraggable` modifier.
/// A type that provides the `draggable` modifier.
@_documentation(visibility: internal)
public protocol DragAttribute: Attribute {

Expand All @@ -1038,13 +1038,13 @@ public protocol DragAttribute: Attribute {
/// Division {
/// ...
/// }
/// .isDraggable(false)
/// .draggable(false)
/// ```
///
/// - Parameter condition: Whether the element should be draggable.
/// - Parameter value: Whether the element should be draggable.
///
/// - Returns: The element
func isDraggable(_ condition: Bool) -> Self
func draggable(_ value: Bool) -> Self
}

extension DragAttribute where Self: ContentNode {
Expand Down Expand Up @@ -3298,21 +3298,21 @@ extension SpanAttribute where Self: EmptyNode {
}
}

/// A type that provides the `hasSpellCheck` modifier.
/// A type that provides the `spellcheck` modifier.
@_documentation(visibility: internal)
public protocol SpellCheckAttribute: Attribute {

/// Mark a element as spellchecked.
///
/// ```swift
/// Input()
/// .hasSpellCheck(false)
/// .spellcheck(false)
/// ```
///
/// - Parameter condition: Whether to spellcheck the content.
/// - Parameter value: Whether to spellcheck the content.
///
/// - Returns: The element
func hasSpellCheck(_ condition: Bool) -> Self
func spellcheck(_ value: Bool) -> Self
}

extension SpellCheckAttribute where Self: ContentNode {
Expand Down Expand Up @@ -3708,13 +3708,13 @@ public protocol TranslateAttribute: Attribute {
/// Paragraph {
/// "Lorem ipsum..."
/// }
/// .translate(.no)
/// .translate(true)
/// ```
///
/// - Parameter value: Whether to exclude the content from translation.
///
/// - Returns: The element
func translate(_ value: Values.Decision) -> Self
func translate(_ value: Bool) -> Self
}

extension TranslateAttribute where Self: ContentNode {
Expand Down
27 changes: 26 additions & 1 deletion Sources/HTMLKit/Abstraction/Elements/BasicElements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,27 @@ extension Html: GlobalAttributes, GlobalEventAttributes {
return mutate(class: value)
}

@available(*, deprecated, message: "Use the editable(_:) modifier instead.")
public func isEditable(_ value: Bool) -> Html {
return mutate(contenteditable: value)
}

public func editable(_ value: Bool = true) -> Html {
return mutate(contenteditable: value)
}

public func direction(_ value: Values.Direction) -> Html {
return mutate(dir: value.rawValue)
}

@available(*, deprecated, message: "Use the draggable(_:) modifier instead.")
public func isDraggable(_ value: Bool) -> Html {
return mutate(draggable: value)
}

public func draggable(_ value: Bool = true) -> Html {
return mutate(draggable: value)
}

public func enterKeyHint(_ value: Values.Hint) -> Html {
return mutate(enterkeyhint: value.rawValue)
Expand All @@ -149,7 +159,7 @@ extension Html: GlobalAttributes, GlobalEventAttributes {
return self
}

@available(*, deprecated, message: "The inputmode attribute is actually an enumerated attribute. Use the inputMode(_: Mode) modifier instead.")
@available(*, unavailable, message: "Use the inputMode(_:) modifier instead.")
public func inputMode(_ value: String) -> Html {
return mutate(inputmode: value)
}
Expand Down Expand Up @@ -210,9 +220,14 @@ extension Html: GlobalAttributes, GlobalEventAttributes {
return mutate(role: value.rawValue)
}

@available(*, deprecated, message: "Use the spellcheck(_:) modifier instead.")
public func hasSpellCheck(_ value: Bool) -> Html {
return mutate(spellcheck: value)
}

public func spellcheck(_ value: Bool = true) -> Html {
return mutate(spellcheck: value)
}

public func style(_ value: String) -> Html {
return mutate(style: TaintedString(value, as: .css(.attribute)))
Expand All @@ -235,10 +250,20 @@ extension Html: GlobalAttributes, GlobalEventAttributes {
return mutate(title: value)
}

@available(*, deprecated, message: "Use the translate(_:) modifier instead.")
public func translate(_ value: Values.Decision) -> Html {
return mutate(translate: value.rawValue)
}

public func translate(_ value: Bool = true) -> Html {

if value {
return mutate(translate: "yes")
}

return mutate(translate: "no")
}

public func inert(_ condition: Bool = true) -> Html {

if condition {
Expand Down
Loading