add: готовый htmx
This commit is contained in:
1 parent
83cdd5625f
commit
9df635e4de
1 file changed
+2
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
(()=>{var ei=Object.create;var Zn=Object.defineProperty;var ti=Object.getOwnPropertyDescriptor;var ri=Object.getOwnPropertyNames;var ni=Object.getPrototypeOf,ii=Object.prototype.hasOwnProperty;var oi=(Qr,Jr)=>()=>{try{return Jr||Qr((Jr={exports:{}}).exports,Jr),Jr.exports}catch(Zr){throw Jr=0,Zr}};var ai=(Qr,Jr,Zr,Wr)=>{if(Jr&&typeof Jr=="object"||typeof Jr=="function")for(let Gr of ri(Jr))!ii.call(Qr,Gr)&&Gr!==Zr&&Zn(Qr,Gr,{get:()=>Jr[Gr],enumerable:!(Wr=ti(Jr,Gr))||Wr.enumerable});return Qr};var si=(Qr,Jr,Zr)=>(Zr=Qr!=null?ei(ni(Qr)):{},ai(Jr||!Qr||!Qr.__esModule?Zn(Zr,"default",{value:Qr,enumerable:!0}):Zr,Qr));var $n=oi((exports,module)=>{(function(Qr,Jr){typeof define=="function"&&define.amd?define([],Jr):typeof module=="object"&&module.exports?module.exports=Jr():Qr.htmx=Qr.htmx||Jr()})(typeof self<"u"?self:exports,function(){return(function(){"use strict";var Q={onLoad:F,process:zt,on:de,off:ge,trigger:ce,ajax:Nr,find:C,findAll:f,closest:v,values:function(Qr,Jr){var Zr=dr(Qr,Jr||"post");return Zr.values},remove:_,addClass:z,removeClass:n,toggleClass:$,takeClass:W,defineExtension:Ur,removeExtension:Br,logAll:V,logNone:j,logger:null,config:{historyEnabled:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:!1,scrollBehavior:"smooth",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get"],selfRequestsOnly:!1,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null},parseInterval:d,_:t,createEventSource:function(Qr){return new EventSource(Qr,{withCredentials:!0})},createWebSocket:function(Qr){var Jr=new WebSocket(Qr,[]);return Jr.binaryType=Q.config.wsBinaryType,Jr},version:"1.9.12"},r={addTriggerHandler:Lt,bodyContains:se,canAccessLocalStorage:U,findThisElement:xe,filterValues:yr,hasAttribute:o,getAttributeValue:te,getClosestAttributeValue:ne,getClosestMatch:c,getExpressionVars:Hr,getHeaders:xr,getInputValues:dr,getInternalData:ae,getSwapSpecification:wr,getTriggerSpecs:it,getTarget:ye,makeFragment:l,mergeObjects:le,makeSettleInfo:T,oobSwap:Ee,querySelectorExt:ue,selectAndSwap:je,settleImmediately:nr,shouldCancel:ut,triggerEvent:ce,triggerErrorEvent:fe,withExtensions:R},w=["get","post","put","delete","patch"],i=w.map(function(Qr){return"[hx-"+Qr+"], [data-hx-"+Qr+"]"}).join(", "),S=e("head"),q=e("title"),H=e("svg",!0);function e(Qr,Jr){return new RegExp("<"+Qr+"(\\s[^>]*>|>)([\\s\\S]*?)<\\/"+Qr+">",Jr?"gim":"im")}function d(Qr){if(Qr==null)return;let Jr=NaN;return Qr.slice(-2)=="ms"?Jr=parseFloat(Qr.slice(0,-2)):Qr.slice(-1)=="s"?Jr=parseFloat(Qr.slice(0,-1))*1e3:Qr.slice(-1)=="m"?Jr=parseFloat(Qr.slice(0,-1))*1e3*60:Jr=parseFloat(Qr),isNaN(Jr)?void 0:Jr}function ee(Qr,Jr){return Qr.getAttribute&&Qr.getAttribute(Jr)}function o(Qr,Jr){return Qr.hasAttribute&&(Qr.hasAttribute(Jr)||Qr.hasAttribute("data-"+Jr))}function te(Qr,Jr){return ee(Qr,Jr)||ee(Qr,"data-"+Jr)}function u(Qr){return Qr.parentElement}function re(){return document}function c(Qr,Jr){for(;Qr&&!Jr(Qr);)Qr=u(Qr);return Qr||null}function L(Qr,Jr,Zr){var Wr=te(Jr,Zr),Gr=te(Jr,"hx-disinherit");return Qr!==Jr&&Gr&&(Gr==="*"||Gr.split(" ").indexOf(Zr)>=0)?"unset":Wr}function ne(Qr,Jr){var Zr=null;if(c(Qr,function(Wr){return Zr=L(Qr,Wr,Jr)}),Zr!=="unset")return Zr}function h(Qr,Jr){var Zr=Qr.matches||Qr.matchesSelector||Qr.msMatchesSelector||Qr.mozMatchesSelector||Qr.webkitMatchesSelector||Qr.oMatchesSelector;return Zr&&Zr.call(Qr,Jr)}function A(Qr){var Jr=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Zr=Jr.exec(Qr);return Zr?Zr[1].toLowerCase():""}function s(Qr,Jr){for(var Zr=new DOMParser,Wr=Zr.parseFromString(Qr,"text/html"),Gr=Wr.body;Jr>0;)Jr--,Gr=Gr.firstChild;return Gr==null&&(Gr=re().createDocumentFragment()),Gr}function N(Qr){return/<body/.test(Qr)}function l(Qr){var Jr=!N(Qr),Zr=A(Qr),Wr=Qr;if(Zr==="head"&&(Wr=Wr.replace(S,"")),Q.config.useTemplateFragments&&Jr){var Gr=s("<body><template>"+Wr+"</template></body>",0),Yr=Gr.querySelector("template").content;return Q.config.allowScriptTags?oe(Yr.querySelectorAll("script"),function(Kr){Q.config.inlineScriptNonce&&(Kr.nonce=Q.config.inlineScriptNonce),Kr.htmxExecuted=navigator.userAgent.indexOf("Firefox")===-1}):oe(Yr.querySelectorAll("script"),function(Kr){_(Kr)}),Yr}switch(Zr){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return s("<table>"+Wr+"</table>",1);case"col":return s("<table><colgroup>"+Wr+"</colgroup></table>",2);case"tr":return s("<table><tbody>"+Wr+"</tbody></table>",2);case"td":case"th":return s("<table><tbody><tr>"+Wr+"</tr></tbody></taLine truncated
|
||||||
|
`),Gr=null,Yr=0;Wr.length>0;){var Kr=Wr.shift(),en=Kr.match(/^\s*([a-zA-Z:\-\.]+:)(.*)/);Yr===0&&en?(Kr.split(":"),Gr=en[1].slice(0,-1),Zr[Gr]=en[2]):Zr[Gr]+=Kr,Yr+=Bt(Kr)}for(var tn in Zr)Ft(Qr,tn,Zr[tn])}}function jt(Qr){Ae(Qr);for(var Jr=0;Jr<Qr.attributes.length;Jr++){var Zr=Qr.attributes[Jr].name,Wr=Qr.attributes[Jr].value;if(g(Zr,"hx-on")||g(Zr,"data-hx-on")){var Gr=Zr.indexOf("-on")+3,Yr=Zr.slice(Gr,Gr+1);if(Yr==="-"||Yr===":"){var Kr=Zr.slice(Gr+1);g(Kr,":")?Kr="htmx"+Kr:g(Kr,"-")?Kr="htmx:"+Kr.slice(1):g(Kr,"htmx-")&&(Kr="htmx:"+Kr.slice(5)),Ft(Qr,Kr,Wr)}}}}function _t(Qr){if(v(Qr,Q.config.disableSelector)){m(Qr);return}var Jr=ae(Qr);if(Jr.initHash!==Le(Qr)){Ne(Qr),Jr.initHash=Le(Qr),Vt(Qr),ce(Qr,"htmx:beforeProcessNode"),Qr.value&&(Jr.lastValue=Qr.value);var Zr=it(Qr),Wr=Ht(Qr,Jr,Zr);Wr||(ne(Qr,"hx-boost")==="true"?lt(Qr,Jr,Zr):o(Qr,"hx-trigger")&&Zr.forEach(function(Kr){Lt(Qr,Kr,Jr,function(){})})),(Qr.tagName==="FORM"||ee(Qr,"type")==="submit"&&o(Qr,"form"))&&Ut(Qr);var Gr=te(Qr,"hx-sse");Gr&&St(Qr,Jr,Gr);var Yr=te(Qr,"hx-ws");Yr&&mt(Qr,Jr,Yr),ce(Qr,"htmx:afterProcessNode")}}function zt(Qr){if(Qr=p(Qr),v(Qr,Q.config.disableSelector)){m(Qr);return}_t(Qr),oe(Pt(Qr),function(Jr){_t(Jr)}),oe(kt(Qr),jt)}function $t(Qr){return Qr.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Wt(Qr,Jr){var Zr;return window.CustomEvent&&typeof window.CustomEvent=="function"?Zr=new CustomEvent(Qr,{bubbles:!0,cancelable:!0,detail:Jr}):(Zr=re().createEvent("CustomEvent"),Zr.initCustomEvent(Qr,!0,!0,Jr)),Zr}function fe(Qr,Jr,Zr){ce(Qr,Jr,le({error:Jr},Zr))}function Gt(Qr){return Qr==="htmx:afterProcessNode"}function R(Qr,Jr){oe(Fr(Qr),function(Zr){try{Jr(Zr)}catch(Wr){b(Wr)}})}function b(Qr){console.error?console.error(Qr):console.log&&console.log("ERROR: ",Qr)}function ce(Qr,Jr,Zr){Qr=p(Qr),Zr==null&&(Zr={}),Zr.elt=Qr;var Wr=Wt(Jr,Zr);Q.logger&&!Gt(Jr)&&Q.logger(Qr,Jr,Zr),Zr.error&&(b(Zr.error),ce(Qr,"htmx:error",{errorInfo:Zr}));var Gr=Qr.dispatchEvent(Wr),Yr=$t(Jr);if(Gr&&Yr!==Jr){var Kr=Wt(Yr,Wr.detail);Gr=Gr&&Qr.dispatchEvent(Kr)}return R(Qr,function(en){Gr=Gr&&en.onEvent(Jr,Wr)!==!1&&!Wr.defaultPrevented}),Gr}var Jt=location.pathname+location.search;function Zt(){var Qr=re().querySelector("[hx-history-elt],[data-hx-history-elt]");return Qr||re().body}function Kt(Qr,Jr,Zr,Wr){if(U()){if(Q.config.historyCacheSize<=0){localStorage.removeItem("htmx-history-cache");return}Qr=B(Qr);for(var Gr=E(localStorage.getItem("htmx-history-cache"))||[],Yr=0;Yr<Gr.length;Yr++)if(Gr[Yr].url===Qr){Gr.splice(Yr,1);break}var Kr={url:Qr,content:Jr,title:Zr,scroll:Wr};for(ce(re().body,"htmx:historyItemCreated",{item:Kr,cache:Gr}),Gr.push(Kr);Gr.length>Q.config.historyCacheSize;)Gr.shift();for(;Gr.length>0;)try{localStorage.setItem("htmx-history-cache",JSON.stringify(Gr));break}catch(en){fe(re().body,"htmx:historyCacheError",{cause:en,cache:Gr}),Gr.shift()}}}function Yt(Qr){if(!U())return null;Qr=B(Qr);for(var Jr=E(localStorage.getItem("htmx-history-cache"))||[],Zr=0;Zr<Jr.length;Zr++)if(Jr[Zr].url===Qr)return Jr[Zr];return null}function Qt(Qr){var Jr=Q.config.requestClass,Zr=Qr.cloneNode(!0);return oe(f(Zr,"."+Jr),function(Wr){n(Wr,Jr)}),Zr.innerHTML}function er(){var Qr=Zt(),Jr=Jt||location.pathname+location.search,Zr;try{Zr=re().querySelector('[hx-history="false" i],[data-hx-history="false" i]')}catch{Zr=re().querySelector('[hx-history="false"],[data-hx-history="false"]')}Zr||(ce(re().body,"htmx:beforeHistorySave",{path:Jr,historyElt:Qr}),Kt(Jr,Qt(Qr),re().title,window.scrollY)),Q.config.historyEnabled&&history.replaceState({htmx:!0},re().title,window.location.href)}function tr(Qr){Q.config.getCacheBusterParam&&(Qr=Qr.replace(/org\.htmx\.cache-buster=[^&]*&?/,""),(G(Qr,"&")||G(Qr,"?"))&&(Qr=Qr.slice(0,-1))),Q.config.historyEnabled&&history.pushState({htmx:!0},"",Qr),Jt=Qr}function rr(Qr){Q.config.historyEnabled&&history.replaceState({htmx:!0},"",Qr),Jt=Qr}function nr(Qr){oe(Qr,function(Jr){Jr.call()})}function ir(Qr){var Jr=new XMLHttpRequest,Zr={path:Qr,xhr:Jr};ce(re().body,"htmx:historyCacheMiss",Zr),Jr.open("GET",Qr,!0),Jr.setRequestHeader("HX-Request","true"),Jr.setRequestHeader("HX-History-Restore-Request","true"),Jr.setRequestHeader("HX-Current-URL",re().location.href),Jr.onload=function(){if(this.status>=200&&this.status<400){ce(re().body,"htmx:historyCacheMissLoad",Zr);var Wr=l(this.response);Wr=Wr.querySelector("[hx-history-elt],[data-hx-history-elt]")||Wr;var Gr=Zt(),Yr=T(Gr),Kr=Ve(this.response);if(Kr){var en=C("title");en?en.innerHTML=Kr:window.document.title=Kr}Ue(Gr,Wr,Yr),nr(Yr.tasks),Jt=Qr,ce(re().body,"htmx:historyRestore",{path:Qr,cacheMiss:!0,serverResponse:this.response})}else fe(re().body,"htmx:historyCacheMissLoadError",Zr)},Jr.send()}function ar(Qr){er(),Qr=Qr||location.pathname+location.search;var Jr=Yt(Qr);if(Jr){var Zr=l(Jr.content),Wr=Zt(),Gr=T(Wr);Ue(Wr,Zr,Gr),nr(Gr.tasks),document.title=Jr.title,setTimeout(function(){window.scrollTo(0,Jr.scroll)},0),Jt=Qr,ce(re().body,"htmx:historyRestore",{path
Line truncated
|
||||||
Reference in new issue
Block a user