From f748991bddce627437c2061afb134825f5da5d27 Mon Sep 17 00:00:00 2001 From: Simon Leeb <52261246+sliemeobn@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:04:26 +0100 Subject: [PATCH] renamed to `hyperscript` --- Package.swift | 1 - README.md | 4 ++-- Sources/ElementaryHyperscript/HTMLAttribute+Hyperscript.swift | 2 +- .../ElementaryHyperscriptTest/ElementaryHyperscriptTest.swift | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Package.swift b/Package.swift index 1409df5..c7ef2ed 100644 --- a/Package.swift +++ b/Package.swift @@ -53,7 +53,6 @@ let package = Package( name: "ElementaryHyperscript", dependencies: [ .product(name: "Elementary", package: "elementary"), - .target(name: "ElementaryHTMX"), ], swiftSettings: featureFlags ), diff --git a/README.md b/README.md index f703519..5742518 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ import Elementary import ElementaryHyperscript // Hyperscript extension -button(.hs("on click send hello to
")) { +button(.hyperscript("on click send hello to ")) { "Send" } ``` @@ -69,7 +69,7 @@ The package brings the `.hx` syntaxt to all `HTMLElements` - providing a rich AP There is also an `ElementaryHTMXSSE` module that adds the `.sse` syntax for the [Server Sent Events extensions](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/sse/README.md), as well as `ElementaryHTMXWS` to add the `.ws` syntax for the [WebSockets extensions.](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/ws/README.md) -The package also supports the [Hyperscript](https://hyperscript.org) `_` attribute as `.hs`. +The package also supports the [Hyperscript](https://hyperscript.org) `_` attribute as `.hyperscript`. ## Future directions diff --git a/Sources/ElementaryHyperscript/HTMLAttribute+Hyperscript.swift b/Sources/ElementaryHyperscript/HTMLAttribute+Hyperscript.swift index 99c2537..91a5079 100644 --- a/Sources/ElementaryHyperscript/HTMLAttribute+Hyperscript.swift +++ b/Sources/ElementaryHyperscript/HTMLAttribute+Hyperscript.swift @@ -1,7 +1,7 @@ import Elementary public extension HTMLAttribute where Tag: HTMLTrait.Attributes.Global { - static func hs(_ script: String) -> HTMLAttribute { + static func hyperscript(_ script: String) -> Self { .init(name: "_", value: script) } } diff --git a/Tests/ElementaryHyperscriptTest/ElementaryHyperscriptTest.swift b/Tests/ElementaryHyperscriptTest/ElementaryHyperscriptTest.swift index 320eeb4..c57b3d3 100644 --- a/Tests/ElementaryHyperscriptTest/ElementaryHyperscriptTest.swift +++ b/Tests/ElementaryHyperscriptTest/ElementaryHyperscriptTest.swift @@ -5,6 +5,6 @@ import XCTest final class elementary_hyperscriptTests: XCTestCase { func testScript() { - HTMLAttributeAssertEqual(.hs("on click send hello to "), "_", "on click send hello to ") + HTMLAttributeAssertEqual(.hyperscript("on click send hello to "), "_", "on click send hello to ") } }