@neuronet.io/vido
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "@neuronet.io/vido", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Compilation-less and eval free frontend framework for fast scalable apps.", | ||
@@ -5,0 +5,0 @@ "main": "vido.js", |
@@ -147,3 +147,3 @@ /** | ||
* http://polymer.github.io/PATENTS.txt | ||
*/export default function(e,n){let s=0;const o={};let i,r,a=[],l=0;const c=Promise.resolve();function d(e){return t((function(t,n){return function(s){const o=s.committer.element;for(const s of t)if("function"==typeof s){const t=a.find(t=>t.instance===e&&t.componentAction.create===s&&t.element===o);if(t)t.props=n;else{void 0!==o.__vido__&&delete o.__vido__;const t={create:s,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:o,props:n})}}}}))}const u={state:e,api:n,html:R,svg:O,directive:t,asyncAppend:F,asyncReplace:j,cache:q,classMap:G,guard:K,ifDefined:Q,repeat:se,styleMap:ie,unsafeHTML:ae,until:ce,actions(e,t){},onDestroy(){},onChange(e){},createComponent(e,t){const n=s++,i=function(e){return{instance:e,destroy:()=>u.destroyComponent(e),update:()=>u.updateTemplate(),change(t){o[e].change(t)},html:(t={})=>o[e].update(t)}}(n);const r=[];const a=[];const l={destroy(){for(const e of r)e()},update:e(Object.assign(Object.assign({},u),{update:function(){u.updateTemplate()},onDestroy:function(e){r.push(e)},onChange:function(e){a.push(e)},instance:n,actions:d(n)}),t),change(e){for(const t of a)t(e)}};return o[n]=l,l.change(t),i},destroyComponent(e){"function"==typeof o[e].destroy&&o[e].destroy(),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),delete o[e]},updateTemplate(){const e=++l,t=this;c.then((function(){e===l&&(t.render(),l=0)}))},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);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);for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){H(o[i].update(),r),u.executeActions()}};return u} | ||
*/export default function(e,n){let s=0;const o={};let i,r,a=[],l=0;function c(e){return t((function(t,n){return function(s){const o=s.committer.element;for(const s of t)if("function"==typeof s){const t=a.find(t=>t.instance===e&&t.componentAction.create===s&&t.element===o);if(t)t.props=n;else{void 0!==o.__vido__&&delete o.__vido__;const t={create:s,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:o,props:n})}}}}))}const d={state:e,api:n,html:R,svg:O,directive:t,asyncAppend:F,asyncReplace:j,cache:q,classMap:G,guard:K,ifDefined:Q,repeat:se,styleMap:ie,unsafeHTML:ae,until:ce,actions(e,t){},onDestroy(){},onChange(e){},createComponent(e,t){const n=s++,i=function(e){return{instance:e,destroy:()=>d.destroyComponent(e),update:()=>d.updateTemplate(),change(t){o[e].change(t)},html:(t={})=>o[e].update(t)}}(n);const r=[];const a=[];const l={destroy(){for(const e of r)e()},update:e(Object.assign(Object.assign({},d),{update:function(){d.updateTemplate()},onDestroy:function(e){r.push(e)},onChange:function(e){a.push(e)},instance:n,actions:c(n)}),t),change(e){for(const t of a)t(e)}};return o[n]=l,o[n].change(t),i},destroyComponent(e){"function"==typeof o[e].destroy&&o[e].destroy(),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),delete o[e]},updateTemplate(){const e=++l,t=this;window.setTimeout((function(){e===l&&(t.render(),l=0)}),0)},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);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);for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){H(o[i].update(),r),d.executeActions()}};return d} | ||
//# sourceMappingURL=vido.esm.min.js.map |
@@ -147,3 +147,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vido=t()}(this,(function(){"use strict"; | ||
* http://polymer.github.io/PATENTS.txt | ||
*/return function(e,n){let s=0;const o={};let i,r,a=[],l=0;const c=Promise.resolve();function d(e){return t((function(t,n){return function(s){const o=s.committer.element;for(const s of t)if("function"==typeof s){const t=a.find(t=>t.instance===e&&t.componentAction.create===s&&t.element===o);if(t)t.props=n;else{void 0!==o.__vido__&&delete o.__vido__;const t={create:s,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:o,props:n})}}}}))}const u={state:e,api:n,html:R,svg:O,directive:t,asyncAppend:F,asyncReplace:j,cache:q,classMap:G,guard:K,ifDefined:Q,repeat:se,styleMap:ie,unsafeHTML:ae,until:ce,actions(e,t){},onDestroy(){},onChange(e){},createComponent(e,t){const n=s++,i=function(e){return{instance:e,destroy:()=>u.destroyComponent(e),update:()=>u.updateTemplate(),change(t){o[e].change(t)},html:(t={})=>o[e].update(t)}}(n);const r=[];const a=[];const l={destroy(){for(const e of r)e()},update:e(Object.assign(Object.assign({},u),{update:function(){u.updateTemplate()},onDestroy:function(e){r.push(e)},onChange:function(e){a.push(e)},instance:n,actions:d(n)}),t),change(e){for(const t of a)t(e)}};return o[n]=l,l.change(t),i},destroyComponent(e){"function"==typeof o[e].destroy&&o[e].destroy(),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),delete o[e]},updateTemplate(){const e=++l,t=this;c.then((function(){e===l&&(t.render(),l=0)}))},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);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);for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){H(o[i].update(),r),u.executeActions()}};return u}})); | ||
*/return function(e,n){let s=0;const o={};let i,r,a=[],l=0;function c(e){return t((function(t,n){return function(s){const o=s.committer.element;for(const s of t)if("function"==typeof s){const t=a.find(t=>t.instance===e&&t.componentAction.create===s&&t.element===o);if(t)t.props=n;else{void 0!==o.__vido__&&delete o.__vido__;const t={create:s,update(){},destroy(){}};a.push({instance:e,componentAction:t,element:o,props:n})}}}}))}const d={state:e,api:n,html:R,svg:O,directive:t,asyncAppend:F,asyncReplace:j,cache:q,classMap:G,guard:K,ifDefined:Q,repeat:se,styleMap:ie,unsafeHTML:ae,until:ce,actions(e,t){},onDestroy(){},onChange(e){},createComponent(e,t){const n=s++,i=function(e){return{instance:e,destroy:()=>d.destroyComponent(e),update:()=>d.updateTemplate(),change(t){o[e].change(t)},html:(t={})=>o[e].update(t)}}(n);const r=[];const a=[];const l={destroy(){for(const e of r)e()},update:e(Object.assign(Object.assign({},d),{update:function(){d.updateTemplate()},onDestroy:function(e){r.push(e)},onChange:function(e){a.push(e)},instance:n,actions:c(n)}),t),change(e){for(const t of a)t(e)}};return o[n]=l,o[n].change(t),i},destroyComponent(e){"function"==typeof o[e].destroy&&o[e].destroy(),a=a.filter(t=>(t.instance===e&&"function"==typeof t.componentAction.destroy&&t.componentAction.destroy(t.element,t.props),t.instance!==e)),delete o[e]},updateTemplate(){const e=++l,t=this;window.setTimeout((function(){e===l&&(t.render(),l=0)}),0)},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);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);for(const e of a)e.element.__vido__={instance:e.instance,props:e.props}},render(){H(o[i].update(),r),d.executeActions()}};return d}})); | ||
//# sourceMappingURL=vido.min.js.map |
22
vido.ts
@@ -22,2 +22,3 @@ import { render, html, directive, svg } from 'lit-html'; | ||
const resolved = Promise.resolve(); | ||
let timeout; | ||
@@ -77,5 +78,5 @@ function getActions(instance) { | ||
} | ||
const onChangeFuntions = []; | ||
const onChangeFunctions = []; | ||
function onChange(fn) { | ||
onChangeFuntions.push(fn); | ||
onChangeFunctions.push(fn); | ||
} | ||
@@ -91,3 +92,3 @@ const vidoInstance = { ...vido, update, onDestroy, onChange, instance, actions: getActions(instance) }; | ||
change(props) { | ||
for (const fn of onChangeFuntions) { | ||
for (const fn of onChangeFunctions) { | ||
fn(props); | ||
@@ -98,3 +99,3 @@ } | ||
components[instance] = methods; | ||
methods.change(props); | ||
components[instance].change(props); | ||
return componentInstanceMethods; | ||
@@ -120,3 +121,6 @@ }, | ||
const self = this; | ||
resolved.then(function flush() { | ||
if (timeout) { | ||
window.clearTimeout(timeout); | ||
} | ||
window.setTimeout(function flush() { | ||
if (currentShouldUpdateCount === shouldUpdateCount) { | ||
@@ -126,3 +130,9 @@ self.render(); | ||
} | ||
}); | ||
}, 0); | ||
/*resolved.then(function flush() { | ||
if (currentShouldUpdateCount === shouldUpdateCount) { | ||
self.render(); | ||
shouldUpdateCount = 0; | ||
} | ||
});*/ | ||
}, | ||
@@ -129,0 +139,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
847513
5434