@k37z3r/jbase 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/index.cjs +33 -10
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +33 -10
- package/dist/index.mjs.map +2 -2
- package/dist/jbase.browser.js +33 -10
- package/dist/jbase.browser.js.map +2 -2
- package/dist/jbase.min.js +2 -2
- package/dist/jbase.min.js.map +3 -3
- package/dist/modules/http/get.d.ts +7 -3
- package/dist/modules/http/get.d.ts.map +1 -1
- package/dist/modules/http/index.d.ts +3 -3
- package/dist/modules/http/post.d.ts +5 -3
- package/dist/modules/http/post.d.ts.map +1 -1
- package/dist/server.js +33 -10
- package/dist/server.js.map +2 -2
- package/package.json +1 -1
package/dist/jbase.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @k37z3r/jbase - A modern micro-framework for the web: jBase offers the familiar syntax of classic DOM libraries, but without their baggage. Fully typed, modular, and optimized for modern browser engines.
|
|
3
|
-
* @version 2.0.
|
|
3
|
+
* @version 2.0.3
|
|
4
4
|
* @homepage https://github.com/k37z3r/jBase-2.0
|
|
5
5
|
* @author Sven Minio (https://github.com/k37z3r/jBase-2.0)
|
|
6
6
|
* @license GPL-3.0-or-later
|
|
7
7
|
* @copyright 2026 Sven Minio (https://github.com/k37z3r/jBase-2.0)
|
|
8
8
|
*/
|
|
9
|
-
"use strict";(()=>{var we=Object.defineProperty;var o=(t,e)=>()=>(t&&(e=t(t=0)),e);var xe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),a=(t,e)=>{for(var n in e)we(t,n,{get:e[n],enumerable:!0})};var f,j=o(()=>{"use strict";f=class extends Array{selectorSource="";doc;constructor(e,n){if(super(),n instanceof Document?this.doc=n:n&&n.document?this.doc=n.document:this.doc=typeof document<"u"?document:null,!(typeof document>"u")&&(this.selectorSource=typeof e=="string"?e:"<DOM Object/Array>",!!e))if(e instanceof HTMLElement||e===document||e===window||e instanceof Element)this.push(e);else if(typeof e=="string"){let s=e.trim();if(s.startsWith("<")&&s.endsWith(">")){let r=document.createElement("div");r.innerHTML=s,this.push(...Array.from(r.children))}else if(s.startsWith("#")&&!s.includes(" ")&&!s.includes(".")){let r=document.getElementById(s.slice(1));r&&this.push(r)}else if(s.startsWith(".")&&!s.includes(" ")&&!/[:\[#]/.test(s)){let r=document.getElementsByClassName(s.slice(1));for(let i=0;i<r.length;i++)this.push(r[i])}else if(/^[a-zA-Z0-9]+$/.test(s)){let r=document.getElementsByTagName(s);for(let i=0;i<r.length;i++)this.push(r[i])}else try{this.push(...Array.from(document.querySelectorAll(e)))}catch(r){console.warn(`jBase: Invalid selector "${e}"`,r)}}else(e instanceof NodeList||Array.isArray(e))&&this.push(...Array.from(e))}toJSON(){return{meta:"jBase Wrapper",query:this.selectorSource,count:this.length,preview:this.slice(0,10).map(e=>e instanceof Element?e.tagName.toLowerCase():typeof e)}}}});var g={};a(g,{addClass:()=>Te,hasClass:()=>Se,removeClass:()=>be,toggleClass:()=>Me});function Te(...t){return this.forEach(e=>{e instanceof Element&&e.classList.add(...t)}),this}function be(...t){return this.forEach(e=>{e instanceof Element&&e.classList.remove(...t)}),this}function Me(t){return this.forEach(e=>{e instanceof Element&&e.classList.toggle(t)}),this}function Se(t){return this.some(e=>e instanceof Element&&e.classList.contains(t))}var K=o(()=>{"use strict";});var E={};a(E,{css:()=>Le});function Le(t,e){if(e===void 0){let n=this[0];if(n instanceof HTMLElement||n instanceof SVGElement){let s=n.ownerDocument,r=s?s.defaultView:null;return r?r.getComputedStyle(n)[t]:n.style[t]||""}return""}return this.forEach(n=>{(n instanceof HTMLElement||n instanceof SVGElement)&&(n.style[t]=e)}),this}var J=o(()=>{"use strict";});var D,$=o(()=>{"use strict";K();J();D={...g,...E}});var v={};a(v,{off:()=>We,on:()=>Ce});function Ce(t,e){return this.forEach(n=>{n.addEventListener(t,e)}),this}function We(t,e){return this.forEach(n=>{n.removeEventListener(t,e)}),this}var P=o(()=>{"use strict";});var y={};a(y,{click:()=>He,dblclick:()=>qe,mousedown:()=>_e,mouseenter:()=>Ae,mouseleave:()=>Oe,mousemove:()=>ke,mouseout:()=>Ie,mouseover:()=>Ke,mouseup:()=>Ne});function He(t){return t?this.on("click",t):(this.forEach(e=>{e instanceof HTMLElement&&e.click()}),this)}function ke(t){return this.on("mousemove",t)}function Oe(t){return this.on("mouseleave",t)}function Ae(t){return this.on("mouseenter",t)}function _e(t){return this.on("mousedown",t)}function Ne(t){return this.on("mouseup",t)}function qe(t){return t?this.on("dblclick",t):(this.forEach(e=>{e instanceof HTMLElement&&e.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0,cancelable:!0,view:window}))}),this)}function Ie(t){return this.on("mouseout",t)}function Ke(t){return this.on("mouseover",t)}var F=o(()=>{"use strict";});var w={};a(w,{ready:()=>Je});function Je(t){let e=window.document;return e.readyState==="complete"||e.readyState==="interactive"?t():this.on("DOMContentLoaded",t),this}var U=o(()=>{"use strict";});var x={};a(x,{keydown:()=>De,keypress:()=>Pe,keyup:()=>$e,pressedKey:()=>Fe});function De(t){return this.on("keydown",t)}function $e(t){return this.on("keyup",t)}function Pe(t){return this.on("keypress",t)}function Fe(t,e){return this.on("keydown",n=>{let s=n;s.key.toLowerCase()===t.toLowerCase()&&e(s)})}var V=o(()=>{"use strict";});var T={};a(T,{blur:()=>Ge,change:()=>Ve,focus:()=>Xe,input:()=>ze,submit:()=>Ue});function Ue(t){return this.on("submit",t)}function Ve(t){return this.on("change",t)}function ze(t){return this.on("input",t)}function Xe(t){return t?this.on("focus",t):(this.forEach(e=>{e instanceof HTMLElement&&e.focus()}),this)}function Ge(t){return t?this.on("blur",t):(this.forEach(e=>{e instanceof HTMLElement&&e.blur()}),this)}var z=o(()=>{"use strict";});var b={};a(b,{touchcancel:()=>Ye,touchend:()=>Ze,touchmove:()=>Qe,touchstart:()=>Re});function Re(t){return this.on("touchstart",t)}function Ze(t){return this.on("touchend",t)}function Qe(t){return this.on("touchmove",t)}function Ye(t){return this.on("touchcancel",t)}var X=o(()=>{"use strict";});var G,R=o(()=>{"use strict";P();F();U();V();z();X();G={...v,...y,...w,...x,...T,...b}});var M={};a(M,{attr:()=>et,val:()=>tt});function et(t,e){if(e===void 0){let n=this[0];return n instanceof Element?n.getAttribute(t):null}return this.forEach(n=>{n instanceof Element&&n.setAttribute(t,e)}),this}function tt(t){if(t===void 0){let e=this[0];return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e.value:""}return this.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(e.value=t)}),this}var Z=o(()=>{"use strict";});var S={};a(S,{html:()=>nt,text:()=>st});function nt(t){if(t===void 0){let e=this[0];return e instanceof Element?e.innerHTML:""}return this.forEach(e=>{e instanceof Element&&(e.innerHTML=t)}),this}function st(t){if(t===void 0){let e=this[0];return e instanceof Node&&e.textContent||""}return this.forEach(e=>{e instanceof HTMLElement&&(e.textContent=t)}),this}var Q=o(()=>{"use strict";});var L={};a(L,{after:()=>ht,append:()=>ct,appendTo:()=>lt,before:()=>ft,empty:()=>ot,insertAfter:()=>Bt,insertBefore:()=>mt,prepend:()=>ut,prependTo:()=>pt,remove:()=>it,replaceWith:()=>dt,replaceWithClone:()=>at,unwrap:()=>gt,wrap:()=>jt});function rt(t,e){let n=e.createElement("div");return n.innerHTML=t.trim(),n.firstElementChild}function u(t){return t.length>0&&t[0]instanceof Element?t[0].ownerDocument:typeof document<"u"?document:null}function l(t,e){let n=e.createDocumentFragment(),s=r=>{if(typeof r=="string"){let i=e.createElement("div");for(i.innerHTML=r.trim();i.firstChild;)n.appendChild(i.firstChild)}else r instanceof Node?n.appendChild(r):(r instanceof f||Array.isArray(r)||r instanceof NodeList)&&Array.from(r).forEach(i=>s(i))};return s(t),n}function it(){return this.forEach(t=>{t instanceof Element&&t.remove()}),this}function ot(){return this.forEach(t=>{t instanceof Element&&(t.innerHTML="")}),this}function at(){let t=[];return this.forEach(e=>{if(e instanceof Element){let n=e.cloneNode(!0);e.replaceWith(n),t.push(n)}}),new this.constructor(t)}function ct(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("beforeend",t)}),this;let e=u(this);if(!e)return this;let n=l(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.appendChild(i)}}),this}function ut(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("afterbegin",t)}),this;let e=u(this);if(!e)return this;let n=l(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.prepend(i)}}),this}function ft(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("beforebegin",t)}),this;let e=u(this);if(!e)return this;let n=l(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.before(i)}}),this}function ht(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("afterend",t)}),this;let e=u(this);if(!e)return this;let n=l(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.after(i)}}),this}function dt(t){let e=u(this);if(!e)return this;let n=l(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.replaceWith(i)}}),this}function lt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.appendChild(s)}return this}function pt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.prepend(s)}return this}function mt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.before(s)}return this}function Bt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.after(s)}return this}function jt(t){let e=u(this);return e?(this.forEach(n=>{if(n instanceof Element){let s=rt(t,e);n.parentNode&&n.parentNode.insertBefore(s,n),s.appendChild(n)}}),this):this}function gt(){let t=u(this);if(!t)return this;let e=new Set;return this.forEach(n=>{n instanceof Element&&n.parentElement&&e.add(n.parentElement)}),e.forEach(n=>{let s=t.createDocumentFragment();for(;n.firstChild;)s.appendChild(n.firstChild);n.replaceWith(s)}),this}var Y=o(()=>{"use strict";j();});var C={};a(C,{children:()=>yt,closest:()=>Et,descendants:()=>xt,descendantsUntil:()=>Mt,eq:()=>qt,filterBy:()=>Jt,findAll:()=>wt,first:()=>It,last:()=>Kt,next:()=>St,nextAll:()=>kt,nextSibling:()=>Ct,nextUntil:()=>_t,not:()=>Dt,parent:()=>vt,parents:()=>Tt,parentsUntil:()=>bt,prev:()=>Lt,prevAll:()=>Ot,prevSibling:()=>Wt,prevUntil:()=>Nt,sibling:()=>Ht,siblings:()=>At});function Et(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.closest(t);r&&e.push(r)}});let n=this.constructor;return new n([...new Set(e)])}function vt(){let t=[];this.forEach(n=>{n instanceof Element&&n.parentElement&&t.push(n.parentElement)});let e=this.constructor;return new e([...new Set(t)])}function yt(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=Array.from(s.children);e=e.concat(r)}}),t&&(e=e.filter(s=>s.matches(t)));let n=this.constructor;return new n(e)}function wt(t){let e=[];this.forEach(s=>{(s instanceof Element||s instanceof Document)&&s.querySelectorAll(t).forEach(i=>e.push(i))});let n=this.constructor;return new n([...new Set(e)])}function xt(){return this.findAll("*")}function Tt(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.parentElement;for(;r;)(!t||r.matches(t))&&e.push(r),r=r.parentElement}});let n=this.constructor;return new n([...new Set(e)])}function bt(t,e){let n=[];this.forEach(r=>{if(r instanceof Element){let i=r.parentElement;for(;i&&!i.matches(t);)(!e||i.matches(e))&&n.push(i),i=i.parentElement}});let s=this.constructor;return new s([...new Set(n)])}function Mt(t,e){let n=[],s=i=>{let I=i.children;for(let B=0;B<I.length;B++){let p=I[B];p.matches(t)||((!e||p.matches(e))&&n.push(p),s(p))}};this.forEach(i=>{i instanceof Element&&s(i)});let r=this.constructor;return new r([...new Set(n)])}function St(t){let e=[];this.forEach(s=>{if(s instanceof Element&&s.nextElementSibling){let r=s.nextElementSibling;(!t||r.matches(t))&&e.push(r)}});let n=this.constructor;return new n([...new Set(e)])}function Lt(t){let e=[];this.forEach(s=>{if(s instanceof Element&&s.previousElementSibling){let r=s.previousElementSibling;(!t||r.matches(t))&&e.push(r)}});let n=this.constructor;return new n([...new Set(e)])}function Ct(t){return this.next(t)}function Wt(t){return this.prev(t)}function Ht(t){return this.next(t)}function kt(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.nextElementSibling;for(;r;)(!t||r.matches(t))&&e.push(r),r=r.nextElementSibling}});let n=this.constructor;return new n([...new Set(e)])}function Ot(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.previousElementSibling;for(;r;)(!t||r.matches(t))&&e.push(r),r=r.previousElementSibling}});let n=this.constructor;return new n([...new Set(e)])}function At(t){let e=[];this.forEach(s=>{s instanceof Element&&s.parentElement&&Array.from(s.parentElement.children).forEach(i=>{i!==s&&(!t||i.matches(t))&&e.push(i)})});let n=this.constructor;return new n([...new Set(e)])}function _t(t,e){let n=[];this.forEach(r=>{if(r instanceof Element){let i=r.nextElementSibling;for(;i&&!i.matches(t);)(!e||i.matches(e))&&n.push(i),i=i.nextElementSibling}});let s=this.constructor;return new s([...new Set(n)])}function Nt(t,e){let n=[];this.forEach(r=>{if(r instanceof Element){let i=r.previousElementSibling;for(;i&&!i.matches(t);)(!e||i.matches(e))&&n.push(i),i=i.previousElementSibling}});let s=this.constructor;return new s([...new Set(n)])}function qt(t){let e=this.length,n=t<0?e+t:t,s=this[n],r=this.constructor;return new r(s?[s]:[])}function It(){return this.eq(0)}function Kt(){return this.eq(-1)}function Jt(t){let e=[];this.forEach((s,r)=>{s instanceof Element&&(typeof t=="string"?s.matches(t)&&e.push(s):typeof t=="function"&&t.call(s,r,s)&&e.push(s))});let n=this.constructor;return new n(e)}function Dt(t){let e=[];this.forEach((s,r)=>{s instanceof Element&&(typeof t=="string"?s.matches(t)||e.push(s):typeof t=="function"&&(t.call(s,r,s)||e.push(s)))});let n=this.constructor;return new n(e)}var ee=o(()=>{"use strict";});var W={};a(W,{checked:()=>$t,disabled:()=>Ft,selected:()=>Pt});function $t(t){if(t===void 0){let e=this[0];return e instanceof HTMLInputElement?e.checked:!1}return this.forEach(e=>{e instanceof HTMLInputElement&&(e.checked=t)}),this}function Pt(t){if(t===void 0){let e=this[0];return e instanceof HTMLOptionElement?e.selected:!1}return this.forEach(e=>{e instanceof HTMLOptionElement&&(e.selected=t)}),this}function Ft(t){if(t===void 0){let e=this[0];return e instanceof HTMLElement&&"disabled"in e?e.disabled:!1}return this.forEach(e=>{e instanceof HTMLElement&&"disabled"in e&&(e.disabled=t,t?e.classList.add("disabled"):e.classList.remove("disabled"))}),this}var te=o(()=>{"use strict";});var ne,se=o(()=>{"use strict";Z();Q();Y();ee();te();ne={...M,...S,...L,...C,...W}});function c(){return typeof window<"u"&&typeof window.requestAnimationFrame<"u"}var d=o(()=>{"use strict";});var H={};a(H,{slideIn:()=>Ut,slideOut:()=>Vt,slideToggle:()=>zt});function Ut(t={}){if(!c())return this;let{duration:e=300}=t;return this.forEach(n=>{n instanceof HTMLElement&&(n.style.willChange="transform",n.style.transition=`transform ${e}ms cubic-bezier(0.4, 0.0, 0.2, 1)`,requestAnimationFrame(()=>{n.style.transform="translateX(0%)"}),n.setAttribute("data-slide-state","open"))}),this}function Vt(t={}){if(!c())return this;let{direction:e="left",duration:n=300}=t,s=e==="left"?"-100%":"100%";return this.forEach(r=>{r instanceof HTMLElement&&(r.style.willChange="transform",r.style.transition=`transform ${n}ms cubic-bezier(0.4, 0.0, 0.2, 1)`,requestAnimationFrame(()=>{r.style.transform=`translateX(${s})`}),r.setAttribute("data-slide-state","closed"))}),this}function zt(t={}){return c()?(this.forEach(e=>{if(e instanceof HTMLElement){let n=e.getAttribute("data-slide-state"),s=e.style.transform;n==="open"||s==="translateX(0%)"?new this.constructor(e).slideOut(t):new this.constructor(e).slideIn(t)}}),this):this}var re=o(()=>{"use strict";d();});var k={};a(k,{slideDown:()=>Xt,slideToggleBox:()=>Rt,slideUp:()=>Gt});function Xt(t={}){if(!c())return this;let{duration:e=300,displayType:n="block"}=t;return this.forEach(s=>{if(s instanceof HTMLElement){if(window.getComputedStyle(s).display!=="none")return;s.style.display=n;let r=s.scrollHeight;s.style.height="0px",s.style.overflow="hidden",s.style.transition=`height ${e}ms ease-in-out`,s.offsetHeight,s.style.height=`${r}px`,setTimeout(()=>{s.style.height="auto",s.style.overflow="visible",s.style.transition=""},e)}}),this}function Gt(t={}){if(!c())return this;let{duration:e=300}=t;return this.forEach(n=>{n instanceof HTMLElement&&(n.style.height=`${n.scrollHeight}px`,n.style.overflow="hidden",n.style.transition=`height ${e}ms ease-in-out`,n.offsetHeight,n.style.height="0px",setTimeout(()=>{n.style.display="none",n.style.height="",n.style.overflow="",n.style.transition=""},e))}),this}function Rt(t={}){return c()?(this.forEach(e=>{if(e instanceof HTMLElement){let n=window.getComputedStyle(e).display,s=new this.constructor(e);n==="none"?s.slideDown(t):s.slideUp(t)}}),this):this}var ie=o(()=>{"use strict";d();});var O={};a(O,{fadeIn:()=>Zt,fadeOut:()=>Qt,fadeToggle:()=>Yt});function Zt(t={}){if(!c())return this;let{duration:e=300,displayType:n="block"}=t;return this.forEach(s=>{s instanceof HTMLElement&&(s.style.opacity="0",s.style.display=n,s.style.transition=`opacity ${e}ms ease-in-out`,s.offsetHeight,requestAnimationFrame(()=>{s.style.opacity="1"}),setTimeout(()=>{s.style.transition=""},e))}),this}function Qt(t={}){if(!c())return this;let{duration:e=300}=t;return this.forEach(n=>{n instanceof HTMLElement&&(n.style.opacity="1",n.style.transition=`opacity ${e}ms ease-in-out`,n.offsetHeight,requestAnimationFrame(()=>{n.style.opacity="0"}),setTimeout(()=>{n.style.display="none",n.style.transition=""},e))}),this}function Yt(t={}){return c()?(this.forEach(e=>{if(e instanceof HTMLElement){let n=window.getComputedStyle(e).display,s=new this.constructor(e);n==="none"?s.fadeIn(t):s.fadeOut(t)}}),this):this}var oe=o(()=>{"use strict";d();});var ae,ce=o(()=>{"use strict";re();ie();oe();ae={...H,...k,...O}});var A={};a(A,{get:()=>en,getText:()=>tn});async function en(t){let e=await fetch(t,{signal:AbortSignal.timeout(5e3)});if(!e.ok)throw new Error(`HTTP Error: ${e.status}`);let n=await e.text();return n?JSON.parse(n):{}}async function tn(t){let e=await fetch(t);if(!e.ok)throw new Error(`HTTP Error: ${e.status}`);let n=await e.text();return n?JSON.parse(n):{}}var ue=o(()=>{"use strict";});var _={};a(_,{post:()=>nn});async function nn(t,e={}){let n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.status===204){let r=await n.text();return r?JSON.parse(r):{}}if(!n.ok)throw new Error(`HTTP Error: ${n.status}`);let s=await n.text();return s?JSON.parse(s):{}}var fe=o(()=>{"use strict";});var m,N=o(()=>{"use strict";ue();fe();m={...A,..._}});var he=o(()=>{"use strict";});var de=o(()=>{"use strict";});var q=o(()=>{"use strict";he();de();});var h,le,pe,me,Be,je,ge,Ee,ve,ye=o(()=>{"use strict";j();$();R();se();ce();N();q();d();d();N();q();Object.assign(f.prototype,D);Object.assign(f.prototype,G);Object.assign(f.prototype,ne);Object.assign(f.prototype,ae);h=t=>new f(t),le=h,pe=h,me=h,Be=h,je=h,ge=h,Ee=h,ve=h});var an=xe(()=>{ye();window.$=le;window.jBase=Ee;window.jB=pe;window._jB=me;window.__jB=Be;window._jBase=je;window.__jBase=ge;window.__=ve;window.http=m;console.log("jBase initialized and ready!")});an();})();
|
|
9
|
+
"use strict";(()=>{var we=Object.defineProperty;var o=(t,e)=>()=>(t&&(e=t(t=0)),e);var xe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),a=(t,e)=>{for(var n in e)we(t,n,{get:e[n],enumerable:!0})};var f,g=o(()=>{"use strict";f=class extends Array{selectorSource="";doc;constructor(e,n){if(super(),n instanceof Document?this.doc=n:n&&n.document?this.doc=n.document:this.doc=typeof document<"u"?document:null,!(typeof document>"u")&&(this.selectorSource=typeof e=="string"?e:"<DOM Object/Array>",!!e))if(e instanceof HTMLElement||e===document||e===window||e instanceof Element)this.push(e);else if(typeof e=="string"){let s=e.trim();if(s.startsWith("<")&&s.endsWith(">")){let r=document.createElement("div");r.innerHTML=s,this.push(...Array.from(r.children))}else if(s.startsWith("#")&&!s.includes(" ")&&!s.includes(".")){let r=document.getElementById(s.slice(1));r&&this.push(r)}else if(s.startsWith(".")&&!s.includes(" ")&&!/[:\[#]/.test(s)){let r=document.getElementsByClassName(s.slice(1));for(let i=0;i<r.length;i++)this.push(r[i])}else if(/^[a-zA-Z0-9]+$/.test(s)){let r=document.getElementsByTagName(s);for(let i=0;i<r.length;i++)this.push(r[i])}else try{this.push(...Array.from(document.querySelectorAll(e)))}catch(r){console.warn(`jBase: Invalid selector "${e}"`,r)}}else(e instanceof NodeList||Array.isArray(e))&&this.push(...Array.from(e))}toJSON(){return{meta:"jBase Wrapper",query:this.selectorSource,count:this.length,preview:this.slice(0,10).map(e=>e instanceof Element?e.tagName.toLowerCase():typeof e)}}}});var E={};a(E,{addClass:()=>be,hasClass:()=>Se,removeClass:()=>Te,toggleClass:()=>Me});function be(...t){return this.forEach(e=>{e instanceof Element&&e.classList.add(...t)}),this}function Te(...t){return this.forEach(e=>{e instanceof Element&&e.classList.remove(...t)}),this}function Me(t){return this.forEach(e=>{e instanceof Element&&e.classList.toggle(t)}),this}function Se(t){return this.some(e=>e instanceof Element&&e.classList.contains(t))}var K=o(()=>{"use strict";});var v={};a(v,{css:()=>Le});function Le(t,e){if(e===void 0){let n=this[0];if(n instanceof HTMLElement||n instanceof SVGElement){let s=n.ownerDocument,r=s?s.defaultView:null;return r?r.getComputedStyle(n)[t]:n.style[t]||""}return""}return this.forEach(n=>{(n instanceof HTMLElement||n instanceof SVGElement)&&(n.style[t]=e)}),this}var J=o(()=>{"use strict";});var D,$=o(()=>{"use strict";K();J();D={...E,...v}});var y={};a(y,{off:()=>We,on:()=>Ce});function Ce(t,e){return this.forEach(n=>{n.addEventListener(t,e)}),this}function We(t,e){return this.forEach(n=>{n.removeEventListener(t,e)}),this}var F=o(()=>{"use strict";});var w={};a(w,{click:()=>He,dblclick:()=>qe,mousedown:()=>_e,mouseenter:()=>Ae,mouseleave:()=>Oe,mousemove:()=>ke,mouseout:()=>Ie,mouseover:()=>Ke,mouseup:()=>Ne});function He(t){return t?this.on("click",t):(this.forEach(e=>{e instanceof HTMLElement&&e.click()}),this)}function ke(t){return this.on("mousemove",t)}function Oe(t){return this.on("mouseleave",t)}function Ae(t){return this.on("mouseenter",t)}function _e(t){return this.on("mousedown",t)}function Ne(t){return this.on("mouseup",t)}function qe(t){return t?this.on("dblclick",t):(this.forEach(e=>{e instanceof HTMLElement&&e.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0,cancelable:!0,view:window}))}),this)}function Ie(t){return this.on("mouseout",t)}function Ke(t){return this.on("mouseover",t)}var P=o(()=>{"use strict";});var x={};a(x,{ready:()=>Je});function Je(t){let e=window.document;return e.readyState==="complete"||e.readyState==="interactive"?t():this.on("DOMContentLoaded",t),this}var U=o(()=>{"use strict";});var b={};a(b,{keydown:()=>De,keypress:()=>Fe,keyup:()=>$e,pressedKey:()=>Pe});function De(t){return this.on("keydown",t)}function $e(t){return this.on("keyup",t)}function Fe(t){return this.on("keypress",t)}function Pe(t,e){return this.on("keydown",n=>{let s=n;s.key.toLowerCase()===t.toLowerCase()&&e(s)})}var R=o(()=>{"use strict";});var T={};a(T,{blur:()=>Ge,change:()=>Re,focus:()=>ze,input:()=>Ve,submit:()=>Ue});function Ue(t){return this.on("submit",t)}function Re(t){return this.on("change",t)}function Ve(t){return this.on("input",t)}function ze(t){return t?this.on("focus",t):(this.forEach(e=>{e instanceof HTMLElement&&e.focus()}),this)}function Ge(t){return t?this.on("blur",t):(this.forEach(e=>{e instanceof HTMLElement&&e.blur()}),this)}var V=o(()=>{"use strict";});var M={};a(M,{touchcancel:()=>Ye,touchend:()=>Ze,touchmove:()=>Qe,touchstart:()=>Xe});function Xe(t){return this.on("touchstart",t)}function Ze(t){return this.on("touchend",t)}function Qe(t){return this.on("touchmove",t)}function Ye(t){return this.on("touchcancel",t)}var z=o(()=>{"use strict";});var G,X=o(()=>{"use strict";F();P();U();R();V();z();G={...y,...w,...x,...b,...T,...M}});var S={};a(S,{attr:()=>et,val:()=>tt});function et(t,e){if(e===void 0){let n=this[0];return n instanceof Element?n.getAttribute(t):null}return this.forEach(n=>{n instanceof Element&&n.setAttribute(t,e)}),this}function tt(t){if(t===void 0){let e=this[0];return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e.value:""}return this.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(e.value=t)}),this}var Z=o(()=>{"use strict";});var L={};a(L,{html:()=>nt,text:()=>st});function nt(t){if(t===void 0){let e=this[0];return e instanceof Element?e.innerHTML:""}return this.forEach(e=>{e instanceof Element&&(e.innerHTML=t)}),this}function st(t){if(t===void 0){let e=this[0];return e instanceof Node&&e.textContent||""}return this.forEach(e=>{e instanceof HTMLElement&&(e.textContent=t)}),this}var Q=o(()=>{"use strict";});var C={};a(C,{after:()=>ht,append:()=>ct,appendTo:()=>lt,before:()=>ft,empty:()=>ot,insertAfter:()=>Bt,insertBefore:()=>mt,prepend:()=>ut,prependTo:()=>pt,remove:()=>it,replaceWith:()=>dt,replaceWithClone:()=>at,unwrap:()=>gt,wrap:()=>jt});function rt(t,e){let n=e.createElement("div");return n.innerHTML=t.trim(),n.firstElementChild}function u(t){return t.length>0&&t[0]instanceof Element?t[0].ownerDocument:typeof document<"u"?document:null}function p(t,e){let n=e.createDocumentFragment(),s=r=>{if(typeof r=="string"){let i=e.createElement("div");for(i.innerHTML=r.trim();i.firstChild;)n.appendChild(i.firstChild)}else r instanceof Node?n.appendChild(r):(r instanceof f||Array.isArray(r)||r instanceof NodeList)&&Array.from(r).forEach(i=>s(i))};return s(t),n}function it(){return this.forEach(t=>{t instanceof Element&&t.remove()}),this}function ot(){return this.forEach(t=>{t instanceof Element&&(t.innerHTML="")}),this}function at(){let t=[];return this.forEach(e=>{if(e instanceof Element){let n=e.cloneNode(!0);e.replaceWith(n),t.push(n)}}),new this.constructor(t)}function ct(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("beforeend",t)}),this;let e=u(this);if(!e)return this;let n=p(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.appendChild(i)}}),this}function ut(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("afterbegin",t)}),this;let e=u(this);if(!e)return this;let n=p(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.prepend(i)}}),this}function ft(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("beforebegin",t)}),this;let e=u(this);if(!e)return this;let n=p(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.before(i)}}),this}function ht(t){if(typeof t=="string")return this.forEach(s=>{s instanceof Element&&s.insertAdjacentHTML("afterend",t)}),this;let e=u(this);if(!e)return this;let n=p(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.after(i)}}),this}function dt(t){let e=u(this);if(!e)return this;let n=p(t,e);return this.forEach((s,r)=>{if(s instanceof Element){let i=r<this.length-1?n.cloneNode(!0):n;s.replaceWith(i)}}),this}function lt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.appendChild(s)}return this}function pt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.prepend(s)}return this}function mt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.before(s)}return this}function Bt(t){let e=u(this);if(!e)return this;let n=typeof t=="string"?e.querySelector(t):t;if(n instanceof Element){let s=e.createDocumentFragment();this.forEach(r=>{r instanceof Node&&s.appendChild(r)}),n.after(s)}return this}function jt(t){let e=u(this);return e?(this.forEach(n=>{if(n instanceof Element){let s=rt(t,e);n.parentNode&&n.parentNode.insertBefore(s,n),s.appendChild(n)}}),this):this}function gt(){let t=u(this);if(!t)return this;let e=new Set;return this.forEach(n=>{n instanceof Element&&n.parentElement&&e.add(n.parentElement)}),e.forEach(n=>{let s=t.createDocumentFragment();for(;n.firstChild;)s.appendChild(n.firstChild);n.replaceWith(s)}),this}var Y=o(()=>{"use strict";g();});var W={};a(W,{children:()=>yt,closest:()=>Et,descendants:()=>xt,descendantsUntil:()=>Mt,eq:()=>qt,filterBy:()=>Jt,findAll:()=>wt,first:()=>It,last:()=>Kt,next:()=>St,nextAll:()=>kt,nextSibling:()=>Ct,nextUntil:()=>_t,not:()=>Dt,parent:()=>vt,parents:()=>bt,parentsUntil:()=>Tt,prev:()=>Lt,prevAll:()=>Ot,prevSibling:()=>Wt,prevUntil:()=>Nt,sibling:()=>Ht,siblings:()=>At});function Et(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.closest(t);r&&e.push(r)}});let n=this.constructor;return new n([...new Set(e)])}function vt(){let t=[];this.forEach(n=>{n instanceof Element&&n.parentElement&&t.push(n.parentElement)});let e=this.constructor;return new e([...new Set(t)])}function yt(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=Array.from(s.children);e=e.concat(r)}}),t&&(e=e.filter(s=>s.matches(t)));let n=this.constructor;return new n(e)}function wt(t){let e=[];this.forEach(s=>{(s instanceof Element||s instanceof Document)&&s.querySelectorAll(t).forEach(i=>e.push(i))});let n=this.constructor;return new n([...new Set(e)])}function xt(){return this.findAll("*")}function bt(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.parentElement;for(;r;)(!t||r.matches(t))&&e.push(r),r=r.parentElement}});let n=this.constructor;return new n([...new Set(e)])}function Tt(t,e){let n=[];this.forEach(r=>{if(r instanceof Element){let i=r.parentElement;for(;i&&!i.matches(t);)(!e||i.matches(e))&&n.push(i),i=i.parentElement}});let s=this.constructor;return new s([...new Set(n)])}function Mt(t,e){let n=[],s=i=>{let l=i.children;for(let j=0;j<l.length;j++){let m=l[j];m.matches(t)||((!e||m.matches(e))&&n.push(m),s(m))}};this.forEach(i=>{i instanceof Element&&s(i)});let r=this.constructor;return new r([...new Set(n)])}function St(t){let e=[];this.forEach(s=>{if(s instanceof Element&&s.nextElementSibling){let r=s.nextElementSibling;(!t||r.matches(t))&&e.push(r)}});let n=this.constructor;return new n([...new Set(e)])}function Lt(t){let e=[];this.forEach(s=>{if(s instanceof Element&&s.previousElementSibling){let r=s.previousElementSibling;(!t||r.matches(t))&&e.push(r)}});let n=this.constructor;return new n([...new Set(e)])}function Ct(t){return this.next(t)}function Wt(t){return this.prev(t)}function Ht(t){return this.next(t)}function kt(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.nextElementSibling;for(;r;)(!t||r.matches(t))&&e.push(r),r=r.nextElementSibling}});let n=this.constructor;return new n([...new Set(e)])}function Ot(t){let e=[];this.forEach(s=>{if(s instanceof Element){let r=s.previousElementSibling;for(;r;)(!t||r.matches(t))&&e.push(r),r=r.previousElementSibling}});let n=this.constructor;return new n([...new Set(e)])}function At(t){let e=[];this.forEach(s=>{s instanceof Element&&s.parentElement&&Array.from(s.parentElement.children).forEach(i=>{i!==s&&(!t||i.matches(t))&&e.push(i)})});let n=this.constructor;return new n([...new Set(e)])}function _t(t,e){let n=[];this.forEach(r=>{if(r instanceof Element){let i=r.nextElementSibling;for(;i&&!i.matches(t);)(!e||i.matches(e))&&n.push(i),i=i.nextElementSibling}});let s=this.constructor;return new s([...new Set(n)])}function Nt(t,e){let n=[];this.forEach(r=>{if(r instanceof Element){let i=r.previousElementSibling;for(;i&&!i.matches(t);)(!e||i.matches(e))&&n.push(i),i=i.previousElementSibling}});let s=this.constructor;return new s([...new Set(n)])}function qt(t){let e=this.length,n=t<0?e+t:t,s=this[n],r=this.constructor;return new r(s?[s]:[])}function It(){return this.eq(0)}function Kt(){return this.eq(-1)}function Jt(t){let e=[];this.forEach((s,r)=>{s instanceof Element&&(typeof t=="string"?s.matches(t)&&e.push(s):typeof t=="function"&&t.call(s,r,s)&&e.push(s))});let n=this.constructor;return new n(e)}function Dt(t){let e=[];this.forEach((s,r)=>{s instanceof Element&&(typeof t=="string"?s.matches(t)||e.push(s):typeof t=="function"&&(t.call(s,r,s)||e.push(s)))});let n=this.constructor;return new n(e)}var ee=o(()=>{"use strict";});var H={};a(H,{checked:()=>$t,disabled:()=>Pt,selected:()=>Ft});function $t(t){if(t===void 0){let e=this[0];return e instanceof HTMLInputElement?e.checked:!1}return this.forEach(e=>{e instanceof HTMLInputElement&&(e.checked=t)}),this}function Ft(t){if(t===void 0){let e=this[0];return e instanceof HTMLOptionElement?e.selected:!1}return this.forEach(e=>{e instanceof HTMLOptionElement&&(e.selected=t)}),this}function Pt(t){if(t===void 0){let e=this[0];return e instanceof HTMLElement&&"disabled"in e?e.disabled:!1}return this.forEach(e=>{e instanceof HTMLElement&&"disabled"in e&&(e.disabled=t,t?e.classList.add("disabled"):e.classList.remove("disabled"))}),this}var te=o(()=>{"use strict";});var ne,se=o(()=>{"use strict";Z();Q();Y();ee();te();ne={...S,...L,...C,...W,...H}});function c(){return typeof window<"u"&&typeof window.requestAnimationFrame<"u"}var d=o(()=>{"use strict";});var k={};a(k,{slideIn:()=>Ut,slideOut:()=>Rt,slideToggle:()=>Vt});function Ut(t={}){if(!c())return this;let{duration:e=300}=t;return this.forEach(n=>{n instanceof HTMLElement&&(n.style.willChange="transform",n.style.transition=`transform ${e}ms cubic-bezier(0.4, 0.0, 0.2, 1)`,requestAnimationFrame(()=>{n.style.transform="translateX(0%)"}),n.setAttribute("data-slide-state","open"))}),this}function Rt(t={}){if(!c())return this;let{direction:e="left",duration:n=300}=t,s=e==="left"?"-100%":"100%";return this.forEach(r=>{r instanceof HTMLElement&&(r.style.willChange="transform",r.style.transition=`transform ${n}ms cubic-bezier(0.4, 0.0, 0.2, 1)`,requestAnimationFrame(()=>{r.style.transform=`translateX(${s})`}),r.setAttribute("data-slide-state","closed"))}),this}function Vt(t={}){return c()?(this.forEach(e=>{if(e instanceof HTMLElement){let n=e.getAttribute("data-slide-state"),s=e.style.transform;n==="open"||s==="translateX(0%)"?new this.constructor(e).slideOut(t):new this.constructor(e).slideIn(t)}}),this):this}var re=o(()=>{"use strict";d();});var O={};a(O,{slideDown:()=>zt,slideToggleBox:()=>Xt,slideUp:()=>Gt});function zt(t={}){if(!c())return this;let{duration:e=300,displayType:n="block"}=t;return this.forEach(s=>{if(s instanceof HTMLElement){if(window.getComputedStyle(s).display!=="none")return;s.style.display=n;let r=s.scrollHeight;s.style.height="0px",s.style.overflow="hidden",s.style.transition=`height ${e}ms ease-in-out`,s.offsetHeight,s.style.height=`${r}px`,setTimeout(()=>{s.style.height="auto",s.style.overflow="visible",s.style.transition=""},e)}}),this}function Gt(t={}){if(!c())return this;let{duration:e=300}=t;return this.forEach(n=>{n instanceof HTMLElement&&(n.style.height=`${n.scrollHeight}px`,n.style.overflow="hidden",n.style.transition=`height ${e}ms ease-in-out`,n.offsetHeight,n.style.height="0px",setTimeout(()=>{n.style.display="none",n.style.height="",n.style.overflow="",n.style.transition=""},e))}),this}function Xt(t={}){return c()?(this.forEach(e=>{if(e instanceof HTMLElement){let n=window.getComputedStyle(e).display,s=new this.constructor(e);n==="none"?s.slideDown(t):s.slideUp(t)}}),this):this}var ie=o(()=>{"use strict";d();});var A={};a(A,{fadeIn:()=>Zt,fadeOut:()=>Qt,fadeToggle:()=>Yt});function Zt(t={}){if(!c())return this;let{duration:e=300,displayType:n="block"}=t;return this.forEach(s=>{s instanceof HTMLElement&&(s.style.opacity="0",s.style.display=n,s.style.transition=`opacity ${e}ms ease-in-out`,s.offsetHeight,requestAnimationFrame(()=>{s.style.opacity="1"}),setTimeout(()=>{s.style.transition=""},e))}),this}function Qt(t={}){if(!c())return this;let{duration:e=300}=t;return this.forEach(n=>{n instanceof HTMLElement&&(n.style.opacity="1",n.style.transition=`opacity ${e}ms ease-in-out`,n.offsetHeight,requestAnimationFrame(()=>{n.style.opacity="0"}),setTimeout(()=>{n.style.display="none",n.style.transition=""},e))}),this}function Yt(t={}){return c()?(this.forEach(e=>{if(e instanceof HTMLElement){let n=window.getComputedStyle(e).display,s=new this.constructor(e);n==="none"?s.fadeIn(t):s.fadeOut(t)}}),this):this}var oe=o(()=>{"use strict";d();});var ae,ce=o(()=>{"use strict";re();ie();oe();ae={...k,...O,...A}});var _={};a(_,{get:()=>en,getText:()=>tn});async function en(t,e){let n={...e};n.method?.toLowerCase()==="post"&&(n.method="GET"),n.signal||(n.signal=AbortSignal.timeout(5e3));let s=await fetch(t,{...n});if(!s.ok)throw new Error(`HTTP Error: ${s.status}`);let r=await s.text();return r?JSON.parse(r):{}}async function tn(t,e){let n={...e};n.method?.toLowerCase()!=="get"&&(n.method="GET"),n.signal||(n.signal=AbortSignal.timeout(5e3));let s=await fetch(t,{...n});if(!s.ok)throw new Error(`HTTP Error: ${s.status}`);let r=await s.text();return r?JSON.parse(r):{}}var ue=o(()=>{"use strict";});var N={};a(N,{post:()=>nn});async function nn(t,e={},n){let s={...n};s.method?.toLowerCase()!=="post"&&(s.method="post"),s.signal||(s.signal=AbortSignal.timeout(5e3));let r=await fetch(t,{...s,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.status===204){let l=await r.text();return l?JSON.parse(l):{}}if(!r.ok)throw new Error(`HTTP Error: ${r.status}`);let i=await r.text();return i?JSON.parse(i):{}}var fe=o(()=>{"use strict";});var B,q=o(()=>{"use strict";ue();fe();B={..._,...N}});var he=o(()=>{"use strict";});var de=o(()=>{"use strict";});var I=o(()=>{"use strict";he();de();});var h,le,pe,me,Be,je,ge,Ee,ve,ye=o(()=>{"use strict";g();$();X();se();ce();q();I();d();d();q();I();Object.assign(f.prototype,D);Object.assign(f.prototype,G);Object.assign(f.prototype,ne);Object.assign(f.prototype,ae);h=t=>new f(t),le=h,pe=h,me=h,Be=h,je=h,ge=h,Ee=h,ve=h});var an=xe(()=>{ye();window.$=le;window.jBase=Ee;window.jB=pe;window._jB=me;window.__jB=Be;window._jBase=je;window.__jBase=ge;window.__=ve;window.http=B;console.log("jBase initialized and ready!")});an();})();
|
|
10
10
|
//# sourceMappingURL=jbase.min.js.map
|