chore(htmx): upgrade htmx to v4
release.yaml / publish (push) Successful in 3m48s

This commit was merged in pull request #3.
This commit is contained in:
schreifuchs committed 2026-09-29 11:03:38 +02:00
1 parent 812891a205
commit 2a96034fca
17 files changed
+94 -95

No files matched your search

+1
View File
@@ -0,0 +1 @@
!function(){let e;function t(e){let t=document.createElement(e.tagName);for(const r of e.attributes)t.setAttribute(r.name,r.value);return t.textContent=e.textContent,"LINK"===e.tagName&&"stylesheet"===e.rel?new Promise(e=>{t.onload=e,t.onerror=e,document.head.appendChild(t)}):"SCRIPT"!==e.tagName||!e.src||e.async||e.defer?(document.head.appendChild(t),e._preloadHint&&t.addEventListener("load",()=>e._preloadHint.remove(),{once:!0}),null):new Promise((e,r)=>{t.onload=e,t.onerror=r,document.head.appendChild(t)})}async function r(r,d){if(r&&r.indexOf("<head")>-1){const o=document.createElement("html");let a=r.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"").match(/(<head(\s[^>]*>|>)([\s\S]*?)<\/head>)/im);if(a){let r=[],n=[],h=[],s=[],m=[];o.innerHTML=a;let l=o.querySelector("head"),i=document.head;if(null==l)return[];let c=new Map;for(const e of l.children)c.set(e.outerHTML,e);let u=e.attributeValue(l,"hx-head")||d;for(const t of i.children){let r=c.has(t.outerHTML),d="re-eval"===t.getAttribute("hx-head"),o="true"===e.attributeValue(t,"hx-preserve");r||o?d?n.push(t):(c.delete(t.outerHTML),h.push(t)):"append"===u?d&&(n.push(t),s.push(t)):!1!==htmx.trigger(document.body,"htmx:head:before:remove",{headElement:t})&&n.push(t)}s.push(...c.values());for(const e of s)if("SCRIPT"===e.tagName&&e.defer){if(m.push(e),e.src){let t=document.createElement("link");t.rel="module"===e.type?"modulepreload":"preload",t.as="script",t.href=e.src,document.head.appendChild(t),e._preloadHint=t}}else!1!==htmx.trigger(document.body,"htmx:head:before:add",{headElement:e})&&(await t(e),r.push(e));for(const e of n)!1!==htmx.trigger(document.body,"htmx:head:before:remove",{headElement:e})&&i.removeChild(e);return htmx.trigger(document.body,"htmx:head:after:merge",{added:r,kept:h,removed:n}),m}}return[]}htmx.registerExtension("hx-head",{init:t=>{e=t},htmx_before_response:(e,t)=>{let d=t.ctx,o=d.target===document.body?"merge":"append";if(htmx.trigger(document.body,"htmx:head:before:merge",t)){let e=d.response.raw.text.bind(d.response.raw);d.response.raw.text=async()=>{let t=await e();return d._deferredHeadScripts=await r(t,o),t}}},htmx_after_swap:(e,r)=>{for(const e of r.ctx._deferredHeadScripts||[])t(e)},htmx_history_cache_before_restore:(e,t)=>{t.head&&(t.ready=r(t.head,"merge").then(e=>{t._deferredHeadScripts=e}))},htmx_history_cache_after_restore:(e,r)=>{for(const e of r._deferredHeadScripts||[])t(e)}})}();