Problem/Motivation

Htmx is working on a new version of the library with some nice improvements that we will definitely want to take advantage of: https://htmx.org/essays/the-fetchening/

HTMX 4.0 Timeline

As always, software takes as long as it takes.

However, our current planned timeline is:

  • htmx 4.0 beta 1 is out
  • According to the lead maintainer, "I do not expect the API or implementation of htmx to change significantly from here (it’s been pretty stable for a while now.)"
  • We are going to slow roll our final release, with release candidates expected in May & June and a release late summer.

You can track our progress (and see quite a bit of dust flying around) in the four branch on github and at: https://four.htmx.org

Proposed resolution

Remaining tasks

  1. Move to 12.x branch when it opens per policy.
  2. Review the htmx 2 => 4 migration guide and adjust our code as needed.
  3. Update to htmx releases as they come out.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3555916

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nod_ created an issue. See original summary.

fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Issue summary: View changes
catch’s picture

Issue tags: +12.0.0 release notes

Given the overall timings this looks like something we should try to get into 12.0.0

nod_’s picture

worked out the problems to get things working with that new branch. This is now behaving like our current ajax framework. Assets needs to be loaded before DOM replacement happens.

nod_’s picture

Got an assist from @latent with the code: https://gist.github.com/MichaelWest22/7ca5b715b368ec1289352d4eeb310182

This moves the code to an htmx extension, and we might be able to use an extension to declare new swap styles to manage modals and messages.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Issue summary: View changes
Issue tags: +Needs change record
fathershawn’s picture

I'm going to update the HTMX object with changes for 4.x. I'm leaving the rebase for @nod_ as the javascript files are branching from an earlier version of those files and I don't want to try to interpret his work.

fathershawn’s picture

Reposting a question from Slack for wider discussion:

The default attribute format in htmx 4 is hx- although there apparently is a config that can be set to allow data-hx- We previously decided when working on the POC to go with the second, normative, approach.  The default hx- definitely stands out more when reading the code.  Shall we revisit this?

longwave’s picture

Issue tags: +12.0.0 beta blocker

Adding to #3449808: [12.x] [meta] Requirements for tagging 12.0.0-beta1 after discussions in Slack where HTMX 4 should be stable shortly before we release Drupal 12.

fathershawn’s picture

Rebased the feature branch onto the current head of main. htmx-assets.js should be re-checked to verify that I preserved the refactor but brought in appropriately the bug fixes in that file since the feature branch was forked.

Refactored the Htmx class to account for the two new attribute modifiers :inherited and :append

AI Note: I refactored the first htmx attribute building method and then tasked my JetBrains AI agent to repeat the pattern for the remaining methods.

fathershawn’s picture

I can't get the yarn.lock to update without adding dev dependencies.

fathershawn’s picture

The backend tests now pass. JS tests are failing - I very likely missed something rebasing the JS on changes in main.

fathershawn’s picture

All tests passing - waiting for updated releases of htmx 4

catch’s picture

Once there's a beta or rc of htmx 4 we could update to that in core on the expectation we'll be able to update again to stable prior to our own stable release.

fathershawn’s picture

@catch This MR is currently on 4.0.0-beta2. Michael has improvements coming in the next tag that include restoring data-hx- equally supported as hx- so I'm waiting for the next tag and will update accordingly.

fathershawn’s picture

We received an pre-release of beta3 from the HTMX team. I copy/pasted the code into this branch and returned our markup strategy to data-hx- syntax. All tests still pass.

The branch is conflicted with main. I'm going to rebase and resolve and then mark this issue for an initial review.

fathershawn’s picture

Issue summary: View changes
Status: Active » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

fathershawn’s picture

I'll update this branch again when the new htmx release is tagged.