-
Notifications
You must be signed in to change notification settings - Fork 96
/
van-0.11.6.min.js
1 lines (1 loc) · 1.17 KB
/
van-0.11.6.min.js
1
let e,t,n,l=Object,d=Object.getPrototypeOf,r=(e,t,n,l)=>(e??(setTimeout(n,l),new Set)).add(t),s={get val(){return this.t},set val(e){let n=this,l=n.t;e!==l&&(n.l===l?t=r(t,n,c):e===n.l&&t.delete(n),n.t=e,n.o.forEach((t=>t(e,l))))},onnew(e){this.o.push(e)}},o=d(s),i=e=>e.nodeType?e:new Text(e),u=(e,...t)=>t.flat(1/0).forEach((t=>e.appendChild(d(t)===s?w(t,(e=>e)):i(t)))),a=new Proxy(((e,...t)=>{let[n,...r]=d(t[0]??0)===o?t:[{},...t],i=document.createElement(e);return l.entries(n).forEach((([e,t])=>{let n=void 0!==i[e]?t=>i[e]=t:t=>i.setAttribute(e,t);d(t)===s?w(t,(e=>(n(e),i))):d(t)===o?w(...t.deps,((...e)=>(n(t.f(...e)),i))):n(t)})),u(i,...r),i}),{get:(t,n)=>t.bind(e,n)}),_=e=>e.i=e.i.filter((e=>e.u?.isConnected)),c=()=>{let n=[...t];t=e,new Set(n.flatMap(_)).forEach((t=>{let{_:n,u:l,g:d}=t,r=d(...n.map((e=>e.t)),l,...n.map((e=>e.l)));r!==l&&(r!=e?l.replaceWith(t.u=i(r)):(l.remove(),t.u=e))})),n.forEach((e=>e.l=e.t))},w=(...t)=>{let l=t.slice(0,-1),d=t[t.length-1],s=d(...l.map((e=>e.t)));if(s==e)return[];let o={_:l,u:i(s),g:d};return l.forEach((t=>{n=r(n,t,(()=>(n.forEach(_),n=e)),1e3),t.i.push(o)})),o.u};export default{add:u,tags:a,state:e=>({__proto__:s,t:e,l:e,i:[],o:[]}),bind:w};