jsquery_node 1.0.14 → 1.0.16

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.
@@ -0,0 +1 @@
1
+ var JSQuery=(()=>{var f=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var g=(r,t)=>{for(var e in t)f(r,e,{get:t[e],enumerable:!0})},w=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of J(t))!v.call(r,i)&&i!==e&&f(r,i,{get:()=>t[i],enumerable:!(s=A(t,i))||s.enumerable});return r};var Q=r=>w(f({},"__esModule",{value:!0}),r);var O={};g(O,{$:()=>L,JSQuery:()=>c});var c={};g(c,{Caching:()=>d,Element:()=>n,ElementArray:()=>h,Extension:()=>l,Plugin:()=>x});var b=function(r,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!s:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(r):s?s.value:t.get(r)},m,S;function C(r){return r instanceof NodeList||r instanceof HTMLCollection}function p(r){return r instanceof n?r.elt:r}var l=class r{constructor(){if(this.constructor===r)throw new Error("you can't make an instance of class: JSQuery.Extension")}get(){return{$:this.$(),Element:this.Element(),static_Element:this.static_Element(),static_ElementArray:this.static_ElementArray(),ElementArray:this.ElementArray(),JSQuery:this.JSQuery()}}$(){return{}}Element(){return{}}ElementArray(){return{}}static_Element(){return{}}static_ElementArray(){return{}}JSQuery(){return{}}},n=class r{static from(t){return t==null?null:C(t)?h.from(t).map(e=>new this(e)):new this(t)}new(){return r.from(this.elt)}constructor(t){m.add(this),this.elt=t}on(t,e,s){return this.elt.addEventListener(t,e,s),this}removeEvent(t,e,s){return this.elt.removeEventListener(t,e,s),this}trigger(t){return this.elt[t](),this}css(t){for(let[e,s]of Object.entries(t))this.elt.style[e]=s;return this}getCss(t){return this.elt.style[t]}props(t){for(let[e,s]of Object.entries(t))s===null?this.elt.removeAttribute(e):this.elt.setAttribute(e,s);return this}getProp(t){return this.elt.getAttribute(t)}id(t){return t==null?this.getProp("id"):(this.props({id:t}),this)}class(t){return Array.isArray(t)?t.forEach(e=>this.elt.classList.add(e)):this.elt.classList.add(t),this}removeClass(t){return Array.isArray(t)?t.forEach(e=>this.elt.classList.remove(e)):this.elt.classList.remove(t),this}toggleClass(t){return Array.isArray(t)?t.forEach(e=>this.elt.classList.toggle(e)):this.elt.classList.toggle(t),this}hasClass(t){return this.elt.classList.contains(t)}$(t){return r.from(this.elt.querySelector(t))}all(t){return r.from(this.elt.querySelectorAll(t))}is(t){return this.elt.matches(t)}child(t){return Array.isArray(t)?t.forEach(e=>this.elt.appendChild(p(e))):this.elt.appendChild(p(t)),this}remove(){return this.elt.remove(),this}get children(){return r.from(this.elt.children)}html(t){return t==null?this.elt.innerHTML:(this.elt.innerHTML=t,this)}text(t){return t==null?this.elt.textContent:(this.elt.textContent=t,this)}rect(){return this.elt.getBoundingClientRect().toJSON()}value(t){return t==null?this.elt.value:(this.elt.value=t,this)}checked(t){return t==null?this.elt.checked:(this.elt.checked=t,this)}click(t,e){return b(this,m,"m",S).call(this,"click",t,e),this}};m=new WeakSet,S=function(t,e,s){if(!e){this.trigger(t);return}this.on(t,e,s)};var d=class extends l{$(){return{cache(t){let e=(...s)=>{let i=JSON.stringify(s);if(e.cache.hasOwnProperty(i))return e.cache[i];let y=t(...s);return e.cache[i]=y,y};return e.cache={},e}}}},h=class r extends Array{on(t,e,s){return this.forEach(i=>i.on(t,e,s)),this}rect(){return this.map(t=>t.rect())}hasClass(t){return this.map(e=>e.hasClass(t))}is(t){return this.map(e=>e.is(t))}checked(t){return t!==void 0?(this.forEach(e=>e.checked(t)),this):this.map(e=>e.checked())}trigger(t){return this.forEach(e=>e.trigger(t)),this}css(t){return this.forEach(e=>e.css(t)),this}props(t){return this.forEach(e=>e.props(t)),this}class(t){return this.forEach(e=>e.class(t)),this}removeClass(t){return this.forEach(e=>e.removeClass(t)),this}toggleClass(t){return this.forEach(e=>e.toggleClass(t)),this}remove(){return this.forEach(t=>t.remove()),this}new(){let t=new r;return this.forEach(e=>t.push(e.new())),t}click(t,e){return this.forEach(s=>s.click(t,e)),this}},x=l;function o(r){return n.from(document.querySelector(r))}o.from=(r=>n.from(r));o.all=r=>n.from(document.querySelectorAll(r));var a;o.head=()=>(a||(a=n.from(document.head)),a);var u;o.body=()=>(u||(u=n.from(document.body)),u);var E;o.doc=()=>(E||(E=n.from(document)),E);o.create=r=>n.from(document.createElement(r));o.loadExtension=r=>{if(Object.getPrototypeOf(r)!==l)throw new Error("the class is not a child of JSQuery.Extension or the inputed class is an instance");u=void 0,a=void 0;let t=new r().get();Object.assign(o,t.$),Object.assign(c,t.JSQuery),Object.assign(n.prototype,t.Element),Object.assign(h.prototype,t.ElementArray),Object.assign(n,t.static_Element),Object.assign(h,t.static_ElementArray)};o.loadPlugin=o.loadExtension;var L=o;return Q(O);})();