Skip to content
Merged
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
20 changes: 0 additions & 20 deletions Sources/Elementary/Core/CoreModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ public protocol HTML<Tag> {
/// The HTML content of this component.
@HTMLBuilder var body: Body { get }

/// The HTML content of this component.
@HTMLBuilder
@available(*, deprecated, message: "`var content` is deprecated, use `var body` instead")
var content: Body { get }

static func _render<Renderer: _HTMLRendering>(
_ html: consuming Self,
into renderer: inout Renderer,
Expand All @@ -50,21 +45,6 @@ public protocol HTML<Tag> {
#endif
}

extension HTML {
@available(*, deprecated, message: "`var content` is deprecated, use `var body` instead")
public var body: Body {
// NOTE: sorry for the change
content
}

@available(*, deprecated, message: "Content was renamed, use Body instead")
public typealias Content = Body

public var content: Body {
fatalError("Please make sure to add a `var body` implementation to your HTML type.")
}
}

/// A type that represents an HTML tag.
public protocol HTMLTagDefinition: Sendable {
/// The name of the HTML tag as it is rendered in an HTML document.
Expand Down
14 changes: 2 additions & 12 deletions Sources/Elementary/Core/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,7 @@ public struct _ModifiedTaskLocal<T: Sendable, Content: HTML>: HTML {
into renderer: inout Renderer,
with context: consuming _RenderingContext
) {
#if compiler(>=6.0)
// https://github.com/swiftlang/swift/issues/76474
let context = consume context
#endif

html.taskLocal.withValue(html.value) {
html.taskLocal.withValue(html.value) { [context] in
Content._render(html.wrappedContent, into: &renderer, with: context)
}
}
Expand All @@ -102,12 +97,7 @@ public struct _ModifiedTaskLocal<T: Sendable, Content: HTML>: HTML {
into renderer: inout Renderer,
with context: consuming _RenderingContext
) async throws {
#if compiler(>=6.0)
// https://github.com/swiftlang/swift/issues/76474
let context = consume context
#endif

try await html.taskLocal.withValue(html.value) {
try await html.taskLocal.withValue(html.value) { [context] in
try await Content._render(html.wrappedContent, into: &renderer, with: context)
}
}
Expand Down
4 changes: 0 additions & 4 deletions Sources/Elementary/Core/Html+Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public struct HTMLAttributeMergeAction: Sendable {
/// Ignores the new value if the attribute already exists.
public static var ignoring: Self { .init(mergeMode: .ignoreIfSet) }

/// Appends the new value to the existing value, separated by the specified string.
@available(*, deprecated, renamed: "appending(separatedBy:)")
public static func appending(seperatedBy: String) -> Self { .init(mergeMode: .appendValue(seperatedBy)) }

/// Appends the new value to the existing value, separated by the specified string.
public static func appending(separatedBy: String) -> Self { .init(mergeMode: .appendValue(separatedBy)) }
}
Expand Down
11 changes: 0 additions & 11 deletions Sources/Elementary/Core/HtmlBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
HTMLText(content)
}

@available(*, deprecated, message: "use buildExpression(_: String) instead")
public static func buildExpression<Content>(_ content: Content) -> HTMLText where Content: StringProtocol {
HTMLText(String(content))
}

@inlinable
public static func buildBlock() -> EmptyHTML {
EmptyHTML()
Expand Down Expand Up @@ -122,12 +117,6 @@ public struct HTMLText: HTML, Sendable {
/// The text content.
public var text: String

/// Creates a new text content with the specified text.
@available(*, deprecated, message: "use init(_: String) instead")
public init(_ text: some StringProtocol) {
self.text = String(text)
}

/// Creates a new text content with the specified text.
@inlinable
public init(_ text: String) {
Expand Down
6 changes: 0 additions & 6 deletions Sources/Elementary/Html+Rendering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ public extension HTML {
return renderer.collect()
}

@available(*, deprecated, message: "will be removed, use async API render(into:chunkSize:) instead")
consuming func render(into writer: @escaping (String) -> Void) {
var renderer = HTMLStreamRenderer(writer: writer)
Self._render(self, into: &renderer, with: .emptyContext)
}

/// Renders the HTML content into a stream writer.
/// - Parameters:
/// - writer: The ``HTMLStreamWriter`` to write the rendered content to.
Expand Down
9 changes: 0 additions & 9 deletions Sources/Elementary/Rendering/HtmlTextRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ struct HTMLTextRenderer: _HTMLRendering {
}
}

@available(*, deprecated, message: "will be removed")
struct HTMLStreamRenderer: _HTMLRendering {
let writer: (String) -> Void

mutating func appendToken(_ token: consuming _HTMLRenderToken) {
writer(token.renderedValue())
}
}

struct PrettyHTMLTextRenderer {
let indentation: String

Expand Down
2 changes: 1 addition & 1 deletion Sources/Elementary/ServerSupport/SendOnceBox.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if compiler(>=6.0) && !hasFeature(Embedded)
#if !hasFeature(Embedded)
import Synchronization

@available(iOS 18, macOS 15, *)
Expand Down
13 changes: 0 additions & 13 deletions Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,19 @@ public struct _SendableAnyHTMLBox: Sendable {

enum Storage {
case sendable(any HTML & Sendable)
#if compiler(>=6.0)
// NOTE: protocol can be removed when macOS 15 is the minimum
case sendOnceBox(any SendOnceBoxing<any HTML>)
#endif
}

public init(_ html: any HTML & Sendable) {
storage = .sendable(html)
}

#if compiler(>=6.0)
@available(macOS 15, *)
public init(_ html: sending any HTML) {
storage = .sendOnceBox(SendOnceBox(html))
}
#endif

#if compiler(>=6.0)
public consuming func tryTake() -> sending (any HTML)? {
switch storage {
case let .sendable(html):
Expand All @@ -36,13 +31,5 @@ public struct _SendableAnyHTMLBox: Sendable {
return box.tryTake()
}
}
#else
public consuming func tryTake() -> (any HTML & Sendable)? {
switch storage {
case let .sendable(html):
return html
}
}
#endif
}
#endif
2 changes: 0 additions & 2 deletions Tests/ElementaryTests/SendableAnyHTMLBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ final class SendOnceHTMLValueTests: XCTestCase {
XCTAssertNotNil(box.tryTake())
}

#if compiler(>=6.0)
func testHoldsNonSendable() throws {
guard #available(macOS 15.0, *) else {
throw XCTSkip("Requires macOS 15.0")
Expand All @@ -20,7 +19,6 @@ final class SendOnceHTMLValueTests: XCTestCase {
XCTAssertNotNil(box.tryTake())
XCTAssertNil(box.tryTake())
}
#endif
}

class NonSendable {
Expand Down
Loading