@verajs/renderer 0.1.5 → 0.2.1
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 +1063 -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 +1959 -269
- 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 +1592 -244
- 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 +41 -0
- package/dist/development/vera-renderer-spread.d.ts.map +1 -0
- package/dist/development/vera-renderer-spread.js +633 -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 +829 -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 +1522 -235
- 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}),e="$v"+(1e9*Math.random()>>>0).toString(36)+"$",i="?"+e,n=document,l=(t="")=>n.createComment(t),o=n.createTreeWalker(n,129),h=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 i="",n=0,l="",o=0,h="",f=0,u=!1,_="",a=[],p="";const d=t=>{let s=t;for(;s>0&&!c.test(i[s-1]);)s--;return i.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(p);const t=l||'"';i+=` ${s.length}${e}=${t}${a.join(e)}${t}`,s.push({l:1,o:_}),n=1,""!==l&&v++;continue}p+=t,v++}else if(0===n){if("<"===t){if(m.startsWith("!--",v+1)){n=3,i+="\x3c!--",v+=4;continue}u="/"===m[v+1],f=i.length+(u?2:1),n=1}i+=t,v++}else if(1===n){if('"'===t||"'"===t)l=t,o=i.length,n=2;else if(">"===t){const t=i.slice(f).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";u||!r.test(t)||i.endsWith("/")?n=0:(h=t.toLowerCase(),n=4)}i+=t,v++}else if(2===n)t===l&&(n=1),i+=t,v++;else if(3===n){if("-"===t&&m.startsWith("->",v+1)){i+="--\x3e",v+=3,n=0;continue}i+=t,v++}else"<"===t&&m.slice(v+1,v+2+h.length).toLowerCase()==="/"+h&&(v+2+h.length>=m.length||/[\s/>]/.test(m[v+2+h.length]))&&(u=!0,f=i.length+2,n=1),i+=t,v++}if(c===t.length-1)break;if(0===n)i+=`<?${e}>`,s.push({l:0});else if(4===n)i+=e,s.push({l:0});else if(3===n)s.push({l:2});else if(5===n)a.push(p),p="";else if(2===n){const t="="===i[o-1]?d(o-1):"";t?(_=t,a=[i.slice(o+1)],p="",i=i.slice(0,o-1-t.length),n=5):s.push({l:2})}else{const t=i.endsWith("=")?d(i.length-1):"";t?(_=t,a=[""],p="",l="",i=i.slice(0,i.length-1-t.length),n=5):(i+=` ${s.length}${e}="${e}"`,s.push({l:1,o:"&"}))}}return{markup:i,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)}o.currentNode=_;let a,p=0;const d=this.i,m=()=>{for(;p<u.length&&2===u[p].l;)d.push({l:2,h:-1}),p++};for(m();p<u.length&&null!==(a=o.nextNode());)if(1===a.nodeType){const t=a;if(t.hasAttributes())for(const s of t.getAttributeNames())if(s.endsWith(e)){const i=u[p++];d.push({l:1,h:-1,o:i.o,u:t.getAttribute(s).split(e),_:t}),t.removeAttribute(s),m()}if(r.test(t.tagName)&&t.textContent.includes(e)){const s=t.textContent.split(e);t.textContent="";for(let e=0;e<s.length-1;e++)s[e]&&t.append(s[e]),t.append(l(i));s[s.length-1]&&t.append(s[s.length-1])}}else if(a.data===i){p++;const t=n.createTextNode("");a.parentNode.insertBefore(t,a),o.currentNode=t,a.remove(),d.push({l:0,h:-1,_:t}),m()}h.currentNode=_;let v=-1,y=0;for(;y<d.length&&2===d[y].l;)y++;for(;y<d.length&&null!==(a=h.nextNode());)for(v++;y<d.length&&d[y]._===a;)for(d[y].h=v,y++;y<d.length&&2===d[y].l;)y++;for(const t of d)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},p={},d=n.createDocumentFragment(),m=(t,s)=>{const e=l(),i=l();return t.insertBefore(e,s),t.insertBefore(i,s),new b(e,i)},v=t=>null==t?"":String(t);class y{t;o;u;m;v;$;k=p;j=null;constructor(t,s,e){const i=s[0];let n="."===i?1:"?"===i?2:"@"===i?3:"&"===i?4:0,l=n?s.slice(1):s;0===n&&"o"===i&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(n=3,l=s.slice(2).toLowerCase()),this.v=n,this.o=l,this.t=t,this.u=e,this.m=e.length-1,this.$=1===this.m&&""===e[0]&&""===e[1]}handleEvent(t){this.j&&this.j.call(this.t,t)}p(t,s){const e=this.v;let i;if(this.$||e>=3)i=t[s];else{const e=this.u;let n=e[0];for(let i=0;i<this.m;i++)n+=v(t[s+i])+e[i+1];i=n}if(i!==this.k){const t=this.k===p;if(this.k=i,0===e)null==i?t||this.t.removeAttribute(this.o):this.t.setAttribute(this.o,i);else if(1===e)this.t[this.o]=i;else if(2===e)t&&!i||this.t.toggleAttribute(this.o,!!i);else if(3===e)null===this.j&&null!=i&&this.t.addEventListener(this.o,this),this.j=i??null;else if(null!=i)if("function"==typeof i)i(this.t);else if("object"==typeof i){const t=i;t._$apply$?t._$apply$(this.t,this):t.value=this.t}}return s+this.m}}class w{i=[];I;constructor(t){this.I=t.t.content.cloneNode(!0);const s=t.i;h.currentNode=this.I;let e=-1,i=null;for(let t=0;t<s.length;t++){const n=s[t];if(2!==n.l){for(;e<n.h;)i=h.nextNode(),e++;this.i.push(0===n.l?new k(i):new y(i,n.o,n.u))}else this.i.push(a)}}M(t){let s=0;const e=this.i;for(let i=0;i<e.length;i++)s=e[i].p(t,s)}}const $=t=>void 0!==t.strings;class k{A;S="";W=null;constructor(t){this.A=t}p(t,s){const e=t[s];if(null!==this.W)return this.W.L(e),s+1;if(null==e||"object"==typeof e){const t=l(),i=l(),n=this.A.parentNode;n.insertBefore(t,this.A),n.insertBefore(i,this.A.nextSibling);const o=new b(t,i);return o.F=x,o.A=this.A,o.S=this.S,this.W=o,o.L(e),s+1}return e!==this.S&&(this.S=e,this.A.data=e),s+1}}const x=1;class b{H;N;F=0;S;A=null;O=null;V=null;Z=null;q=!1;B=null;constructor(t,s){this.H=t,this.N=s}p(t,s){return this.L(t[s]),s+1}C(t){this.H.parentNode.insertBefore(t,this.N)}D(){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 e=s.nextSibling;t.removeChild(s),s=e}}else t.textContent="",t.appendChild(this.H),null!==s&&t.appendChild(s);this.F=0,this.A=null,this.O=null,this.Z=null,this.V=null}L(t){if(null==t)return void(0!==this.F&&this.D());if("object"!=typeof t)return void(this.F===x?this.S!==t&&(this.S=t,this.A.data=t):(0!==this.F&&this.D(),this.A=n.createTextNode(t),this.C(this.A),this.S=t,this.F=x));const s=t.$h;if(void 0===s){if($(t)){if(this.V===t.strings)return void this.O.M(t.values);const s=_(t);0!==this.F&&this.D();const e=new w(s);return e.M(t.values),this.C(e.I),this.O=e,this.V=t.strings,void(this.F=2)}Array.isArray(t)?this.G(t):"function"!=typeof t[Symbol.iterator]?this.L(String(t)):this.G([...t])}else this.J(s)}J(t){if(2===this.F&&this.V===t.strings)return void this.O.M(t.values);const s=this.B??=new Map;if(2===this.F){const t=this.O.I;let e=this.H.nextSibling;for(;e!==this.N;){const s=e.nextSibling;t.appendChild(e),e=s}s.set(this.V,this.O)}else 0!==this.F&&this.D();const e=s.get(t.strings)??new w(_(t));e.M(t.values),this.C(e.I),this.O=e,this.V=t.strings,this.F=2}K(t,s,e){if(null!==t&&"object"==typeof t&&void 0!==t.strings){const i=t,n=_(i),l=new w(n);l.M(i.values);const o=l.I.firstChild;if(null!==o&&1===o.nodeType&&null===o.nextSibling)return s.insertBefore(o,e),{P:i.key,t:o,O:l,V:i.strings,R:null};const h=m(s,e);return h.O=l,h.V=i.strings,h.F=2,h.H.parentNode.insertBefore(l.I,h.N),{P:i.key,t:null,O:null,V:null,R:h}}const i=m(s,e);return i.L(t),{P:t?.key,t:null,O:null,V:null,R:i}}T(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.V)return void t.O.M(s.values);const e=m(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.O=null,t.V=null,void(t.R=e).L(s)}t.R.L(s)}U(t){return t.t??t.R.H}X(t,s,e=this.H.parentNode){if(null!==t.t)return void e.insertBefore(t.t,s);let i=t.R.H;const n=t.R.N.nextSibling;for(;i!==n;){const t=i.nextSibling;e.insertBefore(i,s),i=t}}Y(t){this.X(t,null,d),d.textContent=""}G(t){3!==this.F&&(0!==this.F&&this.D(),this.Z=[],this.q=!1,this.F=3);const s=t.length;if(0===s)return void(this.Z.length&&(this.D(),this.Z=[],this.F=3));const e=null!=t[0]&&void 0!==t[0].key;e!==this.q&&this.Z.length&&(this.D(),this.Z=[],this.F=3),this.q=e;const i=this.Z,l=this.H.parentNode;if(0===i.length){const e=n.createDocumentFragment();for(let n=0;n<s;n++)i.push(this.K(t[n],e,null));return void this.C(e)}if(!e){const e=i.length<s?i.length:s;for(let s=0;s<e;s++)this.T(i[s],t[s]);if(s>i.length){const e=n.createDocumentFragment();for(let n=i.length;n<s;n++)i.push(this.K(t[n],e,null));this.C(e)}else if(s<i.length){const t=i[i.length-1];let e=this.U(i[s]);const n=null!==t.t?t.t.nextSibling:t.R.N.nextSibling;for(;e!==n;){const t=e.nextSibling;l.removeChild(e),e=t}i.length=s}return}if(i.length===s){let e=0;for(;e<s&&i[e].P===t[e].key;)this.T(i[e],t[e]),e++;if(e===s)return}const o=i,h=new Array(s);for(let e=0;e<s;e++)h[e]=t[e].key;const r=new Array(s);let c,f,u=0,_=o.length-1,a=0,p=s-1;const d=t=>t<s&&void 0!==r[t]?this.U(r[t]):this.N;for(;u<=_&&a<=p;)if(null===o[u])u++;else if(null===o[_])_--;else if(o[u].P===h[a])this.T(r[a]=o[u],t[a]),u++,a++;else if(o[_].P===h[p])this.T(r[p]=o[_],t[p]),_--,p--;else if(o[u].P===h[p]){const s=o[u];this.X(s,d(p+1)),this.T(s,t[p]),r[p]=s,u++,p--}else if(o[_].P===h[a]){const s=o[_];this.X(s,this.U(o[u])),this.T(s,t[a]),r[a]=s,_--,a++}else{if(void 0===c){c=new Map;for(let t=a;t<=p;t++)c.set(h[t],t);f=new Map;for(let t=u;t<=_;t++)null!==o[t]&&f.set(o[t].P,t)}if(c.has(o[u].P))if(c.has(o[_].P)){const s=f.get(h[a]);if(void 0===s)r[a]=this.K(t[a],l,this.U(o[u]));else{const e=o[s];this.X(e,this.U(o[u])),this.T(e,t[a]),r[a]=e,o[s]=null}a++}else this.Y(o[_]),_--;else this.Y(o[u]),u++}for(;a<=p;)r[a]=this.K(t[a],l,d(p+1)),a++;for(;u<=_;){const t=o[u++];null!==t&&this.Y(t)}this.Z=r}}const j=new WeakMap,I={},M=t=>(t.offset>0&&(t.node=t.node.splitText(t.offset),t.offset=0),t.node),g=new WeakMap,A=(t,s,e)=>{e.tt++;const i=e.st.i;if(3===t.nodeType){let n=!1;for(;e.et<i.length&&i[e.et].h===e.tt;)n=!0,e.et++,W(s,e.it[e.nt++],e.lt),S(e);return void(n||((t,s)=>{let e=s;for(;e.length>0;){const s=t.node;if(null===s||3!==s.nodeType)throw I;const i=s.data,n=i.length-t.offset;if(0===n){t.node=s.nextSibling,t.offset=0;continue}const l=n<e.length?n:e.length;if(i.slice(t.offset,t.offset+l)!==e.slice(0,l))throw I;e=e.slice(l),t.offset+=l,t.offset===i.length&&(t.node=s.nextSibling,t.offset=0)}})(s,t.data))}const n=M(s);if(null===n||1!==n.nodeType)throw I;if(n.localName!==t.localName)throw I;for(;e.et<i.length&&i[e.et].h===e.tt;){const t=i[e.et++],s=new y(n,t.o,t.u);e.lt.push(s),e.nt=s.p(e.it,e.nt),S(e)}const l={parent:n,node:n.firstChild,offset:0};let o=t.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,l,e),o=o.nextSibling;if(null!==l.node&&(3!==l.node.nodeType||""!==l.node.data||null!==l.node.nextSibling))throw I;s.node=n.nextSibling,s.offset=0},S=t=>{const s=t.st.i;for(;t.et<s.length&&2===s[t.et].l;)t.lt.push(a),t.nt++,t.et++},W=(t,s,e)=>{const i=s?.$h,o=void 0!==i?i:s;if(null!=o&&"object"!=typeof o){const s=new k(((t,s)=>{const e=M(t);if(""===s){const s=n.createTextNode("");return t.parent.insertBefore(s,e),s}if(null===e||3!==e.nodeType)throw I;const i=e;if(i.data.length>s.length&&i.splitText(s.length),i.data!==s)throw I;return t.node=i.nextSibling,t.offset=0,i})(t,v(o)));return s.S=o,void e.push(s)}const h=l();t.parent.insertBefore(h,M(t));const r=new b(h,null);if(null==o);else if($(o))r.O=z(_(o),o.values,t),r.V=o.strings,r.F=2;else{const s=Array.isArray(o)?o:[...o],e=[];for(const i of s)e.push(L(t,i));r.Z=e,r.q=s.length>0&&void 0!==s[0]?.key,r.F=3}const c=l();t.parent.insertBefore(c,M(t)),r.N=c,e.push(r)},L=(t,s)=>{if(null!==s&&"object"==typeof s&&void 0!==s.strings){const e=s,i=_(e),n=i.t.content.firstChild;if(null!==n&&1===n.nodeType&&null===n.nextSibling){const s=M(t),n=z(i,e.values,t);return{P:e.key,t:s,O:n,V:e.strings,R:null}}const o=l();t.parent.insertBefore(o,M(t));const h=z(i,e.values,t),r=l();t.parent.insertBefore(r,M(t));const c=new b(o,r);return c.O=h,c.V=e.strings,c.F=2,{P:e.key,t:null,O:null,V:null,R:c}}const e=[];return W(t,s,e),{P:s?.key,t:null,O:null,V:null,R:e[0]}},z=(t,s,e)=>{const i=Object.create(w.prototype);i.i=[],i.I=n.createDocumentFragment();const l={st:t,it:s,nt:0,et:0,tt:-1,lt:i.i};S(l),(t=>{let s=g.get(t);if(void 0===s){let e;for(s=[],h.currentNode=t.t.content;null!==(e=h.nextNode());)s.push(e);g.set(t,s)}})(t);let o=t.t.content.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,e,l),o=o.nextSibling;if(S(l),l.et!==t.i.length)throw I;return i},E=(t,s)=>{if(!j.has(s)&&null!==s.firstChild&&null!==t&&"object"==typeof t&&$(t)){const e=((t,s)=>{let e=s.firstChild;for(;null!==e&&1===e.nodeType&&e.hasAttribute("vera-styles");)e=e.nextSibling;const i=l();s.insertBefore(i,e);try{const e={parent:s,node:i.nextSibling,offset:0},n=z(_(t),t.values,e);if(null!==e.node)throw I;const l=new b(i,null);return l.O=n,l.V=t.strings,l.F=2,l}catch(t){if(t!==I)throw t;return i.remove(),null}})(t,s);if(null!==e)return void j.set(s,e);(t=>{let s=t.firstChild;for(;null!==s;){const e=s.nextSibling;1===s.nodeType&&s.hasAttribute("vera-styles")||t.removeChild(s),s=e}})(s)}((t,s)=>{let e=j.get(s);if(void 0===e){const t=l();s.appendChild(t),j.set(s,e=new b(t,null))}e.L(t)})(t,s)};export{s as hold,t as keyed,E 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,n=document,e=(t="")=>n.createComment(t),l=n.createTreeWalker(n,129),o=n.createTreeWalker(n,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 n="",e=0,l="",o=0,c="",f=0,u=!1,a="",_=[],d="";const v=t=>{let s=t;for(;s>0&&!r.test(n[s-1]);)s--;return n.slice(s,t)};for(let r=0;r<t.length;r++){const p=t[r];let m=0;for(;m<p.length;){const t=p[m];if(5===e){if(t===l||""===l&&(" "===t||"\t"===t||"\n"===t||"\r"===t||">"===t||"/"===t)){_.push(d);const t=l||'"';n+=` ${i.length}${s}=${t}${_.join(s)}${t}`,i.push({l:1,o:a}),e=1,""!==l&&m++;continue}d+=t,m++}else if(0===e){if("<"===t){if(p.startsWith("!--",m+1)){e=3,n+="\x3c!--",m+=4;continue}u="/"===p[m+1],f=n.length+(u?2:1),e=1}n+=t,m++}else if(1===e){if('"'===t||"'"===t)l=t,o=n.length,e=2;else if(">"===t){const t=n.slice(f).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";u||!h.test(t)||n.endsWith("/")?e=0:(c=t.toLowerCase(),e=4)}n+=t,m++}else if(2===e)t===l&&(e=1),n+=t,m++;else if(3===e){if("-"===t&&p.startsWith("->",m+1)){n+="--\x3e",m+=3,e=0;continue}n+=t,m++}else"<"===t&&p.slice(m+1,m+2+c.length).toLowerCase()==="/"+c&&(m+2+c.length>=p.length||/[\s/>]/.test(p[m+2+c.length]))&&(u=!0,f=n.length+2,e=1),n+=t,m++}if(r===t.length-1)break;if(0===e)n+=`<?${s}>`,i.push({l:0});else if(4===e)n+=s,i.push({l:0});else if(3===e)i.push({l:2});else if(5===e)_.push(d),d="";else if(2===e){const t="="===n[o-1]?v(o-1):"";t?(a=t,_=[n.slice(o+1)],d="",n=n.slice(0,o-1-t.length),e=5):i.push({l:2})}else{const t=n.endsWith("=")?v(n.length-1):"";t?(a=t,_=[""],d="",l="",n=n.slice(0,n.length-1-t.length),e=5):(n+=` ${i.length}${s}="${s}"`,i.push({l:1,o:"&"}))}}return{markup:n,specs:i}})(t.strings);this.t=n.createElement("template"),this.t.innerHTML=2===c?`<svg>${f}</svg>`:3===c?`<math>${f}</math>`:f;const a=this.t.content;if(1!==c){const t=a.firstChild;for(;t.firstChild;)a.insertBefore(t.firstChild,t);a.removeChild(t)}l.currentNode=a;let _,d=0;const v=this.i,p=()=>{for(;d<u.length&&2===u[d].l;)v.push({l:2,h:-1}),d++};for(p();d<u.length&&null!==(_=l.nextNode());)if(1===_.nodeType){const t=_;if(t.hasAttributes())for(const i of t.getAttributeNames())if(i.endsWith(s)){const n=parseInt(i,10);if(n>d)do{v.push({l:2,h:-1})}while(++d<n);const e=u[d++];v.push({l:1,h:-1,o:e.o,u:t.getAttribute(i).split(s),_:t.hasAttribute(e.o),v:t}),t.removeAttribute(i),p()}if(h.test(t.tagName)&&t.textContent.includes(s)){const n=t.textContent.split(s);t.textContent="";for(let s=0;s<n.length-1;s++)n[s]&&t.append(n[s]),t.append(e(i));n[n.length-1]&&t.append(n[n.length-1])}}else if(_.data===i){d++;const t=n.createTextNode("");_.parentNode.insertBefore(t,_),l.currentNode=t,_.remove(),v.push({l:0,h:-1,v:t}),p()}o.currentNode=a;let m=-1,y=0;for(;y<v.length&&2===v[y].l;)y++;for(;y<v.length&&null!==(_=o.nextNode());)for(m++;y<v.length&&v[y].v===_;)for(v[y].h=m,y++;y<v.length&&2===v[y].l;)y++;for(const t of v)t.v=void 0;const w=I();if(void 0!==w){o.currentNode=a;let t=-1;for(;null!==(_=o.nextNode());)t++,"slot"===_.localName&&(this.p=w,(this.m??=[]).push(t))}}}const a=t=>{let s=f.get(t.strings);return void 0===s&&f.set(t.strings,s=new u(t)),s},_={$:(t,s)=>s+1},d={},v=(t,s)=>{const i=e(),n=e();return t.insertBefore(i,s),t.insertBefore(n,s),new H(i,n)},p=t=>null==t?"":`${t}`,m=(t,s,i)=>{const n=t;let e=n;for(;null!==e;){const t=Object.getOwnPropertyDescriptor(e,s);if(void 0!==t){if(void 0!==t.set)return n[s]=i,1;if(void 0!==t.get)return void 0!==n._$adopt$&&n._$adopt$(s,i),-1;break}e=Object.getPrototypeOf(e)}if(n[s]=i,void 0!==n._$adopt$)return n._$adopt$(s,i),1;const l=n._$props$??={};Object.hasOwn(l,s),l[s]=i;const o=t.ownerDocument.defaultView;return null===o||Object.getPrototypeOf(n)!==o.HTMLElement.prototype?1:0},y=(t,s)=>{try{t(s)}catch(t){console.error("[vera] ref threw",t)}};class w{t;o;u;m;j;k;O=d;S=null;A=!1;_;constructor(t,s,i,n=!1){const e=s[0];let l="."===e?1:"?"===e?2:"@"===e?4:"&"===e?5:"!"===e?3:0,o=l?s.slice(1):s;1!==l&&3!==l||"__proto__"!==o||(l=-1),0===l&&"o"===e&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(l=4,o=s.slice(2).toLowerCase()),1===l&&t.localName.includes("-")&&(l=6),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.A=1===l&&"value"===o&&"select"===t.localName,this._=n}M(){const t=this.O;"function"==typeof t?y(t,null):null!==t&&"object"==typeof t&&void 0===t._$apply$&&(t.value=null),this.O=d}handleEvent(t){const s=this.S;"function"==typeof s?s.call(this.t,t):"function"==typeof s?.handleEvent&&s.handleEvent(t)}$(t,s,i){const n=this.j;if(-1===n)return s+this.m;let e;if(this.k||n>=4)e=t[s];else{const i=this.u;let n=i[0];for(let e=0;e<this.m;e++)n+=p(t[s+e])+i[e+1];e=n}if(3===n){if(this.O=e,i)this.t.localName.includes("-")&&m(this.t,this.o,e);else{const t=this.t;t[this.o]!==e&&(t[this.o]=e)}return s+this.m}if(this.A)return this.O=e,i||($??=[]).push(this.t,e),s+this.m;if(e!==this.O){if(0===n)null==e?(this._||this.O!==d)&&this.t.removeAttribute(this.o):this.t.setAttribute(this.o,e);else if(1===n){const t=this.t,n=this.o;if(i&&("value"===n||"checked"===n||"selected"===n))return this.O=e,s+this.m;t[n]=e}else if(2===n)this.t.toggleAttribute(this.o,!!e);else if(4===n)null===this.S&&null!=e&&this.t.addEventListener(this.o,this),this.S=e??null;else if(6===n){const t=m(this.t,this.o,e);0!==t&&(this.j=t)}else if(null!=e)if(z=!0,"function"==typeof e)y(e,this.t);else if("object"==typeof e){const t=e;t._$apply$?t._$apply$(this.t,this):t.value=this.t}this.O=e}return s+this.m}}let $=null;const b=n.createDocumentFragment(),j={value:!0,enumerable:!1,configurable:!0,writable:!0},k=(t,s=!0)=>{if(j.value=s,11!==t.nodeType)Object.defineProperty(t,"_$own$",j);else for(let s=t.firstChild;null!==s;s=s.nextSibling)Object.defineProperty(s,"_$own$",j)},x=t=>{t.W?.I(),t.F?.L()};class O{i=[];H;constructor(t){this.H=n.importNode(t.t.content,!0);const s=t.i;o.currentNode=this.H;let i=-1,e=null;for(let t=0;t<s.length;t++){const n=s[t];if(2!==n.l){for(;i<n.h;)e=o.nextNode(),i++;this.i.push(0===n.l?new S(e):new w(e,n.o,n.u,n._))}else this.i.push(_)}if(void 0!==t.p&&null!==c){const s=t.m;o.currentNode=this.H,i=-1;const n=[];for(let t=0;t<s.length;t++){for(;i<s[t];)e=o.nextNode(),i++;n.push(e)}this.N=n}}I(){const t=this.i;for(let s=0;s<t.length;s++){const i=t[s];5===i.j&&i.M(),i.V?.L()}this.Z?.forEach((t=>t._$park$?.()))}q(t){let s=0;const i=this.i;for(let n=0;n<i.length;n++)s=i[n].$(t,s);void 0!==this.N&&this.B()}B(){const t=this.N;this.N=void 0;const s=c,i=I();if(void 0!==i&&null!==s)for(let n=0;n<t.length;n++){const e=t[n],l=i(e,s,e.getAttribute("name")??"");null!=l&&((this.Z??=[]).push(l),z=!0)}}}const g=t=>void 0!==t.strings;class S{C;D="";V=null;constructor(t){this.C=t}$(t,s){const i=t[s];if(null!==this.V)return this.V.G(i),s+1;if(null==i||"object"==typeof i){const t=e(),n=e(),l=I()?._$home$?.(this.C)??null,o=null!==l?l.parentNode:this.C.parentNode;null!==l?(o.insertBefore(t,l),o.insertBefore(n,l)):(o.insertBefore(t,this.C),o.insertBefore(n,this.C.nextSibling));const h=new H(t,n);return h.J=F,h.C=this.C,h.D=this.D,this.V=h,h.G(i),s+1}return i!==this.D&&(this.D=i,this.C.data=i),s+1}}let A=null,M=!1;const I=()=>{const t=A?.get("slot")?.[0];return void 0!==t&&(M=!0),t},W=[],L=[];let z=!1;const E=()=>{z=!0},F=1;class H{K;P;J=0;D;C=null;W=null;R=null;T=null;U=!1;X=null;Y=void 0;tt=void 0;constructor(t,s){this.K=t,this.P=s}$(t,s){return this.G(t[s]),s+1}st(t){const s=this.K.parentNode;M&&!0===s._$hosted$&&k(t,null===this.P||this),s.insertBefore(t,this.P)}L(){void 0!==this.tt&&this.tt._$detach$?.(this.Y),this.W?.I();const t=this.T;if(null!=t)for(let s=0;s<t.length;s++)x(t[s])}it(){z&&this.L();const t=this.K.parentNode,s=this.P,i=this.T;if(this.K.nextSibling===s&&0!==this.J)if(null!==i){for(const t of i)null!==t&&this.$m(t,null,b);b.textContent=""}else if(this.J===F)this.C?.remove();else if(2===this.J){if(Array.isArray(this.D))for(const t of this.D)t.remove()}else 4===this.J&&"function"==typeof this.D.remove&&this.D.remove();else if(null!==this.K.previousSibling||null!==s&&null!==s.nextSibling){let s=this.K.nextSibling;for(;null!==s&&s!==this.P;){const i=s.nextSibling;t.removeChild(s),s=i}}else t.textContent="",t.appendChild(this.K),null!==s&&t.appendChild(s);this.J=0,this.C=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.G(t),this.Y=s,this.tt=i}G(t){if(null==t)return void(0!==this.J&&this.it());if("object"!=typeof t)return void(this.J===F?this.D!==t&&(this.D=t,this.C.data=t):(0!==this.J&&this.it(),this.C=n.createTextNode(t),this.st(this.C),this.D=t,this.J=F));const s=t.$h;if(void 0!==s)return void this.nt(s);if(g(t)){if(this.R===t.strings)return void this.W.q(t.values);const s=a(t);0!==this.J&&this.it();const i=new O(s);return i.q(t.values),this.D=[...i.H.childNodes],this.st(i.H),this.W=i,this.R=t.strings,void(this.J=2)}const i=A?A.get("value")??W:W;for(let s=0;s<i.length;s++)if(i[s](this,t))return;for(let s=0;s<L.length;s++)if(L[s](this,t))return;const e=t._$child$;if(void 0!==e){const s=this.tt===e?this.Y:void 0;return this.tt=e,void 0!==e._$detach$&&(z=!0),void(this.Y=e.call(t,this,s))}void 0===t.nodeType?this.G(String(t)):4===this.J&&this.D===t||(0!==this.J&&this.it(),this.st(t),this.D=t,this.J=4)}nt(t){if(2===this.J&&this.R===t.strings)return void this.W.q(t.values);const s=this.X??=new Map;if(2===this.J){const t=this.W.H;if(this.K.nextSibling===this.P&&Array.isArray(this.D))for(const s of this.D)t.appendChild(s);else{let s=this.K.nextSibling;for(;s!==this.P;){const i=s.nextSibling;t.appendChild(s),s=i}}s.set(this.R,this.W)}else 0!==this.J&&this.it();const i=s.get(t.strings)??new O(a(t));i.q(t.values),this.D=[...i.H.childNodes],this.st(i.H),this.W=i,this.R=t.strings,this.J=2}$c(t,s,i){const n=M&&!0===s._$hosted$?null===this.P||this:null;if(null!==t&&"object"==typeof t&&void 0!==t.strings){const e=t,l=a(e),o=new O(l);o.q(e.values);const h=o.H.firstChild;if(null!==h&&1===h.nodeType&&null===h.nextSibling)return null!==n&&k(h,n),s.insertBefore(h,i),{$k:e.key,t:h,W:o,R:e.strings,F:null};const r=v(s,i);return r.W=o,r.R=e.strings,r.J=2,r.D=[...o.H.childNodes],null!==n&&k(o.H,n),r.K.parentNode.insertBefore(o.H,r.P),{$k:e.key,t:null,W:null,R:null,F:r}}const e=v(s,i);return e.G(t),{$k:t?.key,t:null,W:null,R:null,F:e}}$u(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.R)return void t.W.q(s.values);const i=v(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.W=null,t.R=null,void(t.F=i).G(s)}t.F.G(s)}$f(t){return t.t??t.F.K}$m(t,s,i=this.K.parentNode){const n=t.t??t.F.P;if(n.nextSibling===s&&n.parentNode===i)return;if(null!==t.t)return void i.insertBefore(t.t,s);let e=t.F.K;const l=t.F.P.nextSibling;for(;e!==l;){const t=e.nextSibling;i.insertBefore(e,s),e=t}}$d(t){z&&x(t),this.$m(t,null,b),b.textContent=""}et(t){3!==this.J&&(0!==this.J&&this.it(),this.T=[],this.U=!1,this.J=3);const s=t.length;if(0===s)return void(this.T.length&&(this.it(),this.T=[],this.J=3));const i=null!=t[0]&&void 0!==t[0].$r;i!==this.U&&this.T.length&&(this.it(),this.T=[],this.J=3),this.U=i;const e=this.T;if(0!==e.length)if(i)this.T=t[0].$r(this,t,e,this.K.parentNode,this.P);else{const i=e.length<s?e.length:s;for(let s=0;s<i;s++)this.$u(e[s],t[s]);if(s>e.length){const i=n.createDocumentFragment();for(let n=e.length;n<s;n++)e.push(this.$c(t[n],i,null));this.st(i)}else if(s<e.length){if(z)for(let t=s;t<e.length;t++)x(e[t]);for(let t=s;t<e.length;t++)this.$m(e[t],null,b);b.textContent="",e.length=s}}else{const i=n.createDocumentFragment();for(let n=0;n<s;n++)e.push(this.$c(t[n],i,null));this.st(i)}}}const N=new WeakMap,V=(t,s)=>{let i=N.get(s);if(void 0===i){const t=e();s.appendChild(t),1===s.nodeType&&I()?._$capture$?.(s,t),N.set(s,i=new H(t,null))}c=s;try{i.G(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]}})()}};L.push(((t,s)=>Array.isArray(s)?(t.et(s),!0):null!==s&&"function"==typeof s[Symbol.iterator]&&(t.et([...s]),!0)));const Z={name:"@verajs/renderer",on:"render",fn:V,priority:50,connect:t=>{A=t}},q={},B=t=>(t.offset>0&&(t.node=t.node.splitText(t.offset),t.offset=0),t.node),C=t=>{for(;0===t.offset&&null!==t.node&&8===t.node.nodeType;)t.node=t.node.nextSibling},D=new WeakMap;let G=null,J=!1,K=[];const P=(t,s)=>{const i=s.lt.i;for(let e=t.firstChild;null!==e;e=e.nextSibling)if(1===e.nodeType||3===e.nodeType){for(s.ot++;s.ht<i.length&&i[s.ht].h===s.ot;)s.rt+=1===(n=i[s.ht]).l?n.u.length-1:1,s.ht++;1===e.nodeType&&P(e,s)}var n},Q=(t,s,i)=>{i.ot++;const n=i.lt.i;if(3===t.nodeType){let e=!1;for(;i.ht<n.length&&n[i.ht].h===i.ot;)e=!0,i.ht++,T(s,i.ct[i.rt++],i.ft),R(i);return void(e||((t,s)=>{let i=s;for(;i.length>0;){C(t);const s=t.node;if(null===s||3!==s.nodeType)throw q;const n=s.data,e=n.length-t.offset;if(0===e){t.node=s.nextSibling,t.offset=0;continue}const l=e<i.length?e:i.length;if(n.slice(t.offset,t.offset+l)!==i.slice(0,l))throw q;i=i.slice(l),t.offset+=l,t.offset===n.length&&(t.node=s.nextSibling,t.offset=0)}})(s,t.data))}if(void 0!==i.lt.p&&"slot"===t.localName)return void((t,s,i)=>{const n=i.lt.p._$adopt$,e=t.cloneNode(!1),l=i.lt.i;for(;i.ht<l.length&&l[i.ht].h===i.ot;){const t=l[i.ht++],s=new w(e,t.o,t.u,t._);i.ft.push(s),i.rt=s.$(i.ct,i.rt,!0),R(i)}const o=e.getAttribute("name")??"";C(s);const h=s.parent,r=[];if(""!==o){let t=B(s);for(;null!==t&&1===t.nodeType&&t.getAttribute("slot")===o;)r.push(t),s.node=t.nextSibling,t=B(s)}else if(!J){const t=h.getAttribute?.("data-vm-slotted"),i=null==t?0:Number(t.slice(t.indexOf(",")+1));if(i>0){J=!0,h.removeAttribute("data-vm-slotted");for(let t=0;t<i;t++){const t=B(s);if(null===t)break;r.push(t),s.node=t.nextSibling}}}if(r.length>0){const l=s.node,c=[];for(let s=t.firstChild;null!==s;s=s.nextSibling)1!==s.nodeType&&3!==s.nodeType||c.push(s.cloneNode(!0));P(t,i);const f=n(G,o,r,c,h,l,e);K.push(f),(i.Z??=[]).push(f),E()}else{const l=s.node;for(let n=t.firstChild;null!==n;n=n.nextSibling)1!==n.nodeType&&3!==n.nodeType||Q(n,s,i);const r=[];for(let t=l;null!==t&&t!==s.node;t=t.nextSibling)r.push(t);const c=n(G,o,null,r,h,s.node,e);K.push(c),(i.Z??=[]).push(c),E()}})(t,s,i);C(s);const e=B(s);if(null===e||1!==e.nodeType)throw q;if(e.localName!==t.localName)throw q;for(;i.ht<n.length&&n[i.ht].h===i.ot;){const t=n[i.ht++],s=new w(e,t.o,t.u,t._);i.ft.push(s),i.rt=s.$(i.ct,i.rt,!0),R(i)}const l={parent:e,node:e.firstChild,offset:0};let o=t.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||Q(o,l,i),o=o.nextSibling;if(null!==l.node&&3===l.node.nodeType&&null===l.node.nextSibling&&null===t.firstChild&&"textarea"===e.localName&&(l.node=null),C(l),null!==l.node&&(3!==l.node.nodeType||""!==l.node.data||null!==l.node.nextSibling))throw q;s.node=e.nextSibling,s.offset=0},R=t=>{const s=t.lt.i;for(;t.ht<s.length&&2===s[t.ht].l;)t.ft.push(_),t.rt++,t.ht++},T=(t,s,i)=>{const l=s?.$h,o=void 0!==l?l:s;if(null!=o&&("object"!=typeof o||!g(o)&&void 0===o.nodeType&&"function"!=typeof o[Symbol.iterator])){const s=new S(((t,s)=>{const i=B(t);if(""===s){const s=n.createTextNode("");return t.parent.insertBefore(s,i),s}if(null===i||3!==i.nodeType)throw q;const e=i;if(e.data.length>s.length&&e.splitText(s.length),e.data!==s)throw q;return t.node=e.nextSibling,t.offset=0,e})(t,p(o)));return s.D=o,void i.push(s)}const h=e();t.parent.insertBefore(h,B(t));const r=new H(h,null);if(null==o);else if(g(o))r.W=X(a(o),o.values,t),r.R=o.strings,r.J=2;else if(void 0!==o.nodeType)t.parent.insertBefore(o,B(t)),r.D=o,r.J=4;else{const s=Array.isArray(o)?o:[...o],i=[];for(const n of s)i.push(U(t,n));r.T=i,r.U=s.length>0&&void 0!==s[0]?.$r,r.J=3}const c=e();t.parent.insertBefore(c,B(t)),r.P=c,i.push(r)},U=(t,s)=>{if(null!==s&&"object"==typeof s&&void 0!==s.strings){const i=s,n=a(i),l=n.t.content.firstChild;if(null!==l&&1===l.nodeType&&null===l.nextSibling){const s=B(t),e=X(n,i.values,t);return{$k:i.key,t:s,W:e,R:i.strings,F:null}}const o=e();t.parent.insertBefore(o,B(t));const h=X(n,i.values,t),r=e();t.parent.insertBefore(r,B(t));const c=new H(o,r);return c.W=h,c.R=i.strings,c.J=2,{$k:i.key,t:null,W:null,R:null,F:c}}const i=[];return T(t,s,i),{$k:s?.key,t:null,W:null,R:null,F:i[0]}},X=(t,s,i)=>{const e=Object.create(O.prototype);e.i=[],e.H=n.createDocumentFragment();const l={lt:t,ct:s,rt:0,ht:0,ot:-1,ft:e.i};R(l),(t=>{let s=D.get(t);if(void 0===s){let i;for(s=[],o.currentNode=t.t.content;null!==(i=o.nextNode());)s.push(i);D.set(t,s)}})(t);let h=t.t.content.firstChild;for(;null!==h;)1!==h.nodeType&&3!==h.nodeType||Q(h,i,l),h=h.nextSibling;if(R(l),l.ht!==t.i.length)throw q;return void 0!==l.Z&&(e.Z=l.Z),e},Y=(t,s)=>{if(!N.has(s)&&null!==s.firstChild&&null!==t&&"object"==typeof t&&g(t)){const i=((t,s)=>{let i=s.firstChild;for(;null!==i&&1===i.nodeType&&i.hasAttribute("data-vm-sheet");)i=i.nextSibling;const n=e();s.insertBefore(n,i),G=1===s.nodeType?s:null,J=!1,K=[];try{const i={parent:s,node:n.nextSibling,offset:0},e=X(a(t),t.values,i);if(C(i),null!==i.node)throw q;const l=new H(n,null);return l.W=e,l.R=t.strings,l.J=2,l}catch(t){if(t!==q)throw t;for(const t of K)t._$park$();return K=[],n.remove(),null}})(t,s);if(null!==i)return void N.set(s,i);const n=1===s.nodeType?I()?._$rescue$?.(s):null;if((t=>{let s=t.firstChild;for(;null!==s;){const i=s.nextSibling;1===s.nodeType&&s.hasAttribute("data-vm-sheet")||t.removeChild(s),s=i}})(s),null!=n)for(const t of n)s.appendChild(t)}V(t,s)},tt={...Z,fn:Y};export{t as hold,Y as renderInto,tt as renderer};
|
|
2
2
|
//# sourceMappingURL=vera-renderer-hydrate.min.js.map
|