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