Skip to content

0.7.0

Latest

Choose a tag to compare

@sliemeobn sliemeobn released this 31 Oct 13:01
91b3128

⚡️ htmx 4 ⚡️

ElementaryHTMX now supports htmx 4 through the new ElementaryHTMX4, ElementaryHTMX4SSE and ElementaryHTMX4WS modules (#26). The example apps now use it too (#27).

htmx 4 is on npm's next tag, so install htmx.org@next or htmx.org@4.0.0. See What's new in htmx 4 for upstream changes.

meta(htmxConfig: [.defaultSwap(.innerMorph), .defaultTimeout(5000)])

form(
    .hx.post("/messages"),
    .hx.target("#messages"),
    .hx.swap(.beforeEnd, [.scroll(.bottom), .settle("100ms")]),
    .hx.status("422", [.swap(.innerHTML), .target("#errors")])
) {
    input(.name("text"), .required)
    button { "Send" }
}

🧩 hxPartial

hxPartial adds <hx-partial>, which lets one response update several targets. It works with htmx 4 and htmx 2.0.11 or later (#25, #26).

hxPartial(.hx.target("#messages"), .hx.swap(.beforeEnd)) {
    div { "New message" }
}

📌 Pin an htmx version

The new ElementaryHTMX2, ElementaryHTMX2SSE and ElementaryHTMX2WS modules pin your code to htmx 2 (#25).

Note

ElementaryHTMX, ElementaryHTMXSSE and ElementaryHTMXWS still target htmx 2, so existing imports keep working. Code that spells out the old module name, such as ElementaryHTMX.HTMLAttributeValue, may need the versioned module instead.

What's Changed

  • Move htmx 2 code to versioned modules and add hx-partial by @sliemeobn in #25
  • Add htmx 4 support (ElementaryHTMX4) by @sliemeobn in #26
  • Move examples to htmx 4 and bump dependencies by @sliemeobn in #27
  • Add Hyperscript to SPI docs and fix README wording by @sliemeobn in #28

Full Changelog: 0.6.0...0.7.0