@verajs/renderer 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +975 -27
- package/dist/development/vera-renderer-hydrate.d.ts +32 -13
- package/dist/development/vera-renderer-hydrate.d.ts.map +1 -1
- package/dist/development/vera-renderer-hydrate.js +1786 -231
- package/dist/development/vera-renderer-hydrate.js.map +1 -1
- package/dist/development/vera-renderer-keyed.d.ts +17 -0
- package/dist/development/vera-renderer-keyed.d.ts.map +1 -0
- package/dist/development/vera-renderer-keyed.js +322 -0
- package/dist/development/vera-renderer-keyed.js.map +1 -0
- package/dist/development/vera-renderer-profiler.d.ts +57 -17
- package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
- package/dist/development/vera-renderer-profiler.js +1419 -206
- package/dist/development/vera-renderer-profiler.js.map +1 -1
- package/dist/development/vera-renderer-slots.d.ts +103 -0
- package/dist/development/vera-renderer-slots.d.ts.map +1 -0
- package/dist/development/vera-renderer-slots.js +1387 -0
- package/dist/development/vera-renderer-slots.js.map +1 -0
- package/dist/development/vera-renderer-spread.d.ts +51 -0
- package/dist/development/vera-renderer-spread.d.ts.map +1 -0
- package/dist/development/vera-renderer-spread.js +499 -0
- package/dist/development/vera-renderer-spread.js.map +1 -0
- package/dist/development/vera-renderer-tag.d.ts +61 -0
- package/dist/development/vera-renderer-tag.d.ts.map +1 -0
- package/dist/development/vera-renderer-tag.js +727 -0
- package/dist/development/vera-renderer-tag.js.map +1 -0
- package/dist/development/vera-renderer.d.ts +41 -16
- package/dist/development/vera-renderer.d.ts.map +1 -1
- package/dist/development/vera-renderer.js +1349 -197
- package/dist/development/vera-renderer.js.map +1 -1
- package/dist/vera-renderer-hydrate.min.js +1 -1
- package/dist/vera-renderer-hydrate.min.js.map +1 -1
- package/dist/vera-renderer-keyed.min.js +2 -0
- package/dist/vera-renderer-keyed.min.js.map +1 -0
- package/dist/vera-renderer-slots.min.js +2 -0
- package/dist/vera-renderer-slots.min.js.map +1 -0
- package/dist/vera-renderer-spread.min.js +2 -0
- package/dist/vera-renderer-spread.min.js.map +1 -0
- package/dist/vera-renderer-tag.min.js +2 -0
- package/dist/vera-renderer-tag.min.js.map +1 -0
- package/dist/vera-renderer.min.js +1 -1
- package/dist/vera-renderer.min.js.map +1 -1
- package/package.json +24 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=(t,s)=>(s.key=t,s),s=t=>({$h:t}),i="$v"+(1e9*Math.random()>>>0).toString(36)+"$",e="?"+i,n=document,l=(t="")=>n.createComment(t),h=n.createTreeWalker(n,129),o=n.createTreeWalker(n,5),r=/^(?:script|style|textarea|title)$/i,c=/[\s"'>=/]/,f=new WeakMap;class u{t;i=[];constructor(t){const s=t._$litType$??1,{markup:f,specs:u}=(t=>{const s=[];let e="",n=0,l="",h=0,o="",f=0,u=!1,_="",a=[],d="";const p=t=>{let s=t;for(;s>0&&!c.test(e[s-1]);)s--;return e.slice(s,t)};for(let c=0;c<t.length;c++){const m=t[c];let v=0;for(;v<m.length;){const t=m[v];if(5===n){if(t===l||""===l&&(" "===t||"\t"===t||"\n"===t||"\r"===t||">"===t||"/"===t)){a.push(d);const t=l||'"';e+=` ${s.length}${i}=${t}${a.join(i)}${t}`,s.push({l:1,h:_}),n=1,""!==l&&v++;continue}d+=t,v++}else if(0===n){if("<"===t){if(m.startsWith("!--",v+1)){n=3,e+="\x3c!--",v+=4;continue}u="/"===m[v+1],f=e.length+(u?2:1),n=1}e+=t,v++}else if(1===n){if('"'===t||"'"===t)l=t,h=e.length,n=2;else if(">"===t){const t=e.slice(f).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";u||!r.test(t)||e.endsWith("/")?n=0:(o=t.toLowerCase(),n=4)}e+=t,v++}else if(2===n)t===l&&(n=1),e+=t,v++;else if(3===n){if("-"===t&&m.startsWith("->",v+1)){e+="--\x3e",v+=3,n=0;continue}e+=t,v++}else"<"===t&&m.slice(v+1,v+2+o.length).toLowerCase()==="/"+o&&(v+2+o.length>=m.length||/[\s/>]/.test(m[v+2+o.length]))&&(u=!0,f=e.length+2,n=1),e+=t,v++}if(c===t.length-1)break;if(0===n)e+=`<?${i}>`,s.push({l:0});else if(4===n)e+=i,s.push({l:0});else if(3===n)s.push({l:2});else if(5===n)a.push(d),d="";else if(2===n){const t="="===e[h-1]?p(h-1):"";t?(_=t,a=[e.slice(h+1)],d="",e=e.slice(0,h-1-t.length),n=5):s.push({l:2})}else{const t=e.endsWith("=")?p(e.length-1):"";t?(_=t,a=[""],d="",l="",e=e.slice(0,e.length-1-t.length),n=5):(e+=` ${s.length}${i}="${i}"`,s.push({l:1,h:"&"}))}}return{markup:e,specs:s}})(t.strings);this.t=n.createElement("template"),this.t.innerHTML=2===s?`<svg>${f}</svg>`:3===s?`<math>${f}</math>`:f;const _=this.t.content;if(1!==s){const t=_.firstChild;for(;t.firstChild;)_.insertBefore(t.firstChild,t);_.removeChild(t)}h.currentNode=_;let a,d=0;const p=this.i,m=()=>{for(;d<u.length&&2===u[d].l;)p.push({l:2,o:-1}),d++};for(m();d<u.length&&null!==(a=h.nextNode());)if(1===a.nodeType){const t=a;if(t.hasAttributes())for(const s of t.getAttributeNames())if(s.endsWith(i)){const e=u[d++];p.push({l:1,o:-1,h:e.h,u:t.getAttribute(s).split(i),_:t}),t.removeAttribute(s),m()}if(r.test(t.tagName)&&t.textContent.includes(i)){const s=t.textContent.split(i);t.textContent="";for(let i=0;i<s.length-1;i++)s[i]&&t.append(s[i]),t.append(l(e));s[s.length-1]&&t.append(s[s.length-1])}}else if(a.data===e){d++;const t=n.createTextNode("");a.parentNode.insertBefore(t,a),h.currentNode=t,a.remove(),p.push({l:0,o:-1,_:t}),m()}o.currentNode=_;let v=-1,y=0;for(;y<p.length&&2===p[y].l;)y++;for(;y<p.length&&null!==(a=o.nextNode());)for(v++;y<p.length&&p[y]._===a;)for(p[y].o=v,y++;y<p.length&&2===p[y].l;)y++;for(const t of p)t._=void 0}}const _=t=>{let s=f.get(t.strings);return void 0===s&&f.set(t.strings,s=new u(t)),s},a={p:(t,s)=>s+1},d={},p=n.createDocumentFragment(),m=(t,s)=>{const i=l(),e=l();return t.insertBefore(i,s),t.insertBefore(e,s),new x(i,e)},v=t=>null==t?"":String(t);class y{t;h;u;m;v;$;k=d;M=null;constructor(t,s,i){const e=s[0];let n="."===e?1:"?"===e?2:"@"===e?3:"&"===e?4:0,l=n?s.slice(1):s;0===n&&"o"===e&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(n=3,l=s.slice(2).toLowerCase()),this.v=n,this.h=l,this.t=t,this.u=i,this.m=i.length-1,this.$=1===this.m&&""===i[0]&&""===i[1]}handleEvent(t){this.M&&this.M.call(this.t,t)}p(t,s){const i=this.v;let e;if(this.$||i>=3)e=t[s];else{const i=this.u;let n=i[0];for(let e=0;e<this.m;e++)n+=v(t[s+e])+i[e+1];e=n}if(e!==this.k){const t=this.k===d;if(this.k=e,0===i)null==e?t||this.t.removeAttribute(this.h):this.t.setAttribute(this.h,e);else if(1===i)this.t[this.h]=e;else if(2===i)t&&!e||this.t.toggleAttribute(this.h,!!e);else if(3===i)null===this.M&&null!=e&&this.t.addEventListener(this.h,this),this.M=e??null;else if(null!=e)if("function"==typeof e)e(this.t);else if("object"==typeof e){const t=e;t._$apply$?t._$apply$(this.t,this):t.value=this.t}}return s+this.m}}class w{i=[];j;constructor(t){this.j=t.t.content.cloneNode(!0);const s=t.i;o.currentNode=this.j;let i=-1,e=null;for(let t=0;t<s.length;t++){const n=s[t];if(2!==n.l){for(;i<n.o;)e=o.nextNode(),i++;this.i.push(0===n.l?new $(e):new y(e,n.h,n.u))}else this.i.push(a)}}A(t){let s=0;const i=this.i;for(let e=0;e<i.length;e++)s=i[e].p(t,s)}}class ${I;S="";L=null;constructor(t){this.I=t}p(t,s){const i=t[s];if(null!==this.L)return this.L.W(i),s+1;if(null==i||"object"==typeof i){const t=l(),e=l(),n=this.I.parentNode;n.insertBefore(t,this.I),n.insertBefore(e,this.I.nextSibling);const h=new x(t,e);return h.F=k,h.I=this.I,h.S=this.S,this.L=h,h.W(i),s+1}return i!==this.S&&(this.S=i,this.I.data=i),s+1}}const k=1;class x{H;N;F=0;S;I=null;V=null;Z=null;q=null;B=!1;C=null;constructor(t,s){this.H=t,this.N=s}p(t,s){return this.W(t[s]),s+1}D(t){this.H.parentNode.insertBefore(t,this.N)}G(){const t=this.H.parentNode,s=this.N;if(null!==this.H.previousSibling||null!==s&&null!==s.nextSibling){let s=this.H.nextSibling;for(;null!==s&&s!==this.N;){const i=s.nextSibling;t.removeChild(s),s=i}}else t.textContent="",t.appendChild(this.H),null!==s&&t.appendChild(s);this.F=0,this.I=null,this.V=null,this.q=null,this.Z=null}W(t){if(null==t)return void(0!==this.F&&this.G());if("object"!=typeof t)return void(this.F===k?this.S!==t&&(this.S=t,this.I.data=t):(0!==this.F&&this.G(),this.I=n.createTextNode(t),this.D(this.I),this.S=t,this.F=k));const s=t.$h;if(void 0===s){if((t=>void 0!==t.strings)(t)){if(this.Z===t.strings)return void this.V.A(t.values);const s=_(t);0!==this.F&&this.G();const i=new w(s);return i.A(t.values),this.D(i.j),this.V=i,this.Z=t.strings,void(this.F=2)}Array.isArray(t)?this.J(t):"function"!=typeof t[Symbol.iterator]?this.W(String(t)):this.J([...t])}else this.K(s)}K(t){if(2===this.F&&this.Z===t.strings)return void this.V.A(t.values);const s=this.C??=new Map;if(2===this.F){const t=this.V.j;let i=this.H.nextSibling;for(;i!==this.N;){const s=i.nextSibling;t.appendChild(i),i=s}s.set(this.Z,this.V)}else 0!==this.F&&this.G();const i=s.get(t.strings)??new w(_(t));i.A(t.values),this.D(i.j),this.V=i,this.Z=t.strings,this.F=2}O(t,s,i){if(null!==t&&"object"==typeof t&&void 0!==t.strings){const e=t,n=_(e),l=new w(n);l.A(e.values);const h=l.j.firstChild;if(null!==h&&1===h.nodeType&&null===h.nextSibling)return s.insertBefore(h,i),{P:e.key,t:h,V:l,Z:e.strings,R:null};const o=m(s,i);return o.V=l,o.Z=e.strings,o.F=2,o.H.parentNode.insertBefore(l.j,o.N),{P:e.key,t:null,V:null,Z:null,R:o}}const e=m(s,i);return e.W(t),{P:t?.key,t:null,V:null,Z:null,R:e}}T(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.Z)return void t.V.A(s.values);const i=m(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.V=null,t.Z=null,void(t.R=i).W(s)}t.R.W(s)}U(t){return t.t??t.R.H}X(t,s,i=this.H.parentNode){if(null!==t.t)return void i.insertBefore(t.t,s);let e=t.R.H;const n=t.R.N.nextSibling;for(;e!==n;){const t=e.nextSibling;i.insertBefore(e,s),e=t}}Y(t){this.X(t,null,p),p.textContent=""}J(t){3!==this.F&&(0!==this.F&&this.G(),this.q=[],this.B=!1,this.F=3);const s=t.length;if(0===s)return void(this.q.length&&(this.G(),this.q=[],this.F=3));const i=null!=t[0]&&void 0!==t[0].key;i!==this.B&&this.q.length&&(this.G(),this.q=[],this.F=3),this.B=i;const e=this.q,l=this.H.parentNode;if(0===e.length){const i=n.createDocumentFragment();for(let n=0;n<s;n++)e.push(this.O(t[n],i,null));return void this.D(i)}if(!i){const i=e.length<s?e.length:s;for(let s=0;s<i;s++)this.T(e[s],t[s]);if(s>e.length){const i=n.createDocumentFragment();for(let n=e.length;n<s;n++)e.push(this.O(t[n],i,null));this.D(i)}else if(s<e.length){const t=e[e.length-1];let i=this.U(e[s]);const n=null!==t.t?t.t.nextSibling:t.R.N.nextSibling;for(;i!==n;){const t=i.nextSibling;l.removeChild(i),i=t}e.length=s}return}if(e.length===s){let i=0;for(;i<s&&e[i].P===t[i].key;)this.T(e[i],t[i]),i++;if(i===s)return}const h=e,o=new Array(s);for(let i=0;i<s;i++)o[i]=t[i].key;const r=new Array(s);let c,f,u=0,_=h.length-1,a=0,d=s-1;const p=t=>t<s&&void 0!==r[t]?this.U(r[t]):this.N;for(;u<=_&&a<=d;)if(null===h[u])u++;else if(null===h[_])_--;else if(h[u].P===o[a])this.T(r[a]=h[u],t[a]),u++,a++;else if(h[_].P===o[d])this.T(r[d]=h[_],t[d]),_--,d--;else if(h[u].P===o[d]){const s=h[u];this.X(s,p(d+1)),this.T(s,t[d]),r[d]=s,u++,d--}else if(h[_].P===o[a]){const s=h[_];this.X(s,this.U(h[u])),this.T(s,t[a]),r[a]=s,_--,a++}else{if(void 0===c){c=new Map;for(let t=a;t<=d;t++)c.set(o[t],t);f=new Map;for(let t=u;t<=_;t++)null!==h[t]&&f.set(h[t].P,t)}if(c.has(h[u].P))if(c.has(h[_].P)){const s=f.get(o[a]);if(void 0===s)r[a]=this.O(t[a],l,this.U(h[u]));else{const i=h[s];this.X(i,this.U(h[u])),this.T(i,t[a]),r[a]=i,h[s]=null}a++}else this.Y(h[_]),_--;else this.Y(h[u]),u++}for(;a<=d;)r[a]=this.O(t[a],l,p(d+1)),a++;for(;u<=_;){const t=h[u++];null!==t&&this.Y(t)}this.q=r}}const b=new WeakMap,g=(t,s)=>{let i=b.get(s);if(void 0===i){const t=l();s.appendChild(t),b.set(s,i=new x(t,null))}i.W(t)};export{s as hold,t as keyed,g as render};
|
|
1
|
+
const t=t=>null!=t&&"object"==typeof t&&g(t)?{$h:t}:t,s="$v"+(1e9*Math.random()>>>0).toString(36)+"$",i="?"+s,e=document,n=(t="")=>e.createComment(t),l=e.createTreeWalker(e,129),o=e.createTreeWalker(e,5),h=/^(?:script|style|textarea|title|iframe|noscript)$/i,r=/[\s"'>=/]/;let c=null;new Set;const f=new WeakMap;class u{t;i=[];constructor(t){const c=t._$litType$??1,{markup:f,specs:u}=(t=>{const i=[];let e="",n=0,l="",o=0,c="",f=0,u=!1,_="",a=[],d="";const p=t=>{let s=t;for(;s>0&&!r.test(e[s-1]);)s--;return e.slice(s,t)};for(let r=0;r<t.length;r++){const v=t[r];let m=0;for(;m<v.length;){const t=v[m];if(5===n){if(t===l||""===l&&(" "===t||"\t"===t||"\n"===t||"\r"===t||">"===t||"/"===t)){a.push(d);const t=l||'"';e+=` ${i.length}${s}=${t}${a.join(s)}${t}`,i.push({l:1,o:_}),n=1,""!==l&&m++;continue}d+=t,m++}else if(0===n){if("<"===t){if(v.startsWith("!--",m+1)){n=3,e+="\x3c!--",m+=4;continue}u="/"===v[m+1],f=e.length+(u?2:1),n=1}e+=t,m++}else if(1===n){if('"'===t||"'"===t)l=t,o=e.length,n=2;else if(">"===t){const t=e.slice(f).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";u||!h.test(t)||e.endsWith("/")?n=0:(c=t.toLowerCase(),n=4)}e+=t,m++}else if(2===n)t===l&&(n=1),e+=t,m++;else if(3===n){if("-"===t&&v.startsWith("->",m+1)){e+="--\x3e",m+=3,n=0;continue}e+=t,m++}else"<"===t&&v.slice(m+1,m+2+c.length).toLowerCase()==="/"+c&&(m+2+c.length>=v.length||/[\s/>]/.test(v[m+2+c.length]))&&(u=!0,f=e.length+2,n=1),e+=t,m++}if(r===t.length-1)break;if(0===n)e+=`<?${s}>`,i.push({l:0});else if(4===n)e+=s,i.push({l:0});else if(3===n)i.push({l:2});else if(5===n)a.push(d),d="";else if(2===n){const t="="===e[o-1]?p(o-1):"";t?(_=t,a=[e.slice(o+1)],d="",e=e.slice(0,o-1-t.length),n=5):i.push({l:2})}else{const t=e.endsWith("=")?p(e.length-1):"";t?(_=t,a=[""],d="",l="",e=e.slice(0,e.length-1-t.length),n=5):(e+=` ${i.length}${s}="${s}"`,i.push({l:1,o:"&"}))}}return{markup:e,specs:i}})(t.strings);this.t=e.createElement("template"),this.t.innerHTML=2===c?`<svg>${f}</svg>`:3===c?`<math>${f}</math>`:f;const _=this.t.content;if(1!==c){const t=_.firstChild;for(;t.firstChild;)_.insertBefore(t.firstChild,t);_.removeChild(t)}l.currentNode=_;let a,d=0;const p=this.i,v=()=>{for(;d<u.length&&2===u[d].l;)p.push({l:2,h:-1}),d++};for(v();d<u.length&&null!==(a=l.nextNode());)if(1===a.nodeType){const t=a;if(t.hasAttributes())for(const i of t.getAttributeNames())if(i.endsWith(s)){const e=parseInt(i,10);if(e>d)do{p.push({l:2,h:-1})}while(++d<e);const n=u[d++];p.push({l:1,h:-1,o:n.o,u:t.getAttribute(i).split(s),_:t.hasAttribute(n.o),p:t}),t.removeAttribute(i),v()}if(h.test(t.tagName)&&t.textContent.includes(s)){const e=t.textContent.split(s);t.textContent="";for(let s=0;s<e.length-1;s++)e[s]&&t.append(e[s]),t.append(n(i));e[e.length-1]&&t.append(e[e.length-1])}}else if(a.data===i){d++;const t=e.createTextNode("");a.parentNode.insertBefore(t,a),l.currentNode=t,a.remove(),p.push({l:0,h:-1,p:t}),v()}o.currentNode=_;let m=-1,y=0;for(;y<p.length&&2===p[y].l;)y++;for(;y<p.length&&null!==(a=o.nextNode());)for(m++;y<p.length&&p[y].p===a;)for(p[y].h=m,y++;y<p.length&&2===p[y].l;)y++;for(const t of p)t.p=void 0;const $=L();if(void 0!==$){o.currentNode=_;let t=-1;for(;null!==(a=o.nextNode());)t++,"slot"===a.localName&&(this.v=$,(this.m??=[]).push(t))}}}const _=t=>{let s=f.get(t.strings);return void 0===s&&f.set(t.strings,s=new u(t)),s},a={$:(t,s)=>s+1},d={},p=(t,s)=>{const i=n(),e=n();return t.insertBefore(i,s),t.insertBefore(e,s),new F(i,e)},v=t=>null==t?"":`${t}`,m=(t,s)=>{try{t(s)}catch(t){console.error("[vera] ref threw",t)}};class y{t;o;u;m;j;k;S=d;A=null;M=!1;_;constructor(t,s,i,e=!1){const n=s[0];let l="."===n?1:"?"===n?2:"@"===n?4:"&"===n?5:"!"===n?3:0,o=l?s.slice(1):s;1!==l&&3!==l||"__proto__"!==o||(l=-1),0===l&&"o"===n&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(l=4,o=s.slice(2).toLowerCase()),this.j=l,this.o=o,this.t=t,this.u=i,this.m=i.length-1,this.k=1===this.m&&""===i[0]&&""===i[1],this.M=1===l&&"value"===o&&"select"===t.localName,this._=e}L(){const t=this.S;"function"==typeof t?m(t,null):null!==t&&"object"==typeof t&&void 0===t._$apply$&&(t.value=null),this.S=d}handleEvent(t){const s=this.A;"function"==typeof s?s.call(this.t,t):"function"==typeof s?.handleEvent&&s.handleEvent(t)}$(t,s,i){const e=this.j;if(-1===e)return s+this.m;let n;if(this.k||e>=4)n=t[s];else{const i=this.u;let e=i[0];for(let n=0;n<this.m;n++)e+=v(t[s+n])+i[n+1];n=e}if(3===e){this.S=n;{const t=this.t;t[this.o]!==n&&(t[this.o]=n)}return s+this.m}if(this.M)return this.S=n,($??=[]).push(this.t,n),s+this.m;if(n!==this.S){if(0===e)null==n?(this._||this.S!==d)&&this.t.removeAttribute(this.o):this.t.setAttribute(this.o,n);else if(1===e)this.t[this.o]=n;else if(2===e)this.t.toggleAttribute(this.o,!!n);else if(4===e)null===this.A&&null!=n&&this.t.addEventListener(this.o,this),this.A=n??null;else if(null!=n)if(z=!0,"function"==typeof n)m(n,this.t);else if("object"==typeof n){const t=n;t._$apply$?t._$apply$(this.t,this):t.value=this.t}this.S=n}return s+this.m}}let $=null;const w=e.createDocumentFragment(),b={value:!0,enumerable:!1,configurable:!0,writable:!0},j=(t,s=!0)=>{if(b.value=s,11!==t.nodeType)Object.defineProperty(t,"_$own$",b);else for(let s=t.firstChild;null!==s;s=s.nextSibling)Object.defineProperty(s,"_$own$",b)},k=t=>{t.W?.O(),t.H?.F()};class x{i=[];I;constructor(t){this.I=e.importNode(t.t.content,!0);const s=t.i;o.currentNode=this.I;let i=-1,n=null;for(let t=0;t<s.length;t++){const e=s[t];if(2!==e.l){for(;i<e.h;)n=o.nextNode(),i++;this.i.push(0===e.l?new S(n):new y(n,e.o,e.u,e._))}else this.i.push(a)}if(void 0!==t.v&&null!==c){const s=t.m;o.currentNode=this.I,i=-1;const e=[];for(let t=0;t<s.length;t++){for(;i<s[t];)n=o.nextNode(),i++;e.push(n)}this.V=e}}O(){const t=this.i;for(let s=0;s<t.length;s++){const i=t[s];5===i.j&&i.L(),i.Z?.F()}this.q?.forEach((t=>t._$park$?.()))}B(t){let s=0;const i=this.i;for(let e=0;e<i.length;e++)s=i[e].$(t,s);void 0!==this.V&&this.C()}C(){const t=this.V;this.V=void 0;const s=c,i=L();if(void 0!==i&&null!==s)for(let e=0;e<t.length;e++){const n=t[e],l=i(n,s,n.getAttribute("name")??"");null!=l&&((this.q??=[]).push(l),z=!0)}}}const g=t=>void 0!==t.strings;class S{D;G="";Z=null;constructor(t){this.D=t}$(t,s){const i=t[s];if(null!==this.Z)return this.Z.J(i),s+1;if(null==i||"object"==typeof i){const t=n(),e=n(),l=L()?._$home$?.(this.D)??null,o=null!==l?l.parentNode:this.D.parentNode;null!==l?(o.insertBefore(t,l),o.insertBefore(e,l)):(o.insertBefore(t,this.D),o.insertBefore(e,this.D.nextSibling));const h=new F(t,e);return h.K=E,h.D=this.D,h.G=this.G,this.Z=h,h.J(i),s+1}return i!==this.G&&(this.G=i,this.D.data=i),s+1}}let A=null,M=!1;const L=()=>{const t=A?.get("slot")?.[0];return void 0!==t&&(M=!0),t},O=[],W=[];let z=!1;const E=1;class F{N;P;K=0;G;D=null;W=null;R=null;T=null;U=!1;X=null;Y=void 0;tt=void 0;constructor(t,s){this.N=t,this.P=s}$(t,s){return this.J(t[s]),s+1}st(t){const s=this.N.parentNode;M&&!0===s._$hosted$&&j(t,null===this.P||this),s.insertBefore(t,this.P)}F(){void 0!==this.tt&&this.tt._$detach$?.(this.Y),this.W?.O();const t=this.T;if(null!=t)for(let s=0;s<t.length;s++)k(t[s])}it(){z&&this.F();const t=this.N.parentNode,s=this.P,i=this.T;if(this.N.nextSibling===s&&0!==this.K)if(null!==i){for(const t of i)null!==t&&this.$m(t,null,w);w.textContent=""}else if(this.K===E)this.D?.remove();else if(2===this.K){if(Array.isArray(this.G))for(const t of this.G)t.remove()}else 4===this.K&&"function"==typeof this.G.remove&&this.G.remove();else if(null!==this.N.previousSibling||null!==s&&null!==s.nextSibling){let s=this.N.nextSibling;for(;null!==s&&s!==this.P;){const i=s.nextSibling;t.removeChild(s),s=i}}else t.textContent="",t.appendChild(this.N),null!==s&&t.appendChild(s);this.K=0,this.D=null,this.W=null,this.T=null,this.R=null,this.Y=void 0,this.tt=void 0}_$commit$(t){const s=this.Y,i=this.tt;this.J(t),this.Y=s,this.tt=i}J(t){if(null==t)return void(0!==this.K&&this.it());if("object"!=typeof t)return void(this.K===E?this.G!==t&&(this.G=t,this.D.data=t):(0!==this.K&&this.it(),this.D=e.createTextNode(t),this.st(this.D),this.G=t,this.K=E));const s=t.$h;if(void 0!==s)return void this.et(s);if(g(t)){if(this.R===t.strings)return void this.W.B(t.values);const s=_(t);0!==this.K&&this.it();const i=new x(s);return i.B(t.values),this.G=[...i.I.childNodes],this.st(i.I),this.W=i,this.R=t.strings,void(this.K=2)}const i=A?A.get("value")??O:O;for(let s=0;s<i.length;s++)if(i[s](this,t))return;for(let s=0;s<W.length;s++)if(W[s](this,t))return;const n=t._$child$;if(void 0!==n){const s=this.tt===n?this.Y:void 0;return this.tt=n,void 0!==n._$detach$&&(z=!0),void(this.Y=n.call(t,this,s))}void 0===t.nodeType?this.J(String(t)):4===this.K&&this.G===t||(0!==this.K&&this.it(),this.st(t),this.G=t,this.K=4)}et(t){if(2===this.K&&this.R===t.strings)return void this.W.B(t.values);const s=this.X??=new Map;if(2===this.K){const t=this.W.I;if(this.N.nextSibling===this.P&&Array.isArray(this.G))for(const s of this.G)t.appendChild(s);else{let s=this.N.nextSibling;for(;s!==this.P;){const i=s.nextSibling;t.appendChild(s),s=i}}s.set(this.R,this.W)}else 0!==this.K&&this.it();const i=s.get(t.strings)??new x(_(t));i.B(t.values),this.G=[...i.I.childNodes],this.st(i.I),this.W=i,this.R=t.strings,this.K=2}$c(t,s,i){const e=M&&!0===s._$hosted$?null===this.P||this:null;if(null!==t&&"object"==typeof t&&void 0!==t.strings){const n=t,l=_(n),o=new x(l);o.B(n.values);const h=o.I.firstChild;if(null!==h&&1===h.nodeType&&null===h.nextSibling)return null!==e&&j(h,e),s.insertBefore(h,i),{$k:n.key,t:h,W:o,R:n.strings,H:null};const r=p(s,i);return r.W=o,r.R=n.strings,r.K=2,r.G=[...o.I.childNodes],null!==e&&j(o.I,e),r.N.parentNode.insertBefore(o.I,r.P),{$k:n.key,t:null,W:null,R:null,H:r}}const n=p(s,i);return n.J(t),{$k:t?.key,t:null,W:null,R:null,H:n}}$u(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.R)return void t.W.B(s.values);const i=p(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.W=null,t.R=null,void(t.H=i).J(s)}t.H.J(s)}$f(t){return t.t??t.H.N}$m(t,s,i=this.N.parentNode){const e=t.t??t.H.P;if(e.nextSibling===s&&e.parentNode===i)return;if(null!==t.t)return void i.insertBefore(t.t,s);let n=t.H.N;const l=t.H.P.nextSibling;for(;n!==l;){const t=n.nextSibling;i.insertBefore(n,s),n=t}}$d(t){z&&k(t),this.$m(t,null,w),w.textContent=""}nt(t){3!==this.K&&(0!==this.K&&this.it(),this.T=[],this.U=!1,this.K=3);const s=t.length;if(0===s)return void(this.T.length&&(this.it(),this.T=[],this.K=3));const i=null!=t[0]&&void 0!==t[0].$r;i!==this.U&&this.T.length&&(this.it(),this.T=[],this.K=3),this.U=i;const n=this.T;if(0!==n.length)if(i)this.T=t[0].$r(this,t,n,this.N.parentNode,this.P);else{const i=n.length<s?n.length:s;for(let s=0;s<i;s++)this.$u(n[s],t[s]);if(s>n.length){const i=e.createDocumentFragment();for(let e=n.length;e<s;e++)n.push(this.$c(t[e],i,null));this.st(i)}else if(s<n.length){if(z)for(let t=s;t<n.length;t++)k(n[t]);for(let t=s;t<n.length;t++)this.$m(n[t],null,w);w.textContent="",n.length=s}}else{const i=e.createDocumentFragment();for(let e=0;e<s;e++)n.push(this.$c(t[e],i,null));this.st(i)}}}const H=new WeakMap,I=(t,s)=>{let i=H.get(s);if(void 0===i){const t=n();s.appendChild(t),1===s.nodeType&&L()?._$capture$?.(s,t),H.set(s,i=new F(t,null))}c=s;try{i.J(t)}finally{c=null,(()=>{const t=$;if(null!==t){$=null;for(let s=0;s<t.length;s+=2)t[s].value=t[s+1]}})()}};W.push(((t,s)=>Array.isArray(s)?(t.nt(s),!0):null!==s&&"function"==typeof s[Symbol.iterator]&&(t.nt([...s]),!0)));const V={name:"@verajs/renderer",on:"render",fn:I,priority:50,connect:t=>{A=t}};export{t as hold,I as renderInto,V as renderer};
|
|
2
2
|
//# sourceMappingURL=vera-renderer.min.js.map
|