-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvan-0.10.2.nomodule.min.js
More file actions
1 lines (1 loc) · 1.22 KB
/
van-0.10.2.nomodule.min.js
File metadata and controls
1 lines (1 loc) · 1.22 KB
1
{let t,e,n,r,s,i,l,u,o,a,c;e=Object,n=null,s=r={},i=class{constructor(t){this.t=t,this.i=[],this.l=[]}get val(){return this.t}set val(e){let r=this;e!==r.t&&(r.u?e===r.u&&(r.u=n,t.delete(r)):((e=>{t=(t??(setTimeout(a),new Set)).add(e)})(r),r.u=r.t),r.t=e,r.l.forEach((t=>t())))}},l=t=>new i(t),u=(t,...e)=>e.flat(1/0).forEach((e=>{return t.appendChild((n=e).nodeType?n:n instanceof i?c(n,(t=>new Text(t))):new Text(n));var n})),o=new Proxy(((t,...n)=>{let[r,...s]=n[0]?.constructor===e?n:[{},...n],l=document.createElement(t);return e.entries(r).forEach((([t,e])=>{t.startsWith("on")?l[t]=e:e instanceof i?c(e,(e=>(l[t]=e,l))):l.setAttribute(t,e)})),u(l,...s),l}),{get:(t,e)=>t.bind(n,e)}),a=()=>{let e=[...t];t=n,new Set(e.flatMap((t=>t.i=t.i.filter((t=>t.o.isConnected))))).forEach((t=>{let{o:e,h:n,m:s}=t,i=s(...n.map((t=>t.t)),e,...n.map((t=>t.u)));i!==e&&(i!==r?e.replaceWith(i):e.remove(),t.o=i)})),e.forEach((t=>t.u=n))},c=(...t)=>{let e=t.slice(0,-1),n=t[t.length-1],s=n(...e.map((t=>t.t)));if(s===r)return[];if(s.nodeType){let t={h:e,o:s,m:n};return e.forEach((e=>e.i.push(t))),s}let i=l(s),u=()=>i.val=n(...e.map((t=>t.t)),i.t,...e.map((t=>t.u)));return e.forEach((t=>t.l.push(u))),i},window.van={add:u,tags:o,state:l,bind:c,empty:s};}