diff --git a/src/sigpro.min.js b/src/sigpro.min.js deleted file mode 100644 index a2f7f1c..0000000 --- a/src/sigpro.min.js +++ /dev/null @@ -1 +0,0 @@ -const isFunc=e=>"function"==typeof e,isObj=e=>e&&"object"==typeof e,isArr=Array.isArray,doc="undefined"!=typeof document?document:null,ensureNode=e=>e?._isRuntime?e.container:e instanceof Node?e:doc.createTextNode(null==e?"":String(e));let activeEffect=null,activeOwner=null,isFlushing=!1,batchDepth=0;const effectQueue=new Set,MOUNTED_NODES=new WeakMap,SVG_NS="http://www.w3.org/2000/svg",XLINK_NS="http://www.w3.org/1999/xlink",SVG_TAGS=new Set("svg,path,circle,rect,line,polyline,polygon,g,defs,text,textPath,tspan,use,symbol,image,marker,ellipse".split(",")),dispose=e=>{if(!e||e._disposed)return;e._disposed=!0;const t=[e];for(;t.length;){const e=t.pop();e._cleanups&&(e._cleanups.forEach((e=>e())),e._cleanups.clear()),e._children&&(e._children.forEach((e=>t.push(e))),e._children.clear()),e._deps&&(e._deps.forEach((t=>t.delete(e))),e._deps.clear())}},onUnmount=e=>{activeOwner&&(activeOwner._cleanups||=new Set).add(e)},untrack=e=>{const t=activeEffect;activeEffect=null;try{return e()}finally{activeEffect=t}},createEffect=(e,t=!1)=>{const n=()=>{if(n._disposed)return;n._deps&&n._deps.forEach((e=>e.delete(n))),n._cleanups&&(n._cleanups.forEach((e=>e())),n._cleanups.clear());const t=activeEffect,s=activeOwner;activeEffect=activeOwner=n;try{return n._result=e()}catch(e){}finally{activeEffect=t,activeOwner=s}};return n._deps=n._cleanups=n._children=null,n._disposed=!1,n._isComputed=t,n._depth=activeEffect?activeEffect._depth+1:0,n._mounts=[],n._parent=activeOwner,activeOwner&&(activeOwner._children||=new Set).add(n),n},flush=()=>{if(isFlushing)return;isFlushing=!0;const e=Array.from(effectQueue).sort(((e,t)=>e._depth-t._depth));effectQueue.clear();for(const t of e)t._disposed||t();isFlushing=!1},batch=e=>{batchDepth++;try{return e()}finally{batchDepth--,0===batchDepth&&effectQueue.size>0&&!isFlushing&&flush()}},trackUpdate=(e,t=!1)=>{if(t||!activeEffect||activeEffect._disposed){if(t&&e.size>0){let t=!1;for(const n of e)n===activeEffect||n._disposed||(n._isComputed?(n._dirty=!0,n._subs&&trackUpdate(n._subs,!0)):(effectQueue.add(n),t=!0));t&&!isFlushing&&0===batchDepth&&queueMicrotask(flush)}}else e.add(activeEffect),(activeEffect._deps||=new Set).add(e)},$=(e,t=null)=>{const n=new Set;if(isFunc(e)){let t;const s=()=>{if(s._dirty){const c=activeEffect;activeEffect=s;try{const s=e();Object.is(t,s)||(t=s,trackUpdate(n,!0))}finally{activeEffect=c}s._dirty=!1}return trackUpdate(n),t};return s._isComputed=!0,s._subs=n,s._dirty=!0,s._deps=null,s._disposed=!1,s}if(t)try{e=JSON.parse(localStorage.getItem(t))??e}catch(e){}return(...s)=>{if(s.length){const c=isFunc(s[0])?s[0](e):s[0];Object.is(e,c)||(e=c,t&&localStorage.setItem(t,JSON.stringify(e)),trackUpdate(n,!0))}return trackUpdate(n),e}},watch=(e,t)=>{if(void 0===t){const t=createEffect(e);return t(),()=>dispose(t)}const n=createEffect((()=>{const n=isArr(e)?e.map((e=>e())):e();untrack((()=>t(n)))}));return n(),()=>dispose(n)},cleanupNode=e=>{e&&(e._cleanups&&(e._cleanups.forEach((e=>e())),e._cleanups.clear()),e._ownerEffect&&dispose(e._ownerEffect),e.childNodes&&e.childNodes.forEach((e=>cleanupNode(e))))};var DANGEROUS_PROTOCOL=/^\s*(javascript|data|vbscript):/i,DANGEROUS_URI_ATTRS=new Set(["src","href","formaction","action","background","code","archive"]),isDangerousAttr=e=>DANGEROUS_URI_ATTRS.has(e)||e.startsWith("on");const validateAttr=(e,t)=>{if(null==t||!1===t)return null;if(isDangerousAttr(e)){const e=String(t);if(DANGEROUS_PROTOCOL.test(e))return"#"}return t},h=(e,t={},n=[])=>{if((t instanceof Node||isArr(t)||!isObj(t))&&(n=t,t={}),isFunc(e)){const s=createEffect((()=>{const c=e(t,{children:n,emit:(e,...n)=>t[`on${e[0].toUpperCase()}${e.slice(1)}`]?.(...n)});return s._result=c,c}));s();const c=s._result;if(null==c)return null;const r=c instanceof Node||isArr(c)&&c.every((e=>e instanceof Node))?c:doc.createTextNode(String(c)),i=e=>{isObj(e)&&!e._isRuntime&&(e._mounts=s._mounts||[],e._cleanups=s._cleanups||new Set,e._ownerEffect=s)};return isArr(r)?r.forEach(i):i(r),r}const s=SVG_TAGS.has(e),c=s?doc.createElementNS(SVG_NS,e):doc.createElement(e);c._cleanups=new Set;for(const e of Object.keys(t)){let n=t[e];if("ref"!==e)if(s&&e.startsWith("xlink:")){const t=validateAttr(e.slice(6),n);null==t?c.removeAttributeNS(XLINK_NS,e.slice(6)):c.setAttributeNS(XLINK_NS,e.slice(6),t)}else if(e.startsWith("on")){const t=e.slice(2).toLowerCase();c.addEventListener(t,n);const s=()=>c.removeEventListener(t,n);c._cleanups.add(s),onUnmount(s)}else if(isFunc(n)){const t=createEffect((()=>{const t=validateAttr(e,n());"class"===e?c.className=t||"":null==t?c.removeAttribute(e):"style"===e&&"string"==typeof t?c.setAttribute("style",t):e in c&&!s?c[e]=t:c.setAttribute(e,!0===t?"":t)}));if(t(),c._cleanups.add((()=>dispose(t))),onUnmount((()=>dispose(t))),/^(INPUT|TEXTAREA|SELECT)$/.test(c.tagName)&&("value"===e||"checked"===e)){const t="checked"===e?"change":"input";c.addEventListener(t,(t=>n(t.target[e])))}}else{const t=validateAttr(e,n);null!=t&&("style"===e&&"string"==typeof t?c.setAttribute("style",t):e in c&&!s?c[e]=t:c.setAttribute(e,!0===t?"":t))}else isFunc(n)?n(c):n.current=c}const r=e=>{if(isArr(e))return e.forEach(r);if(isFunc(e)){const t=doc.createTextNode("");c.appendChild(t);let n=[];const s=createEffect((()=>{const s=e(),c=(isArr(s)?s:[s]).map(ensureNode);n.forEach((e=>{e._isRuntime?e.destroy():cleanupNode(e),e.parentNode&&e.remove()}));let r=t;for(let e=c.length-1;e>=0;e--){const t=c[e];t.parentNode!==r.parentNode&&r.parentNode?.insertBefore(t,r),t._mounts&&t._mounts.forEach((e=>e())),r=t}n=c}));s(),c._cleanups.add((()=>dispose(s))),onUnmount((()=>dispose(s)))}else{const t=ensureNode(e);c.appendChild(t),t._mounts&&t._mounts.forEach((e=>e()))}};return r(n),c},render=e=>{const t=new Set,n=activeOwner,s=activeEffect,c=doc.createElement("div");c.style.display="contents",c.setAttribute("role","presentation"),activeOwner={_cleanups:t},activeEffect=null;const r=e=>{e&&(e._isRuntime?(t.add(e.destroy),c.appendChild(e.container)):isArr(e)?e.forEach(r):c.appendChild(e instanceof Node?e:doc.createTextNode(String(null==e?"":e))))};try{r(e({onCleanup:e=>t.add(e)}))}finally{activeOwner=n,activeEffect=s}return{_isRuntime:!0,container:c,destroy:()=>{t.forEach((e=>e())),cleanupNode(c),c.remove()}}},when=(e,t,n=null)=>{const s=doc.createTextNode(""),c=h("div",{style:"display:contents"},[s]);let r=null;return watch((()=>!!(isFunc(e)?e():e)),(e=>{r&&(r.destroy(),r=null);const i=e?t:n;i&&(r=render((()=>isFunc(i)?i():i)),c.insertBefore(r.container,s))})),onUnmount((()=>r?.destroy())),c},each=(e,t,n)=>{const s=doc.createTextNode(""),c=h("div",{style:"display:contents"},[s]);let r=new Map;return watch((()=>(isFunc(e)?e():e)||[]),(e=>{const i=new Map,o=[],a=e||[];for(let e=0;et(s,e))),i.set(c,l),o.push(l)}r.forEach((e=>e.destroy()));let l=s;for(let e=o.length-1;e>=0;e--){const t=o[e].container;t.nextSibling!==l&&c.insertBefore(t,l),l=t}r=i})),c},Fragment=e=>e.children,mount=(e,t)=>{const n="string"==typeof t?doc.querySelector(t):t;if(!n)return;MOUNTED_NODES.has(n)&&MOUNTED_NODES.get(n).destroy();const s=render(isFunc(e)?e:()=>e);return n.replaceChildren(s.container),MOUNTED_NODES.set(n,s),s};"undefined"!=typeof window&&"a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup svg table tbody td template textarea tfoot th thead time tr u ul video".split(" ").forEach((e=>{window[e]=(t,n)=>h(e,t,n)}));export{$,watch,batch,h,Fragment,render,mount,when,each,onUnmount,isArr,isFunc,isObj}; \ No newline at end of file