@neuronet.io/vido
Advanced tools
Comparing version 1.0.29 to 1.0.30
{ | ||
"name": "@neuronet.io/vido", | ||
"version": "1.0.29", | ||
"version": "1.0.30", | ||
"description": "Compilation-less and eval free frontend framework for fast scalable apps.", | ||
@@ -5,0 +5,0 @@ "main": "vido.js", |
@@ -134,3 +134,3 @@ /** | ||
* http://polymer.github.io/PATENTS.txt | ||
*/var R=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,s){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,s,(t=e[n](t)).done,t.value)}))}}};const B=t((e,t)=>async n=>{var o,s;if(!(n instanceof A))throw new Error("asyncReplace can only be used in text bindings");if(e===n.value)return;const i=new A(n.options);n.value=e;let r=0;try{for(var a,l=R(e);!(a=await l.next()).done;){let o=a.value;if(n.value!==e)break;0===r&&(n.clear(),i.appendIntoPart(n)),void 0!==t&&(o=t(o,r)),i.setValue(o),i.commit(),r++}}catch(e){o={error:e}}finally{try{a&&!a.done&&(s=l.return)&&await s.call(l)}finally{if(o)throw o.error}}}),D=new WeakMap,J=t(e=>t=>{if(!(t instanceof A))throw new Error("cache can only be used in text bindings");let n=D.get(t);void 0===n&&(n=new WeakMap,D.set(t,n));const o=t.value;if(o instanceof v){if(e instanceof _&&o.template===t.options.templateFactory(e))return void t.setValue(e);{let e=n.get(o.template);void 0===e&&(e={instance:o,nodes:document.createDocumentFragment()},n.set(o.template,e)),s(e.nodes,t.startNode.nextSibling,t.endNode)}}if(e instanceof _){const o=t.options.templateFactory(e),s=n.get(o);void 0!==s&&(t.setValue(s.nodes),t.commit(),t.value=s.instance)}t.setValue(e)}),q=new WeakMap,z=t(e=>t=>{if(!(t instanceof E)||t instanceof C||"class"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `classMap` directive must be used in the `class` attribute and must be the only part in the attribute.");const{committer:n}=t,{element:o}=n;q.has(t)||(o.className=n.strings.join(" "));const{classList:s}=o,i=q.get(t);for(const t in i)t in e||s.remove(t);for(const t in e){const n=e[t];if(!i||n!==i[t]){s[n?"add":"remove"](t)}}q.set(t,e)}),G=new WeakMap,K=t((e,t)=>n=>{const o=G.get(n);if(Array.isArray(e)){if(Array.isArray(o)&&o.length===e.length&&e.every((e,t)=>e===o[t]))return}else if(o===e&&(void 0!==e||G.has(n)))return;n.setValue(t()),G.set(n,Array.isArray(e)?Array.from(e):e)}),Q=t(e=>t=>{if(void 0===e&&t instanceof E){if(e!==t.value){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else t.setValue(e)}),U=(e,t)=>{const n=e.startNode.parentNode,o=void 0===t?e.endNode:t.startNode,s=n.insertBefore(f(),o);n.insertBefore(f(),o);const i=new A(e.options);return i.insertAfterNode(s),i},X=(e,t)=>(e.setValue(t),e.commit(),e),Y=(e,t,n)=>{const o=e.startNode.parentNode,i=n?n.startNode:e.endNode,r=t.endNode.nextSibling;r!==i&&s(o,t.startNode,r,i)},Z=e=>{i(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},ee=(e,t,n)=>{const o=new Map;for(let s=t;s<=n;s++)o.set(e[s],s);return o},te=new WeakMap,ne=new WeakMap,oe=t((e,t,n)=>{let o;return void 0===n?n=t:void 0!==t&&(o=t),t=>{if(!(t instanceof A))throw new Error("repeat can only be used in text bindings");const s=te.get(t)||[],i=ne.get(t)||[],r=[],a=[],l=[];let c,d,u=0;for(const t of e)l[u]=o?o(t,u):u,a[u]=n(t,u),u++;let p=0,h=s.length-1,m=0,f=a.length-1;for(;p<=h&&m<=f;)if(null===s[p])p++;else if(null===s[h])h--;else if(i[p]===l[m])r[m]=X(s[p],a[m]),p++,m++;else if(i[h]===l[f])r[f]=X(s[h],a[f]),h--,f--;else if(i[p]===l[f])r[f]=X(s[p],a[f]),Y(t,s[p],r[f+1]),p++,f--;else if(i[h]===l[m])r[m]=X(s[h],a[m]),Y(t,s[h],s[p]),h--,m++;else if(void 0===c&&(c=ee(l,m,f),d=ee(i,p,h)),c.has(i[p]))if(c.has(i[h])){const e=d.get(l[m]),n=void 0!==e?s[e]:null;if(null===n){const e=U(t,s[p]);X(e,a[m]),r[m]=e}else r[m]=X(n,a[m]),Y(t,n,s[p]),s[e]=null;m++}else Z(s[h]),h--;else Z(s[p]),p++;for(;m<=f;){const e=U(t,r[f+1]);X(e,a[m]),r[m++]=e}for(;p<=h;){const e=s[p++];null!==e&&Z(e)}te.set(t,r),ne.set(t,l)}}),se=new WeakMap,ie=t(e=>t=>{if(!(t instanceof E)||t instanceof C||"style"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `styleMap` directive must be used in the style attribute and must be the only part in the attribute.");const{committer:n}=t,{style:o}=n.element;se.has(t)||(o.cssText=n.strings.join(" "));const s=se.get(t);for(const t in s)t in e||(-1===t.indexOf("-")?o[t]=null:o.removeProperty(t));for(const t in e)-1===t.indexOf("-")?o[t]=e[t]:o.setProperty(t,e[t]);se.set(t,e)}),re=new WeakMap,ae=t(e=>t=>{if(!(t instanceof A))throw new Error("unsafeHTML can only be used in text bindings");const n=re.get(t);if(void 0!==n&&b(e)&&e===n.value&&t.value===n.fragment)return;const o=document.createElement("template");o.innerHTML=e;const s=document.importNode(o.content,!0);t.setValue(s),re.set(t,{value:e,fragment:s})}),le=new WeakMap,ce=t((...e)=>t=>{let n=le.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},le.set(t,n));const o=n.values;let s=o.length;n.values=e;for(let i=0;i<e.length&&!(i>n.lastRenderedIndex);i++){const r=e[i];if(b(r)||"function"!=typeof r.then){t.setValue(r),n.lastRenderedIndex=i;break}i<s&&r===o[i]||(n.lastRenderedIndex=2147483647,s=0,Promise.resolve(r).then(e=>{const o=n.values.indexOf(r);o>-1&&o<n.lastRenderedIndex&&(n.lastRenderedIndex=o,t.setValue(e),t.commit())}))}}); | ||
*/var R=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,s){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,s,(t=e[n](t)).done,t.value)}))}}};const B=t((e,t)=>async n=>{var o,s;if(!(n instanceof A))throw new Error("asyncReplace can only be used in text bindings");if(e===n.value)return;const i=new A(n.options);n.value=e;let r=0;try{for(var a,l=R(e);!(a=await l.next()).done;){let o=a.value;if(n.value!==e)break;0===r&&(n.clear(),i.appendIntoPart(n)),void 0!==t&&(o=t(o,r)),i.setValue(o),i.commit(),r++}}catch(e){o={error:e}}finally{try{a&&!a.done&&(s=l.return)&&await s.call(l)}finally{if(o)throw o.error}}}),D=new WeakMap,J=t(e=>t=>{if(!(t instanceof A))throw new Error("cache can only be used in text bindings");let n=D.get(t);void 0===n&&(n=new WeakMap,D.set(t,n));const o=t.value;if(o instanceof v){if(e instanceof _&&o.template===t.options.templateFactory(e))return void t.setValue(e);{let e=n.get(o.template);void 0===e&&(e={instance:o,nodes:document.createDocumentFragment()},n.set(o.template,e)),s(e.nodes,t.startNode.nextSibling,t.endNode)}}if(e instanceof _){const o=t.options.templateFactory(e),s=n.get(o);void 0!==s&&(t.setValue(s.nodes),t.commit(),t.value=s.instance)}t.setValue(e)}),q=new WeakMap,z=t(e=>t=>{if(!(t instanceof E)||t instanceof C||"class"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `classMap` directive must be used in the `class` attribute and must be the only part in the attribute.");const{committer:n}=t,{element:o}=n;q.has(t)||(o.className=n.strings.join(" "));const{classList:s}=o,i=q.get(t);for(const t in i)t in e||s.remove(t);for(const t in e){const n=e[t];if(!i||n!==i[t]){s[n?"add":"remove"](t)}}q.set(t,e)}),G=new WeakMap,K=t((e,t)=>n=>{const o=G.get(n);if(Array.isArray(e)){if(Array.isArray(o)&&o.length===e.length&&e.every((e,t)=>e===o[t]))return}else if(o===e&&(void 0!==e||G.has(n)))return;n.setValue(t()),G.set(n,Array.isArray(e)?Array.from(e):e)}),Q=t(e=>t=>{if(void 0===e&&t instanceof E){if(e!==t.value){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else t.setValue(e)}),U=(e,t)=>{const n=e.startNode.parentNode,o=void 0===t?e.endNode:t.startNode,s=n.insertBefore(f(),o);n.insertBefore(f(),o);const i=new A(e.options);return i.insertAfterNode(s),i},X=(e,t)=>(e.setValue(t),e.commit(),e),Y=(e,t,n)=>{const o=e.startNode.parentNode,i=n?n.startNode:e.endNode,r=t.endNode.nextSibling;r!==i&&s(o,t.startNode,r,i)},Z=e=>{i(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},ee=(e,t,n)=>{const o=new Map;for(let s=t;s<=n;s++)o.set(e[s],s);return o},te=new WeakMap,ne=new WeakMap,oe=t((e,t,n)=>{let o;return void 0===n?n=t:void 0!==t&&(o=t),t=>{if(!(t instanceof A))throw new Error("repeat can only be used in text bindings");const s=te.get(t)||[],i=ne.get(t)||[],r=[],a=[],l=[];let c,d,u=0;for(const t of e)l[u]=o?o(t,u):u,a[u]=n(t,u),u++;let p=0,h=s.length-1,m=0,f=a.length-1;for(;p<=h&&m<=f;)if(null===s[p])p++;else if(null===s[h])h--;else if(i[p]===l[m])r[m]=X(s[p],a[m]),p++,m++;else if(i[h]===l[f])r[f]=X(s[h],a[f]),h--,f--;else if(i[p]===l[f])r[f]=X(s[p],a[f]),Y(t,s[p],r[f+1]),p++,f--;else if(i[h]===l[m])r[m]=X(s[h],a[m]),Y(t,s[h],s[p]),h--,m++;else if(void 0===c&&(c=ee(l,m,f),d=ee(i,p,h)),c.has(i[p]))if(c.has(i[h])){const e=d.get(l[m]),n=void 0!==e?s[e]:null;if(null===n){const e=U(t,s[p]);X(e,a[m]),r[m]=e}else r[m]=X(n,a[m]),Y(t,n,s[p]),s[e]=null;m++}else Z(s[h]),h--;else Z(s[p]),p++;for(;m<=f;){const e=U(t,r[f+1]);X(e,a[m]),r[m++]=e}for(;p<=h;){const e=s[p++];null!==e&&Z(e)}te.set(t,r),ne.set(t,l)}}),se=new WeakMap,ie=t(e=>t=>{if(!(t instanceof E)||t instanceof C||"style"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `styleMap` directive must be used in the style attribute and must be the only part in the attribute.");const{committer:n}=t,{style:o}=n.element;se.has(t)||(o.cssText=n.strings.join(" "));const s=se.get(t);for(const t in s)t in e||(-1===t.indexOf("-")?o[t]=null:o.removeProperty(t));for(const t in e)-1===t.indexOf("-")?o[t]=e[t]:o.setProperty(t,e[t]);se.set(t,e)}),re=new WeakMap,ae=t(e=>t=>{if(!(t instanceof A))throw new Error("unsafeHTML can only be used in text bindings");const n=re.get(t);if(void 0!==n&&b(e)&&e===n.value&&t.value===n.fragment)return;const o=document.createElement("template");o.innerHTML=e;const s=document.importNode(o.content,!0);t.setValue(s),re.set(t,{value:e,fragment:s})}),le=new WeakMap,ce=t((...e)=>t=>{let n=le.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},le.set(t,n));const o=n.values;let s=o.length;n.values=e;for(let i=0;i<e.length&&!(i>n.lastRenderedIndex);i++){const r=e[i];if(b(r)||"function"!=typeof r.then){t.setValue(r),n.lastRenderedIndex=i;break}i<s&&r===o[i]||(n.lastRenderedIndex=2147483647,s=0,Promise.resolve(r).then(e=>{const o=n.values.indexOf(r);o>-1&&o<n.lastRenderedIndex&&(n.lastRenderedIndex=o,t.setValue(e),t.commit())}))}}),de=()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}}; | ||
/** | ||
@@ -148,3 +148,3 @@ * @license | ||
* http://polymer.github.io/PATENTS.txt | ||
*/function de(e){return JSON.parse(JSON.stringify(e))}export default function(e,n){let o=0;const s={};let i,r,a=[],l=0;const c=Promise.resolve();function d(e){return t((function(t,n){return function(o){const s=o.committer.element;for(const o of t)if("function"==typeof o){const t=a.find(t=>t.instance===e&&t.componentAction.create===o&&t.element===s);if(t)t.props=n;else{void 0!==s.__vido__&&delete s.__vido__;const t={create:o,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:s,props:n})}}}}))}const u={debug:!1,state:e,api:n,html:L,svg:W,directive:t,asyncAppend:F,asyncReplace:B,cache:J,classMap:z,guard:K,ifDefined:Q,repeat:oe,styleMap:ie,unsafeHTML:ae,until:ce,lastProps:{},actions(e,t){},onDestroy(){},onChange(e){},componentsFromDataArray(e,t,n,o){if(e.length<t.length){let s=t.length-e.length;for(;s;){const i=t[t.length-s];e.push(u.createComponent(o,n(i))),s--}}else if(e.length>t.length){let n=e.length-t.length;for(;n;){e[e.length-n].destroy(),n--}e.length=t.length}let s=0;for(const o of t)e[s].change(n(o)),s++;return e},createComponent(e,t){const n=e.name+":"+o++;let i;const r=[];let l=[];i=Object.assign(Object.assign({},u),{update:function(){u.updateTemplate(i)},onDestroy:function(e){r.push(e)},onChange:function(e){l.push(e)},instance:n,actions:d(n),lastProps:t});const c=function(e,t){return{instance:e,vidoInstance:t,destroy:()=>(t.debug&&(console.groupCollapsed(`destroying component ${e}`),console.log(de({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.destroyComponent(e,t)),update:()=>(t.debug&&(console.groupCollapsed(`updating component ${e}`),console.log(de({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.updateTemplate(t)),change(n){t.debug&&(console.groupCollapsed(`changing component ${e}`),console.log(de({props:n,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),void 0!==s[e]&&s[e].change(n,t)},html(n={}){if(void 0!==s[e])return s[e].update(n,t)}}}(n,i),p=e(i,t),h={instance:n,vidoInstance:i,lastProps:t,destroy(){i.debug&&(console.groupCollapsed(`component destroy method fired ${n}`),console.log(de({props:t,components:Object.keys(s),destroyable:r})),console.trace(),console.groupEnd());for(const e of r)e();l.length=0,r.length=0},update:e=>(i.debug&&(console.groupCollapsed(`component update method fired ${n}`),console.log(de({props:e,components:Object.keys(s),onChangeFunctions:l})),console.trace(),console.groupEnd()),p(e)),change(e){i.debug&&(console.groupCollapsed(`component change method fired ${n}`),console.log(de({props:t,components:Object.keys(s),onChangeFunctions:l,changedProps:e})),console.trace(),console.groupEnd());for(const t of l)t(e);i.lastProps=e}};return s[n]=h,s[n].change(t),i.debug&&(console.groupCollapsed(`component created ${n}`),console.log(de({props:t,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),c},destroyComponent(e,t){t.debug&&(console.groupCollapsed(`destroying component ${e}...`),console.log(de({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),void 0!==s[e]&&"function"==typeof s[e].destroy&&s[e].destroy(),delete s[e],t.debug&&(console.groupCollapsed(`component destroyed ${e}`),console.log(de({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd())},updateTemplate(e){const t=++l,n=this;c.then((function(){t===l&&(n.render(),l=0,e.debug&&(console.groupCollapsed("templates updated"),console.trace(),console.groupEnd()))}))},createApp(e,t){r=t;const n=this.createComponent(e);return i=n.instance,this.render(),n},executeActions(){for(const e of a)if(void 0===e.element.__vido__){if("function"==typeof e.componentAction.create){const t=e.componentAction.create(e.element,e.props);u.debug&&(console.groupCollapsed(`create action executed ${e.instance}`),console.log(de({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()),void 0!==t&&("function"==typeof t.update&&(e.componentAction.update=t.update),"function"==typeof t.destroy&&(e.componentAction.destroy=t.destroy))}}else"function"==typeof e.componentAction.update&&(e.componentAction.update(e.element,e.props),u.debug&&(console.groupCollapsed(`update action executed ${e.instance}`),console.log(de({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()));for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){j(s[i].update(),r),u.executeActions()}};return u}export{de as mergeDeep}; | ||
*/function ue(e){return JSON.parse(JSON.stringify(e,de))}export default function(e,n){let o=0;const s={};let i,r,a=[],l=0;const c=Promise.resolve();function d(e){return t((function(t,n){return function(o){const s=o.committer.element;for(const o of t)if("function"==typeof o){const t=a.find(t=>t.instance===e&&t.componentAction.create===o&&t.element===s);if(t)t.props=n;else{void 0!==s.__vido__&&delete s.__vido__;const t={create:o,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:s,props:n})}}}}))}const u={debug:!1,state:e,api:n,html:L,svg:W,directive:t,asyncAppend:F,asyncReplace:B,cache:J,classMap:z,guard:K,ifDefined:Q,repeat:oe,styleMap:ie,unsafeHTML:ae,until:ce,lastProps:{},actions(e,t){},onDestroy(){},onChange(e){},componentsFromDataArray(e,t,n,o){if(e.length<t.length){let s=t.length-e.length;for(;s;){const i=t[t.length-s];e.push(u.createComponent(o,n(i))),s--}}else if(e.length>t.length){let n=e.length-t.length;for(;n;){e[e.length-n].destroy(),n--}e.length=t.length}let s=0;for(const o of t)e[s].change(n(o)),s++;return e},createComponent(e,t){const n=e.name+":"+o++;let i;const r=[];let l=[];i=Object.assign(Object.assign({},u),{update:function(){u.updateTemplate(i)},onDestroy:function(e){r.push(e)},onChange:function(e){l.push(e)},instance:n,actions:d(n),lastProps:t});const c=function(e,t){return{instance:e,vidoInstance:t,destroy:()=>(t.debug&&(console.groupCollapsed(`destroying component ${e}`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.destroyComponent(e,t)),update:()=>(t.debug&&(console.groupCollapsed(`updating component ${e}`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.updateTemplate(t)),change(n){t.debug&&(console.groupCollapsed(`changing component ${e}`),console.log(ue({props:n,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),void 0!==s[e]&&s[e].change(n,t)},html(n={}){if(void 0!==s[e])return s[e].update(n,t)}}}(n,i),p=e(i,t),h={instance:n,vidoInstance:i,lastProps:t,destroy(){i.debug&&(console.groupCollapsed(`component destroy method fired ${n}`),console.log(ue({props:t,components:Object.keys(s),destroyable:r})),console.trace(),console.groupEnd());for(const e of r)e();l.length=0,r.length=0},update:e=>(i.debug&&(console.groupCollapsed(`component update method fired ${n}`),console.log(ue({props:e,components:Object.keys(s),onChangeFunctions:l})),console.trace(),console.groupEnd()),p(e)),change(e){i.debug&&(console.groupCollapsed(`component change method fired ${n}`),console.log(ue({props:t,components:Object.keys(s),onChangeFunctions:l,changedProps:e})),console.trace(),console.groupEnd());for(const t of l)t(e);i.lastProps=e}};return s[n]=h,s[n].change(t),i.debug&&(console.groupCollapsed(`component created ${n}`),console.log(ue({props:t,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),c},destroyComponent(e,t){t.debug&&(console.groupCollapsed(`destroying component ${e}...`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),void 0!==s[e]&&"function"==typeof s[e].destroy&&s[e].destroy(),delete s[e],t.debug&&(console.groupCollapsed(`component destroyed ${e}`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd())},updateTemplate(e){const t=++l,n=this;c.then((function(){t===l&&(n.render(),l=0,e.debug&&(console.groupCollapsed("templates updated"),console.trace(),console.groupEnd()))}))},createApp(e,t){r=t;const n=this.createComponent(e);return i=n.instance,this.render(),n},executeActions(){for(const e of a)if(void 0===e.element.__vido__){if("function"==typeof e.componentAction.create){const t=e.componentAction.create(e.element,e.props);u.debug&&(console.groupCollapsed(`create action executed ${e.instance}`),console.log(ue({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()),void 0!==t&&("function"==typeof t.update&&(e.componentAction.update=t.update),"function"==typeof t.destroy&&(e.componentAction.destroy=t.destroy))}}else"function"==typeof e.componentAction.update&&(e.componentAction.update(e.element,e.props),u.debug&&(console.groupCollapsed(`update action executed ${e.instance}`),console.log(ue({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()));for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){j(s[i].update(),r),u.executeActions()}};return u}export{ue as mergeDeep}; | ||
//# sourceMappingURL=vido.esm.min.js.map |
@@ -134,3 +134,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Vido={})}(this,(function(e){"use strict"; | ||
* http://polymer.github.io/PATENTS.txt | ||
*/var B=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,s){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,s,(t=e[n](t)).done,t.value)}))}}};const D=n((e,t)=>async n=>{var o,s;if(!(n instanceof A))throw new Error("asyncReplace can only be used in text bindings");if(e===n.value)return;const i=new A(n.options);n.value=e;let r=0;try{for(var a,l=B(e);!(a=await l.next()).done;){let o=a.value;if(n.value!==e)break;0===r&&(n.clear(),i.appendIntoPart(n)),void 0!==t&&(o=t(o,r)),i.setValue(o),i.commit(),r++}}catch(e){o={error:e}}finally{try{a&&!a.done&&(s=l.return)&&await s.call(l)}finally{if(o)throw o.error}}}),J=new WeakMap,q=n(e=>t=>{if(!(t instanceof A))throw new Error("cache can only be used in text bindings");let n=J.get(t);void 0===n&&(n=new WeakMap,J.set(t,n));const o=t.value;if(o instanceof y){if(e instanceof x&&o.template===t.options.templateFactory(e))return void t.setValue(e);{let e=n.get(o.template);void 0===e&&(e={instance:o,nodes:document.createDocumentFragment()},n.set(o.template,e)),i(e.nodes,t.startNode.nextSibling,t.endNode)}}if(e instanceof x){const o=t.options.templateFactory(e),s=n.get(o);void 0!==s&&(t.setValue(s.nodes),t.commit(),t.value=s.instance)}t.setValue(e)}),z=new WeakMap,G=n(e=>t=>{if(!(t instanceof V)||t instanceof k||"class"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `classMap` directive must be used in the `class` attribute and must be the only part in the attribute.");const{committer:n}=t,{element:o}=n;z.has(t)||(o.className=n.strings.join(" "));const{classList:s}=o,i=z.get(t);for(const t in i)t in e||s.remove(t);for(const t in e){const n=e[t];if(!i||n!==i[t]){s[n?"add":"remove"](t)}}z.set(t,e)}),K=new WeakMap,Q=n((e,t)=>n=>{const o=K.get(n);if(Array.isArray(e)){if(Array.isArray(o)&&o.length===e.length&&e.every((e,t)=>e===o[t]))return}else if(o===e&&(void 0!==e||K.has(n)))return;n.setValue(t()),K.set(n,Array.isArray(e)?Array.from(e):e)}),U=n(e=>t=>{if(void 0===e&&t instanceof V){if(e!==t.value){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else t.setValue(e)}),X=(e,t)=>{const n=e.startNode.parentNode,o=void 0===t?e.endNode:t.startNode,s=n.insertBefore(g(),o);n.insertBefore(g(),o);const i=new A(e.options);return i.insertAfterNode(s),i},Y=(e,t)=>(e.setValue(t),e.commit(),e),Z=(e,t,n)=>{const o=e.startNode.parentNode,s=n?n.startNode:e.endNode,r=t.endNode.nextSibling;r!==s&&i(o,t.startNode,r,s)},ee=e=>{r(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},te=(e,t,n)=>{const o=new Map;for(let s=t;s<=n;s++)o.set(e[s],s);return o},ne=new WeakMap,oe=new WeakMap,se=n((e,t,n)=>{let o;return void 0===n?n=t:void 0!==t&&(o=t),t=>{if(!(t instanceof A))throw new Error("repeat can only be used in text bindings");const s=ne.get(t)||[],i=oe.get(t)||[],r=[],a=[],l=[];let c,d,u=0;for(const t of e)l[u]=o?o(t,u):u,a[u]=n(t,u),u++;let p=0,h=s.length-1,m=0,f=a.length-1;for(;p<=h&&m<=f;)if(null===s[p])p++;else if(null===s[h])h--;else if(i[p]===l[m])r[m]=Y(s[p],a[m]),p++,m++;else if(i[h]===l[f])r[f]=Y(s[h],a[f]),h--,f--;else if(i[p]===l[f])r[f]=Y(s[p],a[f]),Z(t,s[p],r[f+1]),p++,f--;else if(i[h]===l[m])r[m]=Y(s[h],a[m]),Z(t,s[h],s[p]),h--,m++;else if(void 0===c&&(c=te(l,m,f),d=te(i,p,h)),c.has(i[p]))if(c.has(i[h])){const e=d.get(l[m]),n=void 0!==e?s[e]:null;if(null===n){const e=X(t,s[p]);Y(e,a[m]),r[m]=e}else r[m]=Y(n,a[m]),Z(t,n,s[p]),s[e]=null;m++}else ee(s[h]),h--;else ee(s[p]),p++;for(;m<=f;){const e=X(t,r[f+1]);Y(e,a[m]),r[m++]=e}for(;p<=h;){const e=s[p++];null!==e&&ee(e)}ne.set(t,r),oe.set(t,l)}}),ie=new WeakMap,re=n(e=>t=>{if(!(t instanceof V)||t instanceof k||"style"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `styleMap` directive must be used in the style attribute and must be the only part in the attribute.");const{committer:n}=t,{style:o}=n.element;ie.has(t)||(o.cssText=n.strings.join(" "));const s=ie.get(t);for(const t in s)t in e||(-1===t.indexOf("-")?o[t]=null:o.removeProperty(t));for(const t in e)-1===t.indexOf("-")?o[t]=e[t]:o.setProperty(t,e[t]);ie.set(t,e)}),ae=new WeakMap,le=n(e=>t=>{if(!(t instanceof A))throw new Error("unsafeHTML can only be used in text bindings");const n=ae.get(t);if(void 0!==n&&w(e)&&e===n.value&&t.value===n.fragment)return;const o=document.createElement("template");o.innerHTML=e;const s=document.importNode(o.content,!0);t.setValue(s),ae.set(t,{value:e,fragment:s})}),ce=new WeakMap,de=n((...e)=>t=>{let n=ce.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},ce.set(t,n));const o=n.values;let s=o.length;n.values=e;for(let i=0;i<e.length&&!(i>n.lastRenderedIndex);i++){const r=e[i];if(w(r)||"function"!=typeof r.then){t.setValue(r),n.lastRenderedIndex=i;break}i<s&&r===o[i]||(n.lastRenderedIndex=2147483647,s=0,Promise.resolve(r).then(e=>{const o=n.values.indexOf(r);o>-1&&o<n.lastRenderedIndex&&(n.lastRenderedIndex=o,t.setValue(e),t.commit())}))}}); | ||
*/var B=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,s){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,s,(t=e[n](t)).done,t.value)}))}}};const D=n((e,t)=>async n=>{var o,s;if(!(n instanceof A))throw new Error("asyncReplace can only be used in text bindings");if(e===n.value)return;const i=new A(n.options);n.value=e;let r=0;try{for(var a,l=B(e);!(a=await l.next()).done;){let o=a.value;if(n.value!==e)break;0===r&&(n.clear(),i.appendIntoPart(n)),void 0!==t&&(o=t(o,r)),i.setValue(o),i.commit(),r++}}catch(e){o={error:e}}finally{try{a&&!a.done&&(s=l.return)&&await s.call(l)}finally{if(o)throw o.error}}}),J=new WeakMap,q=n(e=>t=>{if(!(t instanceof A))throw new Error("cache can only be used in text bindings");let n=J.get(t);void 0===n&&(n=new WeakMap,J.set(t,n));const o=t.value;if(o instanceof y){if(e instanceof x&&o.template===t.options.templateFactory(e))return void t.setValue(e);{let e=n.get(o.template);void 0===e&&(e={instance:o,nodes:document.createDocumentFragment()},n.set(o.template,e)),i(e.nodes,t.startNode.nextSibling,t.endNode)}}if(e instanceof x){const o=t.options.templateFactory(e),s=n.get(o);void 0!==s&&(t.setValue(s.nodes),t.commit(),t.value=s.instance)}t.setValue(e)}),z=new WeakMap,G=n(e=>t=>{if(!(t instanceof V)||t instanceof k||"class"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `classMap` directive must be used in the `class` attribute and must be the only part in the attribute.");const{committer:n}=t,{element:o}=n;z.has(t)||(o.className=n.strings.join(" "));const{classList:s}=o,i=z.get(t);for(const t in i)t in e||s.remove(t);for(const t in e){const n=e[t];if(!i||n!==i[t]){s[n?"add":"remove"](t)}}z.set(t,e)}),K=new WeakMap,Q=n((e,t)=>n=>{const o=K.get(n);if(Array.isArray(e)){if(Array.isArray(o)&&o.length===e.length&&e.every((e,t)=>e===o[t]))return}else if(o===e&&(void 0!==e||K.has(n)))return;n.setValue(t()),K.set(n,Array.isArray(e)?Array.from(e):e)}),U=n(e=>t=>{if(void 0===e&&t instanceof V){if(e!==t.value){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else t.setValue(e)}),X=(e,t)=>{const n=e.startNode.parentNode,o=void 0===t?e.endNode:t.startNode,s=n.insertBefore(g(),o);n.insertBefore(g(),o);const i=new A(e.options);return i.insertAfterNode(s),i},Y=(e,t)=>(e.setValue(t),e.commit(),e),Z=(e,t,n)=>{const o=e.startNode.parentNode,s=n?n.startNode:e.endNode,r=t.endNode.nextSibling;r!==s&&i(o,t.startNode,r,s)},ee=e=>{r(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},te=(e,t,n)=>{const o=new Map;for(let s=t;s<=n;s++)o.set(e[s],s);return o},ne=new WeakMap,oe=new WeakMap,se=n((e,t,n)=>{let o;return void 0===n?n=t:void 0!==t&&(o=t),t=>{if(!(t instanceof A))throw new Error("repeat can only be used in text bindings");const s=ne.get(t)||[],i=oe.get(t)||[],r=[],a=[],l=[];let c,d,u=0;for(const t of e)l[u]=o?o(t,u):u,a[u]=n(t,u),u++;let p=0,h=s.length-1,m=0,f=a.length-1;for(;p<=h&&m<=f;)if(null===s[p])p++;else if(null===s[h])h--;else if(i[p]===l[m])r[m]=Y(s[p],a[m]),p++,m++;else if(i[h]===l[f])r[f]=Y(s[h],a[f]),h--,f--;else if(i[p]===l[f])r[f]=Y(s[p],a[f]),Z(t,s[p],r[f+1]),p++,f--;else if(i[h]===l[m])r[m]=Y(s[h],a[m]),Z(t,s[h],s[p]),h--,m++;else if(void 0===c&&(c=te(l,m,f),d=te(i,p,h)),c.has(i[p]))if(c.has(i[h])){const e=d.get(l[m]),n=void 0!==e?s[e]:null;if(null===n){const e=X(t,s[p]);Y(e,a[m]),r[m]=e}else r[m]=Y(n,a[m]),Z(t,n,s[p]),s[e]=null;m++}else ee(s[h]),h--;else ee(s[p]),p++;for(;m<=f;){const e=X(t,r[f+1]);Y(e,a[m]),r[m++]=e}for(;p<=h;){const e=s[p++];null!==e&&ee(e)}ne.set(t,r),oe.set(t,l)}}),ie=new WeakMap,re=n(e=>t=>{if(!(t instanceof V)||t instanceof k||"style"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `styleMap` directive must be used in the style attribute and must be the only part in the attribute.");const{committer:n}=t,{style:o}=n.element;ie.has(t)||(o.cssText=n.strings.join(" "));const s=ie.get(t);for(const t in s)t in e||(-1===t.indexOf("-")?o[t]=null:o.removeProperty(t));for(const t in e)-1===t.indexOf("-")?o[t]=e[t]:o.setProperty(t,e[t]);ie.set(t,e)}),ae=new WeakMap,le=n(e=>t=>{if(!(t instanceof A))throw new Error("unsafeHTML can only be used in text bindings");const n=ae.get(t);if(void 0!==n&&w(e)&&e===n.value&&t.value===n.fragment)return;const o=document.createElement("template");o.innerHTML=e;const s=document.importNode(o.content,!0);t.setValue(s),ae.set(t,{value:e,fragment:s})}),ce=new WeakMap,de=n((...e)=>t=>{let n=ce.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},ce.set(t,n));const o=n.values;let s=o.length;n.values=e;for(let i=0;i<e.length&&!(i>n.lastRenderedIndex);i++){const r=e[i];if(w(r)||"function"!=typeof r.then){t.setValue(r),n.lastRenderedIndex=i;break}i<s&&r===o[i]||(n.lastRenderedIndex=2147483647,s=0,Promise.resolve(r).then(e=>{const o=n.values.indexOf(r);o>-1&&o<n.lastRenderedIndex&&(n.lastRenderedIndex=o,t.setValue(e),t.commit())}))}}),ue=()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}}; | ||
/** | ||
@@ -148,3 +148,3 @@ * @license | ||
* http://polymer.github.io/PATENTS.txt | ||
*/function ue(e){return JSON.parse(JSON.stringify(e))}e.default=function(e,t){let o=0;const s={};let i,r,a=[],l=0;const c=Promise.resolve();function d(e){return n((function(t,n){return function(o){const s=o.committer.element;for(const o of t)if("function"==typeof o){const t=a.find(t=>t.instance===e&&t.componentAction.create===o&&t.element===s);if(t)t.props=n;else{void 0!==s.__vido__&&delete s.__vido__;const t={create:o,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:s,props:n})}}}}))}const u={debug:!1,state:e,api:t,html:W,svg:H,directive:n,asyncAppend:R,asyncReplace:D,cache:q,classMap:G,guard:Q,ifDefined:U,repeat:se,styleMap:re,unsafeHTML:le,until:de,lastProps:{},actions(e,t){},onDestroy(){},onChange(e){},componentsFromDataArray(e,t,n,o){if(e.length<t.length){let s=t.length-e.length;for(;s;){const i=t[t.length-s];e.push(u.createComponent(o,n(i))),s--}}else if(e.length>t.length){let n=e.length-t.length;for(;n;){e[e.length-n].destroy(),n--}e.length=t.length}let s=0;for(const o of t)e[s].change(n(o)),s++;return e},createComponent(e,t){const n=e.name+":"+o++;let i;const r=[];let l=[];i=Object.assign(Object.assign({},u),{update:function(){u.updateTemplate(i)},onDestroy:function(e){r.push(e)},onChange:function(e){l.push(e)},instance:n,actions:d(n),lastProps:t});const c=function(e,t){return{instance:e,vidoInstance:t,destroy:()=>(t.debug&&(console.groupCollapsed(`destroying component ${e}`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.destroyComponent(e,t)),update:()=>(t.debug&&(console.groupCollapsed(`updating component ${e}`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.updateTemplate(t)),change(n){t.debug&&(console.groupCollapsed(`changing component ${e}`),console.log(ue({props:n,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),void 0!==s[e]&&s[e].change(n,t)},html(n={}){if(void 0!==s[e])return s[e].update(n,t)}}}(n,i),p=e(i,t),h={instance:n,vidoInstance:i,lastProps:t,destroy(){i.debug&&(console.groupCollapsed(`component destroy method fired ${n}`),console.log(ue({props:t,components:Object.keys(s),destroyable:r})),console.trace(),console.groupEnd());for(const e of r)e();l.length=0,r.length=0},update:e=>(i.debug&&(console.groupCollapsed(`component update method fired ${n}`),console.log(ue({props:e,components:Object.keys(s),onChangeFunctions:l})),console.trace(),console.groupEnd()),p(e)),change(e){i.debug&&(console.groupCollapsed(`component change method fired ${n}`),console.log(ue({props:t,components:Object.keys(s),onChangeFunctions:l,changedProps:e})),console.trace(),console.groupEnd());for(const t of l)t(e);i.lastProps=e}};return s[n]=h,s[n].change(t),i.debug&&(console.groupCollapsed(`component created ${n}`),console.log(ue({props:t,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),c},destroyComponent(e,t){t.debug&&(console.groupCollapsed(`destroying component ${e}...`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),void 0!==s[e]&&"function"==typeof s[e].destroy&&s[e].destroy(),delete s[e],t.debug&&(console.groupCollapsed(`component destroyed ${e}`),console.log(ue({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd())},updateTemplate(e){const t=++l,n=this;c.then((function(){t===l&&(n.render(),l=0,e.debug&&(console.groupCollapsed("templates updated"),console.trace(),console.groupEnd()))}))},createApp(e,t){r=t;const n=this.createComponent(e);return i=n.instance,this.render(),n},executeActions(){for(const e of a)if(void 0===e.element.__vido__){if("function"==typeof e.componentAction.create){const t=e.componentAction.create(e.element,e.props);u.debug&&(console.groupCollapsed(`create action executed ${e.instance}`),console.log(ue({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()),void 0!==t&&("function"==typeof t.update&&(e.componentAction.update=t.update),"function"==typeof t.destroy&&(e.componentAction.destroy=t.destroy))}}else"function"==typeof e.componentAction.update&&(e.componentAction.update(e.element,e.props),u.debug&&(console.groupCollapsed(`update action executed ${e.instance}`),console.log(ue({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()));for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){L(s[i].update(),r),u.executeActions()}};return u},e.mergeDeep=ue,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function pe(e){return JSON.parse(JSON.stringify(e,ue))}e.default=function(e,t){let o=0;const s={};let i,r,a=[],l=0;const c=Promise.resolve();function d(e){return n((function(t,n){return function(o){const s=o.committer.element;for(const o of t)if("function"==typeof o){const t=a.find(t=>t.instance===e&&t.componentAction.create===o&&t.element===s);if(t)t.props=n;else{void 0!==s.__vido__&&delete s.__vido__;const t={create:o,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:s,props:n})}}}}))}const u={debug:!1,state:e,api:t,html:W,svg:H,directive:n,asyncAppend:R,asyncReplace:D,cache:q,classMap:G,guard:Q,ifDefined:U,repeat:se,styleMap:re,unsafeHTML:le,until:de,lastProps:{},actions(e,t){},onDestroy(){},onChange(e){},componentsFromDataArray(e,t,n,o){if(e.length<t.length){let s=t.length-e.length;for(;s;){const i=t[t.length-s];e.push(u.createComponent(o,n(i))),s--}}else if(e.length>t.length){let n=e.length-t.length;for(;n;){e[e.length-n].destroy(),n--}e.length=t.length}let s=0;for(const o of t)e[s].change(n(o)),s++;return e},createComponent(e,t){const n=e.name+":"+o++;let i;const r=[];let l=[];i=Object.assign(Object.assign({},u),{update:function(){u.updateTemplate(i)},onDestroy:function(e){r.push(e)},onChange:function(e){l.push(e)},instance:n,actions:d(n),lastProps:t});const c=function(e,t){return{instance:e,vidoInstance:t,destroy:()=>(t.debug&&(console.groupCollapsed(`destroying component ${e}`),console.log(pe({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.destroyComponent(e,t)),update:()=>(t.debug&&(console.groupCollapsed(`updating component ${e}`),console.log(pe({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),u.updateTemplate(t)),change(n){t.debug&&(console.groupCollapsed(`changing component ${e}`),console.log(pe({props:n,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),void 0!==s[e]&&s[e].change(n,t)},html(n={}){if(void 0!==s[e])return s[e].update(n,t)}}}(n,i),p=e(i,t),h={instance:n,vidoInstance:i,lastProps:t,destroy(){i.debug&&(console.groupCollapsed(`component destroy method fired ${n}`),console.log(pe({props:t,components:Object.keys(s),destroyable:r})),console.trace(),console.groupEnd());for(const e of r)e();l.length=0,r.length=0},update:e=>(i.debug&&(console.groupCollapsed(`component update method fired ${n}`),console.log(pe({props:e,components:Object.keys(s),onChangeFunctions:l})),console.trace(),console.groupEnd()),p(e)),change(e){i.debug&&(console.groupCollapsed(`component change method fired ${n}`),console.log(pe({props:t,components:Object.keys(s),onChangeFunctions:l,changedProps:e})),console.trace(),console.groupEnd());for(const t of l)t(e);i.lastProps=e}};return s[n]=h,s[n].change(t),i.debug&&(console.groupCollapsed(`component created ${n}`),console.log(pe({props:t,components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),c},destroyComponent(e,t){t.debug&&(console.groupCollapsed(`destroying component ${e}...`),console.log(pe({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd()),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),void 0!==s[e]&&"function"==typeof s[e].destroy&&s[e].destroy(),delete s[e],t.debug&&(console.groupCollapsed(`component destroyed ${e}`),console.log(pe({components:Object.keys(s),actions:a})),console.trace(),console.groupEnd())},updateTemplate(e){const t=++l,n=this;c.then((function(){t===l&&(n.render(),l=0,e.debug&&(console.groupCollapsed("templates updated"),console.trace(),console.groupEnd()))}))},createApp(e,t){r=t;const n=this.createComponent(e);return i=n.instance,this.render(),n},executeActions(){for(const e of a)if(void 0===e.element.__vido__){if("function"==typeof e.componentAction.create){const t=e.componentAction.create(e.element,e.props);u.debug&&(console.groupCollapsed(`create action executed ${e.instance}`),console.log(pe({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()),void 0!==t&&("function"==typeof t.update&&(e.componentAction.update=t.update),"function"==typeof t.destroy&&(e.componentAction.destroy=t.destroy))}}else"function"==typeof e.componentAction.update&&(e.componentAction.update(e.element,e.props),u.debug&&(console.groupCollapsed(`update action executed ${e.instance}`),console.log(pe({components:Object.keys(s),action:e,actions:a})),console.trace(),console.groupEnd()));for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){L(s[i].update(),r),u.executeActions()}};return u},e.mergeDeep=pe,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=vido.min.js.map |
15
vido.ts
@@ -13,4 +13,17 @@ import { render, html, directive, svg } from 'lit-html'; | ||
const getCircularReplacer = () => { | ||
const seen = new WeakSet(); | ||
return (key, value) => { | ||
if (typeof value === 'object' && value !== null) { | ||
if (seen.has(value)) { | ||
return; | ||
} | ||
seen.add(value); | ||
} | ||
return value; | ||
}; | ||
}; | ||
export function mergeDeep(source) { | ||
return JSON.parse(JSON.stringify(source)); | ||
return JSON.parse(JSON.stringify(source, getCircularReplacer)); | ||
} | ||
@@ -17,0 +30,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
909812
5861