From d7a720d87f2778e2b516ac3e258d063d8c35fa27 Mon Sep 17 00:00:00 2001 From: Simon Leeb <52261246+sliemeobn@users.noreply.github.com> Date: Tue, 25 Nov 2025 16:56:15 +0100 Subject: [PATCH 1/4] dependency upgrade + rename --- .github/workflows/api-breakage.yml | 2 +- .gitignore | 3 +- Package.swift | 8 +- .../ElementaryHTMX/HTMLAttribute+HTMX.swift | 82 ++++++++++--------- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/.github/workflows/api-breakage.yml b/.github/workflows/api-breakage.yml index e0b6f29..7d6b3f6 100644 --- a/.github/workflows/api-breakage.yml +++ b/.github/workflows/api-breakage.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 container: - image: swift:6.0 + image: swift:6.2 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 47b8146..f89015c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ DerivedData/ .netrc Package.resolved /.vscode -/.devcontainer \ No newline at end of file +/.devcontainer +.swift-version \ No newline at end of file diff --git a/Package.swift b/Package.swift index fb5891a..b9531a7 100644 --- a/Package.swift +++ b/Package.swift @@ -23,13 +23,13 @@ let package = Package( .library(name: "ElementaryHyperscript", targets: ["ElementaryHyperscript"]), ], dependencies: [ - .package(url: "https://github.com/sliemeobn/elementary.git", from: "0.3.0"), + .package(url: "https://github.com/sliemeobn/elementary.git", from: "0.6.0") ], targets: [ .target( name: "ElementaryHTMX", dependencies: [ - .product(name: "Elementary", package: "elementary"), + .product(name: "Elementary", package: "elementary") ], swiftSettings: featureFlags ), @@ -52,7 +52,7 @@ let package = Package( .target( name: "ElementaryHyperscript", dependencies: [ - .product(name: "Elementary", package: "elementary"), + .product(name: "Elementary", package: "elementary") ], swiftSettings: featureFlags ), @@ -91,7 +91,7 @@ let package = Package( .target( name: "TestUtilities", dependencies: [ - .product(name: "Elementary", package: "elementary"), + .product(name: "Elementary", package: "elementary") ], path: "Tests/TestUtilities", swiftSettings: featureFlags diff --git a/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift b/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift index 675bc81..c46fccf 100644 --- a/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift +++ b/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift @@ -1,49 +1,55 @@ import Elementary -public extension HTMLAttribute where Tag: HTMLTrait.Attributes.Global { +extension HTMLAttribute where Tag: HTMLTrait.Attributes.Global { /// A namespace for HTMX attributes. /// See the [htmx reference](https://htmx.org/reference/) for more information. - enum hx {} + public enum hx {} } -public extension HTMLAttribute.hx { - static func get(_ url: String) -> HTMLAttribute { +extension HTMLAttribute.hx { + public static func get(_ url: String) -> HTMLAttribute { .init(name: "hx-get", value: url) } - static func post(_ url: String) -> HTMLAttribute { + public static func post(_ url: String) -> HTMLAttribute { .init(name: "hx-post", value: url) } - static func pushURL(_ url: String) -> HTMLAttribute { + public static func pushURL(_ url: String) -> HTMLAttribute { .init(name: "hx-push-url", value: url) } - static func pushURL(_ value: Bool) -> HTMLAttribute { + public static func pushURL(_ value: Bool) -> HTMLAttribute { .init(name: "hx-push-url", value: value.stringValue) } - static func select(_ selector: String) -> HTMLAttribute { + public static func select(_ selector: String) -> HTMLAttribute { .init(name: "hx-select", value: selector) } - static func selectOOB(_ selector: String, _ swap: HTMLAttributeValue.HTMX.SwapTarget? = nil) -> HTMLAttribute { + public static func selectOOB( + _ selector: String, _ swap: HTMLAttributeValue.HTMX.SwapTarget? = nil + ) -> HTMLAttribute { if let swap { - .init(name: "hx-select-oob", value: "\(selector):\(swap.rawValue)", mergedBy: .appending(seperatedBy: ",")) + .init( + name: "hx-select-oob", value: "\(selector):\(swap.rawValue)", + mergedBy: .appending(separatedBy: ",")) } else { - .init(name: "hx-select-oob", value: selector, mergedBy: .appending(seperatedBy: ",")) + .init(name: "hx-select-oob", value: selector, mergedBy: .appending(separatedBy: ",")) } } - static func swap(_ value: HTMLAttributeValue.HTMX.ModifiedSwapTarget) -> HTMLAttribute { + public static func swap(_ value: HTMLAttributeValue.HTMX.ModifiedSwapTarget) -> HTMLAttribute { .init(name: "hx-swap", value: value.rawValue) } - static func swapOOB(_ value: Bool) -> HTMLAttribute { + public static func swapOOB(_ value: Bool) -> HTMLAttribute { .init(name: "hx-swap-oob", value: value.stringValue) } - static func swapOOB(_ swap: HTMLAttributeValue.HTMX.SwapTarget, _ selector: String? = nil) -> HTMLAttribute { + public static func swapOOB( + _ swap: HTMLAttributeValue.HTMX.SwapTarget, _ selector: String? = nil + ) -> HTMLAttribute { if let selector { .init(name: "hx-swap-oob", value: "\(swap.rawValue):\(selector)") } else { @@ -51,85 +57,85 @@ public extension HTMLAttribute.hx { } } - static func target(_ selector: String) -> HTMLAttribute { + public static func target(_ selector: String) -> HTMLAttribute { .init(name: "hx-target", value: selector) } - static func trigger(_ value: HTMLAttributeValue.HTMX.EventTrigger) -> HTMLAttribute { - .init(name: "hx-trigger", value: value.rawValue, mergedBy: .appending(seperatedBy: ", ")) + public static func trigger(_ value: HTMLAttributeValue.HTMX.EventTrigger) -> HTMLAttribute { + .init(name: "hx-trigger", value: value.rawValue, mergedBy: .appending(separatedBy: ", ")) } - static func trigger(_ value: HTMLAttributeValue.HTMX.PollingTrigger) -> HTMLAttribute { - .init(name: "hx-trigger", value: value.rawValue, mergedBy: .appending(seperatedBy: ", ")) + public static func trigger(_ value: HTMLAttributeValue.HTMX.PollingTrigger) -> HTMLAttribute { + .init(name: "hx-trigger", value: value.rawValue, mergedBy: .appending(separatedBy: ", ")) } - static func vals(_ value: String) -> HTMLAttribute { + public static func vals(_ value: String) -> HTMLAttribute { .init(name: "hx-vals", value: value) } } -public extension HTMLAttribute.hx { - static func boost(_ value: Bool) -> HTMLAttribute { +extension HTMLAttribute.hx { + public static func boost(_ value: Bool) -> HTMLAttribute { .init(name: "hx-boost", value: value.stringValue) } - static func confirm(_ value: String) -> HTMLAttribute { + public static func confirm(_ value: String) -> HTMLAttribute { .init(name: "hx-confirm", value: value) } - static func delete(_ url: String) -> HTMLAttribute { + public static func delete(_ url: String) -> HTMLAttribute { .init(name: "hx-delete", value: url) } - static var disable: HTMLAttribute { + public static var disable: HTMLAttribute { .init(name: "hx-disable", value: .none) } - static func disabledElt(_ value: String) -> HTMLAttribute { + public static func disabledElt(_ value: String) -> HTMLAttribute { .init(name: "hx-disabled-elt", value: value) } - static func ext(_ value: HTMLAttributeValue.HTMX.Extension) -> HTMLAttribute { - .init(name: "hx-ext", value: value.rawValue, mergedBy: .appending(seperatedBy: ",")) + public static func ext(_ value: HTMLAttributeValue.HTMX.Extension) -> HTMLAttribute { + .init(name: "hx-ext", value: value.rawValue, mergedBy: .appending(separatedBy: ",")) } - static func headers(_ value: String) -> HTMLAttribute { + public static func headers(_ value: String) -> HTMLAttribute { .init(name: "hx-headers", value: value) } - static func include(_ value: String) -> HTMLAttribute { + public static func include(_ value: String) -> HTMLAttribute { .init(name: "hx-include", value: value) } - static func indicator(_ value: String) -> HTMLAttribute { + public static func indicator(_ value: String) -> HTMLAttribute { .init(name: "hx-indicator", value: value) } - static func params(_ value: String) -> HTMLAttribute { + public static func params(_ value: String) -> HTMLAttribute { .init(name: "hx-params", value: value) } - static func patch(_ url: String) -> HTMLAttribute { + public static func patch(_ url: String) -> HTMLAttribute { .init(name: "hx-patch", value: url) } - static func put(_ url: String) -> HTMLAttribute { + public static func put(_ url: String) -> HTMLAttribute { .init(name: "hx-put", value: url) } - static func replaceURL(_ url: String) -> HTMLAttribute { + public static func replaceURL(_ url: String) -> HTMLAttribute { .init(name: "hx-replace-url", value: url) } - static func replaceURL(_ value: Bool) -> HTMLAttribute { + public static func replaceURL(_ value: Bool) -> HTMLAttribute { .init(name: "hx-replace-url", value: value.stringValue) } - static func request(_ value: String) -> HTMLAttribute { + public static func request(_ value: String) -> HTMLAttribute { .init(name: "hx-request", value: value) } - static func validate(_ value: Bool) -> HTMLAttribute { + public static func validate(_ value: Bool) -> HTMLAttribute { .init(name: "hx-validate", value: value.stringValue) } } From 01f6e16be0a3bbe7a31fa27db709cf569d206d14 Mon Sep 17 00:00:00 2001 From: Simon Leeb <52261246+sliemeobn@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:16:06 +0100 Subject: [PATCH 2/4] renamed content in examples --- Examples/HummingbirdDemo/Sources/App/Views.swift | 15 ++++++++++----- Examples/VaporDemo/Sources/App/Views.swift | 13 +++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Examples/HummingbirdDemo/Sources/App/Views.swift b/Examples/HummingbirdDemo/Sources/App/Views.swift index 233a772..4d9da3d 100644 --- a/Examples/HummingbirdDemo/Sources/App/Views.swift +++ b/Examples/HummingbirdDemo/Sources/App/Views.swift @@ -41,7 +41,9 @@ struct MainPage: HTMLDocument { div(.hx.ext(.ws), .ws.connect("/echo"), .hx.target("#echo")) { form(.ws.send, .style("display: flex;")) { input(.type(.text), .name("message"), .value("Hello, World!"), .required) - button(.class("btn btn-primary"), .style("height: 100%; margin-left: 1rem;")) { "Send" } + button(.class("btn btn-primary"), .style("height: 100%; margin-left: 1rem;")) { + "Send" + } } div(.id("echo")) {} } @@ -52,7 +54,7 @@ struct MainPage: HTMLDocument { struct ItemList: HTML { @Environment(EnvironmentValues.$database) var database - var content: some HTML { + var body: some HTML { div(.id("list")) { let items = await database.model.items @@ -72,7 +74,7 @@ struct ItemList: HTML { } struct TimeHeading: HTML { - var content: some HTML { + var body: some HTML { h4 { "Server Time: \(Date())" } @@ -86,8 +88,11 @@ enum EnvironmentValues { struct WSResponse: HTML { var echoRequest: EchoRequest - var content: some HTML { - div(.id(echoRequest.headers.hxTarget), .hx.swapOOB(.beforeEnd, "#\(echoRequest.headers.hxTarget)")) { + var body: some HTML { + div( + .id(echoRequest.headers.hxTarget), + .hx.swapOOB(.beforeEnd, "#\(echoRequest.headers.hxTarget)") + ) { "Received: \(echoRequest.message) at \(Date())" br() } diff --git a/Examples/VaporDemo/Sources/App/Views.swift b/Examples/VaporDemo/Sources/App/Views.swift index 7f7f157..ce4bc18 100644 --- a/Examples/VaporDemo/Sources/App/Views.swift +++ b/Examples/VaporDemo/Sources/App/Views.swift @@ -12,7 +12,9 @@ struct MainPage: HTMLDocument { script(.src("/htmx.min.js")) {} script(.src("/htmxsse.min.js")) {} script(.src("/htmxws.min.js")) {} - link(.rel(.stylesheet), .href("https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css")) + link( + .rel(.stylesheet), + .href("https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css")) } var body: some HTML { @@ -60,7 +62,7 @@ struct ResultView: HTML { @Environment(requiring: BonusFactStore.$current) var bonusFacts - var content: some HTML { + var body: some HTML { p { "\(x) + \(y) = " b { "\(x + y)" } @@ -76,7 +78,10 @@ struct ResultView: HTML { struct WSEcho: HTML { let message: String - var content: some HTML { - div(.id("echo"), .hx.swapOOB(.beforeEnd)) { "Echo: \(message)"; br() } + var body: some HTML { + div(.id("echo"), .hx.swapOOB(.beforeEnd)) { + "Echo: \(message)" + br() + } } } From 671fdc50511d35047b1e02c13e6ba9ec8db59b86 Mon Sep 17 00:00:00 2001 From: Simon Leeb <52261246+sliemeobn@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:19:06 +0100 Subject: [PATCH 3/4] formatting --- .swift-format | 63 +++++++++++++++++++ .swiftformat | 1 - Examples/HummingbirdDemo/Package.swift | 8 +-- .../HummingbirdDemo/Sources/App/App.swift | 4 +- .../Sources/App/BrowserSync.swift | 18 +++--- Examples/VaporDemo/Package.swift | 8 +-- Examples/VaporDemo/Sources/App/App.swift | 2 +- .../VaporDemo/Sources/App/BonusFacts.swift | 2 +- .../VaporDemo/Sources/App/BrowserSync.swift | 20 +++--- Examples/VaporDemo/Sources/App/Views.swift | 3 +- .../ElementaryHTMX/HTMLAttribute+HTMX.swift | 12 ++-- Tests/TestUtilities/Utilities.swift | 8 ++- 12 files changed, 111 insertions(+), 38 deletions(-) create mode 100644 .swift-format delete mode 100644 .swiftformat diff --git a/.swift-format b/.swift-format new file mode 100644 index 0000000..8236957 --- /dev/null +++ b/.swift-format @@ -0,0 +1,63 @@ +{ + "version": 1, + "indentation": { + "spaces": 4 + }, + "tabWidth": 4, + "fileScopedDeclarationPrivacy": { + "accessLevel": "private" + }, + "spacesAroundRangeFormationOperators": false, + "indentConditionalCompilationBlocks": false, + "indentSwitchCaseLabels": false, + "lineBreakAroundMultilineExpressionChainComponents": false, + "lineBreakBeforeControlFlowKeywords": false, + "lineBreakBeforeEachArgument": true, + "lineBreakBeforeEachGenericRequirement": true, + "lineLength": 140, + "maximumBlankLines": 1, + "respectsExistingLineBreaks": true, + "prioritizeKeepingFunctionOutputTogether": true, + "multiElementCollectionTrailingCommas": true, + "rules": { + "AllPublicDeclarationsHaveDocumentation": false, + "AlwaysUseLiteralForEmptyCollectionInit": false, + "AlwaysUseLowerCamelCase": false, + "AmbiguousTrailingClosureOverload": true, + "BeginDocumentationCommentWithOneLineSummary": false, + "DoNotUseSemicolons": false, + "DontRepeatTypeInStaticProperties": true, + "FileScopedDeclarationPrivacy": true, + "FullyIndirectEnum": true, + "GroupNumericLiterals": true, + "IdentifiersMustBeASCII": true, + "NeverForceUnwrap": false, + "NeverUseForceTry": false, + "NeverUseImplicitlyUnwrappedOptionals": false, + "NoAccessLevelOnExtensionDeclaration": false, + "NoAssignmentInExpressions": true, + "NoBlockComments": true, + "NoCasesWithOnlyFallthrough": true, + "NoEmptyTrailingClosureParentheses": true, + "NoLabelsInCasePatterns": true, + "NoLeadingUnderscores": false, + "NoParensAroundConditions": true, + "NoVoidReturnOnFunctionSignature": true, + "OmitExplicitReturns": true, + "OneCasePerLine": true, + "OneVariableDeclarationPerLine": true, + "OnlyOneTrailingClosureArgument": true, + "OrderedImports": true, + "ReplaceForEachWithForLoop": true, + "ReturnVoidInsteadOfEmptyTuple": true, + "UseEarlyExits": false, + "UseExplicitNilCheckInConditions": false, + "UseLetInEveryBoundCaseVariable": false, + "UseShorthandTypeNames": true, + "UseSingleLinePropertyGetter": false, + "UseSynthesizedInitializer": false, + "UseTripleSlashForDocumentationComments": true, + "UseWhereClausesInForLoops": false, + "ValidateDocumentationComments": false + } +} diff --git a/.swiftformat b/.swiftformat deleted file mode 100644 index f326726..0000000 --- a/.swiftformat +++ /dev/null @@ -1 +0,0 @@ ---stripunusedargs unnamed-only \ No newline at end of file diff --git a/Examples/HummingbirdDemo/Package.swift b/Examples/HummingbirdDemo/Package.swift index aae803a..7a5c87b 100644 --- a/Examples/HummingbirdDemo/Package.swift +++ b/Examples/HummingbirdDemo/Package.swift @@ -4,10 +4,10 @@ import PackageDescription let package = Package( name: "HummingbirdDemo", platforms: [ - .macOS(.v14), + .macOS(.v14) ], products: [ - .executable(name: "App", targets: ["App"]), + .executable(name: "App", targets: ["App"]) ], dependencies: [ .package(path: "../../"), @@ -32,9 +32,9 @@ let package = Package( .product(name: "ServiceLifecycle", package: "swift-service-lifecycle"), ], resources: [ - .copy("Public"), + .copy("Public") ], swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")] - ), + ) ] ) diff --git a/Examples/HummingbirdDemo/Sources/App/App.swift b/Examples/HummingbirdDemo/Sources/App/App.swift index c7abbc8..9812cf7 100644 --- a/Examples/HummingbirdDemo/Sources/App/App.swift +++ b/Examples/HummingbirdDemo/Sources/App/App.swift @@ -1,7 +1,7 @@ import Foundation import Hummingbird -import HummingbirdWebSocket import HummingbirdWSCompression +import HummingbirdWebSocket @main struct App { @@ -22,7 +22,7 @@ struct App { onServerRunning: { _ in print("Server running on http://localhost:8080/") #if DEBUG - browserSyncReload() + browserSyncReload() #endif } ) diff --git a/Examples/HummingbirdDemo/Sources/App/BrowserSync.swift b/Examples/HummingbirdDemo/Sources/App/BrowserSync.swift index 7ba7964..e3d34d9 100644 --- a/Examples/HummingbirdDemo/Sources/App/BrowserSync.swift +++ b/Examples/HummingbirdDemo/Sources/App/BrowserSync.swift @@ -1,14 +1,14 @@ import Foundation #if DEBUG - func browserSyncReload() { - let p = Process() - p.executableURL = URL(string: "file:///bin/sh") - p.arguments = ["-c", "browser-sync reload"] - do { - try p.run() - } catch { - print("Could not auto-reload: \(error)") - } +func browserSyncReload() { + let p = Process() + p.executableURL = URL(string: "file:///bin/sh") + p.arguments = ["-c", "browser-sync reload"] + do { + try p.run() + } catch { + print("Could not auto-reload: \(error)") } +} #endif diff --git a/Examples/VaporDemo/Package.swift b/Examples/VaporDemo/Package.swift index 7a789bd..7cf92d7 100644 --- a/Examples/VaporDemo/Package.swift +++ b/Examples/VaporDemo/Package.swift @@ -4,10 +4,10 @@ import PackageDescription let package = Package( name: "HummingbirdDemo", platforms: [ - .macOS(.v14), + .macOS(.v14) ], products: [ - .executable(name: "App", targets: ["App"]), + .executable(name: "App", targets: ["App"]) ], dependencies: [ .package(url: "https://github.com/vapor/vapor", from: "4.102.0"), @@ -27,9 +27,9 @@ let package = Package( .product(name: "AsyncAlgorithms", package: "swift-async-algorithms"), ], resources: [ - .copy("Public"), + .copy("Public") ], swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")] - ), + ) ] ) diff --git a/Examples/VaporDemo/Sources/App/App.swift b/Examples/VaporDemo/Sources/App/App.swift index 05d83f7..3fd7776 100644 --- a/Examples/VaporDemo/Sources/App/App.swift +++ b/Examples/VaporDemo/Sources/App/App.swift @@ -9,7 +9,7 @@ struct App { addRoutes(to: app) #if DEBUG - app.lifecycle.use(BrowserSyncHandler()) + app.lifecycle.use(BrowserSyncHandler()) #endif try await app.execute() diff --git a/Examples/VaporDemo/Sources/App/BonusFacts.swift b/Examples/VaporDemo/Sources/App/BonusFacts.swift index 81686bb..d8f6b84 100644 --- a/Examples/VaporDemo/Sources/App/BonusFacts.swift +++ b/Examples/VaporDemo/Sources/App/BonusFacts.swift @@ -12,7 +12,7 @@ actor BonusFactStore { ] func calculateBonusFact() async -> String { - return bonusFacts.randomElement()! + bonusFacts.randomElement()! } @TaskLocal static var current: BonusFactStore? diff --git a/Examples/VaporDemo/Sources/App/BrowserSync.swift b/Examples/VaporDemo/Sources/App/BrowserSync.swift index d9dc362..0bd9c51 100644 --- a/Examples/VaporDemo/Sources/App/BrowserSync.swift +++ b/Examples/VaporDemo/Sources/App/BrowserSync.swift @@ -2,16 +2,16 @@ import Foundation import Vapor #if DEBUG - struct BrowserSyncHandler: LifecycleHandler { - func didBoot(_: Application) throws { - let p = Process() - p.executableURL = URL(string: "file:///bin/sh") - p.arguments = ["-c", "browser-sync reload"] - do { - try p.run() - } catch { - print("Could not auto-reload: \(error)") - } +struct BrowserSyncHandler: LifecycleHandler { + func didBoot(_: Application) throws { + let p = Process() + p.executableURL = URL(string: "file:///bin/sh") + p.arguments = ["-c", "browser-sync reload"] + do { + try p.run() + } catch { + print("Could not auto-reload: \(error)") } } +} #endif diff --git a/Examples/VaporDemo/Sources/App/Views.swift b/Examples/VaporDemo/Sources/App/Views.swift index ce4bc18..487f747 100644 --- a/Examples/VaporDemo/Sources/App/Views.swift +++ b/Examples/VaporDemo/Sources/App/Views.swift @@ -14,7 +14,8 @@ struct MainPage: HTMLDocument { script(.src("/htmxws.min.js")) {} link( .rel(.stylesheet), - .href("https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css")) + .href("https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css") + ) } var body: some HTML { diff --git a/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift b/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift index c46fccf..5e39b32 100644 --- a/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift +++ b/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift @@ -28,12 +28,15 @@ extension HTMLAttribute.hx { } public static func selectOOB( - _ selector: String, _ swap: HTMLAttributeValue.HTMX.SwapTarget? = nil + _ selector: String, + _ swap: HTMLAttributeValue.HTMX.SwapTarget? = nil ) -> HTMLAttribute { if let swap { .init( - name: "hx-select-oob", value: "\(selector):\(swap.rawValue)", - mergedBy: .appending(separatedBy: ",")) + name: "hx-select-oob", + value: "\(selector):\(swap.rawValue)", + mergedBy: .appending(separatedBy: ",") + ) } else { .init(name: "hx-select-oob", value: selector, mergedBy: .appending(separatedBy: ",")) } @@ -48,7 +51,8 @@ extension HTMLAttribute.hx { } public static func swapOOB( - _ swap: HTMLAttributeValue.HTMX.SwapTarget, _ selector: String? = nil + _ swap: HTMLAttributeValue.HTMX.SwapTarget, + _ selector: String? = nil ) -> HTMLAttribute { if let selector { .init(name: "hx-swap-oob", value: "\(swap.rawValue):\(selector)") diff --git a/Tests/TestUtilities/Utilities.swift b/Tests/TestUtilities/Utilities.swift index 919262e..43cca3d 100644 --- a/Tests/TestUtilities/Utilities.swift +++ b/Tests/TestUtilities/Utilities.swift @@ -1,7 +1,13 @@ import Elementary import XCTest -public func HTMLAttributeAssertEqual(_ attribute: HTMLAttribute, _ name: String, _ value: String?, file: StaticString = #filePath, line: UInt = #line) { +public func HTMLAttributeAssertEqual( + _ attribute: HTMLAttribute, + _ name: String, + _ value: String?, + file: StaticString = #filePath, + line: UInt = #line +) { XCTAssertEqual(name, attribute.name, file: file, line: line) XCTAssertEqual(value, attribute.value, file: file, line: line) } From 408212eb786bdc988951d0221d51bde645db2a52 Mon Sep 17 00:00:00 2001 From: Simon Leeb <52261246+sliemeobn@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:19:57 +0100 Subject: [PATCH 4/4] formatting ci --- .github/workflows/format.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/format.yaml diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 0000000..c65b028 --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,27 @@ +name: Swift Format Lint + +on: + push: + branches: [main] + paths: + - "**.swift" + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + linux: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + image: ["swift:6.2"] + + container: + image: ${{ matrix.image }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check Format + run: swift format lint -prs .