@alexgyver/component 1.3.6 → 1.3.7
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/Component.js +1 -1
- package/Component.min.js +1 -1
- package/package.json +1 -1
package/Component.js
CHANGED
package/Component.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={d:(t,a)=>{for(var c in a)e.o(a,c)&&!e.o(t,c)&&Object.defineProperty(t,c,{enumerable:!0,get:a[c]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{EL:()=>a,LV:()=>r,cj:()=>
|
|
1
|
+
var e={d:(t,a)=>{for(var c in a)e.o(a,c)&&!e.o(t,c)&&Object.defineProperty(t,c,{enumerable:!0,get:a[c]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{EL:()=>a,LV:()=>r,cj:()=>n,t4:()=>s,uA:()=>c});class a{static ctx;constructor(e,t={},c=!1){a.ctx=this,this.$root=a.make(e,t,c)}static make(e,t={},c=!1){return e&&"object"==typeof t?t instanceof Node?t:("svg"==e&&(c=!0),a.config(c?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e),t,c)):null}static config(e,t,c=!1){if(Array.isArray(e))return e.forEach((e=>a.config(e,t,c))),null;if(!(e instanceof Node)||"object"!=typeof t)return e;let s=t.context;a.ctx=null===s?null:s||a.ctx,s=a.ctx;let n=t=>{if(t)if(t instanceof Node)e.appendChild(t);else if(t instanceof a)e.appendChild(t.$root);else if("string"==typeof t)e.innerHTML+=t;else if("object"==typeof t){let s=a.make(t.tag??"div",t,c||"svg"==t.tag);s&&e.appendChild(s)}};for(const[c,r]of Object.entries(t))if(null!=r)switch(c){case"tag":case"context":case"get":case"also":continue;case"text":e.textContent=r+"";break;case"html":e.innerHTML=r;break;case"class":(Array.isArray(r)?r:r.split(" ")).map((t=>t&&e.classList.add(t)));break;case"push":r.push(e);break;case"var":s&&(s["$"+r]=e);break;case"events":for(let t in r)e.addEventListener(t,r[t].bind(s));break;case"parent":r&&r.appendChild(e);break;case"attrs":for(let t in r)e.setAttribute(t,r[t]);break;case"props":for(let t in r)e[t]=r[t];break;case"child_r":a.clear(e);case"child":n(r);break;case"children_r":a.clear(e);case"children":for(const e of r)n(e);break;case"style":if("string"==typeof r)e.style.cssText+=r+";";else for(let t in r)e.style[t]=r[t];break;default:e[c]=r}return t.also&&s&&t.also.call(s,e),e}static clear(e){for(;e.firstChild;)e.removeChild(e.lastChild)}static makeArray(e,t=!1){return e&&Array.isArray(e)?e.map((e=>a.make(e.tag,e,t))):[]}static makeShadow(e,t={},c=null){if(!e||"object"!=typeof t)return null;let s=e instanceof Node?e:document.createElement(e);return s.attachShadow({mode:"open"}),a.config(s.shadowRoot,{context:t.context,children:[{tag:"style",textContent:c??""},t.child??{},...t.children??[]]}),delete t.children,delete t.child,a.config(s,t),s}}const c=a;class s{static make=(e,t)=>a.make(e,t,!0);static config=(e,t)=>a.config(e,t,!0);static makeArray=e=>a.makeArray(e,!0);static svg=(e={},t={})=>s._make("svg",e,t);static rect=(e,t,a,c,n,r,o={},l={})=>s._make("rect",{...o,x:e,y:t,width:a,height:c,rx:n,ry:r},l);static circle=(e,t,a,c={},n={})=>s._make("circle",{...c,cx:e,cy:t,r:a},n);static line=(e,t,a,c,n={},r={})=>s._make("line",{...n,x1:e,y1:t,x2:a,y2:c},r);static polyline=(e,t={},a={})=>s._make("polyline",{...t,points:e},a);static polygon=(e,t={},a={})=>s._make("polygon",{...t,points:e},a);static path=(e,t={},a={})=>s._make("path",{...t,d:e},a);static text=(e,t,a,c={},n={})=>s._make("text",{...c,x:t,y:a},{...n,text:e});static _make=(e,t={},a={})=>s.make(e,{attrs:{...t},...a})}class n{static addStyle(e,t,a=!1){if(e&&t&&("object"==typeof t&&(t=t.constructor.name),!n.#e.has(t)&&!n.#t.has(t)))if(a){let a=document.createElement("style");document.head.appendChild(a),a.textContent=e,n.#t.set(t,a)}else n.#a||(n.#a=document.head.appendChild(document.createElement("style"))),n.#a.textContent+=e+"\r\n",n.#e.add(t)}static removeStyle(e){"object"==typeof e&&(e=e.constructor.name),n.#t.has(e)&&(n.#t.get(e).remove(),n.#t.delete(e))}static#a=null;static#e=new Set;static#t=new Map}class r extends a{constructor(e,t={},a=null,c=null,s=!1){super(e,t),n.addStyle(a,c,s)}static make(e,t={},c=null,s=null,r=!1){return n.addStyle(c,s,r),a.make(e,t)}}const o=t.uA,l=t.EL,i=t.t4,d=t.cj,p=t.LV;export{o as Component,l as EL,i as SVG,d as Sheet,p as StyledComponent};
|