diff --git a/dist/sigpro.esm.js b/dist/sigpro.esm.js index 20da198..1e5e384 100644 --- a/dist/sigpro.esm.js +++ b/dist/sigpro.esm.js @@ -559,15 +559,7 @@ var SigPro = Object.freeze({ Anim, Batch }); -var initDX = () => { - if (typeof window !== "undefined") { - Object.assign(window, SigPro); - "div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg".split(" ").forEach((t) => { - const name = t[0].toUpperCase() + t.slice(1); - window[name] = (p, c) => Tag(t, p, c); - }); - } -}; +var initDX = () => {}; export { onUnmount, onMount, diff --git a/dist/sigpro.esm.min.js b/dist/sigpro.esm.min.js index c6a8db0..6a434da 100644 --- a/dist/sigpro.esm.min.js +++ b/dist/sigpro.esm.min.js @@ -1 +1 @@ -var m=(e)=>typeof e==="function",j=(e)=>e&&typeof e==="object",N=Array.isArray,E=typeof document<"u"?document:null,$=(e)=>e?._isRuntime?e.container:e instanceof Node?e:E.createTextNode(e==null?"":String(e)),p=null,_=null,C=!1,A=0,T=new Set,U=new WeakMap,L=Symbol("iter"),M=new WeakMap,v=(e)=>{if(!e||e._disposed)return;e._disposed=!0;let s=[e];while(s.length){let t=s.pop();if(t._cleanups)t._cleanups.forEach((r)=>r()),t._cleanups.clear();if(t._children)t._children.forEach((r)=>s.push(r)),t._children.clear();if(t._deps)t._deps.forEach((r)=>r.delete(t)),t._deps.clear()}},k=(e)=>{if(_)(_._mounts||=[]).push(e)},g=(e)=>{if(_)(_._cleanups||=new Set).add(e)},q=(e)=>{let s=p;p=null;try{return e()}finally{p=s}},O=(e,s=!1)=>{let t=()=>{if(t._disposed)return;if(t._deps)t._deps.forEach((i)=>i.delete(t));if(t._cleanups)t._cleanups.forEach((i)=>i()),t._cleanups.clear();let r=p,n=_;p=_=t;try{return t._result=e()}catch(i){console.error("[SigPro]",i)}finally{p=r,_=n}};if(t._deps=t._cleanups=t._children=null,t._disposed=!1,t._isComputed=s,t._depth=p?p._depth+1:0,t._mounts=[],t._parent=_,_)(_._children||=new Set).add(t);return t},I=()=>{if(C)return;C=!0;let e=Array.from(T).sort((s,t)=>s._depth-t._depth);T.clear();for(let s of e)if(!s._disposed)s();C=!1},z=(e)=>{A++;try{return e()}finally{if(A--,A===0&&T.size>0&&!C)I()}},w=(e,s=!1)=>{if(!s&&p&&!p._disposed)e.add(p),(p._deps||=new Set).add(e);else if(s&&e.size>0){let t=!1;for(let r of e){if(r===p||r._disposed)continue;if(r._isComputed){if(r._dirty=!0,r._subs)w(r._subs,!0)}else T.add(r),t=!0}if(t&&!C&&A===0)queueMicrotask(I)}},B=(e,s=null)=>{let t=new Set;if(m(e)){let r,n=()=>{if(n._dirty){let i=p;p=n;try{let c=e();if(!Object.is(r,c))r=c,w(t,!0)}finally{p=i}n._dirty=!1}return w(t),r};if(n._isComputed=!0,n._subs=t,n._dirty=!0,n._deps=null,n._disposed=!1,n.stop=()=>{},_)g(n.stop);return n}if(s)try{e=JSON.parse(localStorage.getItem(s))??e}catch(r){}return(...r)=>{if(r.length){let n=m(r[0])?r[0](e):r[0];if(!Object.is(e,n)){if(e=n,s)localStorage.setItem(s,JSON.stringify(e));w(t,!0)}}return w(t),e}},W=(e)=>{if(!j(e))return e;let s=U.get(e);if(s)return s;let t=new Map,r=(n)=>{let i=t.get(n);if(!i)t.set(n,i=new Set);return i};return s=new Proxy(e,{get(n,i,c){if(typeof i!=="symbol")w(r(i));return W(Reflect.get(n,i,c))},set(n,i,c,o){let l=!Reflect.has(n,i),a=Reflect.get(n,i,o),d=Reflect.set(n,i,c,o);if(d&&!Object.is(a,c)){if(w(r(i),!0),l)w(r(L),!0)}return d},deleteProperty(n,i){let c=Reflect.deleteProperty(n,i);if(c)w(r(i),!0),w(r(L),!0);return c},ownKeys(n){return w(r(L)),Reflect.ownKeys(n)}}),U.set(e,s),s},R=(e,s)=>{if(s===void 0){let r=O(e);return r(),()=>v(r)}let t=O(()=>{let r=Array.isArray(e)?e.map((n)=>n()):e();q(()=>s(r))});return t(),()=>v(t)},P=(e)=>{if(e._cleanups)e._cleanups.forEach((s)=>s()),e._cleanups.clear();if(e._ownerEffect)v(e._ownerEffect);if(e.childNodes)e.childNodes.forEach(P)},F=/^\s*(javascript|data|vbscript):/i,G=(e)=>e==="src"||e==="href"||e.startsWith("on"),D=(e,s)=>{if(s==null||s===!1)return null;if(G(e)){let t=String(s);if(F.test(t))return console.warn(`[SigPro] Bloqueado protocolo peligroso en ${e}`),"#"}return s},S=(e,s={},t=[])=>{if(s instanceof Node||N(s)||!j(s))t=s,s={};if(m(e)){let c={_mounts:[],_cleanups:new Set},o=O(()=>{let f=e(s,{children:t,emit:(h,...u)=>s[`on${h[0].toUpperCase()}${h.slice(1)}`]?.(...u)});return o._result=f,f});o();let l=o._result;if(l==null)return null;let a=l instanceof Node||N(l)&&l.every((f)=>f instanceof Node)?l:E.createTextNode(String(l)),d=(f)=>{if(j(f)&&!f._isRuntime)f._mounts=o._mounts||[],f._cleanups=o._cleanups||new Set,f._ownerEffect=o};return N(a)?a.forEach(d):d(a),a}let r=/^(svg|path|circle|rect|line|poly(line|gon)|g|defs|text(path)?|tspan|use|symbol|image|marker|ellipse)$/i.test(e),n=r?E.createElementNS("http://www.w3.org/2000/svg",e):E.createElement(e);n._cleanups=new Set;for(let c in s){if(!s.hasOwnProperty(c))continue;let o=s[c];if(c==="ref"){m(o)?o(n):o.current=n;continue}if(r&&c.startsWith("xlink:")){val==null?n.removeAttributeNS("http://www.w3.org/1999/xlink",c.slice(6)):n.setAttributeNS("http://www.w3.org/1999/xlink",c.slice(6),val);continue}if(c.startsWith("on")){let l=c.slice(2).toLowerCase();n.addEventListener(l,o);let a=()=>n.removeEventListener(l,o);n._cleanups.add(a),g(a)}else if(m(o)){let l=O(()=>{let a=D(c,o());if(c==="class")n.className=a||"";else if(a==null)n.removeAttribute(c);else if(c in n&&!r)n[c]=a;else n.setAttribute(c,a===!0?"":a)});if(l(),n._cleanups.add(()=>v(l)),g(()=>v(l)),/^(INPUT|TEXTAREA|SELECT)$/.test(n.tagName)&&(c==="value"||c==="checked")){let a=c==="checked"?"change":"input";n.addEventListener(a,(d)=>o(d.target[c]))}}else{let l=D(c,o);if(l!=null)if(c in n&&!r)n[c]=l;else n.setAttribute(c,l===!0?"":l)}}let i=(c)=>{if(N(c))return c.forEach(i);if(m(c)){let o=E.createTextNode("");n.appendChild(o);let l=[],a=O(()=>{let d=c(),f=(N(d)?d:[d]).map($);l.forEach((u)=>{if(u._isRuntime)u.destroy();else P(u);if(u.parentNode)u.remove()});let h=o;for(let u=f.length-1;u>=0;u--){let y=f[u];if(y.parentNode!==h.parentNode)h.parentNode?.insertBefore(y,h);if(y._mounts)y._mounts.forEach((V)=>V());h=y}l=f});a(),n._cleanups.add(()=>v(a)),g(()=>v(a))}else{let o=$(c);if(n.appendChild(o),o._mounts)o._mounts.forEach((l)=>l())}};return i(t),n},b=(e)=>{let s=new Set,t=[],r=_,n=p,i=E.createElement("div");i.style.display="contents",i.setAttribute("role","presentation"),_={_cleanups:s,_mounts:t},p=null;let c=(o)=>{if(!o)return;if(o._isRuntime)s.add(o.destroy),i.appendChild(o.container);else if(N(o))o.forEach(c);else i.appendChild(o instanceof Node?o:E.createTextNode(String(o==null?"":o)))};try{c(e({onCleanup:(o)=>s.add(o)}))}finally{_=r,p=n}return t.forEach((o)=>o()),{_isRuntime:!0,container:i,destroy:()=>{s.forEach((o)=>o()),P(i),i.remove()}}},J=(e,s,t=null)=>{let r=E.createTextNode(""),n=S("div",{style:"display:contents"},[r]),i=null;return R(()=>!!(m(e)?e():e),(c)=>{if(i)i.destroy(),i=null;let o=c?s:t;if(o)i=b(()=>m(o)?o():o),n.insertBefore(i.container,r)}),g(()=>i?.destroy()),n},K=(e,s,t)=>{let r=E.createTextNode(""),n=S("div",{style:"display:contents"},[r]),i=new Map;return R(()=>(m(e)?e():e)||[],(c)=>{let o=new Map,l=[],a=c||[];for(let f=0;fs(h,f));else i.delete(u);o.set(u,y),l.push(y)}i.forEach((f)=>f.destroy());let d=r;for(let f=l.length-1;f>=0;f--){let u=l[f].container;if(u.nextSibling!==d)n.insertBefore(u,d);d=u}i=o}),n},x=(e)=>{let s=()=>window.location.hash.slice(1)||"/",t=B(s()),r=()=>t(s());window.addEventListener("hashchange",r),g(()=>window.removeEventListener("hashchange",r));let n=S("div",{class:"router-hook"}),i=null;return R([t],()=>{let c=t(),o=e.find((l)=>{let a=l.path.split("/").filter(Boolean),d=c.split("/").filter(Boolean);return a.length===d.length&&a.every((f,h)=>f[0]===":"||f===d[h])})||e.find((l)=>l.path==="*");if(o){i?.destroy();let l={};o.path.split("/").filter(Boolean).forEach((a,d)=>{if(a[0]===":")l[a.slice(1)]=c.split("/").filter(Boolean)[d]}),x.params(l),i=b(()=>m(o.component)?o.component(l):o.component),n.replaceChildren(i.container)}}),n};x.params=B({});x.to=(e)=>window.location.hash=e.replace(/^#?\/?/,"#/");x.back=()=>window.history.back();x.path=()=>window.location.hash.replace(/^#/,"")||"/";var Q=(e,s,{enter:t,leave:r}={})=>{let n=S("div",{style:"display:contents"}),i=null,c=(o,l)=>{let a=!1,d=()=>!a&&(a=!0,l());if(!o)return d();"transitionend animationend".split(" ").map((f)=>o.addEventListener(f,d,{once:!0})),setTimeout(d,500)};return R(e,(o)=>{if(o&&!i){let l=(i=b(s)).container.firstChild;if(n.appendChild(i.container),t&&l)l.classList.add(t),l.clientTop,l.classList.add(t+"-active"),c(l,()=>l.classList.remove(t,t+"-active"))}else if(!o&&i){let l=i.container.firstChild,a=()=>(i?.destroy(),i=null);r&&l?(l.classList.add(r),c(l,a)):a()}}),g(()=>i?.destroy()),n},X=(e,s)=>{let t=typeof s==="string"?E.querySelector(s):s;if(!t)return;if(M.has(t))M.get(t).destroy();let r=b(m(e)?e:()=>e);return t.replaceChildren(r.container),M.set(t,r),r},H=Object.freeze({$:B,$$:W,Watch:R,Tag:S,Render:b,If:J,For:K,Router:x,Mount:X,onMount:k,onUnmount:g,Anim:Q,Batch:z}),Y=()=>{if(typeof window<"u")Object.assign(window,H),"div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg".split(" ").forEach((e)=>{let s=e[0].toUpperCase()+e.slice(1);window[s]=(t,r)=>S(e,t,r)})};export{g as onUnmount,k as onMount,Y as initDX,R as Watch,S as Tag,x as Router,b as Render,X as Mount,J as If,K as For,z as Batch,Q as Anim,W as $$,B as $}; +var I=(q)=>typeof q==="function",E=(q)=>q&&typeof q==="object",T=Array.isArray,$=typeof document<"u"?document:null,g=(q)=>q?._isRuntime?q.container:q instanceof Node?q:$.createTextNode(q==null?"":String(q)),G=null,W=null,N=!1,F=0,O=new Set,h=new WeakMap,y=Symbol("iter"),b=new WeakMap,D=(q)=>{if(!q||q._disposed)return;q._disposed=!0;let K=[q];while(K.length){let z=K.pop();if(z._cleanups)z._cleanups.forEach((Z)=>Z()),z._cleanups.clear();if(z._children)z._children.forEach((Z)=>K.push(Z)),z._children.clear();if(z._deps)z._deps.forEach((Z)=>Z.delete(z)),z._deps.clear()}},l=(q)=>{if(W)(W._mounts||=[]).push(q)},A=(q)=>{if(W)(W._cleanups||=new Set).add(q)},u=(q)=>{let K=G;G=null;try{return q()}finally{G=K}},S=(q,K=!1)=>{let z=()=>{if(z._disposed)return;if(z._deps)z._deps.forEach((L)=>L.delete(z));if(z._cleanups)z._cleanups.forEach((L)=>L()),z._cleanups.clear();let Z=G,J=W;G=W=z;try{return z._result=q()}catch(L){console.error("[SigPro]",L)}finally{G=Z,W=J}};if(z._deps=z._cleanups=z._children=null,z._disposed=!1,z._isComputed=K,z._depth=G?G._depth+1:0,z._mounts=[],z._parent=W,W)(W._children||=new Set).add(z);return z},d=()=>{if(N)return;N=!0;let q=Array.from(O).sort((K,z)=>K._depth-z._depth);O.clear();for(let K of q)if(!K._disposed)K();N=!1},i=(q)=>{F++;try{return q()}finally{if(F--,F===0&&O.size>0&&!N)d()}},C=(q,K=!1)=>{if(!K&&G&&!G._disposed)q.add(G),(G._deps||=new Set).add(q);else if(K&&q.size>0){let z=!1;for(let Z of q){if(Z===G||Z._disposed)continue;if(Z._isComputed){if(Z._dirty=!0,Z._subs)C(Z._subs,!0)}else O.add(Z),z=!0}if(z&&!N&&F===0)queueMicrotask(d)}},m=(q,K=null)=>{let z=new Set;if(I(q)){let Z,J=()=>{if(J._dirty){let L=G;G=J;try{let j=q();if(!Object.is(Z,j))Z=j,C(z,!0)}finally{G=L}J._dirty=!1}return C(z),Z};if(J._isComputed=!0,J._subs=z,J._dirty=!0,J._deps=null,J._disposed=!1,J.stop=()=>{},W)A(J.stop);return J}if(K)try{q=JSON.parse(localStorage.getItem(K))??q}catch(Z){}return(...Z)=>{if(Z.length){let J=I(Z[0])?Z[0](q):Z[0];if(!Object.is(q,J)){if(q=J,K)localStorage.setItem(K,JSON.stringify(q));C(z,!0)}}return C(z),q}},v=(q)=>{if(!E(q))return q;let K=h.get(q);if(K)return K;let z=new Map,Z=(J)=>{let L=z.get(J);if(!L)z.set(J,L=new Set);return L};return K=new Proxy(q,{get(J,L,j){if(typeof L!=="symbol")C(Z(L));return v(Reflect.get(J,L,j))},set(J,L,j,X){let B=!Reflect.has(J,L),H=Reflect.get(J,L,X),Y=Reflect.set(J,L,j,X);if(Y&&!Object.is(H,j)){if(C(Z(L),!0),B)C(Z(y),!0)}return Y},deleteProperty(J,L){let j=Reflect.deleteProperty(J,L);if(j)C(Z(L),!0),C(Z(y),!0);return j},ownKeys(J){return C(Z(y)),Reflect.ownKeys(J)}}),h.set(q,K),K},R=(q,K)=>{if(K===void 0){let Z=S(q);return Z(),()=>D(Z)}let z=S(()=>{let Z=Array.isArray(q)?q.map((J)=>J()):q();u(()=>K(Z))});return z(),()=>D(z)},w=(q)=>{if(q._cleanups)q._cleanups.forEach((K)=>K()),q._cleanups.clear();if(q._ownerEffect)D(q._ownerEffect);if(q.childNodes)q.childNodes.forEach(w)},f=/^\s*(javascript|data|vbscript):/i,o=(q)=>q==="src"||q==="href"||q.startsWith("on"),k=(q,K)=>{if(K==null||K===!1)return null;if(o(q)){let z=String(K);if(f.test(z))return console.warn(`[SigPro] Bloqueado protocolo peligroso en ${q}`),"#"}return K},U=(q,K={},z=[])=>{if(K instanceof Node||T(K)||!E(K))z=K,K={};if(I(q)){let j={_mounts:[],_cleanups:new Set},X=S(()=>{let P=q(K,{children:z,emit:(Q,..._)=>K[`on${Q[0].toUpperCase()}${Q.slice(1)}`]?.(..._)});return X._result=P,P});X();let B=X._result;if(B==null)return null;let H=B instanceof Node||T(B)&&B.every((P)=>P instanceof Node)?B:$.createTextNode(String(B)),Y=(P)=>{if(E(P)&&!P._isRuntime)P._mounts=X._mounts||[],P._cleanups=X._cleanups||new Set,P._ownerEffect=X};return T(H)?H.forEach(Y):Y(H),H}let Z=/^(svg|path|circle|rect|line|poly(line|gon)|g|defs|text(path)?|tspan|use|symbol|image|marker|ellipse)$/i.test(q),J=Z?$.createElementNS("http://www.w3.org/2000/svg",q):$.createElement(q);J._cleanups=new Set;for(let j in K){if(!K.hasOwnProperty(j))continue;let X=K[j];if(j==="ref"){I(X)?X(J):X.current=J;continue}if(Z&&j.startsWith("xlink:")){val==null?J.removeAttributeNS("http://www.w3.org/1999/xlink",j.slice(6)):J.setAttributeNS("http://www.w3.org/1999/xlink",j.slice(6),val);continue}if(j.startsWith("on")){let B=j.slice(2).toLowerCase();J.addEventListener(B,X);let H=()=>J.removeEventListener(B,X);J._cleanups.add(H),A(H)}else if(I(X)){let B=S(()=>{let H=k(j,X());if(j==="class")J.className=H||"";else if(H==null)J.removeAttribute(j);else if(j in J&&!Z)J[j]=H;else J.setAttribute(j,H===!0?"":H)});if(B(),J._cleanups.add(()=>D(B)),A(()=>D(B)),/^(INPUT|TEXTAREA|SELECT)$/.test(J.tagName)&&(j==="value"||j==="checked")){let H=j==="checked"?"change":"input";J.addEventListener(H,(Y)=>X(Y.target[j]))}}else{let B=k(j,X);if(B!=null)if(j in J&&!Z)J[j]=B;else J.setAttribute(j,B===!0?"":B)}}let L=(j)=>{if(T(j))return j.forEach(L);if(I(j)){let X=$.createTextNode("");J.appendChild(X);let B=[],H=S(()=>{let Y=j(),P=(T(Y)?Y:[Y]).map(g);B.forEach((_)=>{if(_._isRuntime)_.destroy();else w(_);if(_.parentNode)_.remove()});let Q=X;for(let _=P.length-1;_>=0;_--){let M=P[_];if(M.parentNode!==Q.parentNode)Q.parentNode?.insertBefore(M,Q);if(M._mounts)M._mounts.forEach((p)=>p());Q=M}B=P});H(),J._cleanups.add(()=>D(H)),A(()=>D(H))}else{let X=g(j);if(J.appendChild(X),X._mounts)X._mounts.forEach((B)=>B())}};return L(z),J},V=(q)=>{let K=new Set,z=[],Z=W,J=G,L=$.createElement("div");L.style.display="contents",L.setAttribute("role","presentation"),W={_cleanups:K,_mounts:z},G=null;let j=(X)=>{if(!X)return;if(X._isRuntime)K.add(X.destroy),L.appendChild(X.container);else if(T(X))X.forEach(j);else L.appendChild(X instanceof Node?X:$.createTextNode(String(X==null?"":X)))};try{j(q({onCleanup:(X)=>K.add(X)}))}finally{W=Z,G=J}return z.forEach((X)=>X()),{_isRuntime:!0,container:L,destroy:()=>{K.forEach((X)=>X()),w(L),L.remove()}}},a=(q,K,z=null)=>{let Z=$.createTextNode(""),J=U("div",{style:"display:contents"},[Z]),L=null;return R(()=>!!(I(q)?q():q),(j)=>{if(L)L.destroy(),L=null;let X=j?K:z;if(X)L=V(()=>I(X)?X():X),J.insertBefore(L.container,Z)}),A(()=>L?.destroy()),J},s=(q,K,z)=>{let Z=$.createTextNode(""),J=U("div",{style:"display:contents"},[Z]),L=new Map;return R(()=>(I(q)?q():q)||[],(j)=>{let X=new Map,B=[],H=j||[];for(let P=0;PK(Q,P));else L.delete(_);X.set(_,M),B.push(M)}L.forEach((P)=>P.destroy());let Y=Z;for(let P=B.length-1;P>=0;P--){let _=B[P].container;if(_.nextSibling!==Y)J.insertBefore(_,Y);Y=_}L=X}),J},x=(q)=>{let K=()=>window.location.hash.slice(1)||"/",z=m(K()),Z=()=>z(K());window.addEventListener("hashchange",Z),A(()=>window.removeEventListener("hashchange",Z));let J=U("div",{class:"router-hook"}),L=null;return R([z],()=>{let j=z(),X=q.find((B)=>{let H=B.path.split("/").filter(Boolean),Y=j.split("/").filter(Boolean);return H.length===Y.length&&H.every((P,Q)=>P[0]===":"||P===Y[Q])})||q.find((B)=>B.path==="*");if(X){L?.destroy();let B={};X.path.split("/").filter(Boolean).forEach((H,Y)=>{if(H[0]===":")B[H.slice(1)]=j.split("/").filter(Boolean)[Y]}),x.params(B),L=V(()=>I(X.component)?X.component(B):X.component),J.replaceChildren(L.container)}}),J};x.params=m({});x.to=(q)=>window.location.hash=q.replace(/^#?\/?/,"#/");x.back=()=>window.history.back();x.path=()=>window.location.hash.replace(/^#/,"")||"/";var n=(q,K,{enter:z,leave:Z}={})=>{let J=U("div",{style:"display:contents"}),L=null,j=(X,B)=>{let H=!1,Y=()=>!H&&(H=!0,B());if(!X)return Y();"transitionend animationend".split(" ").map((P)=>X.addEventListener(P,Y,{once:!0})),setTimeout(Y,500)};return R(q,(X)=>{if(X&&!L){let B=(L=V(K)).container.firstChild;if(J.appendChild(L.container),z&&B)B.classList.add(z),B.clientTop,B.classList.add(z+"-active"),j(B,()=>B.classList.remove(z,z+"-active"))}else if(!X&&L){let B=L.container.firstChild,H=()=>(L?.destroy(),L=null);Z&&B?(B.classList.add(Z),j(B,H)):H()}}),A(()=>L?.destroy()),J},c=(q,K)=>{let z=typeof K==="string"?$.querySelector(K):K;if(!z)return;if(b.has(z))b.get(z).destroy();let Z=V(I(q)?q:()=>q);return z.replaceChildren(Z.container),b.set(z,Z),Z},r=Object.freeze({$:m,$$:v,Watch:R,Tag:U,Render:V,If:a,For:s,Router:x,Mount:c,onMount:l,onUnmount:A,Anim:n,Batch:i}),t=()=>{};export{A as onUnmount,l as onMount,t as initDX,R as Watch,U as Tag,x as Router,V as Render,c as Mount,a as If,s as For,i as Batch,n as Anim,v as $$,m as $}; diff --git a/dist/sigpro.js b/dist/sigpro.js index c8c65b8..45be708 100644 --- a/dist/sigpro.js +++ b/dist/sigpro.js @@ -617,13 +617,5 @@ Anim, Batch }); - var initDX = () => { - if (typeof window !== "undefined") { - Object.assign(window, SigPro); - "div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg".split(" ").forEach((t) => { - const name = t[0].toUpperCase() + t.slice(1); - window[name] = (p, c) => Tag(t, p, c); - }); - } - }; + var initDX = () => {}; })(); diff --git a/dist/sigpro.min.js b/dist/sigpro.min.js index 4962c67..dcaf0b4 100644 --- a/dist/sigpro.min.js +++ b/dist/sigpro.min.js @@ -1 +1 @@ -(()=>{var{defineProperty:M,getOwnPropertyNames:X,getOwnPropertyDescriptor:H}=Object,Y=Object.prototype.hasOwnProperty;function Z(e){return this[e]}var ee=(e)=>{var n=(D??=new WeakMap).get(e),t;if(n)return n;if(n=M({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var o of X(e))if(!Y.call(n,o))M(n,o,{get:Z.bind(e,o),enumerable:!(t=H(e,o))||t.enumerable})}return D.set(e,n),n},D;var te=(e)=>e;function ne(e,n){this[e]=te.bind(null,n)}var se=(e,n)=>{for(var t in n)M(e,t,{get:n[t],enumerable:!0,configurable:!0,set:ne.bind(n,t)})};var ae={};se(ae,{onUnmount:()=>g,onMount:()=>k,initDX:()=>le,Watch:()=>C,Tag:()=>N,Router:()=>b,Render:()=>S,Mount:()=>K,If:()=>F,For:()=>G,Batch:()=>z,Anim:()=>J,$$:()=>$,$:()=>L});var m=(e)=>typeof e==="function",P=(e)=>e&&typeof e==="object",x=Array.isArray,E=typeof document<"u"?document:null,I=(e)=>e?._isRuntime?e.container:e instanceof Node?e:E.createTextNode(e==null?"":String(e)),p=null,_=null,O=!1,A=0,T=new Set,W=new WeakMap,j=Symbol("iter"),B=new WeakMap,v=(e)=>{if(!e||e._disposed)return;e._disposed=!0;let n=[e];while(n.length){let t=n.pop();if(t._cleanups)t._cleanups.forEach((o)=>o()),t._cleanups.clear();if(t._children)t._children.forEach((o)=>n.push(o)),t._children.clear();if(t._deps)t._deps.forEach((o)=>o.delete(t)),t._deps.clear()}},k=(e)=>{if(_)(_._mounts||=[]).push(e)},g=(e)=>{if(_)(_._cleanups||=new Set).add(e)},oe=(e)=>{let n=p;p=null;try{return e()}finally{p=n}},R=(e,n=!1)=>{let t=()=>{if(t._disposed)return;if(t._deps)t._deps.forEach((i)=>i.delete(t));if(t._cleanups)t._cleanups.forEach((i)=>i()),t._cleanups.clear();let o=p,s=_;p=_=t;try{return t._result=e()}catch(i){console.error("[SigPro]",i)}finally{p=o,_=s}};if(t._deps=t._cleanups=t._children=null,t._disposed=!1,t._isComputed=n,t._depth=p?p._depth+1:0,t._mounts=[],t._parent=_,_)(_._children||=new Set).add(t);return t},q=()=>{if(O)return;O=!0;let e=Array.from(T).sort((n,t)=>n._depth-t._depth);T.clear();for(let n of e)if(!n._disposed)n();O=!1},z=(e)=>{A++;try{return e()}finally{if(A--,A===0&&T.size>0&&!O)q()}},w=(e,n=!1)=>{if(!n&&p&&!p._disposed)e.add(p),(p._deps||=new Set).add(e);else if(n&&e.size>0){let t=!1;for(let o of e){if(o===p||o._disposed)continue;if(o._isComputed){if(o._dirty=!0,o._subs)w(o._subs,!0)}else T.add(o),t=!0}if(t&&!O&&A===0)queueMicrotask(q)}},L=(e,n=null)=>{let t=new Set;if(m(e)){let o,s=()=>{if(s._dirty){let i=p;p=s;try{let c=e();if(!Object.is(o,c))o=c,w(t,!0)}finally{p=i}s._dirty=!1}return w(t),o};if(s._isComputed=!0,s._subs=t,s._dirty=!0,s._deps=null,s._disposed=!1,s.stop=()=>{},_)g(s.stop);return s}if(n)try{e=JSON.parse(localStorage.getItem(n))??e}catch(o){}return(...o)=>{if(o.length){let s=m(o[0])?o[0](e):o[0];if(!Object.is(e,s)){if(e=s,n)localStorage.setItem(n,JSON.stringify(e));w(t,!0)}}return w(t),e}},$=(e)=>{if(!P(e))return e;let n=W.get(e);if(n)return n;let t=new Map,o=(s)=>{let i=t.get(s);if(!i)t.set(s,i=new Set);return i};return n=new Proxy(e,{get(s,i,c){if(typeof i!=="symbol")w(o(i));return $(Reflect.get(s,i,c))},set(s,i,c,r){let l=!Reflect.has(s,i),a=Reflect.get(s,i,r),d=Reflect.set(s,i,c,r);if(d&&!Object.is(a,c)){if(w(o(i),!0),l)w(o(j),!0)}return d},deleteProperty(s,i){let c=Reflect.deleteProperty(s,i);if(c)w(o(i),!0),w(o(j),!0);return c},ownKeys(s){return w(o(j)),Reflect.ownKeys(s)}}),W.set(e,n),n},C=(e,n)=>{if(n===void 0){let o=R(e);return o(),()=>v(o)}let t=R(()=>{let o=Array.isArray(e)?e.map((s)=>s()):e();oe(()=>n(o))});return t(),()=>v(t)},U=(e)=>{if(e._cleanups)e._cleanups.forEach((n)=>n()),e._cleanups.clear();if(e._ownerEffect)v(e._ownerEffect);if(e.childNodes)e.childNodes.forEach(U)},re=/^\s*(javascript|data|vbscript):/i,ie=(e)=>e==="src"||e==="href"||e.startsWith("on"),V=(e,n)=>{if(n==null||n===!1)return null;if(ie(e)){let t=String(n);if(re.test(t))return console.warn(`[SigPro] Bloqueado protocolo peligroso en ${e}`),"#"}return n},N=(e,n={},t=[])=>{if(n instanceof Node||x(n)||!P(n))t=n,n={};if(m(e)){let c={_mounts:[],_cleanups:new Set},r=R(()=>{let f=e(n,{children:t,emit:(h,...u)=>n[`on${h[0].toUpperCase()}${h.slice(1)}`]?.(...u)});return r._result=f,f});r();let l=r._result;if(l==null)return null;let a=l instanceof Node||x(l)&&l.every((f)=>f instanceof Node)?l:E.createTextNode(String(l)),d=(f)=>{if(P(f)&&!f._isRuntime)f._mounts=r._mounts||[],f._cleanups=r._cleanups||new Set,f._ownerEffect=r};return x(a)?a.forEach(d):d(a),a}let o=/^(svg|path|circle|rect|line|poly(line|gon)|g|defs|text(path)?|tspan|use|symbol|image|marker|ellipse)$/i.test(e),s=o?E.createElementNS("http://www.w3.org/2000/svg",e):E.createElement(e);s._cleanups=new Set;for(let c in n){if(!n.hasOwnProperty(c))continue;let r=n[c];if(c==="ref"){m(r)?r(s):r.current=s;continue}if(o&&c.startsWith("xlink:")){val==null?s.removeAttributeNS("http://www.w3.org/1999/xlink",c.slice(6)):s.setAttributeNS("http://www.w3.org/1999/xlink",c.slice(6),val);continue}if(c.startsWith("on")){let l=c.slice(2).toLowerCase();s.addEventListener(l,r);let a=()=>s.removeEventListener(l,r);s._cleanups.add(a),g(a)}else if(m(r)){let l=R(()=>{let a=V(c,r());if(c==="class")s.className=a||"";else if(a==null)s.removeAttribute(c);else if(c in s&&!o)s[c]=a;else s.setAttribute(c,a===!0?"":a)});if(l(),s._cleanups.add(()=>v(l)),g(()=>v(l)),/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)&&(c==="value"||c==="checked")){let a=c==="checked"?"change":"input";s.addEventListener(a,(d)=>r(d.target[c]))}}else{let l=V(c,r);if(l!=null)if(c in s&&!o)s[c]=l;else s.setAttribute(c,l===!0?"":l)}}let i=(c)=>{if(x(c))return c.forEach(i);if(m(c)){let r=E.createTextNode("");s.appendChild(r);let l=[],a=R(()=>{let d=c(),f=(x(d)?d:[d]).map(I);l.forEach((u)=>{if(u._isRuntime)u.destroy();else U(u);if(u.parentNode)u.remove()});let h=r;for(let u=f.length-1;u>=0;u--){let y=f[u];if(y.parentNode!==h.parentNode)h.parentNode?.insertBefore(y,h);if(y._mounts)y._mounts.forEach((Q)=>Q());h=y}l=f});a(),s._cleanups.add(()=>v(a)),g(()=>v(a))}else{let r=I(c);if(s.appendChild(r),r._mounts)r._mounts.forEach((l)=>l())}};return i(t),s},S=(e)=>{let n=new Set,t=[],o=_,s=p,i=E.createElement("div");i.style.display="contents",i.setAttribute("role","presentation"),_={_cleanups:n,_mounts:t},p=null;let c=(r)=>{if(!r)return;if(r._isRuntime)n.add(r.destroy),i.appendChild(r.container);else if(x(r))r.forEach(c);else i.appendChild(r instanceof Node?r:E.createTextNode(String(r==null?"":r)))};try{c(e({onCleanup:(r)=>n.add(r)}))}finally{_=o,p=s}return t.forEach((r)=>r()),{_isRuntime:!0,container:i,destroy:()=>{n.forEach((r)=>r()),U(i),i.remove()}}},F=(e,n,t=null)=>{let o=E.createTextNode(""),s=N("div",{style:"display:contents"},[o]),i=null;return C(()=>!!(m(e)?e():e),(c)=>{if(i)i.destroy(),i=null;let r=c?n:t;if(r)i=S(()=>m(r)?r():r),s.insertBefore(i.container,o)}),g(()=>i?.destroy()),s},G=(e,n,t)=>{let o=E.createTextNode(""),s=N("div",{style:"display:contents"},[o]),i=new Map;return C(()=>(m(e)?e():e)||[],(c)=>{let r=new Map,l=[],a=c||[];for(let f=0;fn(h,f));else i.delete(u);r.set(u,y),l.push(y)}i.forEach((f)=>f.destroy());let d=o;for(let f=l.length-1;f>=0;f--){let u=l[f].container;if(u.nextSibling!==d)s.insertBefore(u,d);d=u}i=r}),s},b=(e)=>{let n=()=>window.location.hash.slice(1)||"/",t=L(n()),o=()=>t(n());window.addEventListener("hashchange",o),g(()=>window.removeEventListener("hashchange",o));let s=N("div",{class:"router-hook"}),i=null;return C([t],()=>{let c=t(),r=e.find((l)=>{let a=l.path.split("/").filter(Boolean),d=c.split("/").filter(Boolean);return a.length===d.length&&a.every((f,h)=>f[0]===":"||f===d[h])})||e.find((l)=>l.path==="*");if(r){i?.destroy();let l={};r.path.split("/").filter(Boolean).forEach((a,d)=>{if(a[0]===":")l[a.slice(1)]=c.split("/").filter(Boolean)[d]}),b.params(l),i=S(()=>m(r.component)?r.component(l):r.component),s.replaceChildren(i.container)}}),s};b.params=L({});b.to=(e)=>window.location.hash=e.replace(/^#?\/?/,"#/");b.back=()=>window.history.back();b.path=()=>window.location.hash.replace(/^#/,"")||"/";var J=(e,n,{enter:t,leave:o}={})=>{let s=N("div",{style:"display:contents"}),i=null,c=(r,l)=>{let a=!1,d=()=>!a&&(a=!0,l());if(!r)return d();"transitionend animationend".split(" ").map((f)=>r.addEventListener(f,d,{once:!0})),setTimeout(d,500)};return C(e,(r)=>{if(r&&!i){let l=(i=S(n)).container.firstChild;if(s.appendChild(i.container),t&&l)l.classList.add(t),l.clientTop,l.classList.add(t+"-active"),c(l,()=>l.classList.remove(t,t+"-active"))}else if(!r&&i){let l=i.container.firstChild,a=()=>(i?.destroy(),i=null);o&&l?(l.classList.add(o),c(l,a)):a()}}),g(()=>i?.destroy()),s},K=(e,n)=>{let t=typeof n==="string"?E.querySelector(n):n;if(!t)return;if(B.has(t))B.get(t).destroy();let o=S(m(e)?e:()=>e);return t.replaceChildren(o.container),B.set(t,o),o},ce=Object.freeze({$:L,$$:$,Watch:C,Tag:N,Render:S,If:F,For:G,Router:b,Mount:K,onMount:k,onUnmount:g,Anim:J,Batch:z}),le=()=>{if(typeof window<"u")Object.assign(window,ce),"div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg".split(" ").forEach((e)=>{let n=e[0].toUpperCase()+e.slice(1);window[n]=(t,o)=>N(e,t,o)})};})(); +(()=>{var{defineProperty:b,getOwnPropertyNames:c,getOwnPropertyDescriptor:r}=Object,t=Object.prototype.hasOwnProperty;function e(q){return this[q]}var qq=(q)=>{var J=(k??=new WeakMap).get(q),z;if(J)return J;if(J=b({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var X of c(q))if(!t.call(J,X))b(J,X,{get:e.bind(q,X),enumerable:!(z=r(q,X))||z.enumerable})}return k.set(q,J),J},k;var zq=(q)=>q;function Jq(q,J){this[q]=zq.bind(null,J)}var Kq=(q,J)=>{for(var z in J)b(q,z,{get:J[z],enumerable:!0,configurable:!0,set:Jq.bind(J,z)})};var Bq={};Kq(Bq,{onUnmount:()=>A,onMount:()=>l,initDX:()=>jq,Watch:()=>N,Tag:()=>S,Router:()=>V,Render:()=>T,Mount:()=>s,If:()=>f,For:()=>o,Batch:()=>i,Anim:()=>a,$$:()=>g,$:()=>y});var I=(q)=>typeof q==="function",w=(q)=>q&&typeof q==="object",x=Array.isArray,$=typeof document<"u"?document:null,d=(q)=>q?._isRuntime?q.container:q instanceof Node?q:$.createTextNode(q==null?"":String(q)),G=null,W=null,R=!1,F=0,O=new Set,v=new WeakMap,E=Symbol("iter"),m=new WeakMap,D=(q)=>{if(!q||q._disposed)return;q._disposed=!0;let J=[q];while(J.length){let z=J.pop();if(z._cleanups)z._cleanups.forEach((X)=>X()),z._cleanups.clear();if(z._children)z._children.forEach((X)=>J.push(X)),z._children.clear();if(z._deps)z._deps.forEach((X)=>X.delete(z)),z._deps.clear()}},l=(q)=>{if(W)(W._mounts||=[]).push(q)},A=(q)=>{if(W)(W._cleanups||=new Set).add(q)},Xq=(q)=>{let J=G;G=null;try{return q()}finally{G=J}},U=(q,J=!1)=>{let z=()=>{if(z._disposed)return;if(z._deps)z._deps.forEach((L)=>L.delete(z));if(z._cleanups)z._cleanups.forEach((L)=>L()),z._cleanups.clear();let X=G,K=W;G=W=z;try{return z._result=q()}catch(L){console.error("[SigPro]",L)}finally{G=X,W=K}};if(z._deps=z._cleanups=z._children=null,z._disposed=!1,z._isComputed=J,z._depth=G?G._depth+1:0,z._mounts=[],z._parent=W,W)(W._children||=new Set).add(z);return z},u=()=>{if(R)return;R=!0;let q=Array.from(O).sort((J,z)=>J._depth-z._depth);O.clear();for(let J of q)if(!J._disposed)J();R=!1},i=(q)=>{F++;try{return q()}finally{if(F--,F===0&&O.size>0&&!R)u()}},C=(q,J=!1)=>{if(!J&&G&&!G._disposed)q.add(G),(G._deps||=new Set).add(q);else if(J&&q.size>0){let z=!1;for(let X of q){if(X===G||X._disposed)continue;if(X._isComputed){if(X._dirty=!0,X._subs)C(X._subs,!0)}else O.add(X),z=!0}if(z&&!R&&F===0)queueMicrotask(u)}},y=(q,J=null)=>{let z=new Set;if(I(q)){let X,K=()=>{if(K._dirty){let L=G;G=K;try{let j=q();if(!Object.is(X,j))X=j,C(z,!0)}finally{G=L}K._dirty=!1}return C(z),X};if(K._isComputed=!0,K._subs=z,K._dirty=!0,K._deps=null,K._disposed=!1,K.stop=()=>{},W)A(K.stop);return K}if(J)try{q=JSON.parse(localStorage.getItem(J))??q}catch(X){}return(...X)=>{if(X.length){let K=I(X[0])?X[0](q):X[0];if(!Object.is(q,K)){if(q=K,J)localStorage.setItem(J,JSON.stringify(q));C(z,!0)}}return C(z),q}},g=(q)=>{if(!w(q))return q;let J=v.get(q);if(J)return J;let z=new Map,X=(K)=>{let L=z.get(K);if(!L)z.set(K,L=new Set);return L};return J=new Proxy(q,{get(K,L,j){if(typeof L!=="symbol")C(X(L));return g(Reflect.get(K,L,j))},set(K,L,j,Z){let B=!Reflect.has(K,L),H=Reflect.get(K,L,Z),Y=Reflect.set(K,L,j,Z);if(Y&&!Object.is(H,j)){if(C(X(L),!0),B)C(X(E),!0)}return Y},deleteProperty(K,L){let j=Reflect.deleteProperty(K,L);if(j)C(X(L),!0),C(X(E),!0);return j},ownKeys(K){return C(X(E)),Reflect.ownKeys(K)}}),v.set(q,J),J},N=(q,J)=>{if(J===void 0){let X=U(q);return X(),()=>D(X)}let z=U(()=>{let X=Array.isArray(q)?q.map((K)=>K()):q();Xq(()=>J(X))});return z(),()=>D(z)},h=(q)=>{if(q._cleanups)q._cleanups.forEach((J)=>J()),q._cleanups.clear();if(q._ownerEffect)D(q._ownerEffect);if(q.childNodes)q.childNodes.forEach(h)},Zq=/^\s*(javascript|data|vbscript):/i,Lq=(q)=>q==="src"||q==="href"||q.startsWith("on"),p=(q,J)=>{if(J==null||J===!1)return null;if(Lq(q)){let z=String(J);if(Zq.test(z))return console.warn(`[SigPro] Bloqueado protocolo peligroso en ${q}`),"#"}return J},S=(q,J={},z=[])=>{if(J instanceof Node||x(J)||!w(J))z=J,J={};if(I(q)){let j={_mounts:[],_cleanups:new Set},Z=U(()=>{let P=q(J,{children:z,emit:(Q,..._)=>J[`on${Q[0].toUpperCase()}${Q.slice(1)}`]?.(..._)});return Z._result=P,P});Z();let B=Z._result;if(B==null)return null;let H=B instanceof Node||x(B)&&B.every((P)=>P instanceof Node)?B:$.createTextNode(String(B)),Y=(P)=>{if(w(P)&&!P._isRuntime)P._mounts=Z._mounts||[],P._cleanups=Z._cleanups||new Set,P._ownerEffect=Z};return x(H)?H.forEach(Y):Y(H),H}let X=/^(svg|path|circle|rect|line|poly(line|gon)|g|defs|text(path)?|tspan|use|symbol|image|marker|ellipse)$/i.test(q),K=X?$.createElementNS("http://www.w3.org/2000/svg",q):$.createElement(q);K._cleanups=new Set;for(let j in J){if(!J.hasOwnProperty(j))continue;let Z=J[j];if(j==="ref"){I(Z)?Z(K):Z.current=K;continue}if(X&&j.startsWith("xlink:")){val==null?K.removeAttributeNS("http://www.w3.org/1999/xlink",j.slice(6)):K.setAttributeNS("http://www.w3.org/1999/xlink",j.slice(6),val);continue}if(j.startsWith("on")){let B=j.slice(2).toLowerCase();K.addEventListener(B,Z);let H=()=>K.removeEventListener(B,Z);K._cleanups.add(H),A(H)}else if(I(Z)){let B=U(()=>{let H=p(j,Z());if(j==="class")K.className=H||"";else if(H==null)K.removeAttribute(j);else if(j in K&&!X)K[j]=H;else K.setAttribute(j,H===!0?"":H)});if(B(),K._cleanups.add(()=>D(B)),A(()=>D(B)),/^(INPUT|TEXTAREA|SELECT)$/.test(K.tagName)&&(j==="value"||j==="checked")){let H=j==="checked"?"change":"input";K.addEventListener(H,(Y)=>Z(Y.target[j]))}}else{let B=p(j,Z);if(B!=null)if(j in K&&!X)K[j]=B;else K.setAttribute(j,B===!0?"":B)}}let L=(j)=>{if(x(j))return j.forEach(L);if(I(j)){let Z=$.createTextNode("");K.appendChild(Z);let B=[],H=U(()=>{let Y=j(),P=(x(Y)?Y:[Y]).map(d);B.forEach((_)=>{if(_._isRuntime)_.destroy();else h(_);if(_.parentNode)_.remove()});let Q=Z;for(let _=P.length-1;_>=0;_--){let M=P[_];if(M.parentNode!==Q.parentNode)Q.parentNode?.insertBefore(M,Q);if(M._mounts)M._mounts.forEach((n)=>n());Q=M}B=P});H(),K._cleanups.add(()=>D(H)),A(()=>D(H))}else{let Z=d(j);if(K.appendChild(Z),Z._mounts)Z._mounts.forEach((B)=>B())}};return L(z),K},T=(q)=>{let J=new Set,z=[],X=W,K=G,L=$.createElement("div");L.style.display="contents",L.setAttribute("role","presentation"),W={_cleanups:J,_mounts:z},G=null;let j=(Z)=>{if(!Z)return;if(Z._isRuntime)J.add(Z.destroy),L.appendChild(Z.container);else if(x(Z))Z.forEach(j);else L.appendChild(Z instanceof Node?Z:$.createTextNode(String(Z==null?"":Z)))};try{j(q({onCleanup:(Z)=>J.add(Z)}))}finally{W=X,G=K}return z.forEach((Z)=>Z()),{_isRuntime:!0,container:L,destroy:()=>{J.forEach((Z)=>Z()),h(L),L.remove()}}},f=(q,J,z=null)=>{let X=$.createTextNode(""),K=S("div",{style:"display:contents"},[X]),L=null;return N(()=>!!(I(q)?q():q),(j)=>{if(L)L.destroy(),L=null;let Z=j?J:z;if(Z)L=T(()=>I(Z)?Z():Z),K.insertBefore(L.container,X)}),A(()=>L?.destroy()),K},o=(q,J,z)=>{let X=$.createTextNode(""),K=S("div",{style:"display:contents"},[X]),L=new Map;return N(()=>(I(q)?q():q)||[],(j)=>{let Z=new Map,B=[],H=j||[];for(let P=0;PJ(Q,P));else L.delete(_);Z.set(_,M),B.push(M)}L.forEach((P)=>P.destroy());let Y=X;for(let P=B.length-1;P>=0;P--){let _=B[P].container;if(_.nextSibling!==Y)K.insertBefore(_,Y);Y=_}L=Z}),K},V=(q)=>{let J=()=>window.location.hash.slice(1)||"/",z=y(J()),X=()=>z(J());window.addEventListener("hashchange",X),A(()=>window.removeEventListener("hashchange",X));let K=S("div",{class:"router-hook"}),L=null;return N([z],()=>{let j=z(),Z=q.find((B)=>{let H=B.path.split("/").filter(Boolean),Y=j.split("/").filter(Boolean);return H.length===Y.length&&H.every((P,Q)=>P[0]===":"||P===Y[Q])})||q.find((B)=>B.path==="*");if(Z){L?.destroy();let B={};Z.path.split("/").filter(Boolean).forEach((H,Y)=>{if(H[0]===":")B[H.slice(1)]=j.split("/").filter(Boolean)[Y]}),V.params(B),L=T(()=>I(Z.component)?Z.component(B):Z.component),K.replaceChildren(L.container)}}),K};V.params=y({});V.to=(q)=>window.location.hash=q.replace(/^#?\/?/,"#/");V.back=()=>window.history.back();V.path=()=>window.location.hash.replace(/^#/,"")||"/";var a=(q,J,{enter:z,leave:X}={})=>{let K=S("div",{style:"display:contents"}),L=null,j=(Z,B)=>{let H=!1,Y=()=>!H&&(H=!0,B());if(!Z)return Y();"transitionend animationend".split(" ").map((P)=>Z.addEventListener(P,Y,{once:!0})),setTimeout(Y,500)};return N(q,(Z)=>{if(Z&&!L){let B=(L=T(J)).container.firstChild;if(K.appendChild(L.container),z&&B)B.classList.add(z),B.clientTop,B.classList.add(z+"-active"),j(B,()=>B.classList.remove(z,z+"-active"))}else if(!Z&&L){let B=L.container.firstChild,H=()=>(L?.destroy(),L=null);X&&B?(B.classList.add(X),j(B,H)):H()}}),A(()=>L?.destroy()),K},s=(q,J)=>{let z=typeof J==="string"?$.querySelector(J):J;if(!z)return;if(m.has(z))m.get(z).destroy();let X=T(I(q)?q:()=>q);return z.replaceChildren(X.container),m.set(z,X),X},Pq=Object.freeze({$:y,$$:g,Watch:N,Tag:S,Render:T,If:f,For:o,Router:V,Mount:s,onMount:l,onUnmount:A,Anim:a,Batch:i}),jq=()=>{};})(); diff --git a/docs/sigpro.js b/docs/sigpro.js index c8c65b8..45be708 100644 --- a/docs/sigpro.js +++ b/docs/sigpro.js @@ -617,13 +617,5 @@ Anim, Batch }); - var initDX = () => { - if (typeof window !== "undefined") { - Object.assign(window, SigPro); - "div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg".split(" ").forEach((t) => { - const name = t[0].toUpperCase() + t.slice(1); - window[name] = (p, c) => Tag(t, p, c); - }); - } - }; + var initDX = () => {}; })(); diff --git a/sigpro.js b/sigpro.js index c4eea53..a75cae4 100644 --- a/sigpro.js +++ b/sigpro.js @@ -544,14 +544,14 @@ const SigPro = Object.freeze({ }) export const initDX = () => { - if (typeof window !== "undefined") { - Object.assign(window, SigPro) - "div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg" - .split(" ").forEach(t => { - const name = t[0].toUpperCase() + t.slice(1) - window[name] = (p, c) => Tag(t, p, c) - }) - } + // if (typeof window !== "undefined") { + // Object.assign(window, SigPro) + // "div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg" + // .split(" ").forEach(t => { + // const name = t[0].toUpperCase() + t.slice(1) + // window[name] = (p, c) => Tag(t, p, c) + // }) + // } } export { $, $$, Watch, Tag, Render, If, For, Router, Mount, onMount, onUnmount, Anim, Batch }