(function(o,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(o=typeof globalThis<"u"?globalThis:o||self,c(o.DOMPlus={}))})(this,function(o){"use strict";function c(t,...e){return Array.isArray(t)?t.concat(e):t.split(/\s+/).concat(e)}function m(t,e,...n){const s=c(e,...n);return t.classList.add(...s),t}function b(t,e,...n){const s=c(e,...n);return t.classList.remove(...s),t}function p(t,e,n){return t.classList.toggle(e,n),t}function S(t){return t.charAt(0).toLowerCase()+t.slice(1)}function u(t){return S(t).replace(/_/g,"-").replace(/.[A-Z]+/g,e=>e[0]+"-"+e.slice(1).toLowerCase())}function g(t,e){return window.getComputedStyle(t).getPropertyValue(u(e))}function l(t,e,n){if(!t||!e||!n||!("style"in t))return t;let s="";return typeof n=="string"&&n.endsWith("!important")&&(s="important",n=n.slice(0,-10).trim()),t.style.setProperty(u(e),n,s),t}function E(t,e){return Object.entries(e).forEach(([n,s])=>{l(t,n,s)}),t}function A(t,e,n){return typeof e=="string"?n?l(t,e,n):g(t,e):E(t,e)}function C(t,e,n,s){return t.addEventListener(e,n,s),()=>{t.removeEventListener(e,n,s)}}function q(t){const e=t;return e.$addClass=m.bind(null,e),e.$removeClass=b.bind(null,e),e.$toggleClass=p.bind(null,e),e.$css=A.bind(null,e),e.$on=C.bind(null,e),e.$text=function(n){return typeof n>"u"?this.textContent||"":(this.textContent=n,this)},e}/** * DOM generator * @author Dragon-Fish * @license MIT */function y(t,e,n){let s=null;if(typeof t=="string")s=document.createElement(t);else if(typeof t=="object"&&(t instanceof Element||t instanceof SVGElement))s=t;else throw new TypeError("Invalid first argument: must be a string or an instance of Element");if(!s)return null;const r=q(s);return(typeof e=="string"||e instanceof Element)&&(e=[e]),Array.isArray(e)?r.replaceChildren(...e):typeof e=="object"&&e!==null&&Object.entries(e).forEach(([f,i])=>{if(typeof i>"u"){r.removeAttribute(f);return}if(f==="style")typeof i=="string"?r.style&&(r.style.cssText=i):r.$css(i);else if(f==="class")r.$addClass(i);else if(f.startsWith("on")){const L=f.slice(2).toLowerCase();r.$on(L,i)}else r.setAttribute(f,i)}),(typeof n=="string"||n instanceof Element)&&(n=[n]),Array.isArray(n)&&r.replaceChildren(...n),r}const d=document.querySelector.bind(document),a=document.querySelectorAll.bind(document);o.createElement=y,o.h=y,o.q=d,o.qq=a,o.querySelector=d,o.querySelectorAll=a,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=index.umd.cjs.map