Update to htmx 4.0.2

This commit is contained in:
danieljsummers committed 2026-11-25 09:16:29 -05:00
1 parent 19fd276f21
commit 8197e62453
10 files changed
+22 -18

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
module Giraffe.Htmx.Common module Giraffe.Htmx.Common
/// <summary>The version of htmx embedded in the package</summary> /// <summary>The version of htmx embedded in the package</summary>
let HtmxVersion = "4.0.0" let HtmxVersion = "4.0.2"
/// <summary>URLs for the included htmx library static web assets</summary> /// <summary>URLs for the included htmx library static web assets</summary>
module StaticAssetUrl = module StaticAssetUrl =
+1 -1
View File
@@ -2,6 +2,6 @@
This package contains common code shared between [`Giraffe.Htmx`](https://www.nuget.org/packages/Giraffe.Htmx) and [`Giraffe.ViewEngine.Htmx`](https://www.nuget.org/packages/Giraffe.ViewEngine.Htmx), and will be automatically installed when you install either one. It also contains htmx and htmax as static web assets, allowing them to be loaded from your local (or published) project. This package contains common code shared between [`Giraffe.Htmx`](https://www.nuget.org/packages/Giraffe.Htmx) and [`Giraffe.ViewEngine.Htmx`](https://www.nuget.org/packages/Giraffe.ViewEngine.Htmx), and will be automatically installed when you install either one. It also contains htmx and htmax as static web assets, allowing them to be loaded from your local (or published) project.
**htmx version: 4.0.0** **htmx version: 4.0.2**
_**NOTE:** Pay special attention to breaking changes highlighted in the packages listed above._ _**NOTE:** Pay special attention to breaking changes highlighted in the packages listed above._
+1 -1
View File
@@ -1 +1 @@
var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let n of t.matchAll(r)){let[,t,r,s,o,a,l,c]=n,u=t??r??s,h=(o??a??l??c??"true").trim();try{h=JSON.parse(h)}catch{}let d=s?.includes("."),f=d?u.split(".").reduceRight((e,t)=>({[t]:e}),h):{[u]:h};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,n]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=n?.constructor===Object,s=r[i]?.constructor===Object;t&&s?e.merge(n,r[i]):r[i]=n}return r}};class t{#e=null;#t=[];admit(e,t,r){if(!this.#e)return this.#e={strategy:e,abort:r},"run";if("replace"===e||"abort"!==e&&"abort"===this.#e.strategy)return this.#t=[],this.#e.abort?.(),this.#e={strategy:e,abort:r},"run";if("queue all"===e)this.#t.push(t);else if("queue last"===e)this.#t=[t];else{if("abort"===e||"drop"===e||0!==this.#t.length)return"dropped";this.#t.push(t)}return"queued"}continue(e){this.#e?.abort===e&&(this.#e=null,this.#t.shift()?.())}abort(){this.#e?.abort?.()}}return new class{#r=e;#i=new Map;#n="";#s=new Set;_loc=window.location;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#c={createHTML:e=>e,createScript:e=>e};#u;#h="a,form";#d=["get","post","put","patch","delete","query"];#f;#m;#p;#g;#x;constructor(){this.#b(),this.#y(),this.#u=this.#v("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete],[hx-query]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#w("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={HCON:e,attributeValue:this.#S.bind(this),parseTriggerSpecs:this.#E.bind(this),determineMethodAndAction:this.#A.bind(this),createRequestContext:this.#C.bind(this),collectFormData:this.#T.bind(this),getAttributeObject:this.#q.bind(this),insertContent:this.#_.bind(this),morph:this.#O.bind(this),isSoftMatch:this.#N.bind(this),initSecurity:(e,t,r)=>{e&&(this.#c=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#H.bind(this),htmxProp:this.#k.bind(this),triggerHtmxEvent:this.#M.bind(this),executeJavaScript:this.#I.bind(this)};let t=()=>this.initialize();"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#b(){this.version="4.0.1",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1,allowEmptySwapAfterOOB:!1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#n=this.config.extensions}#y(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass;try{this.indicatorStyleSheet=new CSSStyleSheet,this.indicatorStyleSheet.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets.push(this.indicatorStyleSheet)}catch{}}}registerExtension(e,t){return!(this.#n&&!this.#n.split(/,\s*/).includes(e))&&(!this.#s.has(e)&&(this.#s.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#L(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#P(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#D(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#v(e){return this.#w(e).join(",")}#w(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#V(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#R(e,t){let r=[];return this.#S(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#S(e,t,r,i,n=this.config.implicitInheritance){t=this.#$(t);let s=this.#$(":inherited"),o=this.#$(":append"),a=this.#P(e,t)??this.#P(e,t+s);if(null!=a)return i?i(a,e):a;let l=CSS.escape(n?t:t+s),c=CSS.escape(t+s+o),u=this.#v(`[${l}],[${c}]`),h=this.#D(e,t+o)??this.#D(e,t+s+o);if(h){let r=e.getAttribute(h),s=e.parentNode?.closest?.(u);if(i&&i(r,e),s){let e=this.#S(s,t,void 0,i,n);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let d=e.parentNode?.closest?.(u);return d?(a=this.#S(d,t,void 0,i),!i&&a&&n&&this.#W(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:d}),a)Line truncated var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let n of t.matchAll(r)){let[,t,r,s,o,a,l,c]=n,u=t??r??s,h=(o??a??l??c??"true").trim();try{h=JSON.parse(h)}catch{}let d=s?.includes("."),f=d?u.split(".").reduceRight((e,t)=>({[t]:e}),h):{[u]:h};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,n]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=n?.constructor===Object,s=r[i]?.constructor===Object;t&&s?e.merge(n,r[i]):r[i]=n}return r}};class t{#e=null;#t=[];admit(e,t,r){if(!this.#e)return this.#e={strategy:e,abort:r},"run";if("replace"===e||"abort"!==e&&"abort"===this.#e.strategy)return this.#t=[],this.#e.abort?.(),this.#e={strategy:e,abort:r},"run";if("queue all"===e)this.#t.push(t);else if("queue last"===e)this.#t=[t];else{if("abort"===e||"drop"===e||0!==this.#t.length)return"dropped";this.#t.push(t)}return"queued"}continue(e){this.#e?.abort===e&&(this.#e=null,this.#t.shift()?.())}abort(){this.#e?.abort?.()}}return new class{#r=e;#i=new Map;#n="";#s=new Set;_loc=window.location;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#c={createHTML:e=>e,createScript:e=>e};#u;#h="a,form";#d=["get","post","put","patch","delete","query"];#f;#m;#p;#g;#x;constructor(){this.#b(),this.#y(),this.#u=this.#v("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete],[hx-query]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#w("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={HCON:e,attributeValue:this.#S.bind(this),parseTriggerSpecs:this.#E.bind(this),determineMethodAndAction:this.#A.bind(this),createRequestContext:this.#C.bind(this),collectFormData:this.#T.bind(this),getAttributeObject:this.#q.bind(this),insertContent:this.#_.bind(this),morph:this.#O.bind(this),isSoftMatch:this.#N.bind(this),initSecurity:(e,t,r)=>{e&&(this.#c=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#H.bind(this),htmxProp:this.#k.bind(this),triggerHtmxEvent:this.#M.bind(this),executeJavaScript:this.#I.bind(this)};let t=()=>this.initialize();"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#b(){this.version="4.0.2",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1,allowEmptySwapAfterOOB:!1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#n=this.config.extensions}#y(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass;try{this.indicatorStyleSheet=new CSSStyleSheet,this.indicatorStyleSheet.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets.push(this.indicatorStyleSheet)}catch{}}}registerExtension(e,t){return!(this.#n&&!this.#n.split(/,\s*/).includes(e))&&(!this.#s.has(e)&&(this.#s.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#L(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#P(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#j(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#v(e){return this.#w(e).join(",")}#w(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#D(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#V(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#R(e,t){let r=[];return this.#S(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#S(e,t,r,i,n=this.config.implicitInheritance){t=this.#W(t);let s=this.#W(":inherited"),o=this.#W(":append"),a=this.#P(e,t)??this.#P(e,t+s);if(null!=a)return i?i(a,e):a;let l=CSS.escape(n?t:t+s),c=CSS.escape(t+s+o),u=this.#v(`[${l}],[${c}]`),h=this.#j(e,t+o)??this.#j(e,t+s+o);if(h){let r=e.getAttribute(h),s=e.parentNode?.closest?.(u);if(i&&i(r,e),s){let e=this.#S(s,t,void 0,i,n);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let d=e.parentNode?.closest?.(u);return d?(a=this.#S(d,t,void 0,i),!i&&a&&n&&this.#$(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:d}),a)Line truncated
+1 -1
View File
@@ -1 +1 @@
var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let s of t.matchAll(r)){let[,t,r,n,o,a,l,h]=s,c=t??r??n,u=(o??a??l??h??"true").trim();try{u=JSON.parse(u)}catch{}let d=n?.includes("."),f=d?c.split(".").reduceRight((e,t)=>({[t]:e}),u):{[c]:u};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,s]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=s?.constructor===Object,n=r[i]?.constructor===Object;t&&n?e.merge(s,r[i]):r[i]=s}return r}};class t{#e=null;#t=[];admit(e,t,r){if(!this.#e)return this.#e={strategy:e,abort:r},"run";if("replace"===e||"abort"!==e&&"abort"===this.#e.strategy)return this.#t=[],this.#e.abort?.(),this.#e={strategy:e,abort:r},"run";if("queue all"===e)this.#t.push(t);else if("queue last"===e)this.#t=[t];else{if("abort"===e||"drop"===e||0!==this.#t.length)return"dropped";this.#t.push(t)}return"queued"}continue(e){this.#e?.abort===e&&(this.#e=null,this.#t.shift()?.())}abort(){this.#e?.abort?.()}}return new class{#r=e;#i=new Map;#s="";#n=new Set;_loc=window.location;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#h={createHTML:e=>e,createScript:e=>e};#c;#u="a,form";#d=["get","post","put","patch","delete","query"];#f;#m;#p;#g;#x;constructor(){this.#b(),this.#y(),this.#c=this.#S("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete],[hx-query]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#v("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={HCON:e,attributeValue:this.#E.bind(this),parseTriggerSpecs:this.#w.bind(this),determineMethodAndAction:this.#A.bind(this),createRequestContext:this.#T.bind(this),collectFormData:this.#C.bind(this),getAttributeObject:this.#q.bind(this),insertContent:this.#N.bind(this),morph:this.#I.bind(this),isSoftMatch:this.#M.bind(this),initSecurity:(e,t,r)=>{e&&(this.#h=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#O.bind(this),htmxProp:this.#H.bind(this),triggerHtmxEvent:this.#L.bind(this),executeJavaScript:this.#k.bind(this)};let t=()=>this.initialize();"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#b(){this.version="4.0.1",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1,allowEmptySwapAfterOOB:!1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#s=this.config.extensions}#y(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass;try{this.indicatorStyleSheet=new CSSStyleSheet,this.indicatorStyleSheet.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets.push(this.indicatorStyleSheet)}catch{}}}registerExtension(e,t){return!(this.#s&&!this.#s.split(/,\s*/).includes(e))&&(!this.#n.has(e)&&(this.#n.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#V(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#P(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#R(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#S(e){return this.#v(e).join(",")}#v(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#B(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#z(e,t){let r=[];return this.#E(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#E(e,t,r,i,s=this.config.implicitInheritance){t=this.#F(t);let n=this.#F(":inherited"),o=this.#F(":append"),a=this.#P(e,t)??this.#P(e,t+n);if(null!=a)return i?i(a,e):a;let l=CSS.escape(s?t:t+n),h=CSS.escape(t+n+o),c=this.#S(`[${l}],[${h}]`),u=this.#R(e,t+o)??this.#R(e,t+n+o);if(u){let r=e.getAttribute(u),n=e.parentNode?.closest?.(c);if(i&&i(r,e),n){let e=this.#E(n,t,void 0,i,s);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let d=e.parentNode?.closest?.(c);return d?(a=this.#E(d,t,void 0,i),!i&&a&&s&&this.#$(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:d}),a)Line truncated var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let s of t.matchAll(r)){let[,t,r,n,o,a,l,h]=s,c=t??r??n,u=(o??a??l??h??"true").trim();try{u=JSON.parse(u)}catch{}let d=n?.includes("."),f=d?c.split(".").reduceRight((e,t)=>({[t]:e}),u):{[c]:u};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,s]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=s?.constructor===Object,n=r[i]?.constructor===Object;t&&n?e.merge(s,r[i]):r[i]=s}return r}};class t{#e=null;#t=[];admit(e,t,r){if(!this.#e)return this.#e={strategy:e,abort:r},"run";if("replace"===e||"abort"!==e&&"abort"===this.#e.strategy)return this.#t=[],this.#e.abort?.(),this.#e={strategy:e,abort:r},"run";if("queue all"===e)this.#t.push(t);else if("queue last"===e)this.#t=[t];else{if("abort"===e||"drop"===e||0!==this.#t.length)return"dropped";this.#t.push(t)}return"queued"}continue(e){this.#e?.abort===e&&(this.#e=null,this.#t.shift()?.())}abort(){this.#e?.abort?.()}}return new class{#r=e;#i=new Map;#s="";#n=new Set;_loc=window.location;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#h={createHTML:e=>e,createScript:e=>e};#c;#u="a,form";#d=["get","post","put","patch","delete","query"];#f;#m;#p;#g;#x;constructor(){this.#b(),this.#y(),this.#c=this.#S("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete],[hx-query]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#v("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={HCON:e,attributeValue:this.#E.bind(this),parseTriggerSpecs:this.#w.bind(this),determineMethodAndAction:this.#A.bind(this),createRequestContext:this.#T.bind(this),collectFormData:this.#C.bind(this),getAttributeObject:this.#q.bind(this),insertContent:this.#N.bind(this),morph:this.#I.bind(this),isSoftMatch:this.#M.bind(this),initSecurity:(e,t,r)=>{e&&(this.#h=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#O.bind(this),htmxProp:this.#H.bind(this),triggerHtmxEvent:this.#L.bind(this),executeJavaScript:this.#k.bind(this)};let t=()=>this.initialize();"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#b(){this.version="4.0.2",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1,allowEmptySwapAfterOOB:!1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#s=this.config.extensions}#y(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass;try{this.indicatorStyleSheet=new CSSStyleSheet,this.indicatorStyleSheet.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets.push(this.indicatorStyleSheet)}catch{}}}registerExtension(e,t){return!(this.#s&&!this.#s.split(/,\s*/).includes(e))&&(!this.#n.has(e)&&(this.#n.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#V(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#P(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#R(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#S(e){return this.#v(e).join(",")}#v(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#B(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#z(e,t){let r=[];return this.#E(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#E(e,t,r,i,s=this.config.implicitInheritance){t=this.#F(t);let n=this.#F(":inherited"),o=this.#F(":append"),a=this.#P(e,t)??this.#P(e,t+n);if(null!=a)return i?i(a,e):a;let l=CSS.escape(s?t:t+n),h=CSS.escape(t+n+o),c=this.#S(`[${l}],[${h}]`),u=this.#R(e,t+o)??this.#R(e,t+n+o);if(u){let r=e.getAttribute(u),n=e.parentNode?.closest?.(c);if(i&&i(r,e),n){let e=this.#E(n,t,void 0,i,s);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let d=e.parentNode?.closest?.(c);return d?(a=this.#E(d,t,void 0,i),!i&&a&&s&&this.#$(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:d}),a)Line truncated
+7 -3
View File
@@ -2,11 +2,15 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0;net10.0;net11.0</TargetFrameworks> <TargetFrameworks>net8.0;net10.0;net11.0</TargetFrameworks>
<VersionPrefix>4.0.0</VersionPrefix> <VersionPrefix>4.0.2</VersionPrefix>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReleaseNotes>htmx 4.0.0 Initial Release <PackageReleaseNotes>htmx 4.0.2 Release
See package and prior alpha/beta release READMEs; v2 to v4 is not an update-and-forget-it release. If you encounter build errors after installing this, install v4.0.0-beta5 instead; obsolete elements will generate a warning with suggestions of what to use instead. - Update embedded htmx and CDN links to 4.0.2.
- Add .NET 11 support; will be final release with .NET 8 support.
- No new attributes or server headers since 4.0.0.
Note that v2.x to v4.x is not an update-and-forget-it release. If you encounter build errors after installing this, install v4.0.0-beta5 instead; obsolete elements will generate a warning with suggestions of what to use instead.
</PackageReleaseNotes> </PackageReleaseNotes>
<Authors>danieljsummers</Authors> <Authors>danieljsummers</Authors>
<Company>Bit Badger Solutions</Company> <Company>Bit Badger Solutions</Company>
+1 -1
View File
@@ -2,7 +2,7 @@
This package enables server-side support for [htmx](https://htmx.org) within [Giraffe](https://giraffe.wiki) and ASP.NET's `HttpContext`. This package enables server-side support for [htmx](https://htmx.org) within [Giraffe](https://giraffe.wiki) and ASP.NET's `HttpContext`.
**htmx version: 4.0.0** **htmx version: 4.0.2**
_Upgrading from v2.x: the [migration guide](https://four.htmx.org/docs#migrating-from-htmx-2x-to-4x) lists changes for v4. For this package, the `HX-Trigger` and `HX-Trigger-Name` headers are marked obsolete. They are replaced by `HX-Source`, which provides the triggering tag name and `id` attribute. The `HX-Prompt` header has also been marked as obsolete, as the `hx-prompt` attribute which generated its content has been removed._ _Upgrading from v2.x: the [migration guide](https://four.htmx.org/docs#migrating-from-htmx-2x-to-4x) lists changes for v4. For this package, the `HX-Trigger` and `HX-Trigger-Name` headers are marked obsolete. They are replaced by `HX-Source`, which provides the triggering tag name and `id` attribute. The `HX-Prompt` header has also been marked as obsolete, as the `hx-prompt` attribute which generated its content has been removed._
+1 -1
View File
@@ -6,7 +6,7 @@ open Giraffe.Htmx
/// Test to ensure the version was updated /// Test to ensure the version was updated
let version = let version =
test "HtmxVersion is correct" { test "HtmxVersion is correct" {
Expect.equal HtmxVersion "4.0.0" "htmx version incorrect" Expect.equal HtmxVersion "4.0.2" "htmx version incorrect"
} }
let staticAssetUrl = let staticAssetUrl =
+4 -4
View File
@@ -681,14 +681,14 @@ let script =
let html = RenderView.AsString.htmlNode Script.cdnMinified let html = RenderView.AsString.htmlNode Script.cdnMinified
Expect.equal Expect.equal
html html
$"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js" integrity="sha384-BvJpBiO8Kh31EqtJe5DRIeWrHWnCGkwytKs9NKFi86Hhw96dEqdEMzZDeK9iEGTc" crossorigin="anonymous"></script>""" $"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js" integrity="sha384-6NzMyCdh08UZ4b4M17SJJKQLdDijx4z2IqqKLKD0Q/PzCFQLpFuk3konY0WgqbTy" crossorigin="anonymous"></script>"""
"CDN minified script tag is incorrect" "CDN minified script tag is incorrect"
} }
test "cdnUnminified succeeds" { test "cdnUnminified succeeds" {
let html = RenderView.AsString.htmlNode Script.cdnUnminified let html = RenderView.AsString.htmlNode Script.cdnUnminified
Expect.equal Expect.equal
html html
$"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js" integrity="sha384-ESzWv77gBOAGtF3d7B8QiQ786cghRRsyhuYVVJGsrFGxwT0Dj1fLxReX9Ul6t4n9" crossorigin="anonymous"></script>""" $"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js" integrity="sha384-S/Hqv3GQ+1p3MkOtrWZAx2m6rDYHNGuYiiRt2W8arDk/d6mkwGQ6GhC+pbkxCRtN" crossorigin="anonymous"></script>"""
"CDN unminified script tag is incorrect" "CDN unminified script tag is incorrect"
} }
testList "Max" [ testList "Max" [
@@ -703,14 +703,14 @@ let script =
let html = RenderView.AsString.htmlNode Script.Max.cdnMinified let html = RenderView.AsString.htmlNode Script.Max.cdnMinified
Expect.equal Expect.equal
html html
$"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.min.js" integrity="sha384-F2+P/m0g8+he+KLpgsCVZlZGvOx2z83bU4rmmISSNt7br4A0RTcJ7ddMrz0v45Nv" crossorigin="anonymous"></script>""" $"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.min.js" integrity="sha384-kK7Eaol7bFgQmVaUbFazxuTFu3xV4EfmNklOfM+oQZAngpIAR7b0SdauEqjfXtxW" crossorigin="anonymous"></script>"""
"CDN minified script tag is incorrect" "CDN minified script tag is incorrect"
} }
test "cdnMaxUnminified succeeds" { test "cdnMaxUnminified succeeds" {
let html = RenderView.AsString.htmlNode Script.Max.cdnUnminified let html = RenderView.AsString.htmlNode Script.Max.cdnUnminified
Expect.equal Expect.equal
html html
$"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.js" integrity="sha384-wrTFbAj755gAdIPPR9n4aAVMkLWkzxjr1Zj+8D4kgr2App4h9doO6SXBH9wpivij" crossorigin="anonymous"></script>""" $"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.js" integrity="sha384-+GgF3zXn0uds8qivDz+RMzZbxQVX/FnYVW1vzIXuMZOPnrMD2M3TzOPhNoc7k4EH" crossorigin="anonymous"></script>"""
"CDN unminified script tag is incorrect" "CDN unminified script tag is incorrect"
} }
] ]
+4 -4
View File
@@ -728,14 +728,14 @@ module Script =
/// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks> /// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks>
let cdnMinified = let cdnMinified =
script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js" script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js"
_integrity "sha384-BvJpBiO8Kh31EqtJe5DRIeWrHWnCGkwytKs9NKFi86Hhw96dEqdEMzZDeK9iEGTc" _integrity "sha384-6NzMyCdh08UZ4b4M17SJJKQLdDijx4z2IqqKLKD0Q/PzCFQLpFuk3konY0WgqbTy"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []
/// <summary>Script tag to load the unminified version from jsdelivr.net</summary> /// <summary>Script tag to load the unminified version from jsdelivr.net</summary>
/// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks> /// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks>
let cdnUnminified = let cdnUnminified =
script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js" script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js"
_integrity "sha384-ESzWv77gBOAGtF3d7B8QiQ786cghRRsyhuYVVJGsrFGxwT0Dj1fLxReX9Ul6t4n9" _integrity "sha384-S/Hqv3GQ+1p3MkOtrWZAx2m6rDYHNGuYiiRt2W8arDk/d6mkwGQ6GhC+pbkxCRtN"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []
/// <summary>Script tags to load the htmax bundle</summary> /// <summary>Script tags to load the htmax bundle</summary>
@@ -748,14 +748,14 @@ module Script =
/// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks> /// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks>
let cdnMinified = let cdnMinified =
script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.min.js" script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.min.js"
_integrity "sha384-F2+P/m0g8+he+KLpgsCVZlZGvOx2z83bU4rmmISSNt7br4A0RTcJ7ddMrz0v45Nv" _integrity "sha384-kK7Eaol7bFgQmVaUbFazxuTFu3xV4EfmNklOfM+oQZAngpIAR7b0SdauEqjfXtxW"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []
/// <summary>Script tag to load the unminified htmx-plus-extensions bundle from jsdelivr.net</summary> /// <summary>Script tag to load the unminified htmx-plus-extensions bundle from jsdelivr.net</summary>
/// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks> /// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks>
let cdnUnminified = let cdnUnminified =
script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.js" script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.js"
_integrity "sha384-wrTFbAj755gAdIPPR9n4aAVMkLWkzxjr1Zj+8D4kgr2App4h9doO6SXBH9wpivij" _integrity "sha384-+GgF3zXn0uds8qivDz+RMzZbxQVX/FnYVW1vzIXuMZOPnrMD2M3TzOPhNoc7k4EH"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []
+1 -1
View File
@@ -2,7 +2,7 @@
This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine. This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine.
**htmx version: 4.0.0** **htmx version: 4.0.2**
_Upgrading from v2.x: see [the migration guide](https://four.htmx.org/docs#migrating-from-htmx-2x-to-4x) for changes, which are plentiful. htmx switches from `XMLHTTPRequest` to `fetch`, and many changes are related to the new event cycle._ _Upgrading from v2.x: see [the migration guide](https://four.htmx.org/docs#migrating-from-htmx-2x-to-4x) for changes, which are plentiful. htmx switches from `XMLHTTPRequest` to `fetch`, and many changes are related to the new event cycle._