Comparing version 0.0.16 to 0.0.17
@@ -1,2 +0,2 @@ | ||
// [DOZ] Build version: 0.0.16 | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Doz",[],t):"object"==typeof exports?exports.Doz=t():e.Doz=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=9)}([function(e,t,r){"use strict";e.exports={ROOT:"__DOZ_GLOBAL_COMPONENTS__",INSTANCE:"__DOZ_INSTANCE__",TAG:{ROOT:"doz-root",EACH:"doz-each-root",VIEW:"doz-view",SUFFIX_ROOT:"-root"},REGEX:{IS_CUSTOM_TAG:/^\w+-[\w-]+$/,IS_CUSTOM_TAG_STRING:/<\w+-[\w-]+/,IS_BIND:/^d-bind$/,IS_REF:/^d-ref$/,IS_ALIAS:/^d:alias$/,IS_STORE:/^d:store$/,IS_COMPONENT_LISTENER:/^d:on-(\w+)$/,IS_LISTENER:/^on/,IS_ID_SELECTOR:/^#[\w-_:.]+$/,IS_PARENT_METHOD:/^parent.(.*)/,GET_LISTENER:/^this.(.*)\((.*)\)/,TRIM_QUOTES:/^["'](.*)["']$/},ATTR:{BIND:"d-bind",REF:"d-ref",ALIAS:"d:alias",STORE:"d:store",LISTENER:"d:on",ID:"d:id"}}},function(e,t,r){"use strict";function n(){return window[s]=window[s]||{components:{}},window[s].components}function o(e){var t=n(),r=e.tag.toUpperCase();if(t.hasOwnProperty(r))throw new Error("Component "+r+" already defined");t[r]=e}function i(){window[s]&&(window[s].components={})}function a(e){if("string"!=typeof e)throw new TypeError("tag must be a string");return e=e.toUpperCase(),n()[e]}var u=r(0),s=u.ROOT;e.exports={register:o,get:a,removeAll:i}},function(e,t,r){"use strict";function n(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(var o in t)t.hasOwnProperty(o)&&-1===r.indexOf(o)&&(e.hasOwnProperty(o)&&void 0!==e[o]?"object"===i(e[o])&&n(e[o],t[o]):e[o]=t[o]);return e}function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t[0]=Object.assign({},t[0]),n.apply(this,t)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=n,e.exports.copy=o},function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw new TypeError("Tag must be a string");if(!v.IS_CUSTOM_TAG.test(e))throw new TypeError("Tag must contain a dash (-) like my-component");var r={};r.tag=e,r.cfg=c.copy(t,{updateChildrenProps:!0,props:{},template:function(){return"<div></div>"}}),f(r)}function o(){function e(o){for(var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o;){var u=t.autoCmp||m.get(o.nodeName)||t.view._components[o.nodeName.toLowerCase()];if(u){var s=S(o),c=C(s),l=i(u,{root:o,view:t.view,props:s,dProps:c,parentCmp:a.cmp,isStatic:t.isStatic});if(!l)continue;if(l.render(!0),r||(r=l),o.insertBefore(l._rootElement,o.firstChild),g.callRender(l),n=l,a.cmp){var f=Object.keys(a.cmp.children).length;a.cmp.children[l.alias?l.alias:f++]=l}t.autoCmp=null}o.hasChildNodes()&&e(o.firstChild,{cmp:n}),o=o.nextSibling}}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.template="string"==typeof t.template?p.create(t.template):t.template,t.transform||t.root.appendChild(t.template);var r=null,n=void 0;return e(t.template),r}function i(e,t){var r=c.copy(t.props,"function"==typeof e.cfg.props?e.cfg.props():e.cfg.props),n=Object.defineProperties({},{_isCreated:{value:!1,writable:!0},_prevTpl:{value:null,writable:!0},_prev:{value:null,writable:!0},_prevProps:{value:null,writable:!0},_rootElement:{value:null,writable:!0},_boundElements:{value:{},writable:!0},_callback:{value:t.dProps.callback,writable:!0},_cache:{value:new Map},_loops:{value:{},writable:!0},_isStatic:{value:t.isStatic},_publicProps:{value:Object.assign({},t.props)},_processing:{value:[],writable:!0},_dynamicChildren:{value:[],writable:!0},view:{value:t.view,enumerable:!0},parent:{value:t.parentCmp,enumerable:!0},ref:{value:{},writable:!0,enumerable:!0},children:{value:{},writable:!0,enumerable:!0},tag:{value:e.tag,enumerable:!0},emit:{value:function(e){if(this._callback&&void 0!==this._callback[e]&&void 0!==this.parent[this._callback[e]]&&"function"==typeof this.parent[this._callback[e]]){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.parent[this._callback[e]].apply(this.parent,r)}},enumerable:!0},each:{value:function(e,t){if(Array.isArray(e))return e.map(t).map(function(e){return e=e.trim()}).join("")},enumerable:!0},getStore:{value:function(e){return this.view.getStore(e)},enumerable:!0},getComponentById:{value:function(e){return this.view.getComponentById(e)},enumerable:!0},action:{value:t.view.action,enumerable:!0},render:{value:function(e){var r=this.tag?this.tag+y.SUFFIX_ROOT:y.ROOT,n=this.template().trim(),o=p.create("<"+r+">"+n+"</"+r+">"),i=_(o),a=w(t.root,i,this._prev,0,this,e);s(this),!this._rootElement&&a&&(this._rootElement=a),this._prev=i},enumerable:!0},mount:{value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this._rootElement;return"string"==typeof t.selector?r=r.querySelector(t.selector):t.selector instanceof HTMLElement&&(r=t.selector),this.view.mount(e,r,this)},enumerable:!0},destroy:{value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(t||this._rootElement&&!1!==g.callBeforeDestroy(this)&&this._rootElement.parentNode)&&(Object.keys(this.children).forEach(function(t){e.children[t].destroy()}),t?this._rootElement.parentNode.innerHTML="":this._rootElement.parentNode.parentNode.removeChild(this._rootElement.parentNode),g.callDestroy(this))},enumerable:!0}});if(a(n,e.cfg,t.dProps),!1!==g.callBeforeCreate(n))return b.create(n,r),T.create(n),O.create(n),g.callCreate(n),n._isCreated=!0,n}function a(e,t,r){Object.assign(e,t,r)}function u(e){for(var t=e._dynamicChildren.length-1;t>=0;){var r=e._dynamicChildren[t];!document.body.contains(r)&&r[h]&&(r[h].destroy(!0),e._dynamicChildren.splice(t,1)),t-=1}}function s(e){u(e);for(var t=e._processing.length-1;t>=0;){var r=e._processing[t],n=r.node.parentNode;r.node[h]&&r.node[h].destroy(!0);var i=o({root:n,template:r.node.outerHTML,view:e.view});e._dynamicChildren.push(i._rootElement.parentNode),n.replaceChild(i._rootElement.parentNode,r.node),i._rootElement.parentNode[h]=i,e._processing.splice(t,1),t-=1}}var c=r(2),l=r(1),f=l.register,p=r(4),d=r(0),v=d.REGEX,y=d.TAG,h=d.INSTANCE,m=r(1),b=r(13),g=r(5),E=r(6),_=E.transform,S=E.serializeProps,w=r(8).updateElement,T=r(18),O=r(19),x=r(20),C=x.extract;e.exports={component:n,getInstances:o}},function(e,t,r){"use strict";var n=/\n/g,o=/\s+/g,i={create:function(e){var t=void 0;e=e.replace(n," "),e=e.replace(o," ");var r=document.createElement("div");if(r.innerHTML=e,t=r.firstChild,!this.isValidNode(t))throw new Error("Element not valid");return t},isValidNode:function(e){return e&&"nodeType"in e},getAllNodes:function(e){function t(e){for(;e;)r.push(e),e.hasChildNodes()&&t(e.firstChild),e=e.nextSibling}var r=[];return t(e),r}};e.exports=i},function(e,t,r){"use strict";function n(e){if("function"==typeof e.onBeforeCreate)return e.onBeforeCreate.call(e)}function o(e){"function"==typeof e.onCreate&&e.onCreate.call(e)}function i(e){"function"==typeof e.onRender&&e.onRender.call(e)}function a(e){if("function"==typeof e.onBeforeUpdate)return e.onBeforeUpdate.call(e,Object.assign({},e.props))}function u(e){"function"==typeof e.onUpdate&&e.onUpdate.call(e)}function s(e){if("function"==typeof e.onBeforeDestroy)return e.onBeforeDestroy.call(e)}function c(e){"function"==typeof e.onDestroy&&(e.onDestroy.call(e),e=null)}e.exports={callBeforeCreate:n,callCreate:o,callRender:i,callBeforeUpdate:a,callUpdate:u,callBeforeDestroy:s,callDestroy:c}},function(e,t,r){"use strict";function n(e){var t={};if(e.attributes)for(var r=Array.from(e.attributes),n=r.length-1;n>=0;--n){var o=r[n],a=o.name.match(u.IS_COMPONENT_LISTENER);a?(void 0===t[s.LISTENER]&&(t[s.LISTENER]={}),t[s.LISTENER][a[1]]=o.nodeValue,delete t[o.name]):t[o.name]=""===o.nodeValue||i(o.nodeValue)}return t}function o(e){function t(e,o){for(;e;){var i=void 0;3===e.nodeType?i=e.nodeValue:(i={},i.type=e.nodeName.toLowerCase(),i.children=[],i.props=n(e)),Object.keys(r).length||(r=i),o&&o.children&&o.children.push(i),e.hasChildNodes()&&t(e.firstChild,i),e=e.nextSibling}}var r={};return t(e,r),r}var i=r(7),a=r(0),u=a.REGEX,s=a.ATTR;e.exports={transform:o,serializeProps:n}},function(e,t,r){"use strict";function n(e){if("string"!=typeof e)return e;switch(e){case"undefined":return;case"null":return null;case"NaN":return NaN;case"Infinity":return 1/0;case"true":return!0;case"false":return!1;case"0":return e;default:try{return JSON.parse(e)}catch(e){}}var t=parseFloat(e);return!isNaN(t)&&isFinite(e)?0===e.toLowerCase().indexOf("0x")?parseInt(e,16):t:e}e.exports=n},function(e,t,r){"use strict";var n=r(15);e.exports={updateElement:n.update}},function(e,t,r){"use strict";e.exports=r(10)},function(e,t,r){"use strict";e.exports=r(11),e.exports.component=r(3).component,e.exports.collection=r(1),e.exports.update=r(8).updateElement,e.exports.transform=r(6).transform,e.exports.html=r(4)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(2),u=r(12),s=r(3),c=r(0),l=c.TAG,f=c.REGEX,p=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e);var i="<"+l.VIEW+"></"+l.VIEW+">";if(f.IS_ID_SELECTOR.test(r.root)&&(r.root=document.getElementById(r.root.substring(1))),f.IS_ID_SELECTOR.test(r.template)&&(r.template=document.getElementById(r.template.substring(1)),r.template=r.template.innerHTML),!(r.root instanceof HTMLElement))throw new TypeError("root must be an HTMLElement or an valid ID selector like #example-root");if(!(r.template instanceof HTMLElement||"string"==typeof r.template||"function"==typeof r.template))throw new TypeError("template must be a string or an HTMLElement or a function or an valid ID selector like #example-template");this.cfg=a(r,{components:[],actions:{}}),Object.defineProperties(this,{_components:{value:{},writable:!0},_usedComponents:{value:{},writable:!0},_stores:{value:{},writable:!0},_cache:{value:new Map},_ids:{value:{},writable:!0},action:{value:u(this.cfg.actions,this),enumerable:!0},mount:{value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._tree;if("string"==typeof t&&(t=document.querySelector(t)),!((t=t||r._rootElement)instanceof HTMLElement))throw new TypeError("root must be an HTMLElement or an valid selector like #example-root");var n={tag:l.ROOT,cfg:{props:{},template:function(){return e}}};return s.getInstances({root:t,template:"<"+l.ROOT+"></"+l.ROOT+">",view:this,parentCmp:r,isStatic:!1,autoCmp:n,mount:!0})},enumerable:!0}}),this.cfg.components.forEach(function(e){"object"===(void 0===e?"undefined":o(e))&&"string"==typeof e.tag&&"object"===o(e.cfg)&&(t._components[e.tag]=e)}),this._components[l.VIEW]={tag:l.VIEW,cfg:{props:r.props||{},template:function(){return"function"==typeof r.template?r.template():r.template}}},this._tree=s.getInstances({root:this.cfg.root,template:i,view:this})||[]}return i(e,[{key:"getComponent",value:function(e){return this._tree?this._tree.children[e]:void 0}},{key:"getComponentById",value:function(e){return this._ids[e]}},{key:"getStore",value:function(e){return this._stores[e]}}]),e}();e.exports=p},function(e,t,r){"use strict";function n(e,t){if("object"!==(void 0===e?"undefined":o(e)))throw new TypeError("expected an object");for(var r=Object.assign({},e),i=Object.keys(e),a=i.length-1;a>=0;--a){var u=r[i[a]];"function"==typeof u?r[i[a]]=u.bind(t):"object"===(void 0===u?"undefined":o(u))&&(r[i[a]]=n(u,t))}return r}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=n},function(e,t,r){"use strict";function n(e){return void 0!==window.requestAnimationFrame?window.requestAnimationFrame(e):window.setTimeout(e)}function o(e,t){if(e.updateChildrenProps){Object.keys(e.children).forEach(function(r){t.forEach(function(t){e.children[r]._publicProps.hasOwnProperty(t.currentPath)&&e.children[r].props.hasOwnProperty(t.currentPath)&&(e.children[r].props[t.currentPath]=t.newValue)})})}}function i(e,t){t.forEach(function(t){e._boundElements.hasOwnProperty(t.property)&&e._boundElements[t.property].forEach(function(e){e.value=t.newValue})})}function a(e,t){e.props=u.create(t,!0,function(t){e.render(),i(e,t),e._isCreated&&n(function(){o(e,t),s.callUpdate(e)})}),u.beforeChange(e.props,function(){if(!1===s.callBeforeUpdate(e))return!1})}var u=r(14),s=r(5);e.exports={create:a}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){var e=[],t=[],r=[],o=[],i=null,a=null,u=function(e,t){return t.split(".").reduce(function(e,t){return e?e[t]:void 0},e||self)},s=function s(c,l,f,p){var d=f||null,v=p||"",y=[],h=function(e,t){return e instanceof Array?""!==v?v:t:""!==v?v+"."+t:t},m=function(e){if(!0!==d.paused)if(!0===l)setTimeout(function(){if(e===y.length){for(var t=0;t<d.observers.length;t++)d.observers[t](y);y=[]}},10);else{for(var t=0;t<d.observers.length;t++)d.observers[t](y);y=[]}},b={get:function(e,n){if("__isProxy"===n)return!0;if("__getTarget"===n)return e;if("__getParent"===n)return function(t){if(void 0===t)var t=1;var r=h(e,"__getParent").split(".");return r.splice(-(t+1),t+1),u(d.proxy,r.join("."))};var a=e[n];if(o.push(d),null===i){i=d;var c=t.indexOf(e),f=r[c],p=f.length;if(p>1)for(;p--;)-1===o.indexOf(f[p].observable)&&f[p].proxy[n];i=null,o=[]}if(a instanceof Object&&null!==a&&e.hasOwnProperty(n)&&void 0===a.__isProxy){var c=t.indexOf(a);if(c>-1)for(var y=r[c],p=y.length;p--;)if(y[p].observable===d)return y[p].proxy;return s(a,l,d,""!==v?v+"."+n:n)}return a},deleteProperty:function(e,n){var o=!0;a===g&&(o=!1,a=null);var i=Object.assign({},e),u=h(e,n);if(y.push({type:"delete",target:e,property:n,newValue:null,previousValue:i[n],currentPath:u,proxy:g}),"function"==typeof d.beforeChange){if(!1===d.beforeChange(y))return!1}if(!0===o){var s=t.indexOf(e);if(s>-1)for(var c=r[s].length;c--;)r[s][c].proxy!==g&&(a=r[s][c].proxy,delete r[s][c].proxy[n]);delete e[n]}return m(y.length),!0},set:function(e,o,i,u){var s=!0;a===g&&(s=!1,a=null);var c=e[o];if(c!==i||!1===s){var l=void 0===c?"undefined":n(c),f=h(e,o),p="update";if("undefined"===l&&(p="add"),y.push({type:p,target:e,property:o,newValue:i,previousValue:u[o],currentPath:f,proxy:g}),"function"==typeof d.beforeChange){if(!1===d.beforeChange(y))return!1}if(!0===s){var v=t.indexOf(e);if(v>-1)for(var b=r[v],E=b.length;E--;)b[E].proxy!==g&&(a=b[E].proxy,b[E].proxy[o]=i);setTimeout(function(){l instanceof Object&&function e(n){for(var o in n){var i=n[o];i instanceof Object&&null!==i&&e(i)}var a=t.indexOf(n);if(a>-1){for(var u=r[a],s=u.length;s--;)if(d===u[s].observable){u.splice(s,1);break}0==u.length&&(r.splice(a,1),t.splice(a,1))}}(c)},1e4),e[o]=i}m(y.length)}return!0}},g=new Proxy(c,b);null===d&&(d={target:c,domDelay:l,proxy:g,observers:[],paused:!1,path:v},e.push(d));var E={target:c,proxy:g,observable:d},_=t.indexOf(c);return _>-1?r[_].push(E):(t.push(c),r.push([E])),g};return{create:function(e,t,r){if(!0===e.__isProxy)var e=e.__getTarget;var n=s(e,t);return"function"==typeof r&&this.observe(n,r),n},observe:function(t,r){for(var n=e.length;n--;)if(e[n].proxy===t){e[n].observers.push(r);break}},pause:function(t){for(var r=e.length,n=!1;r--;)if(e[r].proxy===t){e[r].paused=!0,n=!0;break}if(0==n)throw new Error("ObseravableSlim could not pause observable -- matching proxy not found.")},resume:function(t){for(var r=e.length,n=!1;r--;)if(e[r].proxy===t){e[r].paused=!1,n=!0;break}if(0==n)throw new Error("ObseravableSlim could not resume observable -- matching proxy not found.")},remove:function(n){for(var o=null,i=!1,a=e.length;a--;)if(e[a].proxy===n){o=e[a],i=!0;break}for(var u=r.length;u--;)for(var s=r[u].length;s--;)r[u][s].observable===o&&(r[u].splice(s,1),0==r[u].length&&(r.splice(u,1),t.splice(u,1)));!0===i&&e.splice(a,1)},beforeChange:function(t,r){if("function"!=typeof r)throw new Error("Callback function is required");for(var n=e.length,o=!1;n--;)if(e[n].proxy===t){e[n].beforeChange=r,o=!0;break}if(0==o)throw new Error("ObseravableSlim -- matching proxy not found.")}}}();try{e.exports=o}catch(e){}},function(e,t,r){"use strict";function n(e,t){return(void 0===e?"undefined":u(e))!==(void 0===t?"undefined":u(t))||"string"==typeof e&&e!==t||e.type!==t.type||e.props&&e.props.forceupdate}function o(e,t,r){if(void 0!==e){if("string"==typeof e)return document.createTextNode(e);var n=document.createElement(e.type);return c(n,e.props,t),e.children.map(function(e){return o(e,t,r)}).forEach(n.appendChild.bind(n)),-1===e.type.indexOf("-")||r||t._processing.push({node:n,action:"create"}),n}}function i(e,t,r){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments[4],c=arguments[5];if(!r){var p=o(t,s,c);return e.appendChild(p),p}if(t){if(n(t,r)){var v=o(t,s,c);return e.replaceChild(v,e.childNodes[u]),v}if(t.type){var y=l(e.childNodes[u],t.props,r.props,s);if(e.childNodes[u]){var h=e.childNodes[u][d];if(h&&y.length)return void y.forEach(function(e){Object.keys(e).forEach(function(t){h.props[t]=e[t]})})}for(var m=t.children.length,b=r.children.length,g=0;g<m||g<b;g++)i(e.childNodes[u],t.children[g],r.children[g],g,s,c);a()}}else e.childNodes[u]&&f.push(e.childNodes[u])}function a(){for(var e=f.length;e--;)f[e].parentNode.removeChild(f[e]),f.splice(e,1)}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(16),c=s.attach,l=s.updateAttributes,f=[],p=r(0),d=p.INSTANCE;e.exports={create:o,update:i}},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function o(e){return w.IS_LISTENER.test(e)}function i(e){return e===T.BIND}function a(e){return e===T.REF}function u(e){return-1!==["INPUT","TEXTAREA"].indexOf(e.nodeName)}function s(e,t,r,n){if(p(t));else if("className"===t)e.setAttribute("class",r);else if("boolean"==typeof r)d(e,t,r);else if("object"===(void 0===r?"undefined":_(r)))try{e.setAttribute(t,JSON.stringify(r))}catch(e){}else e.setAttribute(t,r)}function c(e,t,r){p(t)||("className"===t?e.removeAttribute("class"):"boolean"==typeof r?v(e,t):e.removeAttribute(t))}function l(e,t,r,n){r?n&&r===n||s(e,t,r):c(e,t,n)}function f(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=(arguments[3],Object.assign({},t,r)),o=[];return Object.keys(n).forEach(function(n){if(l(e,n,t[n],r[n]),t[n]!==r[n]){var i={};i[n]=t[n],o.push(i)}}),o}function p(e){return o(e)||i(e)||a(e)||"forceupdate"===e}function d(e,t,r){r?(e.setAttribute(t,r),e[t]=!0):e[t]=!1}function v(e,t){e.removeAttribute(t),e[t]=!1}function y(e){return e.slice(2).toLowerCase()}function h(e){return e.replace(w.TRIM_QUOTES,"$1")}function m(e,t,r,i){if(o(t)){var a=r.match(w.GET_LISTENER);if(i._isStatic&&(e.dataset[t]=r),a){var u=null,s=a[1],c=a[2];c&&(u=c.split(",").map(function(e){return e=e.trim(),"this"===e?i:O(h(e))}));var l=s.match(w.IS_PARENT_METHOD);l&&(s=l[1],i=i.parent);var f=x(s,i);void 0!==f&&(r=u?f.bind.apply(f,[i].concat(n(u))):f.bind(i))}"function"==typeof r&&e.addEventListener(y(t),r)}}function b(e,t,r,n){i(t)&&u(e)&&void 0!==n.props[r]&&(["compositionstart","compositionend","input","change"].forEach(function(t){e.addEventListener(t,function(){n.props[r]=this.value})}),n._boundElements.hasOwnProperty(r)?n._boundElements[r].push(e):n._boundElements[r]=[e])}function g(e,t,r,n){a(t)&&(n.ref[r]=e)}function E(e,t,r){Object.keys(t).forEach(function(n){s(e,n,t[n],r),m(e,n,t[n],r),b(e,n,t[n],r),g(e,n,t[n],r)});for(var n in e.dataset)e.dataset.hasOwnProperty(n)&&w.IS_LISTENER.test(n)&&m(e,n,e.dataset[n],r)}var _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S=r(0),w=S.REGEX,T=S.ATTR,O=r(7),x=r(17);e.exports={attach:E,updateAttributes:f}},function(e,t,r){"use strict";function n(e,t){return e.split(".").reduce(function(e,t){return e?e[t]:void 0},t)}function o(e,t){return-1!==e.indexOf(".")&&(e=e.split("."),e.pop(),e=e.join(".")),n(e,t)}e.exports=n,e.exports.getLast=o},function(e,t,r){"use strict";function n(e){if("string"==typeof e.store){if(void 0!==e.view._stores[e.store])throw new Error("Store already defined: "+e.store);e.view._stores[e.store]=e.props}}e.exports={create:n}},function(e,t,r){"use strict";function n(e){if("string"==typeof e.id){if(void 0!==e.view._ids[e.id])throw new Error("ID already defined: "+e.id);e.view._ids[e.id]=e}}e.exports={create:n}},function(e,t,r){"use strict";function n(e){var t={};return void 0!==e[i.ALIAS]&&(t.alias=e[i.ALIAS],delete e[i.ALIAS]),void 0!==e[i.STORE]&&(t.store=e[i.STORE],delete e[i.STORE]),void 0!==e[i.LISTENER]&&(t.callback=e[i.LISTENER],delete e[i.LISTENER]),void 0!==e[i.CLASS]&&(t.class=e[i.CLASS],delete e[i.CLASS]),void 0!==e[i.ID]&&(t.id=e[i.ID],delete e[i.ID]),t}var o=r(0),i=o.ATTR;e.exports={extract:n}}])}); | ||
// [DOZ] Build version: 0.0.17 | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Doz",[],t):"object"==typeof exports?exports.Doz=t():e.Doz=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=9)}([function(e,t,n){"use strict";e.exports={ROOT:"__DOZ_GLOBAL_COMPONENTS__",INSTANCE:"__DOZ_INSTANCE__",TAG:{ROOT:"doz-root",EACH:"doz-each-root",VIEW:"doz-view",SUFFIX_ROOT:"-root"},REGEX:{IS_CUSTOM_TAG:/^\w+-[\w-]+$/,IS_CUSTOM_TAG_STRING:/<\w+-[\w-]+/,IS_BIND:/^d-bind$/,IS_REF:/^d-ref$/,IS_ALIAS:/^d:alias$/,IS_STORE:/^d:store$/,IS_COMPONENT_LISTENER:/^d:on-(\w+)$/,IS_LISTENER:/^on/,IS_ID_SELECTOR:/^#[\w-_:.]+$/,IS_PARENT_METHOD:/^parent.(.*)/,GET_LISTENER:/^this.(.*)\((.*)\)/,TRIM_QUOTES:/^["'](.*)["']$/},ATTR:{BIND:"d-bind",REF:"d-ref",ALIAS:"d:alias",STORE:"d:store",LISTENER:"d:on",ID:"d:id"}}},function(e,t,n){"use strict";function r(){return window[s]=window[s]||{components:{}},window[s].components}function o(e){var t=r(),n=e.tag.toUpperCase();if(t.hasOwnProperty(n))throw new Error("Component "+n+" already defined");t[n]=e}function i(){window[s]&&(window[s].components={})}function a(e){if("string"!=typeof e)throw new TypeError("tag must be a string");return e=e.toUpperCase(),r()[e]}var u=n(0),s=u.ROOT;e.exports={register:o,get:a,removeAll:i}},function(e,t,n){"use strict";function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(var o in t)t.hasOwnProperty(o)&&-1===n.indexOf(o)&&(e.hasOwnProperty(o)&&void 0!==e[o]?"object"===i(e[o])&&r(e[o],t[o]):e[o]=t[o]);return e}function o(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t[0]=Object.assign({},t[0]),r.apply(this,t)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=r,e.exports.copy=o},function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw new TypeError("Tag must be a string");if(!v.IS_CUSTOM_TAG.test(e))throw new TypeError("Tag must contain a dash (-) like my-component");var n={};n.tag=e,n.cfg=c.copy(t,{updateChildrenProps:!0,props:{},template:function(){return"<div></div>"}}),f(n)}function o(){function e(o){for(var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o;){var u=t.autoCmp||h.get(o.nodeName)||t.view._components[o.nodeName.toLowerCase()];if(u){var s=S(o),c=C(s),l=i(u,{root:o,view:t.view,props:s,dProps:c,parentCmp:a.cmp,isStatic:t.isStatic});if(!l)continue;if(l.render(!0),n||(n=l),o.insertBefore(l._rootElement,o.firstChild),g.callRender(l),r=l,a.cmp){var f=Object.keys(a.cmp.children).length;a.cmp.children[l.alias?l.alias:f++]=l}t.autoCmp=null}o.hasChildNodes()&&e(o.firstChild,{cmp:r}),o=o.nextSibling}}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.template="string"==typeof t.template?p.create(t.template):t.template,t.transform||t.root.appendChild(t.template);var n=null,r=void 0;return e(t.template),n}function i(e,t){var n=c.copy(t.props,"function"==typeof e.cfg.props?e.cfg.props():e.cfg.props),r=Object.defineProperties({},{_isCreated:{value:!1,writable:!0},_prevTpl:{value:null,writable:!0},_prev:{value:null,writable:!0},_prevProps:{value:null,writable:!0},_rootElement:{value:null,writable:!0},_boundElements:{value:{},writable:!0},_callback:{value:t.dProps.callback,writable:!0},_cache:{value:new Map},_loops:{value:{},writable:!0},_isStatic:{value:t.isStatic},_publicProps:{value:Object.assign({},t.props)},_processing:{value:[],writable:!0},_dynamicChildren:{value:[],writable:!0},view:{value:t.view,enumerable:!0},parent:{value:t.parentCmp,enumerable:!0},ref:{value:{},writable:!0,enumerable:!0},children:{value:{},writable:!0,enumerable:!0},tag:{value:e.tag,enumerable:!0},emit:{value:function(e){if(this._callback&&void 0!==this._callback[e]&&void 0!==this.parent[this._callback[e]]&&"function"==typeof this.parent[this._callback[e]]){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.parent[this._callback[e]].apply(this.parent,n)}},enumerable:!0},each:{value:function(e,t){if(Array.isArray(e))return e.map(t).map(function(e){return e=e.trim()}).join("")},enumerable:!0},getStore:{value:function(e){return this.view.getStore(e)},enumerable:!0},getComponentById:{value:function(e){return this.view.getComponentById(e)},enumerable:!0},action:{value:t.view.action,enumerable:!0},render:{value:function(e){var n=this.template().trim(),r=p.create(n,y.ROOT),o=_(r),i=w(t.root,o,this._prev,0,this,e);s(this),!this._rootElement&&i&&(this._rootElement=i),this._prev=o},enumerable:!0},mount:{value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this._rootElement;return"string"==typeof t.selector?n=n.querySelector(t.selector):t.selector instanceof HTMLElement&&(n=t.selector),this.view.mount(e,n,this)},enumerable:!0},destroy:{value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(t||this._rootElement&&!1!==g.callBeforeDestroy(this)&&this._rootElement.parentNode)&&(Object.keys(this.children).forEach(function(t){e.children[t].destroy()}),t?this._rootElement.parentNode.innerHTML="":this._rootElement.parentNode.parentNode.removeChild(this._rootElement.parentNode),g.callDestroy(this))},enumerable:!0}});if(a(r,e.cfg,t.dProps),!1!==g.callBeforeCreate(r))return b.create(r,n),T.create(r),O.create(r),g.callCreate(r),r._isCreated=!0,r}function a(e,t,n){Object.assign(e,t,n)}function u(e){for(var t=e._dynamicChildren.length-1;t>=0;){var n=e._dynamicChildren[t];!document.body.contains(n)&&n[m]&&(n[m].destroy(!0),e._dynamicChildren.splice(t,1)),t-=1}}function s(e){u(e);for(var t=e._processing.length-1;t>=0;){var n=e._processing[t],r=n.node.parentNode;n.node[m]&&n.node[m].destroy(!0);var i=o({root:r,template:n.node.outerHTML,view:e.view});e._dynamicChildren.push(i._rootElement.parentNode),r.replaceChild(i._rootElement.parentNode,n.node),i._rootElement.parentNode[m]=i,e._processing.splice(t,1),t-=1}}var c=n(2),l=n(1),f=l.register,p=n(4),d=n(0),v=d.REGEX,y=d.TAG,m=d.INSTANCE,h=n(1),b=n(13),g=n(5),E=n(6),_=E.transform,S=E.serializeProps,w=n(8).updateElement,T=n(18),O=n(19),x=n(20),C=x.extract;e.exports={component:r,getInstances:o}},function(e,t,n){"use strict";var r=/\n/g,o=/\s+/g,i={create:function(e,t){var n=void 0;e=e.replace(r," "),e=e.replace(o," ");var i=document.createElement("div");if(i.innerHTML=e,i.children.length>1?(n=document.createElement(t),n.innerHTML=i.innerHTML):n=i.firstChild||document.createTextNode(""),!this.isValidNode(n))throw new Error("Element not valid");return n},isValidNode:function(e){return e&&"nodeType"in e},getAllNodes:function(e){function t(e){for(;e;)n.push(e),e.hasChildNodes()&&t(e.firstChild),e=e.nextSibling}var n=[];return t(e),n}};e.exports=i},function(e,t,n){"use strict";function r(e){if("function"==typeof e.onBeforeCreate)return e.onBeforeCreate.call(e)}function o(e){"function"==typeof e.onCreate&&e.onCreate.call(e)}function i(e){"function"==typeof e.onRender&&e.onRender.call(e)}function a(e){if("function"==typeof e.onBeforeUpdate)return e.onBeforeUpdate.call(e,Object.assign({},e.props))}function u(e){"function"==typeof e.onUpdate&&e.onUpdate.call(e)}function s(e){if("function"==typeof e.onBeforeDestroy)return e.onBeforeDestroy.call(e)}function c(e){"function"==typeof e.onDestroy&&(e.onDestroy.call(e),e=null)}e.exports={callBeforeCreate:r,callCreate:o,callRender:i,callBeforeUpdate:a,callUpdate:u,callBeforeDestroy:s,callDestroy:c}},function(e,t,n){"use strict";function r(e){var t={};if(e.attributes)for(var n=Array.from(e.attributes),r=n.length-1;r>=0;--r){var o=n[r],a=o.name.match(u.IS_COMPONENT_LISTENER);a?(void 0===t[s.LISTENER]&&(t[s.LISTENER]={}),t[s.LISTENER][a[1]]=o.nodeValue,delete t[o.name]):t[o.name]=""===o.nodeValue||i(o.nodeValue)}return t}function o(e){function t(e,o){for(;e;){var i=void 0;3===e.nodeType?i=e.nodeValue:(i={},i.type=e.nodeName.toLowerCase(),i.children=[],i.props=r(e)),Object.keys(n).length||(n=i),o&&o.children&&o.children.push(i),e.hasChildNodes()&&t(e.firstChild,i),e=e.nextSibling}}var n={};return t(e,n),n}var i=n(7),a=n(0),u=a.REGEX,s=a.ATTR;e.exports={transform:o,serializeProps:r}},function(e,t,n){"use strict";function r(e){if("string"!=typeof e)return e;switch(e){case"undefined":return;case"null":return null;case"NaN":return NaN;case"Infinity":return 1/0;case"true":return!0;case"false":return!1;case"0":return e;default:try{return JSON.parse(e)}catch(e){}}var t=parseFloat(e);return!isNaN(t)&&isFinite(e)?0===e.toLowerCase().indexOf("0x")?parseInt(e,16):t:e}e.exports=r},function(e,t,n){"use strict";var r=n(15);e.exports={updateElement:r.update}},function(e,t,n){"use strict";e.exports=n(10)},function(e,t,n){"use strict";e.exports=n(11),e.exports.component=n(3).component,e.exports.collection=n(1),e.exports.update=n(8).updateElement,e.exports.transform=n(6).transform,e.exports.html=n(4)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),u=n(12),s=n(3),c=n(0),l=c.TAG,f=c.REGEX,p=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var i="<"+l.VIEW+"></"+l.VIEW+">";if(f.IS_ID_SELECTOR.test(n.root)&&(n.root=document.getElementById(n.root.substring(1))),f.IS_ID_SELECTOR.test(n.template)&&(n.template=document.getElementById(n.template.substring(1)),n.template=n.template.innerHTML),!(n.root instanceof HTMLElement))throw new TypeError("root must be an HTMLElement or an valid ID selector like #example-root");if(!(n.template instanceof HTMLElement||"string"==typeof n.template||"function"==typeof n.template))throw new TypeError("template must be a string or an HTMLElement or a function or an valid ID selector like #example-template");this.cfg=a(n,{components:[],actions:{}}),Object.defineProperties(this,{_components:{value:{},writable:!0},_usedComponents:{value:{},writable:!0},_stores:{value:{},writable:!0},_cache:{value:new Map},_ids:{value:{},writable:!0},action:{value:u(this.cfg.actions,this),enumerable:!0},mount:{value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._tree;if("string"==typeof t&&(t=document.querySelector(t)),!((t=t||n._rootElement)instanceof HTMLElement))throw new TypeError("root must be an HTMLElement or an valid selector like #example-root");var r={tag:l.ROOT,cfg:{props:{},template:function(){return e}}};return s.getInstances({root:t,template:"<"+l.ROOT+"></"+l.ROOT+">",view:this,parentCmp:n,isStatic:!1,autoCmp:r,mount:!0})},enumerable:!0}}),this.cfg.components.forEach(function(e){"object"===(void 0===e?"undefined":o(e))&&"string"==typeof e.tag&&"object"===o(e.cfg)&&(t._components[e.tag]=e)}),this._components[l.VIEW]={tag:l.VIEW,cfg:{props:n.props||{},template:function(){return"function"==typeof n.template?n.template():n.template}}},this._tree=s.getInstances({root:this.cfg.root,template:i,view:this})||[]}return i(e,[{key:"getComponent",value:function(e){return this._tree?this._tree.children[e]:void 0}},{key:"getComponentById",value:function(e){return this._ids[e]}},{key:"getStore",value:function(e){return this._stores[e]}}]),e}();e.exports=p},function(e,t,n){"use strict";function r(e,t){if("object"!==(void 0===e?"undefined":o(e)))throw new TypeError("expected an object");for(var n=Object.assign({},e),i=Object.keys(e),a=i.length-1;a>=0;--a){var u=n[i[a]];"function"==typeof u?n[i[a]]=u.bind(t):"object"===(void 0===u?"undefined":o(u))&&(n[i[a]]=r(u,t))}return n}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=r},function(e,t,n){"use strict";function r(e){return void 0!==window.requestAnimationFrame?window.requestAnimationFrame(e):window.setTimeout(e)}function o(e,t){if(e.updateChildrenProps){Object.keys(e.children).forEach(function(n){t.forEach(function(t){e.children[n]._publicProps.hasOwnProperty(t.currentPath)&&e.children[n].props.hasOwnProperty(t.currentPath)&&(e.children[n].props[t.currentPath]=t.newValue)})})}}function i(e,t){t.forEach(function(t){e._boundElements.hasOwnProperty(t.property)&&e._boundElements[t.property].forEach(function(e){e.value=t.newValue})})}function a(e,t){e.props=u.create(t,!0,function(t){e.render(),i(e,t),e._isCreated&&r(function(){o(e,t),s.callUpdate(e)})}),u.beforeChange(e.props,function(){if(!1===s.callBeforeUpdate(e))return!1})}var u=n(14),s=n(5);e.exports={create:a}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){var e=[],t=[],n=[],o=[],i=null,a=null,u=function(e,t){return t.split(".").reduce(function(e,t){return e?e[t]:void 0},e||self)},s=function s(c,l,f,p){var d=f||null,v=p||"",y=[],m=function(e,t){return e instanceof Array?""!==v?v:t:""!==v?v+"."+t:t},h=function(e){if(!0!==d.paused)if(!0===l)setTimeout(function(){if(e===y.length){for(var t=0;t<d.observers.length;t++)d.observers[t](y);y=[]}},10);else{for(var t=0;t<d.observers.length;t++)d.observers[t](y);y=[]}},b={get:function(e,r){if("__isProxy"===r)return!0;if("__getTarget"===r)return e;if("__getParent"===r)return function(t){if(void 0===t)var t=1;var n=m(e,"__getParent").split(".");return n.splice(-(t+1),t+1),u(d.proxy,n.join("."))};var a=e[r];if(o.push(d),null===i){i=d;var c=t.indexOf(e),f=n[c],p=f.length;if(p>1)for(;p--;)-1===o.indexOf(f[p].observable)&&f[p].proxy[r];i=null,o=[]}if(a instanceof Object&&null!==a&&e.hasOwnProperty(r)&&void 0===a.__isProxy){var c=t.indexOf(a);if(c>-1)for(var y=n[c],p=y.length;p--;)if(y[p].observable===d)return y[p].proxy;return s(a,l,d,""!==v?v+"."+r:r)}return a},deleteProperty:function(e,r){var o=!0;a===g&&(o=!1,a=null);var i=Object.assign({},e),u=m(e,r);if(y.push({type:"delete",target:e,property:r,newValue:null,previousValue:i[r],currentPath:u,proxy:g}),"function"==typeof d.beforeChange){if(!1===d.beforeChange(y))return!1}if(!0===o){var s=t.indexOf(e);if(s>-1)for(var c=n[s].length;c--;)n[s][c].proxy!==g&&(a=n[s][c].proxy,delete n[s][c].proxy[r]);delete e[r]}return h(y.length),!0},set:function(e,o,i,u){var s=!0;a===g&&(s=!1,a=null);var c=e[o];if(c!==i||!1===s){var l=void 0===c?"undefined":r(c),f=m(e,o),p="update";if("undefined"===l&&(p="add"),y.push({type:p,target:e,property:o,newValue:i,previousValue:u[o],currentPath:f,proxy:g}),"function"==typeof d.beforeChange){if(!1===d.beforeChange(y))return!1}if(!0===s){var v=t.indexOf(e);if(v>-1)for(var b=n[v],E=b.length;E--;)b[E].proxy!==g&&(a=b[E].proxy,b[E].proxy[o]=i);setTimeout(function(){l instanceof Object&&function e(r){for(var o in r){var i=r[o];i instanceof Object&&null!==i&&e(i)}var a=t.indexOf(r);if(a>-1){for(var u=n[a],s=u.length;s--;)if(d===u[s].observable){u.splice(s,1);break}0==u.length&&(n.splice(a,1),t.splice(a,1))}}(c)},1e4),e[o]=i}h(y.length)}return!0}},g=new Proxy(c,b);null===d&&(d={target:c,domDelay:l,proxy:g,observers:[],paused:!1,path:v},e.push(d));var E={target:c,proxy:g,observable:d},_=t.indexOf(c);return _>-1?n[_].push(E):(t.push(c),n.push([E])),g};return{create:function(e,t,n){if(!0===e.__isProxy)var e=e.__getTarget;var r=s(e,t);return"function"==typeof n&&this.observe(r,n),r},observe:function(t,n){for(var r=e.length;r--;)if(e[r].proxy===t){e[r].observers.push(n);break}},pause:function(t){for(var n=e.length,r=!1;n--;)if(e[n].proxy===t){e[n].paused=!0,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not pause observable -- matching proxy not found.")},resume:function(t){for(var n=e.length,r=!1;n--;)if(e[n].proxy===t){e[n].paused=!1,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not resume observable -- matching proxy not found.")},remove:function(r){for(var o=null,i=!1,a=e.length;a--;)if(e[a].proxy===r){o=e[a],i=!0;break}for(var u=n.length;u--;)for(var s=n[u].length;s--;)n[u][s].observable===o&&(n[u].splice(s,1),0==n[u].length&&(n.splice(u,1),t.splice(u,1)));!0===i&&e.splice(a,1)},beforeChange:function(t,n){if("function"!=typeof n)throw new Error("Callback function is required");for(var r=e.length,o=!1;r--;)if(e[r].proxy===t){e[r].beforeChange=n,o=!0;break}if(0==o)throw new Error("ObseravableSlim -- matching proxy not found.")}}}();try{e.exports=o}catch(e){}},function(e,t,n){"use strict";function r(e,t){return(void 0===e?"undefined":u(e))!==(void 0===t?"undefined":u(t))||"string"==typeof e&&e!==t||e.type!==t.type||e.props&&e.props.forceupdate}function o(e,t,n){if(void 0!==e){if("string"==typeof e)return document.createTextNode(e);var r=document.createElement(e.type);return c(r,e.props,t),e.children.map(function(e){return o(e,t,n)}).forEach(r.appendChild.bind(r)),-1===e.type.indexOf("-")||n||t._processing.push({node:r,action:"create"}),r}}function i(e,t,n){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments[4],c=arguments[5];if(!n){var p=o(t,s,c);return e.appendChild(p),p}if(t){if(r(t,n)){var v=o(t,s,c);return e.replaceChild(v,e.childNodes[u]),v}if(t.type){var y=l(e.childNodes[u],t.props,n.props,s);if(e.childNodes[u]){var m=e.childNodes[u][d];if(m&&y.length)return void y.forEach(function(e){Object.keys(e).forEach(function(t){m.props[t]=e[t]})})}for(var h=t.children.length,b=n.children.length,g=0;g<h||g<b;g++)i(e.childNodes[u],t.children[g],n.children[g],g,s,c);a()}}else e.childNodes[u]&&f.push(e.childNodes[u])}function a(){for(var e=f.length;e--;)f[e].parentNode.removeChild(f[e]),f.splice(e,1)}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=n(16),c=s.attach,l=s.updateAttributes,f=[],p=n(0),d=p.INSTANCE;e.exports={create:o,update:i}},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e){return w.IS_LISTENER.test(e)}function i(e){return e===T.BIND}function a(e){return e===T.REF}function u(e){return-1!==["INPUT","TEXTAREA"].indexOf(e.nodeName)}function s(e,t,n,r){if(p(t));else if("className"===t)e.setAttribute("class",n);else if("boolean"==typeof n)d(e,t,n);else if("object"===(void 0===n?"undefined":_(n)))try{e.setAttribute(t,JSON.stringify(n))}catch(e){}else e.setAttribute(t,n)}function c(e,t,n){p(t)||("className"===t?e.removeAttribute("class"):"boolean"==typeof n?v(e,t):e.removeAttribute(t))}function l(e,t,n,r){n?r&&n===r||s(e,t,n):c(e,t,r)}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(arguments[3],Object.assign({},t,n)),o=[];return Object.keys(r).forEach(function(r){if(l(e,r,t[r],n[r]),t[r]!==n[r]){var i={};i[r]=t[r],o.push(i)}}),o}function p(e){return o(e)||i(e)||a(e)||"forceupdate"===e}function d(e,t,n){n?(e.setAttribute(t,n),e[t]=!0):e[t]=!1}function v(e,t){e.removeAttribute(t),e[t]=!1}function y(e){return e.slice(2).toLowerCase()}function m(e){return e.replace(w.TRIM_QUOTES,"$1")}function h(e,t,n,i){if(o(t)){var a=n.match(w.GET_LISTENER);if(i._isStatic&&(e.dataset[t]=n),a){var u=null,s=a[1],c=a[2];c&&(u=c.split(",").map(function(e){return e=e.trim(),"this"===e?i:O(m(e))}));var l=s.match(w.IS_PARENT_METHOD);l&&(s=l[1],i=i.parent);var f=x(s,i);void 0!==f&&(n=u?f.bind.apply(f,[i].concat(r(u))):f.bind(i))}"function"==typeof n&&e.addEventListener(y(t),n)}}function b(e,t,n,r){i(t)&&u(e)&&void 0!==r.props[n]&&(["compositionstart","compositionend","input","change"].forEach(function(t){e.addEventListener(t,function(){r.props[n]=this.value})}),r._boundElements.hasOwnProperty(n)?r._boundElements[n].push(e):r._boundElements[n]=[e])}function g(e,t,n,r){a(t)&&(r.ref[n]=e)}function E(e,t,n){Object.keys(t).forEach(function(r){s(e,r,t[r],n),h(e,r,t[r],n),b(e,r,t[r],n),g(e,r,t[r],n)});for(var r in e.dataset)e.dataset.hasOwnProperty(r)&&w.IS_LISTENER.test(r)&&h(e,r,e.dataset[r],n)}var _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S=n(0),w=S.REGEX,T=S.ATTR,O=n(7),x=n(17);e.exports={attach:E,updateAttributes:f}},function(e,t,n){"use strict";function r(e,t){return e.split(".").reduce(function(e,t){return e?e[t]:void 0},t)}function o(e,t){return-1!==e.indexOf(".")&&(e=e.split("."),e.pop(),e=e.join(".")),r(e,t)}e.exports=r,e.exports.getLast=o},function(e,t,n){"use strict";function r(e){if("string"==typeof e.store){if(void 0!==e.view._stores[e.store])throw new Error("Store already defined: "+e.store);e.view._stores[e.store]=e.props}}e.exports={create:r}},function(e,t,n){"use strict";function r(e){if("string"==typeof e.id){if(void 0!==e.view._ids[e.id])throw new Error("ID already defined: "+e.id);e.view._ids[e.id]=e}}e.exports={create:r}},function(e,t,n){"use strict";function r(e){var t={};return void 0!==e[i.ALIAS]&&(t.alias=e[i.ALIAS],delete e[i.ALIAS]),void 0!==e[i.STORE]&&(t.store=e[i.STORE],delete e[i.STORE]),void 0!==e[i.LISTENER]&&(t.callback=e[i.LISTENER],delete e[i.LISTENER]),void 0!==e[i.CLASS]&&(t.class=e[i.CLASS],delete e[i.CLASS]),void 0!==e[i.ID]&&(t.id=e[i.ID],delete e[i.ID]),t}var o=n(0),i=o.ATTR;e.exports={extract:r}}])}); |
{ | ||
"name": "doz", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "A JavaScript framework for building UI, almost like writing in VanillaJS.", | ||
@@ -5,0 +5,0 @@ "main": "dist/doz.js", |
@@ -223,7 +223,11 @@ const extend = require('../utils/extend'); | ||
value: function (initial) { | ||
const tag = this.tag ? this.tag + TAG.SUFFIX_ROOT : TAG.ROOT; | ||
//const tag = this.tag ? this.tag + TAG.SUFFIX_ROOT : TAG.ROOT; | ||
const template = this.template().trim(); | ||
const tpl = html.create(`<${tag}>${template}</${tag}>`); | ||
//const tpl = html.create(`<${tag}>${template}</${tag}>`); | ||
const tpl = html.create(template, TAG.ROOT); | ||
//console.log(tpl.outerHTML) | ||
let next = transform(tpl); | ||
//console.log(cfg.root.parentNode); | ||
const rootElement = update(cfg.root, next, this._prev, 0, this, initial); | ||
@@ -230,0 +234,0 @@ |
@@ -9,5 +9,6 @@ const regexN = /\n/g; | ||
* @param str html string | ||
* @param wrapper tag string | ||
* @returns {Element | Node | null} | ||
*/ | ||
create: function (str) { | ||
create: function (str, wrapper) { | ||
let element; | ||
@@ -19,4 +20,10 @@ str = str.replace(regexN, replace); | ||
template.innerHTML = str; | ||
element = template.firstChild; | ||
if(template.children.length > 1) { | ||
element = document.createElement(wrapper); | ||
element.innerHTML = template.innerHTML; | ||
} else { | ||
element = template.firstChild || document.createTextNode(''); | ||
} | ||
if (!this.isValidNode(element)) | ||
@@ -23,0 +30,0 @@ throw new Error('Element not valid'); |
Sorry, the diff of this file is too big to display
166635
3301