From ae50a2d08dd0bc60a901446574dcc8c039100cae Mon Sep 17 00:00:00 2001 From: John Connolly Date: Wed, 17 Sep 2025 08:22:11 -0700 Subject: [PATCH 1/2] Fix break change --- Sources/Elementary/Core/HtmlBuilder+Tuples.swift | 3 +++ Sources/Elementary/Rendering/HtmlTextRenderer.swift | 9 +++++++++ Sources/Elementary/ServerSupport/SendOnceBox.swift | 4 ++-- .../Elementary/ServerSupport/SendableAnyHTMLBox.swift | 4 +++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Sources/Elementary/Core/HtmlBuilder+Tuples.swift b/Sources/Elementary/Core/HtmlBuilder+Tuples.swift index 775bc6e..9e3cbca 100644 --- a/Sources/Elementary/Core/HtmlBuilder+Tuples.swift +++ b/Sources/Elementary/Core/HtmlBuilder+Tuples.swift @@ -44,6 +44,7 @@ public extension HTMLBuilder { // variadic generics currently not supported in embedded #if !hasFeature(Embedded) @inlinable + @available(iOS 17, *) static func buildBlock(_ content: repeat each Content) -> _HTMLTuple where repeat each Content: HTML { _HTMLTuple(repeat each content) @@ -273,8 +274,10 @@ public struct _HTMLTuple6: HTML { public let value: (repeat each Child) diff --git a/Sources/Elementary/Rendering/HtmlTextRenderer.swift b/Sources/Elementary/Rendering/HtmlTextRenderer.swift index 076dc80..ee8c23c 100644 --- a/Sources/Elementary/Rendering/HtmlTextRenderer.swift +++ b/Sources/Elementary/Rendering/HtmlTextRenderer.swift @@ -1,3 +1,7 @@ +#if os(iOS) +import Foundation +#endif + #if !hasFeature(Embedded) struct HTMLTextRenderer: _HTMLRendering { private var result: [UInt8] = [] @@ -25,6 +29,7 @@ struct HTMLStreamRenderer: _HTMLRendering { } } + struct PrettyHTMLTextRenderer { let indentation: String @@ -68,7 +73,11 @@ struct PrettyHTMLTextRenderer { } if currentInlineText.contains("\n") { + #if os(iOS) + currentInlineText = currentInlineText.replacingOccurrences(of: "\n", with: "\n\(currentIndentation)") + #else currentInlineText.replace("\n", with: "\n\(currentIndentation)") + #endif addLineBreak() result += currentInlineText return true diff --git a/Sources/Elementary/ServerSupport/SendOnceBox.swift b/Sources/Elementary/ServerSupport/SendOnceBox.swift index eb61348..45f677e 100644 --- a/Sources/Elementary/ServerSupport/SendOnceBox.swift +++ b/Sources/Elementary/ServerSupport/SendOnceBox.swift @@ -1,7 +1,7 @@ -#if compiler(>=6.0) && !hasFeature(Embedded) && !os(iOS) +#if compiler(>=6.0) && !hasFeature(Embedded) import Synchronization -@available(macOS 15.0, *) +@available(iOS 18, macOS 15, *) final class SendOnceBox: Sendable, SendOnceBoxing { // final class SendOnceBox: Sendable, SendOnceBoxing { typealias Value = any HTML diff --git a/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift b/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift index de9ef7e..44619a7 100644 --- a/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift +++ b/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift @@ -1,8 +1,10 @@ -#if !hasFeature(Embedded) && !os(iOS) +#if !hasFeature(Embedded) /// A wrapper around an `any HTML` value that can be safely sent once. /// /// Note: For non-sendable values, this will only allow the value to be taken only once. /// Sendable values can safely be taken multiple times. + +@available(iOS 18, *) public struct _SendableAnyHTMLBox: Sendable { var storage: Storage From 3c656a50adda1079f28a1bfd80e376a0163d1840 Mon Sep 17 00:00:00 2001 From: John Connolly Date: Wed, 17 Sep 2025 08:35:57 -0700 Subject: [PATCH 2/2] fmt --- Sources/Elementary/Rendering/HtmlTextRenderer.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/Elementary/Rendering/HtmlTextRenderer.swift b/Sources/Elementary/Rendering/HtmlTextRenderer.swift index ee8c23c..bc3e107 100644 --- a/Sources/Elementary/Rendering/HtmlTextRenderer.swift +++ b/Sources/Elementary/Rendering/HtmlTextRenderer.swift @@ -29,7 +29,6 @@ struct HTMLStreamRenderer: _HTMLRendering { } } - struct PrettyHTMLTextRenderer { let indentation: String