UNPKG

veljs

Version:

VirtualElement.js - a lighterhtml based virtual elements for building web applications

2 lines (1 loc) 18.4 kB
/*! VirtualElement.js, by Cvetoslav Ludmiloff */var virtualelement=function(e){"use strict";var t=function(e,t){return(t=n.prototype).ELEMENT_NODE=1,t.nodeType=111,t.remove=function(e){var t=this.childNodes,n=this.firstChild,r=this.lastChild;if(this._=null,e&&2===t.length)r.parentNode.removeChild(r);else{var s=this.ownerDocument.createRange();s.setStartBefore(e?t[1]:n),s.setEndAfter(r),s.deleteContents()}return n},t.valueOf=function(e){var t=this._,n=null==t;if(n&&(t=this._=this.ownerDocument.createDocumentFragment()),n||e)for(var r=this.childNodes,s=0,i=r.length;s<i;s++)t.appendChild(r[s]);return t},n;function n(t){var n=this.childNodes=e.call(t,0);this.firstChild=n[0],this.lastChild=n[n.length-1],this.ownerDocument=n[0].ownerDocument,this._=null}}([].slice);const{isArray:n}=Array,r=t.prototype.nodeType;function s(e,t){this.type=e,this.args=t}Object.freeze(s);const i=e=>document.createElementNS("http://www.w3.org/1999/xhtml",e),o=(e,t)=>("svg"===t?a:l)(e),l=e=>{const t=i("template");return t.innerHTML=e,t.content},a=e=>{const{content:t}=i("template"),n=i("div");n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>";const{childNodes:r}=n.firstChild;let{length:s}=r;for(;s--;)t.appendChild(r[0]);return t},{indexOf:c}=[],u=(e,t,n,r,s,i)=>{const o="selectedIndex"in t;let l=o;for(;r<s;){const s=e(n[r],1);if(t.insertBefore(s,i),o&&l&&s.selected){l=!l;let{selectedIndex:e}=t;t.selectedIndex=e<0?r:c.call(t.querySelectorAll("option"),s)}r++}},h=(e,t)=>e==t,d=e=>e,_=(e,t,n,r,s,i,o)=>{const l=i-s;if(l<1)return-1;for(;n-t>=l;){let l=t,a=s;for(;l<n&&a<i&&o(e[l],r[a]);)l++,a++;if(a===i)return t;t=l+1}return-1},f=(e,t,n,r,s)=>n<r?e(t[n],0):0<n?e(t[n-1],-0).nextSibling:s,p=(e,t,n,r,s)=>{if(s-r<2)t.removeChild(e(n[r],-1));else{const i=t.ownerDocument.createRange();i.setStartBefore(e(n[r],-1)),i.setEndAfter(e(n[s-1],-1)),i.deleteContents()}},v=(e,t,n)=>{let r=1,s=t;for(;r<s;){const t=(r+s)/2>>>0;n<e[t]?s=t:r=t+1}return r},y=(e,t,n,r,s,i,o,l,a,c,h,d,_)=>{((e,t,n,r,s,i,o,l,a)=>{const c=new Map,h=e.length;let d=o,_=0;for(;_<h;)switch(e[_++]){case 0:s++,d++;break;case 1:c.set(r[s],1),u(t,n,r,s++,s,d<l?t(i[d],0):a);break;case-1:d++}for(_=0;_<h;)switch(e[_++]){case 0:o++;break;case-1:c.has(i[o])?o++:p(t,n,i,o++,o)}})(((e,t,n,r,s,i,o)=>{const l=n+i,a=[];let c,u,h,d,_,f,p;e:for(c=0;c<=l;c++){if(c>50)return null;for(p=c-1,_=c?a[c-1]:[0,0],f=a[c]=[],u=-c;u<=c;u+=2){for(h=(d=u===-c||u!==c&&_[p+u-1]<_[p+u+1]?_[p+u+1]:_[p+u-1]+1)-u;d<i&&h<n&&o(r[s+d],e[t+h]);)d++,h++;if(d===i&&h===n)break e;f[c+u]=d}}const v=Array(c/2+l/2);let y=v.length-1;for(c=a.length-1;c>=0;c--){for(;d>0&&h>0&&o(r[s+d-1],e[t+h-1]);)v[y--]=0,d--,h--;if(!c)break;p=c-1,_=c?a[c-1]:[0,0],(u=d-h)===-c||u!==c&&_[p+u-1]<_[p+u+1]?(h--,v[y--]=1):(d--,v[y--]=-1)}return v})(n,r,i,o,l,c,d)||((e,t,n,r,s,i,o,l)=>{let a=0,c=r<l?r:l;const u=Array(c++),h=Array(c);h[0]=-1;for(let e=1;e<c;e++)h[e]=o;const d=new Map;for(let e=i;e<o;e++)d.set(s[e],e);for(let r=t;r<n;r++){const t=d.get(e[r]);null!=t&&-1<(a=v(h,c,t))&&(h[a]=t,u[a]={newi:r,oldi:t,prev:u[a-1]})}for(a=--c,--o;h[a]>o;)--a;c=l+r-a;const _=Array(c);let f=u[a];for(--n;f;){const{newi:e,oldi:t}=f;for(;n>e;)_[--c]=1,--n;for(;o>t;)_[--c]=-1,--o;_[--c]=0,--n,--o,f=f.prev}for(;n>=t;)_[--c]=1,--n;for(;o>=i;)_[--c]=-1,--o;return _})(n,r,s,i,o,l,a,c),e,t,n,r,o,l,h,_)},g=(e,t,n,r)=>{r||(r={});const s=r.compare||h,i=r.node||d,o=null==r.before?null:i(r.before,0),l=t.length;let a=l,c=0,v=n.length,g=0;for(;c<a&&g<v&&s(t[c],n[g]);)c++,g++;for(;c<a&&g<v&&s(t[a-1],n[v-1]);)a--,v--;const m=c===a,w=g===v;if(m&&w)return n;if(m&&g<v)return u(i,e,n,g,v,f(i,t,c,l,o)),n;if(w&&c<a)return p(i,e,t,c,a),n;const b=a-c,k=v-g;let N=-1;if(b<k){if(-1<(N=_(n,g,v,t,c,a,s)))return u(i,e,n,g,N,i(t[c],0)),u(i,e,n,N+b,v,f(i,t,a,l,o)),n}else if(k<b&&-1<(N=_(t,c,a,n,g,v,s)))return p(i,e,t,c,N),p(i,e,t,N+k,a),n;return b<2||k<2?(u(i,e,n,g,v,i(t[c],0)),p(i,e,t,c,a),n):b===k&&((e,t,n,r,s,i)=>{for(;r<s&&i(n[r],e[t-1]);)r++,t--;return 0===t})(n,v,t,c,a,s)?(u(i,e,n,g,v,f(i,t,a,l,o)),n):(y(i,e,n,g,v,k,t,c,a,b,l,s,o),n)};var m,w=document.importNode,b="".trim,k="-"+Math.random().toFixed(6)+"%",N=!1;try{"content"in(m=document.createElement("template"))&&(m.innerHTML='<p tabindex="'+k+'"></p>',m.content.childNodes[0].getAttribute("tabindex")==k)||(k="_dt: "+k.slice(1,-1)+";",N=!0)}catch(e){}var x="\x3c!--"+k+"--\x3e",C=8,E=1,A=3,j=/^(?:style|textarea)$/i,R=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;function $(e){return e.join(x).replace(D,G).replace(L,K)}var M=" \\f\\n\\r\\t",S="[^"+M+"\\/>\"'=]+",T="["+M+"]+"+S,O="<([A-Za-z]+[A-Za-z0-9:._-]*)((?:",P="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+S.replace("\\/","")+"))?)",L=new RegExp(O+T+P+"+)(["+M+"]*/?>)","g"),D=new RegExp(O+T+P+"*)(["+M+"]*/>)","g"),V=new RegExp("("+T+"\\s*=\\s*)(['\"]?)"+x+"\\2","gi");function K(e,t,n,r){return"<"+t+n.replace(V,z)+r}function z(e,t,n){return t+(n||'"')+k+(n||'"')}function G(e,t,n){return R.test(t)?e:"<"+t+n+"></"+t+">"}function I(e,t){for(var n=t.length,r=0;r<n;)e=e.childNodes[t[r++]];return e}function W(e,t,n,r){for(var s=new Map,i=e.attributes,o=[],l=o.slice.call(i,0),a=l.length,c=0;c<a;){var u,h=l[c++],d=h.value===k;if(d||1<(u=h.value.split(x)).length){var _=h.name;if(!s.has(_)){var f=n.shift().replace(d?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+_+")\\s*=\\s*('|\")","i"),"$1"),p=i[f]||i[f.toLowerCase()];if(s.set(_,p),d)t.push(H(p,r,f,null));else{for(var v=u.length-2;v--;)n.shift();t.push(H(p,r,f,u))}}o.push(h)}}c=0;for(var y=(0<(a=o.length)&&N&&!("ownerSVGElement"in e));c<a;){var g=o[c++];y&&(g.value=""),e.removeAttribute(g.name)}var m=e.nodeName;if(/^script$/i.test(m)){var w=document.createElement(m);for(a=i.length,c=0;c<a;)w.setAttributeNode(i[c++].cloneNode(!0));w.textContent=e.textContent,e.parentNode.replaceChild(w,e)}}function F(e,t){return{type:"any",node:e,path:t}}function H(e,t,n,r){return{type:"attr",node:e,path:t,name:n,sparse:r}}function Z(e,t){return{type:"text",node:e,path:t}}var B=new WeakMap,U=new WeakMap;function q(e,t){var n=(e.convert||$)(t),r=e.transform;r&&(n=r(n));var s=o(n,e.type);!function(e){var t=e.childNodes,n=t.length;for(;n--;){var r=t[n];1!==r.nodeType&&0===b.call(r.textContent).length&&e.removeChild(r)}}(s);var i=[];!function e(t,n,r,s){for(var i=t.childNodes,o=i.length,l=0;l<o;){var a=i[l];switch(a.nodeType){case E:var c=s.concat(l);W(a,n,r,c),e(a,n,r,c);break;case C:var u=a.textContent;if(u===k)r.shift(),n.push(j.test(t.nodeName)?Z(t,s):F(a,s.concat(l)));else switch(u.slice(0,2)){case"/*":if("*/"!==u.slice(-2))break;case"👻":t.removeChild(a),l--,o--}break;case A:j.test(t.nodeName)&&b.call(a.textContent)===x&&(r.shift(),n.push(Z(t,s)))}l++}}(s,i,t.slice(0),[]);var l={content:s,updates:function(n){for(var r=[],s=i.length,o=0,l=0;o<s;){var a=i[o++],c=I(n,a.path);switch(a.type){case"any":r.push({fn:e.any(c,[]),sparse:!1});break;case"attr":var u=a.sparse,h=e.attribute(c,a.name,a.node);null===u?r.push({fn:h,sparse:!1}):(l+=u.length-2,r.push({fn:h,sparse:!0,values:u}));break;case"text":r.push({fn:e.text(c),sparse:!1}),c.textContent=""}}return s+=l,function(){var e=arguments.length;if(s!==e-1)throw new Error(e-1+" values instead of "+s+"\n"+t.join("${value}"));for(var i=1,o=1;i<e;){var l=r[i-o];if(l.sparse){var a=l.values,c=a[0],u=1,h=a.length;for(o+=h-2;u<h;)c+=arguments[i++]+a[u++];l.fn(c)}else l.fn(arguments[i++])}return n}}};return B.set(t,l),l}function J(e,t){var n=B.get(t)||q(e,t),r=w.call(document,n.content,!0),s={content:r,template:t,updates:n.updates(r)};return U.set(e,s),s}var Q=function(){var e=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,t=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var n;t?n=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),n=e.getAttributeNode("style"));return n.value="",e.setAttributeNode(n),r(n,!0)}(e,t):r(e.style,!1)};function n(e,t,n){return t+"-"+n.toLowerCase()}function r(r,s){var i,o;return function(l){var a,c,u,h;switch(typeof l){case"object":if(l){if("object"===i){if(!s&&o!==l)for(c in o)c in l||(r[c]="")}else s?r.value="":r.cssText="";for(c in a=s?{}:r,l)u="number"!=typeof(h=l[c])||e.test(c)?h:h+"px",!s&&/^--/.test(c)?a.setProperty(c,u):a[c]=u;i="object",s?r.value=function(e){var r,s=[];for(r in e)s.push(r.replace(t,n),":",e[r],";");return s.join("")}(o=a):o=l;break}default:o!=l&&(i="string",o=l,s?r.value=l||"":r.cssText=l||"")}}}}();const X=(e,t)=>e.nodeType===r?1/t<0?t?e.remove(!0):e.lastChild:t?e.valueOf(!0):e.firstChild:e,Y=(e,t)=>{let n,r=!1;const s=t.cloneNode(!0);return t=>{n!==t&&(n=t,s.value!==t&&(null==t?(r&&(r=!1,e.removeAttributeNode(s)),s.value=t):(s.value=t,r||(r=!0,e.setAttributeNode(s)))))}},ee=(e,t)=>{let n;return r=>{n!==r&&(n=r,e[t]!==r&&(null==r?(e[t]="",e.removeAttribute(t)):e[t]=r))}},te=/^(?:form|list)$/i,ne=[].slice,re=(e,t)=>e.ownerDocument.createTextNode(t);function se(e){return this.type=e,t=this,function(e){var n=U.get(t);return null!=n&&n.template===e||(n=J(t,e)),n.updates.apply(null,arguments),n.content};var t}function ie(e){return e(this)}se.prototype={attribute(e,t,n){switch(t){case"class":if("ownerSVGElement"in e)return Y(e,n);t="className";case"data":case"props":return ee(e,t);case"style":return Q(e,n,"ownerSVGElement"in e);case"ref":return(e=>t=>{t.current=e})(e);default:return"."===t.slice(0,1)?((e,t)=>n=>{e[t]=n})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let n,r=t.slice(2);return t.toLowerCase()in e&&(r=r.toLowerCase()),t=>{n!==t&&(n&&e.removeEventListener(r,n,!1),n=t,t&&e.addEventListener(r,t,!1))}})(e,t):t in e&&!("ownerSVGElement"in e||te.test(t))?ee(e,t):Y(e,n)}},any(e,t){const r={node:X,before:e},s="ownerSVGElement"in e?"svg":"html";let i,l=!1;const a=c=>{switch(typeof c){case"string":case"number":case"boolean":l?i!==c&&(i=c,t[0].textContent=c):(l=!0,i=c,t=g(e.parentNode,t,[re(e,c)],r));break;case"function":a(c(e));break;case"object":case"undefined":if(null==c){l=!1,t=g(e.parentNode,t,[],r);break}default:if(l=!1,i=c,n(c))if(0===c.length)t.length&&(t=g(e.parentNode,t,[],r));else switch(typeof c[0]){case"string":case"number":case"boolean":a(String(c));break;case"function":a(c.map(ie,e));break;case"object":n(c[0])&&(c=c.concat.apply([],c));default:t=g(e.parentNode,t,c,r)}else(e=>"ELEMENT_NODE"in e)(c)?t=g(e.parentNode,t,11===c.nodeType?ne.call(c.childNodes):[c],r):"text"in c?a(String(c.text)):"any"in c?a(c.any):"html"in c?t=g(e.parentNode,t,ne.call(o([].concat(c.html).join(""),s).childNodes),r):"length"in c&&a(ne.call(c))}};return a},text(e){let t;const n=r=>{if(t!==r){t=r;const s=typeof r;"object"===s&&r?"text"in r?n(String(r.text)):"any"in r?n(r.any):"html"in r?n([].concat(r.html).join("")):"length"in r&&n(ne.call(r).join("")):"function"===s?n(r(e)):e.textContent=null==r?"":r}};return n}};var oe=(...e)=>e;const le=new WeakMap,ae=new WeakMap;let ce=null;const{html:ue,svg:he,render:de,hook:_e}=(e=>{const t=ve("html",e),n=ve("svg",e);return{html:t,svg:n,hook:e=>({html:pe(e,t),svg:pe(e,n)}),render(t,n){const r=ye.call(this,t,n,e);return ae.get(t)!==r&&(ae.set(t,r),function(e,t){e.textContent="",e.appendChild(t)}(t,r)),t}}})(se);function fe(e,t){return e.nodeType===r?e.valueOf(t):e}function pe(e,t){return function(){const n=e(null);return null===n.current&&(n.current=t.for(n)),fe(n.current.apply(null,arguments),!1)}}function ve(e,t){const n=new WeakMap;return r.for=(r,s)=>{const i=n.get(r)||function(e){const t={$:null};return n.set(e,t),t}(r);return null==s&&(s="$"),i[s]||function(n,r){let s=[],i=null;const o=new t(e),l=()=>o.apply(null,me(s,1,1,t));return n[r]=function(){s=oe.apply(null,arguments);const e=ye(o,l,t);return i||(i=we(e))}}(i,s)},r;function r(){const n=oe.apply(null,arguments);return ce?new s(e,n):new t(e).apply(null,n)}}function ye(e,t,n){const r=ce;(ce=le.get(e)||function(e){const t={i:0,length:0,stack:[],update:!1};return le.set(e,t),t}(e)).i=0;const i=t.call(this);let o;if(i instanceof s){o=fe(ge(i,0,n),ce.update);const{i:e,length:t,stack:r,update:s}=ce;e<t&&r.splice(ce.length=e),s&&(ce.update=!1)}else o=fe(i,!1);return ce=r,o}function ge(e,t,n){const{i:r,length:s,stack:i}=ce,{type:o,args:l}=e,a=r<s;ce.i++,a||(ce.length=i.push({l:t,kind:o,tag:null,tpl:l[0],wire:null})),me(l,1,t+1,n);const c=i[r];if(a){const{l:e,kind:n,tag:r,tpl:s,wire:i}=c;if(e===t&&o===n&&s===l[0])return r.apply(null,l),i}const u=new n(o),h=we(u.apply(null,l));return c.l=t,c.kind=o,c.tag=u,c.tpl=l[0],c.wire=h,r<1&&(ce.update=!0),h}function me(e,t,r,i){for(const{length:o}=e;t<o;t++){const o=e[t];"object"==typeof o&&o&&(o instanceof s?e[t]=ge(o,r-1,i):n(o)&&(e[t]=me(o,0,r++,i)))}return e}function we(e){const n=e.childNodes,{length:r}=n;return 1===r?n[0]:r?new t(n):e}const be=new WeakMap;const ke=Array.prototype.includes,Ne=new Map;function xe(e,t){const n=[];for(let r=0;r<e.length;r++)n.push(e[r].replace("{tag}",t));return function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(n)}new MutationObserver(function(e){e.forEach(e=>{Ne.forEach(n=>{if(!(n.hydrated||n.node instanceof t||n.node instanceof Function)&&(ke.call(e.removedNodes,n.node)||!document.body.contains(n.node))){n.onDisconnected();const e=n.key;Ne.delete(e)}})})}).observe(document.body,{childList:!0,subtree:!0,attributes:!1});let Ce=0;function Ee(e){const n=e.childNodes,r=n.length;return 1===r?n[0]:r?new t(n):e}function Ae(e,t,n,r){const s={id:Ce+=1};function i(){const i=new e(t);if(i.key=s,i.id=r,Ne.set(s,i),i.__parent__=n,n&&n.stylesRegistry)if(r&&n.stylesRegistry[r])i.styles={...i.styles,...n.stylesRegistry[r]};else{const t=e.compName||!1;t&&n.stylesRegistry[t]&&(i.styles={...i.styles,...n.stylesRegistry[t]})}return i}function o(e){let n=Ne.get(s);return n?!e||e instanceof Comment||n._setProps(e):(!e||e instanceof Comment||(t=e),n=i()),n._updater}return o._nameId="_factory",o.instance=function(){return Ne.get(s)||i()},o}return e.Component=Ae,e.Fragment=class{static for(e,t,n){const r=void 0===n?{}:n;return void 0===e.__childs__&&(e.__childs__={}),e.__childs__[t]?e.__childs__[t](n):(e.__childs__[t]=Ae(this,r,e,t),e.__childs__[t])}constructor(e){this._node=null,this.__parent__=null,this.__childs__={},this.__partKeys__={},this.props=e,this.render=this.render.bind(this),this._updater=this._updater.bind(this)}get node(){return this._node}part(e){const t=this.__partKeys__[e]||(this.__partKeys__[e]={tagger:new se("html"),wire:null});return function(){const e=t.tagger.apply(null,arguments);return t.wire||(t.wire=Ee(e))}}onDisconnected(){this.__parent__&&this.__parent__.__childs__&&delete this.__parent__.__childs__[this.id]}_setProps(e){this.props=e}_updater(){const e=this.render(this.props);return this._node||(this._node=e)}render(e){return""}},e.VirtualElement=class{static get properties(){return{}}static for(e,t,n){const r=void 0===t?"default":t,s=void 0===n?{}:n;return void 0===e.__childs__&&(e.__childs__={}),e.__childs__[r]?e.__childs__[r](n):(e.__childs__[r]=Ae(this,s,e,r),e.__childs__[r])}constructor(){this.hydrated=!1,this.v2=!0,this.$=new se("html"),this._html=function(){return this.$.apply(null,arguments)},this._key=null,this._id=null,this._node=null,this.__parent__=null,this.__childs__={},this._needsRender=!0,this._connected=!1,this.__values__={},this.__partKeys__={},this.watched=this.watchers(),this.stylesRegistry={},this.styles={};const e=this.constructor.properties;this.attachProps(e),this.templateCache={},this.render=this.render.bind(this),this._updater=this._updater.bind(this)}attachProps(e,t){e&&Object.keys(e).forEach(n=>{const r=e[n];!function(e,t,n){const{type:r}=n;function s(){const n=e.__values__[t];return"function"==typeof n&&r!==Function?n():n}Object.defineProperty(e,t,n.computed?{get:s}:{get:s,set:function(n){let s;s=null==n||"function"==typeof n?n:r?r(n):n,e._setPropertyValue(t,s)}})}(this,n,r),r.type&&void 0!==r.default?this.__values__[n]=r.default:this.__values__[n]=r,t&&t[n]&&(this.watched[n]=t[n])})}part(e){const t=this.__partKeys__[e]||(this.__partKeys__[e]={tagger:new se("html"),wire:null});return function(){const e=t.tagger.apply(null,arguments);return t.wire||(t.wire=Ee(e))}}dtt(e,t){const n=this.__partKeys__[e]||(this.__partKeys__[e]={tagger:new se("html"),wire:null}),r=this;return function(){let e=r.templateCache[t]||(r.templateCache[t]=xe(arguments[0],t));arguments[0]=e;const s=n.tagger.apply(null,arguments);return n.wire||(n.wire=Ee(s))}}get html(){return this._html}set key(e){this._key=e}get key(){return this._key}get node(){return this._node}set id(e){this._id=e}get id(){return this._id}_setPropertyValue(e,t){const n=this.__values__[e];if(this.__values__[e]=t,n!==t){if(this.watched[e]&&this.watched[e](t,n))return;this._needsRender||this.invalidate()}}_setProps(e){if(e){if(this.onUpdated(e))return;Object.keys(e).forEach(t=>{this._setPropertyValue(t,e[t])})}}watchers(){return{}}onConnected(){}onDisconnected(){this.__parent__&&this.__parent__.__childs__&&delete this.__parent__.__childs__[this.id],this._connected=!1}onRender(){}invalidate(){if(!this._needsRender){if(this._needsRender=!0,this.hydrated)return void Promise.resolve().then(()=>this.deHydrate());Promise.resolve().then(()=>{this._needsRender&&this.update()})}}onUpdated(e){}update(){return this._connected?this._updater():""}deHydrate(){this._node=null,this.hydrated=!1,this.__parent__.invalidate()}_updater(){const e=this.hydrated?this._node:this.render(),t=this._node||(this._node=this.v2?e:Ee(e));return this.onRender(),this._connected||(this._connected=!0,setTimeout(()=>this.onConnected())),this._needsRender=!1,t}render(){return this.html``}vModel(e){const t=this;function n(){return t.__values__[e]}return n.model=()=>e,n}$emit(e,t){if(this.__parent__){const[n,r]=e.split(":");switch(n){case"update":if(this.__values__[r].model){const e=this.__values__[r].model();this.__parent__._setPropertyValue(e,t)}else this.__values__[r]=t;this.invalidate();break;default:this.__parent__.handleEvent&&this.__parent__.handleEvent(e,t)}}else console.log("NO PARENT")}},e.html=ue,e.mapClass=function(e){return e.filter(e=>"string"==typeof e||e[1]).map(e=>"string"==typeof e?e:e[0]).join(" ")},e.render=de,e.svg=he,e.vAnimation=function(e,t,n,r){let s,i=be.get(n);void 0===i&&(i="");const o=r||"v-fade";let l=e?"":"hide";return be.set(n,l),s=""===i?`${o} ${l}`:`${o} ${l=e?"show":"hide"}`,html.for(n)`<div class="${s}">${t}</div>`},e.vLoop=function(e,t){return e.map((e,n)=>{const r=t(e,n);return"function"==typeof r&&r._nameId&&"_factory"===r._nameId?r():r})},e}({});