New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

beejs

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beejs - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

2

build/bee.min.js

@@ -1,2 +0,2 @@

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Bee=t()}}(function(){return function t(e,n,r){function i(a,o){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[a]={exports:{}};e[a][0].call(h.exports,function(t){var n=e[a][1][t];return i(n?n:t)},h,h.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){"use strict";function r(t){t&&(this.prefix=t)}function i(t,e){g(t)&&(e=t,t=e.$tpl),e=e||{};var n,r={$data:{},$watchers:{},$mixins:[],$el:this.$el||null,$target:this.$target||null,$tpl:this.$tpl||"<div></div>",$content:this.$content||null,$parent:null,$root:this,_watchers:{},_assignments:null,_relativePath:[],__links:[],_isRendered:!1},i=[r].concat(this.$mixins||[]).concat([e]);i.forEach(function(t){var e;for(var n in t)t.hasOwnProperty(n)&&(n in x&&m(t[n])?(e=j({},this[n],t[n]),this[n]=j(t[n],e)):this[n]=n in k?o.afterFn(this[n],t[n]):t[n])}.bind(this)),m(this.$data)&&j(this,this.$data),t=t||this.$tpl,n=d.tplParse(t,this.$target,this.$content),this.$el?this.$el.appendChild(n.el):this.$el=n.el,this.$tpl=n.tpl,this.$content=n.content,this.$beforeInit(),this.$el.bee=this,this.$content&&(this.__links=p.walk.call(this.$root,this.$content)),this.__links=this.__links.concat(p.walk.call(this,this.$el));for(var s in this.$watchers)this.$watch(s,this.$watchers[s]);this._isRendered=!0,this.$afterInit()}function s(t,e){var n;this.$beforeUpdate(this.$data),1===arguments.length?e=t:n=[t],n||(n=m(e)?Object.keys(e):["$data"]);for(var r,i=0;r=n[i];i++)this.$update(r,!0);this.$afterUpdate(this.$data)}var a=t("./env.js").document,o=t("./utils.js"),c=t("./class.js"),u=t("./directive.js"),h=t("./component.js"),l=t("./watcher.js"),f=t("./directives"),d=t("./dom-utils.js"),p=t("./check-binding.js"),v=t("./scope"),m=o.isObject,y=o.isUndefined,g=o.isPlainObject,$=o.parseKeyPath,b=o.deepSet,j=o.extend,w=o.create,x={$data:1,$watchers:1},k={$beforeInit:o.noop,$afterInit:o.noop,$beforeUpdate:o.noop,$afterUpdate:o.noop,$beforeDestroy:o.noop,$afterDestroy:o.noop};j(i,{extend:o.afterFn(c.extend,o.noop,function(t){t.directives=j(w(this.directives),t.directives),t.components=j(w(this.components),t.components),t.filters=j(w(this.filters),t.filters)}),utils:o},u,h,{setPrefix:r,prefix:"",doc:a,directives:{},components:{},filters:{json:function(t,e,n){return JSON.stringify(t,e,n)}},mount:function(t,e){var n,r=t.nodeType?t:a.getElementById(t),s=this.getComponent(r.tagName.toLowerCase());return n=s?new s(j({$target:r},e)):new i(r,e)}}),i.setPrefix("b-");for(var _ in f)i.directive(_,f[_]);j(i.prototype,k,{$get:function(t){var e=new u("$get",{path:t,watch:!1});return e.parse(),e.getValue(this,!1)},$set:function(t,e){var n,r,i,a,o=!1,c=this;return y(t)?this:(1===arguments.length?m(t)?(j(!0,this.$data,t),j(!0,this,t)):this.$data=t:(o=!0,i=v.reformScope(this,t),a=i.path,c=i.vm,r=$(a),n=b(a,e,{}),"$data"===r[0]&&(n=n.$data),m(c.$data)?(j(!0,c.$data,n),j(!0,c,n)):c.$data=n),void(o?s.call(c,a,e):s.call(c,t)))},$replace:function(t,e){var n,r,i,a=!1,o=this;return y(t)?this:(1===arguments.length?(m(t)&&(Object.keys(this.$data).forEach(function(t){delete this[t]}.bind(this)),j(this,t)),this.$data=t):(a=!0,r=v.reformScope(this,t),i=r.path,o=r.vm,n=$(i),"$data"!==n[0]&&b(i,e,o.$data),b(i,e,o)),void(a?s.call(o,i,e):s.call(o,t)))},$update:function(t,e){e=e!==!1;for(var n,r,i,s=$(t.replace(/^\$data\./,""));n=s.join(".");){i=this._watchers[n]||[];for(var a=0,c=i.length;c>a;a++)i[a].update();if(!e)break;s.pop(),s.length||"$data"===n||s.push("$data")}r=this.$get(t),m(r)&&!o.isArray(r)&&Object.keys(r).forEach(function(e){this.$update(t+"."+e,!1)}.bind(this)),e&&this.$parent&&this._relativePath.forEach(function(t){this.$parent.$update(t)}.bind(this)),o.isArray(r)&&this.$update(t+".length",!1)},$watch:function(t,e){if(e){var n=e.bind(this);return n._originFn=e,l.addWatcher.call(this,new u("$watch",{path:t,update:n}))}},$unwatch:function(t,e){l.unwatch(this,t,e)},$destroy:function(t){this.$beforeDestroy(),this.__links.forEach(function(t){t.unwatch()}),t&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el),this.__links=[],this.$afterDestroy()}}),i.version="0.3.1",e.exports=i},{"./check-binding.js":3,"./class.js":4,"./component.js":5,"./directive.js":6,"./directives":10,"./dom-utils.js":15,"./env.js":16,"./scope":20,"./utils.js":22,"./watcher.js":23}],2:[function(t,e,n){},{}],3:[function(t,e,n){"use strict";function r(t){var e,n=[];if(t.nodeType===f.FRAGMENT&&(t=t.childNodes),"length"in t&&h.isUndefined(t.nodeType)){for(var a=0;a<t.length;a++)n=n.concat(r.call(this,t[a]));return n}switch(t.nodeType){case f.ELEMENT:break;case f.COMMENT:return n;case f.TEXT:return n=n.concat(s.call(this,t))}if("template"===t.nodeName.toLowerCase()&&!t.content)for(t.content=l.createDocumentFragment();t.childNodes[0];)t.content.appendChild(t.childNodes[0]);if(e=i.call(this,t),n=n.concat(e.watchers),e.terminal)return n;"template"===t.nodeName.toLowerCase()&&(n=n.concat(r.call(this,t.content)));for(var o,c=t.firstChild;c;)o=c.nextSibling,n=n.concat(r.call(this,c)),c=o;return n}function i(t){for(var e,n,r=this.constructor,i=r.directive.getDir(t,r),s=[],o={},c=0,u=i.length;u>c&&(e=i[c],e.dirs=i,!(n>e.priority));c++)t.removeAttribute(e.nodeName),s=s.concat(a.call(this,e)),e.terminal&&(o.terminal=!0,n=e.priority);return o.watchers=s,o}function s(t){var e=[];if(u.hasToken(t.nodeValue)){var n,r,i=u.parseToken(t.nodeValue),o=i.textMap,c=t.parentNode,f=this.constructor.directives;o.length>1?(o.forEach(function(n){var r=l.createTextNode(n);c.insertBefore(r,t),e=e.concat(s.call(this,r))}.bind(this)),c.removeChild(t)):(n=i[0],r=h.create(n.escape?f.text:f.html),e=a.call(this,h.extend(r,n,{el:t})))}return e}function a(t){var e;if(t.replace){var n=t.el;h.isFunction(t.replace)?t.node=t.replace():t.replace&&(t.node=l.createTextNode("")),t.el=t.el.parentNode,t.el.replaceChild(t.node,n)}return t.link(this),e=c.addWatcher.call(this,t),e?[e]:[]}function o(t){t.forEach(function(t){t.unwatch()})}var c=t("./watcher"),u=t("./token.js"),h=t("./utils"),l=t("./env.js").document,f={ELEMENT:1,ATTR:2,TEXT:3,COMMENT:8,FRAGMENT:11};l.createElement("template"),e.exports={walk:r,unBinding:o}},{"./env.js":16,"./token.js":21,"./utils":22,"./watcher":23}],4:[function(t,e,n){var r=t("./utils.js").extend,i={extend:function(t,e){t=t||{};var n=t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},i=this,s=function(){this.constructor=n};return s.prototype=i.prototype,n.prototype=new s,r(n.prototype,t),r(n,i,e,{__super__:i.prototype}),n}};e.exports=i},{"./utils.js":22}],5:[function(t,e,n){"use strict";function r(t,e,n){var r=this.components=this.components||{};return this.doc.createElement(t),s.isObject(e)&&(e=this.extend(e,n)),r[t]=e}function i(t){var e=s.parseKeyPath(t),n=this;return e.forEach(function(t){n=n&&n.components[t]}),n||null}var s=t("./utils.js");n.tag=n.component=r,n.getComponent=i},{"./utils.js":22}],6:[function(t,e,n){"use strict";function r(t,e){var n=this.directives=this.directives||{};return n[t]=new i(t,e)}function i(t,e){this.type=t,a.extend(this,e)}function s(t,e){var n,r,i,s,u,h=[],d={},p=t.parentNode,v=t.nodeName.toLowerCase(),m=e.directives,y=e.prefix;e.getComponent(v)&&t.setAttribute(y+"component",v);for(var g=t.attributes.length-1;g>=0;g--)n=t.attributes[g],r=n.nodeName,i=r.slice(y.length),s={el:t,node:n,nodeName:r,path:n.value},u=null,0===r.indexOf(y)&&i in m?(u=l(m[i]),u.dirName=i):o.hasToken(n.value)?o.parseToken(n.value).forEach(function(t){t.dirName=0===r.indexOf(y)?i:r,h.push(a.extend(l(m.attr),s,t))}):f.test(r)&&(u=a.extend(l(m.attr),{dirName:r.replace(f,""),conditional:!0})),u&&(u.anchor&&!d.start&&(d.start=c.createComment(u.dirName+" start"),p.insertBefore(d.start,t),d.end=c.createComment(u.dirName+" end"),t.nextSibling?p.insertBefore(d.end,t.nextSibling):p.appendChild(d.end)),u.anchors=u.anchor?d:null,h.push(a.extend(u,s)));return h.sort(function(t,e){return e.priority-t.priority}),h}var a=t("./utils.js"),o=t("./token.js"),c=t("./env.js").document,u=t("./parse.js").parse,h=t("./eval.js"),l=a.create;i.prototype={priority:0,link:a.noop,unLink:a.noop,update:a.noop,tearDown:a.noop,terminal:!1,replace:!1,watch:!0,anchor:!1,anchors:null,getNodes:function(){var t=[],e=this.anchors.start.nextSibling;if(this.anchor&&e){for(;e!==this.anchors.end;)t.push(e),e=e.nextSibling;return t}return null},parse:function(){try{this.ast=u(this.path,this.type)}catch(t){this.ast={},t.message='SyntaxError in "'+this.path+'" | '+t.message,console.error(t)}},getValue:function(t,e){e=e!==!1;var n;try{n=h.eval(this.ast,t,this)}catch(r){n="",console.error(r)}return e&&(a.isUndefined(n)||null===n)&&(n=""),n}};var f=/\?$/;i.directive=r,r.getDir=s,e.exports=i},{"./env.js":16,"./eval.js":17,"./parse.js":19,"./token.js":21,"./utils.js":22}],7:[function(t,e,n){"use strict";function r(t,e,n){try{(e in t||"class"===e)&&("style"===e&&t.style.setAttribute?t.style.setAttribute("cssText",n):"class"===e?t.className=n:t[e]="boolean"==typeof t[e]?!0:n)}catch(r){}t.setAttribute(e,n)}function i(t,e){t.removeAttribute(e)}t("../utils.js");e.exports={link:function(){this.dirName===this.type?this.attrs={}:this.update("")},update:function(t){var e=this.el,n={};if(this.dirName===this.type){for(var s in t)r(e,s,t[s]),delete this.attrs[s],n[s]=!0;for(var s in this.attrs)i(e,s);this.attrs=n}else this.conditional?t?r(e,this.dirName,t):i(e,this.dirName):(this.textMap[this.position]=t&&t+"",r(e,this.dirName,this.textMap.join("")))}}},{"../utils.js":22}],8:[function(t,e,n){var r=t("../utils.js"),i=/-(-?)([a-z])/gi,s=function(t){return t.replace(i,function(t,e,n){return e?e+n:n.toUpperCase()})};e.exports={priority:-10,watch:!1,unLink:function(){this.component&&this.component.$destroy()},link:function(t){var e,n,i=this.el,a=t.constructor,o=[],c={},u=a.getComponent(this.path);if(u){if(u===a)return;o=this.dirs,o=o.filter(function(t){return"attr"==t.type||"with"==t.type}),o.forEach(function(n){var i,s;i=n.path,"with"===n.type||"attr"===n.dirName?(s="$data",r.extend(c,t.$get(i))):(s=n.dirName,c[s]=t.$get(i)),t.$watch(i,function(t){e&&(t=n.textMap?n.textMap.join(""):t,e.$set(s,t))})}),n=i.attributes;for(var h=n.length-1;h>=0;h--)c[s(n[h].nodeName)]=n[h].value;return this.component=e=new u({$target:i,$data:r.extend({},u.prototype.$data,c)}),t.$el===i&&(t.__ref=e,t.$el=e.$el),e}console.warn("Component: "+this.path+" not defined! Ignore")}}},{"../utils.js":22}],9:[function(t,e,n){"use strict";var r=t("../dom-utils"),i=t("../check-binding");e.exports={replace:!0,anchor:!0,link:function(t){this.vm=t,this.watchers=[]},unLink:function(){this.watchers.forEach(function(t){t.unwatch()})},update:function(t){var e=this.getNodes(),n=this.anchors.end.parentNode;e.forEach(function(t){n.removeChild(t)}),this.unLink();var s=r.createContent(t);this.watchers=i.walk.call(this.vm,s),n.insertBefore(s,this.anchors.end)}}},{"../check-binding":3,"../dom-utils":15}],10:[function(t,e,n){"use strict";var r=t("../env.js").document,i=t("../utils.js"),s={};s.text={terminal:!0,replace:!0,update:function(t){this.node.nodeValue=i.isUndefined(t)?"":t}},s.html={terminal:!0,replace:!0,link:function(){this.nodes=[]},update:function(t){var e=r.createElement("div");e.innerHTML=i.isUndefined(t)?"":t;for(var n;n=this.nodes.pop();)n.parentNode&&n.parentNode.removeChild(n);for(var s=e.childNodes;n=s[0];)this.nodes.push(n),this.el.insertBefore(n,this.node)}},s["if"]={anchor:!0,link:function(){this.el.content?(this.frag=this.el.content,this.el.parentNode.removeChild(this.el)):(this.frag=r.createDocumentFragment(),this.hide())},update:function(t){t?this.state||this.show():this.state&&this.hide(),this.state=t},show:function(){var t=this.anchors.end;t.parentNode&&t.parentNode.insertBefore(this.frag,t)},hide:function(){var t=this.getNodes();if(t)for(var e=0,n=t.length;n>e;e++)this.frag.appendChild(t[e])}},s.template={priority:1e4,link:function(){for(var t=this.el.childNodes,e=r.createDocumentFragment();t[0];)e.appendChild(t[0]);this.el.content=e}},s.src={update:function(t){this.el.src=t}},s["with"]={},s.repeat=t("./repeat.js"),s.attr=t("./attr.js"),s.model=t("./model.js"),s.style=t("./style.js"),s.on=t("./on.js"),s.component=t("./component.js"),s.content=t("./content.js"),e.exports=s},{"../env.js":16,"../utils.js":22,"./attr.js":7,"./component.js":8,"./content.js":9,"./model.js":11,"./on.js":12,"./repeat.js":13,"./style.js":14}],11:[function(t,e,n){"use strict";var r=t("../utils.js"),i=t("../token.js").hasToken,s=t("../event-bind.js");e.exports={teminal:!0,priority:1,link:function(t){var e=this.path;if(!e)return!1;var n,a=this.el,o="change",c=n="value",u=t,h=r.isUndefined(u.$get(e)),l=/\r\n/g,f=function(t){var e=(t||"")+"",t=a[n];t&&t.replace&&(t=t.replace(l,"\n")),e!==t&&(a[n]=e)},d=function(t){var n=a[c];n.replace&&(n=n.replace(l,"\n")),u.$set(e,n)},p=function(t){t&&t.propertyName&&t.propertyName!==n||d.apply(this,arguments)},v=r.ie;switch(a.tagName){default:c=n="innerHTML";case"INPUT":case"TEXTAREA":switch(a.type){case"checkbox":c=n="checked",v&&(o+=" click");break;case"radio":n="checked",v&&(o+=" click"),f=function(t){a.checked=a.value===t+""},h=a.checked;break;default:u.$lazy||("oninput"in a&&(o+=" input"),v&&(o+=" keyup propertychange cut"))}break;case"SELECT":a.multiple&&(d=function(t){for(var n=[],r=0,i=a.options.length;i>r;r++)a.options[r].selected&&n.push(a.options[r].value);u.$set(e,n)},f=function(t){if(t&&t.length)for(var e=0,n=a.options.length;n>e;e++)a.options[e].selected=-1!==t.indexOf(a.options[e].value)}),h=h&&!i(a[c])}this.update=f,o.split(/\s+/g).forEach(function(t){s.removeEvent(a,t,p),s.addEvent(a,t,p)}),a[c]&&d(!0)}}},{"../event-bind.js":18,"../token.js":21,"../utils.js":22}],12:[function(t,e,n){"use strict";function r(t,e,n){return function(r){var i=r.target||r.srcElement,a=e?s.toArray(t.el.querySelectorAll(e)):[i];do if(a.indexOf(i)>=0)return r.delegateTarget=i,n.call(t.vm,r);while(i=i.parentNode)}}var i=t("../event-bind.js"),s=t("../utils");e.exports={watch:!1,link:function(t){this.vm=t},update:function(t){var e,n;for(var s in t)e=s.split(/\s+/),n=e.shift(),e=e.join(" "),i.addEvent(this.el,n,r(this,e,t[s]))}}},{"../event-bind.js":18,"../utils":22}],13:[function(t,e,n){"use strict";function r(t,e,n){var r=e.slice();return t.filter(function(t){var e,s=i(t,r,n);return 0>s?e=!0:r.splice(s,1),e})}function i(t,e,n,r){r=r||0;var i=e.indexOf(t,r);if(-1===i&&n)for(var a,o=r;a=e[o];o++)if(t[n]===a[n]&&!s.isUndefined(t[n])){i=o;break}return i}var s=(t("../env.js").document,t("../utils.js")),a=["splice","push","pop","shift","unshift","sort","reverse"];e.exports={priority:1e3,anchor:!0,terminal:!0,unLink:function(){this.list.forEach(function(t){t.$destroy()})},link:function(t){var e=this.cstr=t.constructor;for(this.vm=t;e.__super__;)e=e.__super__.constructor;this.trackId=this.el.getAttribute("track-by"),this.el.removeAttribute("track-by"),this.cstr=e.extend({},this.cstr),this.curArr=[],this.list=[],this.el.parentNode.removeChild(this.el)},update:function(t){var e=this.curArr,n=this.anchors.end.parentNode,o=this,c=this.list,u=this.trackId;s.isArray(t)&&(this.listPath=this.summary.locals.filter(function(t){return!s.isFunction(o.vm.$get(t))}),r(e,t,u).forEach(function(t){var r=i(t,e,u);e.splice(r,1),n.removeChild(c[r].$el),c[r].$destroy(),c.splice(r,1)}),t.forEach(function(r,s){var a,h,l=i(r,t,u,s),f=i(r,e,u,s);0>f?(h=this.el.cloneNode(!0),a=new this.cstr(h,{$data:r,_assignments:this.summary.assignments,$index:l,$root:this.vm.$root,$parent:this.vm,__repeat:!0}),n.insertBefore(a.$el,c[l]&&c[l].$el||this.anchors.end),c.splice(l,0,a),e.splice(l,0,r),a._relativePath=this.listPath):l!==f&&(n.insertBefore(c[f].$el,c[l]&&c[l].$el||o.anchors.end),n.insertBefore(c[l].$el,c[f+1]&&c[f+1].$el||o.anchors.end),c[f]=[c[l],c[l]=c[f]][0],e[f]=[e[l],e[l]=e[f]][0],c[l].$index=l,c[l].$update("$index"))}.bind(this)),this.list.forEach(function(t,e){t.$index=e,t.$el.$index=e,t.$update("$index",!1)}),t.__dirs__||(s.extend(t,{$set:function(e,n){t.__dirs__.forEach(function(t){t.list[e].$set(n)})},$replace:function(e,n){t.__dirs__.forEach(function(t){t.list[e].$replace(n)})},$remove:function(e){t.splice(e,1)}}),a.forEach(function(e){t[e]=s.afterFn(t[e],function(){t.__dirs__.forEach(function(t){t.listPath.forEach(function(e){t.vm.$update(e)})})})}),t.__dirs__=[]),-1===t.__dirs__.indexOf(o)&&t.__dirs__.push(o))}}},{"../env.js":16,"../utils.js":22}],14:[function(t,e,n){"use strict";var r=/([A-Z])/g,i=["width","height","min-width","min-height","max-width","max-height","margin","margin-top","margin-right","margin-left","margin-bottom","padding","padding-top","padding-right","padding-bottom","padding-left","top","left","right","bottom"];e.exports={update:function(t){var e,n,s=this.el,a="";if("string"==typeof t)a=t;else for(var o in t)n=t[o],e=o.replace(r,function(t){return"-"+t.toLowerCase()}),!isNaN(n)&&i.indexOf(e)>=0&&(n+="px"),a+=e+": "+n+"; ";s.style.setAttribute?s.style.setAttribute("cssText",a):s.setAttribute("style",a)}}},{}],15:[function(t,e,n){"use strict";function r(t,e,n){var r;return a.isObject(e)&&e.childNodes?n=i(e.childNodes):n&&(n=i(n)),a.isObject(t)?(r=t,t=r.outerHTML):r=i(t).childNodes[0],e&&e.parentNode&&e.parentNode.replaceChild(r,e),{el:r,tpl:t,content:n}}function i(t){var e,n=s.createDocumentFragment(),r=[];a.isObject(t)?t.nodeName&&t.nodeType?n.appendChild(t):"length"in t&&(r=t):(e=s.createElement("div"),e.innerHTML=(t+"").trim(),r=e.childNodes);for(;r[0];)n.appendChild(r[0]);return n}var s=t("./env.js").document,a=t("./utils");e.exports={tplParse:r,createContent:i}},{"./env.js":16,"./utils":22}],16:[function(t,e,n){!function(e){"use strict";n.root=e,n.document=e.document||t("jsdom").jsdom()}(function(){return this}())},{jsdom:2}],17:[function(t,e,n){"use strict";function r(t,e,n){return t&&t.then?t.then(function(t){return e.apply(a.locals,[t].concat(n))}):e.apply(a.locals,[t].concat(n))}function i(t,e){return l[t][e]||function(){}}function s(t,e){c=!0,t?(c=!1,a={locals:t||{},filters:t.constructor.filters||{}}):a={filters:{},locals:{}},e&&(h=e),o={filters:{},locals:{},paths:{},assignments:{}},u=""}var a,o,c,u,h,l={unary:{"+":function(t){return+t},"-":function(t){return-t},"!":function(t){return!t},"[":function(t){return t},"{":function(t){for(var e={},n=0,r=t.length;r>n;n++)e[t[n][0]]=t[n][1];return e},"typeof":function(t){return typeof t},"new":function(t){return new t}},binary:{"+":function(t,e){return t+e},"-":function(t,e){return t-e},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e},"<":function(t,e){return e>t},">":function(t,e){return t>e},"<=":function(t,e){return e>=t},">=":function(t,e){return t>=e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e},"&&":function(t,e){return t&&e},"||":function(t,e){return t||e},",":function(t,e){return e},".":function(t,e){return e&&(u=u+"."+e),t[e]},"[":function(t,e){return"undefined"!=typeof e&&(u=u+"."+e),t[e]},"(":function(t,e){return t.apply(a.locals,e)},"|":function(t,e){return r(t,e,[])},"new":function(t,e){return t===Date?new Function("return new Date("+e.join(", ")+")")():new(Function.prototype.bind.apply(t,e))},"in":function(t,e){return this.repeat?e:t in e},catchby:function(t,e){return t["catch"]?t["catch"](e.bind(a.locals)):(console.error("catchby expect a promise"),t)}},ternary:{"?":function(t,e,n){return t?e:n},"(":function(t,e,n){return t[e].apply(t,n)},"|":function(t,e,n){return r(t,e,n)}}},f=["first","second","third"],d=function(t){for(var e,n,r=t.arity,s=t.value,h=[],l=0;3>l;l++)if(e=t[f[l]])if(Array.isArray(e)){h[l]=[];for(var v=0,m=e.length;m>v;v++)h[l].push("undefined"==typeof e[v].key?d(e[v]):[e[v].key,d(e[v])])}else h[l]=d(e);switch("literal"!==r&&(u&&"."!==s&&"["!==s&&(o.paths[u]=!0),"name"===r&&(u=s)),r){case"unary":case"binary":case"ternary":try{n=i(r,s).apply(t,h)}catch(y){c||console.warn(y)}break;case"literal":n=s;break;case"repeat":o.assignments[s]=!0;break;case"name":o.locals[s]=!0,n=p(s,a.locals);break;case"filter":o.filters[s]=!0,n=a.filters[s];break;case"this":n=a.locals}return n},p=t("./scope").getValue;n.eval=function(t,e,n){return s(e||{},n),d(t)},n.summary=function(t){s(),d(t),u&&(o.paths[u]=!0);for(var e in o)o[e]=Object.keys(o[e]);return o}},{"./scope":20}],18:[function(t,e,n){"use strict";n.addEvent=function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},n.removeEvent=function(t,e,n){t.removeEventListener?t.removeEventListener(e,n):t.detachEvent("on"+e,n)}},{}],19:[function(t,e,n){"use strict";var r,i=Object.create||function(t){function e(){}return e.prototype=t,new e},s=function(t,e){e=e||this;var n=t+=" But found '"+e.value+"'"+(e.from?" at "+e.from:"")+" in '"+r+"'",i=new Error(n);throw i.name=e.name="SyntaxError",e.message=t,i},a=function(t,e,n){var r,i,a,o,c,u=0,h=t.length,l=[],f=function(t,e){return{type:t,value:e,from:i,to:u}};if(t){for(r=t.charAt(u);r;)if(i=u," ">=r)u+=1,r=t.charAt(u);else if(r>="a"&&"z">=r||r>="A"&&"Z">=r||"$"===r||"_"===r){for(c=r,u+=1;r=t.charAt(u),r>="a"&&"z">=r||r>="A"&&"Z">=r||r>="0"&&"9">=r||"_"===r;)c+=r,u+=1;l.push(f("name",c))}else if(r>="0"&&"9">=r){for(c=r,u+=1;r=t.charAt(u),!("0">r||r>"9");)u+=1,c+=r;if("."===r)for(u+=1,c+=r;r=t.charAt(u),!("0">r||r>"9");)u+=1,c+=r;if("e"===r||"E"===r){u+=1,c+=r,r=t.charAt(u),("-"===r||"+"===r)&&(u+=1,c+=r,r=t.charAt(u)),("0">r||r>"9")&&s("Bad exponent",f("number",c));do u+=1,c+=r,r=t.charAt(u);while(r>="0"&&"9">=r)}r>="a"&&"z">=r&&(c+=r,u+=1,s("Bad number",f("number",c))),a=+c,isFinite(a)?l.push(f("number",a)):s("Bad number",f("number",c))}else if("'"===r||'"'===r){for(c="",o=r,u+=1;r=t.charAt(u)," ">r&&(f("string",c),s("\n"===r||"\r"===r||""===r?"Unterminated string.":"Control character in string.",f("",c))),r!==o;){if("\\"===r)switch(u+=1,u>=h&&s("Unterminated string",f("string",c)),r=t.charAt(u)){case"b":r="\b";break;case"f":r="\f";break;case"n":r="\n";break;case"r":r="\r";break;case"t":r=" ";break;case"u":u>=h&&s("Unterminated string",f("string",c)),r=parseInt(t.substr(u+1,4),16),(!isFinite(r)||0>r)&&s("Unterminated string",f("string",c)),r=String.fromCharCode(r),u+=4}c+=r,u+=1}u+=1,l.push(f("string",c)),r=t.charAt(u)}else if(e.indexOf(r)>=0){for(c=r,u+=1;;){if(r=t.charAt(u),u>=h||n.indexOf(r)<0)break;c+=r,u+=1}l.push(f("operator",c))}else u+=1,l.push(f("operator",r)),r=t.charAt(u);return l}},o=function(t){t=t||{};var e,n,o,c,u={},h=function(){return this},l=function(t){return t.nud=h,t.led=null,t.std=null,t.lbp=0,t},f=function(t){var r,a,c,h;return t&&e.id!==t&&s("Expected '"+t+"'.",e),o>=n.length?void(e=u["(end)"]):(c=n[o],o+=1,h=c.value,r=c.type,("operator"===r||"string"!==r)&&h in u?(a=u[h],a||s("Unknown operator.",c)):"name"===r?a=l(c):"string"===r||"number"===r||"regexp"===r?(a=u["(literal)"],r="literal"):s("Unexpected token.",c),e=i(a),e.from=c.from,e.to=c.to,e.value=h,e.arity=r,e)},d=function(t){var n,r=e;for(f(),n=r.nud();t<e.lbp;)r=e,f(),n=r.led(n);return n},p={nud:function(){s("Undefined.",this)},led:function(t){s("Missing operator.",this)}},v=function(t,e){var n=u[t];return e=e||0,n?e>=n.lbp&&(n.lbp=e):(n=i(p),n.id=n.value=t,n.lbp=e,u[t]=n),n},m=function(t,e,n){var r=v(t);return r.nud=function(){return this.value=u[this.id].value,this.arity="literal",this},r.value=e,r},y=function(t,e,n){var r=v(t,e);return r.led=n||function(t){return this.first=t,this.second=d(e),this.arity="binary",this},r},g=function(t,e,n){var r=v(t,e);return r.led=n||function(t){return this.first=t,this.second=d(e-1),this.arity="binary",this},r},$=function(t,e){var n=v(t);return n.nud=e||function(){return this.first=d(70),this.arity="unary",this},n};v("(end)"),v("(name)"),v(":"),v(")"),v("]"),v("}"),v(","),m("true",!0),m("false",!1),m("null",null),m("undefined"),m("Math",Math),m("Date",Date);for(var b in t)m(b,t[b]);return v("(literal)").nud=h,v("this").nud=function(){return this.arity="this",this},y(",",1),y("?",20,function(t){return this.first=t,this.second=d(0),f(":"),this.third=d(0),this.arity="ternary",this}),g("&&",31),g("||",30),g("===",40),g("!==",40),g("==",40),g("!=",40),g("<",40),g("<=",40),g(">",40),g(">=",40),y("in",45,function(t){return this.first=t,this.second=d(0),this.arity="binary","repeat"===c&&(t.arity="repeat",this.repeat=!0),this}),y("+",50),y("-",50),y("*",60),y("/",60),y("%",60),y("(",70,function(t){var n=[];if("."===t.id||"["===t.id?(this.arity="ternary",this.first=t.first,this.second=t.second,this.third=n):(this.arity="binary",this.first=t,this.second=n,"unary"===t.arity&&"function"===t.id||"name"===t.arity||"literal"===t.arity||"("===t.id||"&&"===t.id||"||"===t.id||"?"===t.id||s("Expected a variable name.",t)),")"!==e.id)for(;;){if(n.push(d(1)),","!==e.id)break;f(",")}return f(")"),this}),y(".",80,function(t){return this.first=t,"name"!==e.arity&&s("Expected a property name.",e),e.arity="literal",this.second=e,this.arity="binary",f(),this}),y("[",80,function(t){return this.first=t,this.second=d(0),this.arity="binary",f("]"),this}),y("|",10,function(t){var n;if(this.first=t,e.arity="filter",this.second=d(10),this.arity="binary",":"===e.id)for(this.arity="ternary",this.third=n=[];;)if(f(":"),n.push(d(0)),":"!==e.id)break;return this}),y("catchby",10),$("!"),$("-"),$("typeof"),$("(",function(){var t=d(0);return f(")"),t}),$("[",function(){var t=[];if("]"!==e.id)for(;;){if(t.push(d(1)),","!==e.id)break;f(",")}return f("]"),this.first=t,this.arity="unary",this}),$("{",function(){var t,n,r=[];if("}"!==e.id)for(;;){if(t=e,"name"!==t.arity&&"literal"!==t.arity&&s("Bad property name: ",e),f(),f(":"),n=d(1),n.key=t.value,r.push(n),","!==e.id)break;f(",")}return f("}"),this.first=r,this.arity="unary",this}),$("new",function(){var t=[];if(this.first=d(79),"("===e.id){for(f("("),this.arity="binary",this.second=t;;){if(t.push(d(1)),","!==e.id)break;f(",")}f(")")}else this.arity="unary";return this}),function(t,e){r=t,n=a(t,"=<>!+-*&|/%^","=<>&|"),o=0,c=e,f();var i=d(0);return f("(end)"),i}};n.parse=o()},{}],20:[function(t,e,n){"use strict";var r=t("./utils"),i=function(t,e){for(var n,i=r.parseKeyPath(e),s=t,a=i[0],o=s,c=s;s;){if(c=o=s,n=s._assignments,s.__repeat)if(n&&n.length){if("$index"===a||"$parent"===a)break;if(a===n[0]){1===i.length?i[0]="$data":i.shift();break}}else if(e in s)break;s=s.$parent}return{scope:o,vm:c,path:i.join(".")}},s=function(t,e){var n=i(e,t);return n.scope[n.path]};n.reformScope=i,n.getValue=s},{"./utils":22}],21:[function(t,e,n){function r(t){return s.lastIndex=0,t&&s.test(t)}function i(t){var e,n,r=[],i=[],a=0;for(s.lastIndex=0;e=s.exec(t);)s.lastIndex-a>e[0].length&&i.push(t.slice(a,s.lastIndex-e[0].length)),n={escape:!e[2],path:(e[2]||e[1]).trim(),position:i.length,textMap:i},r.push(n),i.push(e[0]),a=s.lastIndex;return t.length>a&&i.push(t.slice(a,t.length)),r.textMap=i,r}var s=/{{({([^}\n]+)}|[^}\n]+)}}/g;n.hasToken=r,n.parseToken=i},{}],22:[function(t,e,n){"use strict";function r(t){return t.replace(o,"").split(a)}function i(){var t,e,n,r,s,a,o=arguments[0]||{},c=1,h=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[c]||{},c++),"object"==typeof o||u.isFunction(o)||(o={});h>c;c++)if(null!=(t=arguments[c]))for(e in t)if(t.hasOwnProperty(e)&&"prototype"!==e)if(n=o[e],r=t[e],l&&r&&(u.isPlainObject(r)||(s=u.isArray(r)))){if(o===r)continue;s?(s=!1,a=n&&u.isArray(n)?n:[]):a=n&&u.isPlainObject(n)?n:{},o[e]=i(l,a,r)}else u.isUndefined(r)||"string"==typeof o||(o[e]=r);return o}var s=t("./env.js").document,a=/(?:\.|\[)/g,o=/\]/g,c=Object.create||function(t){function e(){}return e.prototype=t,new e},u={noop:function(){},ie:!!s.attachEvent,isObject:function(t){return"object"==typeof t&&null!==t},isUndefined:function(t){return"undefined"==typeof t},isFunction:function(t){return"function"==typeof t},isArray:function(t){return u.ie?t&&t.constructor+""==Array+"":Array.isArray(t)},isPlainObject:function(t){return!t||"[object Object]"!=={}.toString.call(t)||t.nodeType||t===t.window?!1:!0},beforeFn:function(t,e,n){return function(){var r=e.apply(this,arguments);return n&&n.call(this,r)?r:t.apply(this,arguments)}},afterFn:function(t,e,n){return function(){var r=t.apply(this,arguments);return n&&n.call(this,r)?r:(e.apply(this,arguments),r)}},parseKeyPath:r,deepSet:function(t,e,n){if(t){var s=r(t),a=n;s.forEach(function(t,n){n===s.length-1?a[t]=e:a&&a.hasOwnProperty(t)?a=a[t]:(a[t]={},a=a[t])})}else i(n,e);return n},extend:i,create:c,toArray:function(t){var e=[];try{e=Array.prototype.slice.call(t)}catch(n){for(var r=0,i=t.length;i>r;r++)e[r]=t[r]}return e}};e.exports=u},{"./env.js":16}],23:[function(t,e,n){"use strict";function r(t,e){var n,r,i=t,s=[];this.state=1,this.dir=e,this.vm=t,this.watchers=[],this.val=0/0,e.parse(),e.summary=o.summary(e.ast);for(var a=0,c=e.summary.paths.length;c>a;a++)n=h(t,e.summary.paths[a]),i=n.vm,r=n.path,e.watch?(i._watchers[r]=i._watchers[r]||[],i._watchers[r].push(this),s=i._watchers[r]):s=[this],this.watchers.push(s);this.update()}function i(t,e,n){var r;try{r=o.summary(u(e))}catch(i){i.message='SyntaxError in "'+e+'" | '+i.message,console.error(i)}r.paths.forEach(function(e){for(var r,i=t._watchers[e]||[],s=i.length-1;s>=0;s--)r=i[s].dir.update,(r===n||r._originFn===n)&&i.splice(s,1)})}function s(t){return t.path?new r(this,t):void 0}function a(t){try{this.dir.update(t,this.val),this.val=t}catch(e){console.error(e)}}var o=t("./eval.js"),c=t("./utils.js"),u=t("./parse.js").parse,h=t("./scope").reformScope;r.unwatch=i,r.addWatcher=s,c.extend(r.prototype,{update:function(){var t,e=this;t=this.dir.getValue(this.vm),(t!==this.val||c.isObject(t))&&(t&&t.then?t.then(function(t){a.call(e,t)}):a.call(this,t))},unwatch:function(){this.watchers.forEach(function(t){for(var e=t.length-1;e>=0;e--)t[e]===this&&(this.state&&(t[e].dir.unLink(),this.state=0),t.splice(e,1))}.bind(this)),this.watchers=[]}}),e.exports=r},{"./eval.js":17,"./parse.js":19,"./scope":20,"./utils.js":22}]},{},[1])(1)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Bee=t()}}(function(){return function t(e,n,r){function i(a,o){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[a]={exports:{}};e[a][0].call(h.exports,function(t){var n=e[a][1][t];return i(n?n:t)},h,h.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){"use strict";function r(t){t&&(this.prefix=t)}function i(t,e){y(t)&&(e=t,t=e.$tpl),e=e||{};var n,r={$data:{},$watchers:{},$mixins:[],$el:this.$el||null,$target:this.$target||null,$tpl:this.$tpl||"<div></div>",$content:this.$content||null,$parent:null,$root:this,_watchers:{},_assignments:null,_relativePath:[],__links:[],_isRendered:!1},i=[r].concat(this.$mixins||[]).concat([e]);i.forEach(function(t){var e;for(var n in t)t.hasOwnProperty(n)&&(n in w&&m(t[n])?(e=b({},this[n],t[n]),this[n]=b(t[n],e)):this[n]=n in x?o.afterFn(this[n],t[n]):t[n])}.bind(this)),m(this.$data)&&b(this,this.$data),t=t||this.$tpl,n=d.tplParse(t,this.$target,this.$content),this.$el?this.$el.appendChild(n.el):this.$el=n.el,this.$tpl=n.tpl,this.$content=n.content,this.$beforeInit(),this.$el.bee=this,this.$content&&(this.__links=p.walk.call(this.$root,this.$content)),this.__links=this.__links.concat(p.walk.call(this,this.$el));for(var s in this.$watchers)this.$watch(s,this.$watchers[s]);this._isRendered=!0,this.$afterInit()}function s(t,e){var n;this.$beforeUpdate(this.$data),1===arguments.length?e=t:n=[t],n||(n=m(e)?Object.keys(e):["$data"]);for(var r,i=0;r=n[i];i++)this.$update(r,!0);this.$afterUpdate(this.$data)}var a=t("./env.js").document,o=t("./utils.js"),c=t("./class.js"),u=t("./directive.js"),h=t("./component.js"),l=t("./watcher.js"),f=t("./directives"),d=t("./dom-utils.js"),p=t("./check-binding.js"),v=t("./scope"),m=o.isObject,y=(o.isUndefined,o.isPlainObject),g=o.parseKeyPath,$=o.deepSet,b=o.extend,j=o.create,w={$data:1,$watchers:1},x={$beforeInit:o.noop,$afterInit:o.noop,$beforeUpdate:o.noop,$afterUpdate:o.noop,$beforeDestroy:o.noop,$afterDestroy:o.noop};b(i,{extend:o.afterFn(c.extend,o.noop,function(t){t.directives=b(j(this.directives),t.directives),t.components=b(j(this.components),t.components),t.filters=b(j(this.filters),t.filters)}),utils:o},u,h,{setPrefix:r,prefix:"",doc:a,directives:{},components:{},filters:{json:function(t,e,n){return JSON.stringify(t,e,n)}},mount:function(t,e){var n,r=t.nodeType?t:a.getElementById(t),s=this.getComponent(r.tagName.toLowerCase());return n=s?new s(b({$target:r},e)):new i(r,e)}}),i.setPrefix("b-");for(var k in f)i.directive(k,f[k]);b(i.prototype,x,{$get:function(t){var e=new u("$get",{path:t,watch:!1});return e.parse(),e.getValue(this,!1)},$set:function(t,e){var n,r,i,a,o=!1,c=this;1===arguments.length?m(t)?(b(!0,this.$data,t),b(!0,this,t)):this.$data=t:(o=!0,i=v.reformScope(this,t),a=i.path,c=i.vm,r=g(a),n=$(a,e,{}),"$data"===r[0]&&(n=n.$data),m(c.$data)?(b(!0,c.$data,n),b(!0,c,n)):c.$data=n),o?s.call(c,a,e):s.call(c,t)},$replace:function(t,e){var n,r,i,a,o=!1,c=this;1===arguments.length?(e=t,a="$data",n=[a]):(o=!0,i=v.reformScope(this,t),a=i.path,c=i.vm,n=g(a)),r=c.$get(a),"$data"===n[0]?"$data"===a?(m(this.$data)&&Object.keys(this.$data).forEach(function(t){delete this[t]}.bind(this)),b(c,e)):$(n.shift().join("."),e,c):$(a,e,c.$data),$(a,e,c),o?s.call(c,a,b({},r,e)):s.call(c,b({},r,e))},$update:function(t,e){e=e!==!1;for(var n,r,i=g(t.replace(/^\$data\./,""));n=i.join(".");){r=this._watchers[n]||[];for(var s=0,a=r.length;a>s;s++)r[s].update();if(!e)break;i.pop(),i.length||"$data"===n||i.push("$data")}l.getWatchers(this,t).forEach(function(t){t.update()}.bind(this)),e&&this.$parent&&this._relativePath.forEach(function(t){this.$parent.$update(t)}.bind(this))},$watch:function(t,e){if(e){var n=e.bind(this);return n._originFn=e,l.addWatcher.call(this,new u("$watch",{path:t,update:n}))}},$unwatch:function(t,e){l.unwatch(this,t,e)},$destroy:function(t){this.$beforeDestroy(),this.__links.forEach(function(t){t.unwatch()}),t&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el),this.__links=[],this.$afterDestroy()}}),i.version="0.3.2",e.exports=i},{"./check-binding.js":3,"./class.js":4,"./component.js":5,"./directive.js":6,"./directives":10,"./dom-utils.js":15,"./env.js":16,"./scope":20,"./utils.js":22,"./watcher.js":23}],2:[function(t,e,n){},{}],3:[function(t,e,n){"use strict";function r(t){var e,n=[];if(t.nodeType===f.FRAGMENT&&(t=t.childNodes),"length"in t&&h.isUndefined(t.nodeType)){for(var a=0;a<t.length;a++)n=n.concat(r.call(this,t[a]));return n}switch(t.nodeType){case f.ELEMENT:break;case f.COMMENT:return n;case f.TEXT:return n=n.concat(s.call(this,t))}if("template"===t.nodeName.toLowerCase()&&!t.content)for(t.content=l.createDocumentFragment();t.childNodes[0];)t.content.appendChild(t.childNodes[0]);if(e=i.call(this,t),n=n.concat(e.watchers),e.terminal)return n;"template"===t.nodeName.toLowerCase()&&(n=n.concat(r.call(this,t.content)));for(var o,c=t.firstChild;c;)o=c.nextSibling,n=n.concat(r.call(this,c)),c=o;return n}function i(t){for(var e,n,r=this.constructor,i=r.directive.getDir(t,r),s=[],o={},c=0,u=i.length;u>c&&(e=i[c],e.dirs=i,!(n>e.priority));c++)t.removeAttribute(e.nodeName),s=s.concat(a.call(this,e)),e.terminal&&(o.terminal=!0,n=e.priority);return o.watchers=s,o}function s(t){var e=[];if(u.hasToken(t.nodeValue)){var n,r,i=u.parseToken(t.nodeValue),o=i.textMap,c=t.parentNode,f=this.constructor.directives;o.length>1?(o.forEach(function(n){var r=l.createTextNode(n);c.insertBefore(r,t),e=e.concat(s.call(this,r))}.bind(this)),c.removeChild(t)):(n=i[0],r=h.create(n.escape?f.text:f.html),e=a.call(this,h.extend(r,n,{el:t})))}return e}function a(t){var e;if(t.replace){var n=t.el;h.isFunction(t.replace)?t.node=t.replace():t.replace&&(t.node=l.createTextNode("")),t.el=t.el.parentNode,t.el.replaceChild(t.node,n)}return t.link(this),e=c.addWatcher.call(this,t),e?[e]:[]}function o(t){t.forEach(function(t){t.unwatch()})}var c=t("./watcher"),u=t("./token.js"),h=t("./utils"),l=t("./env.js").document,f={ELEMENT:1,ATTR:2,TEXT:3,COMMENT:8,FRAGMENT:11};l.createElement("template"),e.exports={walk:r,unBinding:o}},{"./env.js":16,"./token.js":21,"./utils":22,"./watcher":23}],4:[function(t,e,n){var r=t("./utils.js").extend,i={extend:function(t,e){t=t||{};var n=t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},i=this,s=function(){this.constructor=n};return s.prototype=i.prototype,n.prototype=new s,r(n.prototype,t),r(n,i,e,{__super__:i.prototype}),n}};e.exports=i},{"./utils.js":22}],5:[function(t,e,n){"use strict";function r(t,e,n){var r=this.components=this.components||{};return this.doc.createElement(t),s.isObject(e)&&(e=this.extend(e,n)),r[t]=e}function i(t){var e=s.parseKeyPath(t),n=this;return e.forEach(function(t){n=n&&n.components[t]}),n||null}var s=t("./utils.js");n.tag=n.component=r,n.getComponent=i},{"./utils.js":22}],6:[function(t,e,n){"use strict";function r(t,e){var n=this.directives=this.directives||{};return n[t]=new i(t,e)}function i(t,e){this.type=t,a.extend(this,e)}function s(t,e){var n,r,i,s,u,h=[],d={},p=t.parentNode,v=t.nodeName.toLowerCase(),m=e.directives,y=e.prefix;e.getComponent(v)&&t.setAttribute(y+"component",v);for(var g=t.attributes.length-1;g>=0;g--)n=t.attributes[g],r=n.nodeName,i=r.slice(y.length),s={el:t,node:n,nodeName:r,path:n.value},u=null,0===r.indexOf(y)&&i in m?(u=l(m[i]),u.dirName=i):o.hasToken(n.value)?o.parseToken(n.value).forEach(function(t){t.dirName=0===r.indexOf(y)?i:r,h.push(a.extend(l(m.attr),s,t))}):f.test(r)&&(u=a.extend(l(m.attr),{dirName:r.replace(f,""),conditional:!0})),u&&(u.anchor&&!d.start&&(d.start=c.createComment(u.dirName+" start"),p.insertBefore(d.start,t),d.end=c.createComment(u.dirName+" end"),t.nextSibling?p.insertBefore(d.end,t.nextSibling):p.appendChild(d.end)),u.anchors=u.anchor?d:null,h.push(a.extend(u,s)));return h.sort(function(t,e){return e.priority-t.priority}),h}var a=t("./utils.js"),o=t("./token.js"),c=t("./env.js").document,u=t("./parse.js").parse,h=t("./eval.js"),l=a.create;i.prototype={priority:0,link:a.noop,unLink:a.noop,update:a.noop,tearDown:a.noop,terminal:!1,replace:!1,watch:!0,anchor:!1,anchors:null,getNodes:function(){var t=[],e=this.anchors.start.nextSibling;if(this.anchor&&e){for(;e!==this.anchors.end;)t.push(e),e=e.nextSibling;return t}return null},parse:function(){try{this.ast=u(this.path,this.type)}catch(t){this.ast={},t.message='SyntaxError in "'+this.path+'" | '+t.message,console.error(t)}},getValue:function(t,e){e=e!==!1;var n;try{n=h.eval(this.ast,t,this)}catch(r){n="",console.error(r)}return e&&(a.isUndefined(n)||null===n)&&(n=""),n}};var f=/\?$/;i.directive=r,r.getDir=s,e.exports=i},{"./env.js":16,"./eval.js":17,"./parse.js":19,"./token.js":21,"./utils.js":22}],7:[function(t,e,n){"use strict";function r(t,e,n){try{(e in t||"class"===e)&&("style"===e&&t.style.setAttribute?t.style.setAttribute("cssText",n):"class"===e?t.className=n:t[e]="boolean"==typeof t[e]?!0:n)}catch(r){}t.setAttribute(e,n)}function i(t,e){t.removeAttribute(e)}t("../utils.js");e.exports={link:function(){this.dirName===this.type?this.attrs={}:this.update("")},update:function(t){var e=this.el,n={};if(this.dirName===this.type){for(var s in t)r(e,s,t[s]),delete this.attrs[s],n[s]=!0;for(var s in this.attrs)i(e,s);this.attrs=n}else this.conditional?t?r(e,this.dirName,t):i(e,this.dirName):(this.textMap[this.position]=t&&t+"",r(e,this.dirName,this.textMap.join("")))}}},{"../utils.js":22}],8:[function(t,e,n){var r=t("../utils.js"),i=/-(-?)([a-z])/gi,s=function(t){return t.replace(i,function(t,e,n){return e?e+n:n.toUpperCase()})};e.exports={priority:-10,watch:!1,unLink:function(){this.component&&this.component.$destroy()},link:function(t){var e,n,i=this.el,a=t.constructor,o=[],c={},u=a.getComponent(this.path);if(u){if(u===a)return;o=this.dirs,o=o.filter(function(t){return"attr"==t.type||"with"==t.type}),o.forEach(function(n){var i,s;i=n.path,"with"===n.type||"attr"===n.dirName?(s="$data",r.extend(c,t.$get(i))):(s=n.dirName,c[s]=t.$get(i)),t.$watch(i,function(t){e&&(t=n.textMap?n.textMap.join(""):t,e.$set(s,t))})}),n=i.attributes;for(var h=n.length-1;h>=0;h--)c[s(n[h].nodeName)]=n[h].value;return this.component=e=new u({$target:i,$data:r.extend({},u.prototype.$data,c)}),t.$el===i&&(t.__ref=e,t.$el=e.$el),e}console.warn("Component: "+this.path+" not defined! Ignore")}}},{"../utils.js":22}],9:[function(t,e,n){"use strict";var r=t("../dom-utils"),i=t("../check-binding");e.exports={replace:!0,anchor:!0,link:function(t){this.vm=t,this.watchers=[]},unLink:function(){this.watchers.forEach(function(t){t.unwatch()})},update:function(t){var e=this.getNodes(),n=this.anchors.end.parentNode;e.forEach(function(t){n.removeChild(t)}),this.unLink();var s=r.createContent(t);this.watchers=i.walk.call(this.vm,s),n.insertBefore(s,this.anchors.end)}}},{"../check-binding":3,"../dom-utils":15}],10:[function(t,e,n){"use strict";var r=t("../env.js").document,i=t("../utils.js"),s={};s.text={terminal:!0,replace:!0,update:function(t){this.node.nodeValue=i.isUndefined(t)?"":t}},s.html={terminal:!0,replace:!0,link:function(){this.nodes=[]},update:function(t){var e=r.createElement("div");e.innerHTML=i.isUndefined(t)?"":t;for(var n;n=this.nodes.pop();)n.parentNode&&n.parentNode.removeChild(n);for(var s=e.childNodes;n=s[0];)this.nodes.push(n),this.el.insertBefore(n,this.node)}},s["if"]={anchor:!0,link:function(){this.el.content?(this.frag=this.el.content,this.el.parentNode.removeChild(this.el)):(this.frag=r.createDocumentFragment(),this.hide())},update:function(t){t?this.state||this.show():this.state&&this.hide(),this.state=t},show:function(){var t=this.anchors.end;t.parentNode&&t.parentNode.insertBefore(this.frag,t)},hide:function(){var t=this.getNodes();if(t)for(var e=0,n=t.length;n>e;e++)this.frag.appendChild(t[e])}},s.template={priority:1e4,link:function(){for(var t=this.el.childNodes,e=r.createDocumentFragment();t[0];)e.appendChild(t[0]);this.el.content=e}},s.src={update:function(t){this.el.src=t}},s["with"]={},s.repeat=t("./repeat.js"),s.attr=t("./attr.js"),s.model=t("./model.js"),s.style=t("./style.js"),s.on=t("./on.js"),s.component=t("./component.js"),s.content=t("./content.js"),e.exports=s},{"../env.js":16,"../utils.js":22,"./attr.js":7,"./component.js":8,"./content.js":9,"./model.js":11,"./on.js":12,"./repeat.js":13,"./style.js":14}],11:[function(t,e,n){"use strict";var r=t("../utils.js"),i=t("../token.js").hasToken,s=t("../event-bind.js");e.exports={teminal:!0,priority:1,link:function(t){var e=this.path;if(!e)return!1;var n,a=this.el,o="change",c=n="value",u=t,h=r.isUndefined(u.$get(e)),l=/\r\n/g,f=function(t){var e=(t||"")+"",t=a[n];t&&t.replace&&(t=t.replace(l,"\n")),e!==t&&(a[n]=e)},d=function(t){var n=a[c];n.replace&&(n=n.replace(l,"\n")),u.$set(e,n)},p=function(t){t&&t.propertyName&&t.propertyName!==n||d.apply(this,arguments)},v=r.ie;switch(a.tagName){default:c=n="innerHTML";case"INPUT":case"TEXTAREA":switch(a.type){case"checkbox":c=n="checked",v&&(o+=" click");break;case"radio":n="checked",v&&(o+=" click"),f=function(t){a.checked=a.value===t+""},h=a.checked;break;default:u.$lazy||("oninput"in a&&(o+=" input"),v&&(o+=" keyup propertychange cut"))}break;case"SELECT":a.multiple&&(d=function(t){for(var n=[],r=0,i=a.options.length;i>r;r++)a.options[r].selected&&n.push(a.options[r].value);u.$set(e,n)},f=function(t){if(t&&t.length)for(var e=0,n=a.options.length;n>e;e++)a.options[e].selected=-1!==t.indexOf(a.options[e].value)}),h=h&&!i(a[c])}this.update=f,o.split(/\s+/g).forEach(function(t){s.removeEvent(a,t,p),s.addEvent(a,t,p)}),a[c]&&d(!0)}}},{"../event-bind.js":18,"../token.js":21,"../utils.js":22}],12:[function(t,e,n){"use strict";function r(t,e,n){return function(r){var i=r.target||r.srcElement,a=e?s.toArray(t.el.querySelectorAll(e)):[i];do if(a.indexOf(i)>=0)return r.delegateTarget=i,n.call(t.vm,r);while(i=i.parentNode)}}var i=t("../event-bind.js"),s=t("../utils");e.exports={watch:!1,link:function(t){this.vm=t},update:function(t){var e,n;for(var s in t)e=s.split(/\s+/),n=e.shift(),e=e.join(" "),i.addEvent(this.el,n,r(this,e,t[s]))}}},{"../event-bind.js":18,"../utils":22}],13:[function(t,e,n){"use strict";function r(t,e,n){var r=e.slice();return t.filter(function(t){var e,s=i(t,r,n);return 0>s?e=!0:r.splice(s,1),e})}function i(t,e,n,r){r=r||0;var i=e.indexOf(t,r);if(-1===i&&n)for(var a,o=r;a=e[o];o++)if(t[n]===a[n]&&!s.isUndefined(t[n])){i=o;break}return i}var s=(t("../env.js").document,t("../utils.js")),a=["splice","push","pop","shift","unshift","sort","reverse"];e.exports={priority:1e3,anchor:!0,terminal:!0,unLink:function(){this.list.forEach(function(t){t.$destroy()})},link:function(t){var e=this.cstr=t.constructor;for(this.vm=t;e.__super__;)e=e.__super__.constructor;this.trackId=this.el.getAttribute("track-by"),this.el.removeAttribute("track-by"),this.cstr=e.extend({},this.cstr),this.curArr=[],this.list=[],this.el.parentNode.removeChild(this.el)},update:function(t){var e=this.curArr,n=this.anchors.end.parentNode,o=this,c=this.list,u=this.trackId;s.isArray(t)&&(this.listPath=this.summary.locals.filter(function(t){return!s.isFunction(o.vm.$get(t))}),r(e,t,u).forEach(function(t){var r=i(t,e,u);e.splice(r,1),n.removeChild(c[r].$el),c[r].$destroy(),c.splice(r,1)}),t.forEach(function(r,s){var a,h,l=i(r,t,u,s),f=i(r,e,u,s);0>f?(h=this.el.cloneNode(!0),a=new this.cstr(h,{$data:r,_assignments:this.summary.assignments,$index:l,$root:this.vm.$root,$parent:this.vm,__repeat:!0}),n.insertBefore(a.$el,c[l]&&c[l].$el||this.anchors.end),c.splice(l,0,a),e.splice(l,0,r),a._relativePath=this.listPath):l!==f&&(n.insertBefore(c[f].$el,c[l]&&c[l].$el||o.anchors.end),n.insertBefore(c[l].$el,c[f+1]&&c[f+1].$el||o.anchors.end),c[f]=[c[l],c[l]=c[f]][0],e[f]=[e[l],e[l]=e[f]][0],c[l].$index=l,c[l].$update("$index"))}.bind(this)),this.list.forEach(function(t,e){t.$index=e,t.$el.$index=e,t.$update("$index",!1)}),t.__dirs__||(s.extend(t,{$set:function(e,n){t.__dirs__.forEach(function(t){t.list[e].$set(n)})},$replace:function(e,n){t.__dirs__.forEach(function(t){t.list[e].$replace(n)})},$remove:function(e){t.splice(e,1)}}),a.forEach(function(e){t[e]=s.afterFn(t[e],function(){t.__dirs__.forEach(function(t){t.listPath.forEach(function(e){t.vm.$update(e)})})})}),t.__dirs__=[]),-1===t.__dirs__.indexOf(o)&&t.__dirs__.push(o))}}},{"../env.js":16,"../utils.js":22}],14:[function(t,e,n){"use strict";var r=/([A-Z])/g,i=["width","height","min-width","min-height","max-width","max-height","margin","margin-top","margin-right","margin-left","margin-bottom","padding","padding-top","padding-right","padding-bottom","padding-left","top","left","right","bottom"];e.exports={update:function(t){var e,n,s=this.el,a="";if("string"==typeof t)a=t;else for(var o in t)n=t[o],e=o.replace(r,function(t){return"-"+t.toLowerCase()}),!isNaN(n)&&i.indexOf(e)>=0&&(n+="px"),a+=e+": "+n+"; ";s.style.setAttribute?s.style.setAttribute("cssText",a):s.setAttribute("style",a)}}},{}],15:[function(t,e,n){"use strict";function r(t,e,n){var r;return a.isObject(e)&&e.childNodes?n=i(e.childNodes):n&&(n=i(n)),a.isObject(t)?(r=t,t=r.outerHTML):r=i(t).childNodes[0],e&&e.parentNode&&e.parentNode.replaceChild(r,e),{el:r,tpl:t,content:n}}function i(t){var e,n=s.createDocumentFragment(),r=[];a.isObject(t)?t.nodeName&&t.nodeType?n.appendChild(t):"length"in t&&(r=t):(e=s.createElement("div"),e.innerHTML=(t+"").trim(),r=e.childNodes);for(;r[0];)n.appendChild(r[0]);return n}var s=t("./env.js").document,a=t("./utils");e.exports={tplParse:r,createContent:i}},{"./env.js":16,"./utils":22}],16:[function(t,e,n){!function(e){"use strict";n.root=e,n.document=e.document||t("jsdom").jsdom()}(function(){return this}())},{jsdom:2}],17:[function(t,e,n){"use strict";function r(t,e,n){return t&&t.then?t.then(function(t){return e.apply(a.locals,[t].concat(n))}):e.apply(a.locals,[t].concat(n))}function i(t,e){return l[t][e]||function(){}}function s(t,e){c=!0,t?(c=!1,a={locals:t||{},filters:t.constructor.filters||{}}):a={filters:{},locals:{}},e&&(h=e),o={filters:{},locals:{},paths:{},assignments:{}},u=""}var a,o,c,u,h,l={unary:{"+":function(t){return+t},"-":function(t){return-t},"!":function(t){return!t},"[":function(t){return t},"{":function(t){for(var e={},n=0,r=t.length;r>n;n++)e[t[n][0]]=t[n][1];return e},"typeof":function(t){return typeof t},"new":function(t){return new t}},binary:{"+":function(t,e){return t+e},"-":function(t,e){return t-e},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e},"<":function(t,e){return e>t},">":function(t,e){return t>e},"<=":function(t,e){return e>=t},">=":function(t,e){return t>=e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e},"&&":function(t,e){return t&&e},"||":function(t,e){return t||e},",":function(t,e){return e},".":function(t,e){return e&&(u=u+"."+e),t[e]},"[":function(t,e){return"undefined"!=typeof e&&(u=u+"."+e),t[e]},"(":function(t,e){return t.apply(a.locals,e)},"|":function(t,e){return r(t,e,[])},"new":function(t,e){return t===Date?new Function("return new Date("+e.join(", ")+")")():new(Function.prototype.bind.apply(t,e))},"in":function(t,e){return this.repeat?e:t in e},catchby:function(t,e){return t["catch"]?t["catch"](e.bind(a.locals)):(console.error("catchby expect a promise"),t)}},ternary:{"?":function(t,e,n){return t?e:n},"(":function(t,e,n){return t[e].apply(t,n)},"|":function(t,e,n){return r(t,e,n)}}},f=["first","second","third"],d=function(t){for(var e,n,r=t.arity,s=t.value,c=[],h=0;3>h;h++)if(e=t[f[h]])if(Array.isArray(e)){c[h]=[];for(var l=0,v=e.length;v>l;l++)c[h].push("undefined"==typeof e[l].key?d(e[l]):[e[l].key,d(e[l])])}else c[h]=d(e);switch("literal"!==r&&(u&&"."!==s&&"["!==s&&(o.paths[u]=!0),"name"===r&&(u=s)),r){case"unary":case"binary":case"ternary":try{n=i(r,s).apply(t,c)}catch(m){}break;case"literal":n=s;break;case"repeat":o.assignments[s]=!0;break;case"name":o.locals[s]=!0,n=p(s,a.locals);break;case"filter":o.filters[s]=!0,n=a.filters[s];break;case"this":n=a.locals}return n},p=t("./scope").getValue;n.eval=function(t,e,n){return s(e||{},n),d(t)},n.summary=function(t){s(),d(t),u&&(o.paths[u]=!0);for(var e in o)o[e]=Object.keys(o[e]);return o}},{"./scope":20}],18:[function(t,e,n){"use strict";n.addEvent=function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},n.removeEvent=function(t,e,n){t.removeEventListener?t.removeEventListener(e,n):t.detachEvent("on"+e,n)}},{}],19:[function(t,e,n){"use strict";var r,i=Object.create||function(t){function e(){}return e.prototype=t,new e},s=function(t,e){e=e||this;var n=t+=" But found '"+e.value+"'"+(e.from?" at "+e.from:"")+" in '"+r+"'",i=new Error(n);throw i.name=e.name="SyntaxError",e.message=t,i},a=function(t,e,n){var r,i,a,o,c,u=0,h=t.length,l=[],f=function(t,e){return{type:t,value:e,from:i,to:u}};if(t){for(r=t.charAt(u);r;)if(i=u," ">=r)u+=1,r=t.charAt(u);else if(r>="a"&&"z">=r||r>="A"&&"Z">=r||"$"===r||"_"===r){for(c=r,u+=1;r=t.charAt(u),r>="a"&&"z">=r||r>="A"&&"Z">=r||r>="0"&&"9">=r||"_"===r;)c+=r,u+=1;l.push(f("name",c))}else if(r>="0"&&"9">=r){for(c=r,u+=1;r=t.charAt(u),!("0">r||r>"9");)u+=1,c+=r;if("."===r)for(u+=1,c+=r;r=t.charAt(u),!("0">r||r>"9");)u+=1,c+=r;if("e"===r||"E"===r){u+=1,c+=r,r=t.charAt(u),("-"===r||"+"===r)&&(u+=1,c+=r,r=t.charAt(u)),("0">r||r>"9")&&s("Bad exponent",f("number",c));do u+=1,c+=r,r=t.charAt(u);while(r>="0"&&"9">=r)}r>="a"&&"z">=r&&(c+=r,u+=1,s("Bad number",f("number",c))),a=+c,isFinite(a)?l.push(f("number",a)):s("Bad number",f("number",c))}else if("'"===r||'"'===r){for(c="",o=r,u+=1;r=t.charAt(u)," ">r&&(f("string",c),s("\n"===r||"\r"===r||""===r?"Unterminated string.":"Control character in string.",f("",c))),r!==o;){if("\\"===r)switch(u+=1,u>=h&&s("Unterminated string",f("string",c)),r=t.charAt(u)){case"b":r="\b";break;case"f":r="\f";break;case"n":r="\n";break;case"r":r="\r";break;case"t":r=" ";break;case"u":u>=h&&s("Unterminated string",f("string",c)),r=parseInt(t.substr(u+1,4),16),(!isFinite(r)||0>r)&&s("Unterminated string",f("string",c)),r=String.fromCharCode(r),u+=4}c+=r,u+=1}u+=1,l.push(f("string",c)),r=t.charAt(u)}else if(e.indexOf(r)>=0){for(c=r,u+=1;;){if(r=t.charAt(u),u>=h||n.indexOf(r)<0)break;c+=r,u+=1}l.push(f("operator",c))}else u+=1,l.push(f("operator",r)),r=t.charAt(u);return l}},o=function(t){t=t||{};var e,n,o,c,u={},h=function(){return this},l=function(t){return t.nud=h,t.led=null,t.std=null,t.lbp=0,t},f=function(t){var r,a,c,h;return t&&e.id!==t&&s("Expected '"+t+"'.",e),o>=n.length?void(e=u["(end)"]):(c=n[o],o+=1,h=c.value,r=c.type,("operator"===r||"string"!==r)&&h in u?(a=u[h],a||s("Unknown operator.",c)):"name"===r?a=l(c):"string"===r||"number"===r||"regexp"===r?(a=u["(literal)"],r="literal"):s("Unexpected token.",c),e=i(a),e.from=c.from,e.to=c.to,e.value=h,e.arity=r,e)},d=function(t){var n,r=e;for(f(),n=r.nud();t<e.lbp;)r=e,f(),n=r.led(n);return n},p={nud:function(){s("Undefined.",this)},led:function(t){s("Missing operator.",this)}},v=function(t,e){var n=u[t];return e=e||0,n?e>=n.lbp&&(n.lbp=e):(n=i(p),n.id=n.value=t,n.lbp=e,u[t]=n),n},m=function(t,e,n){var r=v(t);return r.nud=function(){return this.value=u[this.id].value,this.arity="literal",this},r.value=e,r},y=function(t,e,n){var r=v(t,e);return r.led=n||function(t){return this.first=t,this.second=d(e),this.arity="binary",this},r},g=function(t,e,n){var r=v(t,e);return r.led=n||function(t){return this.first=t,this.second=d(e-1),this.arity="binary",this},r},$=function(t,e){var n=v(t);return n.nud=e||function(){return this.first=d(70),this.arity="unary",this},n};v("(end)"),v("(name)"),v(":"),v(")"),v("]"),v("}"),v(","),m("true",!0),m("false",!1),m("null",null),m("undefined"),m("Math",Math),m("Date",Date);for(var b in t)m(b,t[b]);return v("(literal)").nud=h,v("this").nud=function(){return this.arity="this",this},y(",",1),y("?",20,function(t){return this.first=t,this.second=d(0),f(":"),this.third=d(0),this.arity="ternary",this}),g("&&",31),g("||",30),g("===",40),g("!==",40),g("==",40),g("!=",40),g("<",40),g("<=",40),g(">",40),g(">=",40),y("in",45,function(t){return this.first=t,this.second=d(0),this.arity="binary","repeat"===c&&(t.arity="repeat",this.repeat=!0),this}),y("+",50),y("-",50),y("*",60),y("/",60),y("%",60),y("(",70,function(t){var n=[];if("."===t.id||"["===t.id?(this.arity="ternary",this.first=t.first,this.second=t.second,this.third=n):(this.arity="binary",this.first=t,this.second=n,"unary"===t.arity&&"function"===t.id||"name"===t.arity||"literal"===t.arity||"("===t.id||"&&"===t.id||"||"===t.id||"?"===t.id||s("Expected a variable name.",t)),")"!==e.id)for(;;){if(n.push(d(1)),","!==e.id)break;f(",")}return f(")"),this}),y(".",80,function(t){return this.first=t,"name"!==e.arity&&s("Expected a property name.",e),e.arity="literal",this.second=e,this.arity="binary",f(),this}),y("[",80,function(t){return this.first=t,this.second=d(0),this.arity="binary",f("]"),this}),y("|",10,function(t){var n;if(this.first=t,e.arity="filter",this.second=d(10),this.arity="binary",":"===e.id)for(this.arity="ternary",this.third=n=[];;)if(f(":"),n.push(d(0)),":"!==e.id)break;return this}),y("catchby",10),$("!"),$("-"),$("typeof"),$("(",function(){var t=d(0);return f(")"),t}),$("[",function(){var t=[];if("]"!==e.id)for(;;){if(t.push(d(1)),","!==e.id)break;f(",")}return f("]"),this.first=t,this.arity="unary",this}),$("{",function(){var t,n,r=[];if("}"!==e.id)for(;;){if(t=e,"name"!==t.arity&&"literal"!==t.arity&&s("Bad property name: ",e),f(),f(":"),n=d(1),n.key=t.value,r.push(n),","!==e.id)break;f(",")}return f("}"),this.first=r,this.arity="unary",this}),$("new",function(){var t=[];if(this.first=d(79),"("===e.id){for(f("("),this.arity="binary",this.second=t;;){if(t.push(d(1)),","!==e.id)break;f(",")}f(")")}else this.arity="unary";return this}),function(t,e){r=t,n=a(t,"=<>!+-*&|/%^","=<>&|"),o=0,c=e,f();var i=d(0);return f("(end)"),i}};n.parse=o()},{}],20:[function(t,e,n){"use strict";var r=t("./utils"),i=function(t,e){for(var n,i=r.parseKeyPath(e),s=t,a=i[0],o=s,c=s;s;){if(c=o=s,n=s._assignments,s.__repeat)if(n&&n.length){if("$index"===a||"$parent"===a)break;if(a===n[0]){1===i.length?i[0]="$data":i.shift();break}}else if(e in s)break;s=s.$parent}return{scope:o,vm:c,path:i.join(".")}},s=function(t,e){var n=i(e,t);return n.scope[n.path]};n.reformScope=i,n.getValue=s},{"./utils":22}],21:[function(t,e,n){function r(t){return s.lastIndex=0,t&&s.test(t)}function i(t){var e,n,r=[],i=[],a=0;for(s.lastIndex=0;e=s.exec(t);)s.lastIndex-a>e[0].length&&i.push(t.slice(a,s.lastIndex-e[0].length)),n={escape:!e[2],path:(e[2]||e[1]).trim(),position:i.length,textMap:i},r.push(n),i.push(e[0]),a=s.lastIndex;return t.length>a&&i.push(t.slice(a,t.length)),r.textMap=i,r}var s=/{{({([^}\n]+)}|[^}\n]+)}}/g;n.hasToken=r,n.parseToken=i},{}],22:[function(t,e,n){"use strict";function r(t){return t.replace(o,"").split(a)}function i(){var t,e,n,r,s,a,o=arguments[0]||{},c=1,h=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[c]||{},c++),"object"==typeof o||u.isFunction(o)||(o={});h>c;c++)if(null!=(t=arguments[c]))for(e in t)if(t.hasOwnProperty(e)&&"prototype"!==e)if(n=o[e],r=t[e],l&&r&&(u.isPlainObject(r)||(s=u.isArray(r)))){if(o===r)continue;s?(s=!1,a=n&&u.isArray(n)?n:[]):a=n&&u.isPlainObject(n)?n:{},o[e]=i(l,a,r)}else u.isUndefined(r)||"string"==typeof o||(o[e]=r);return o}var s=t("./env.js").document,a=/(?:\.|\[)/g,o=/\]/g,c=Object.create||function(t){function e(){}return e.prototype=t,new e},u={noop:function(){},ie:!!s.attachEvent,isObject:function(t){return"object"==typeof t&&null!==t},isUndefined:function(t){return"undefined"==typeof t},isFunction:function(t){return"function"==typeof t},isArray:function(t){return u.ie?t&&t.constructor+""==Array+"":Array.isArray(t)},isPlainObject:function(t){return!t||"[object Object]"!=={}.toString.call(t)||t.nodeType||t===t.window?!1:!0},beforeFn:function(t,e,n){return function(){var r=e.apply(this,arguments);return n&&n.call(this,r)?r:t.apply(this,arguments)}},afterFn:function(t,e,n){return function(){var r=t.apply(this,arguments);return n&&n.call(this,r)?r:(e.apply(this,arguments),r)}},parseKeyPath:r,deepSet:function(t,e,n){if(t){var s=r(t),a=n;s.forEach(function(t,n){n===s.length-1?a[t]=e:a&&a.hasOwnProperty(t)?a=a[t]:(a[t]={},a=a[t])})}else i(n,e);return n},extend:i,create:c,toArray:function(t){var e=[];try{e=Array.prototype.slice.call(t)}catch(n){for(var r=0,i=t.length;i>r;r++)e[r]=t[r]}return e}};e.exports=u},{"./env.js":16}],23:[function(t,e,n){"use strict";function r(t,e){var n,r,i=t,s=[];this.state=1,this.dir=e,this.vm=t,this.watchers=[],this.val=0/0,e.parse(),e.summary=o.summary(e.ast);for(var a=0,c=e.summary.paths.length;c>a;a++)n=h(t,e.summary.paths[a]),i=n.vm,r=n.path,e.watch?(i._watchers[r]=i._watchers[r]||[],i._watchers[r].push(this),s=i._watchers[r]):s=[this],this.watchers.push(s);this.update()}function i(t,e,n){var r;try{r=o.summary(u(e))}catch(i){i.message='SyntaxError in "'+e+'" | '+i.message,console.error(i)}r.paths.forEach(function(e){for(var r,i=t._watchers[e]||[],s=i.length-1;s>=0;s--)r=i[s].dir.update,(r===n||r._originFn===n)&&i.splice(s,1)})}function s(t){return t.path?new r(this,t):void 0}function a(t){try{this.dir.update(t,this.val),this.val=t}catch(e){console.error(e)}}var o=t("./eval.js"),c=t("./utils.js"),u=t("./parse.js").parse,h=t("./scope").reformScope;r.unwatch=i,r.addWatcher=s,r.getWatchers=function(t,e){var n,r=t._watchers,i=[];for(var s in r)n=s.charAt(e.length),0===s.indexOf(e)&&"."===n&&(i=i.concat(r[s]));return i},c.extend(r.prototype,{update:function(){var t,e=this;t=this.dir.getValue(this.vm),(t!==this.val||c.isObject(t))&&(t&&t.then?t.then(function(t){a.call(e,t)}):a.call(this,t))},unwatch:function(){this.watchers.forEach(function(t){for(var e=t.length-1;e>=0;e--)t[e]===this&&(this.state&&(t[e].dir.unLink(),this.state=0),t.splice(e,1))}.bind(this)),this.watchers=[]}}),e.exports=r},{"./eval.js":17,"./parse.js":19,"./scope":20,"./utils.js":22}]},{},[1])(1)});
//# sourceMappingURL=bee.min.js.map

@@ -0,1 +1,6 @@

0.3.2
---
- 修复 `$replace` 不能深层删除的问题
- 表达式求值错误时不再打印警告 (`console.warn`)
0.3.0

@@ -2,0 +7,0 @@ ---

@@ -249,4 +249,10 @@ Bee 构造函数

IE 浏览器会校验 `style` 属性值, 所以直接使用 `style='{{"color: white"}}'` 这种写法在 IE 中没有效果. 为了兼容 IE 浏览器,
可以使用 `b-style` 指令, 指令值可以为字符串或对象.
直接使用 `src='{{src}}'` 这种写法有可能会想服务器发送一条无效的 `404` 请求, 为了避免这种情况应该使用 `b-src` 指令代替.
```html
<div b-style="{color: color, width: 50}"></div>
<div b-style="'color: ' + color + '; width: 50px;'"></div>
```

@@ -253,0 +259,0 @@

{
"name": "beejs",
"version": "0.3.1",
"version": "0.3.2",
"description": "轻量级 MVVM 库",

@@ -5,0 +5,0 @@ "main": "src/bee.js",

@@ -81,3 +81,3 @@ "use strict";

var el;
var elInfo;

@@ -107,11 +107,11 @@ var mixins = ([defaults].concat(this.$mixins || [])).concat([props])

tpl = tpl || this.$tpl;
el = domUtils.tplParse(tpl, this.$target, this.$content);
elInfo = domUtils.tplParse(tpl, this.$target, this.$content);
if(this.$el){
this.$el.appendChild(el.el);
this.$el.appendChild(elInfo.el);
}else{
this.$el = el.el;
this.$el = elInfo.el;
}
this.$tpl = el.tpl;
this.$content = el.content;
this.$tpl = elInfo.tpl;
this.$content = elInfo.content;

@@ -198,3 +198,2 @@ this.$beforeInit()

var reformed, reKey, reVm = this;
if(isUndefined(key)){ return this; }

@@ -231,15 +230,9 @@ if(arguments.length === 1){

, $replace: function (key, val) {
var keys, hasKey = false;
var keys, last, hasKey = false;
var reformed, reKey, reVm = this;
if(isUndefined(key)){ return this; }
if(arguments.length === 1){
if(isObject(key)) {
Object.keys(this.$data).forEach(function(key) {
delete this[key];
}.bind(this))
extend(this, key);
}
this.$data = key;
val = key;
reKey = '$data';
keys = [reKey];
}else{

@@ -251,8 +244,23 @@ hasKey = true;

keys = parseKeyPath(reKey);
if(keys[0] !== '$data') {
deepSet(reKey, val, reVm.$data);
}
last = reVm.$get(reKey);
if (keys[0] === '$data') {
if(reKey === '$data') {
if(isObject(this.$data)) {
Object.keys(this.$data).forEach(function (k) {
delete this[k];
}.bind(this))
}
extend(reVm, val);
}else {
deepSet(keys.shift().join('.'), val, reVm)
}
deepSet(reKey, val, reVm);
} else {
deepSet(reKey, val, reVm.$data);
}
hasKey ? update.call(reVm, reKey, val) : update.call(reVm, key);
deepSet(reKey, val, reVm)
hasKey ? update.call(reVm, reKey, extend({}, last, val)) : update.call(reVm, extend({}, last, val));
}

@@ -267,3 +275,3 @@ /**

var keys = parseKeyPath(keyPath.replace(/^\$data\./, '')), key, attrs;
var keys = parseKeyPath(keyPath.replace(/^\$data\./, '')), key;
var watchers;

@@ -289,11 +297,8 @@

attrs = this.$get(keyPath);
//同时更新子路径
if(isObject(attrs) && !utils.isArray(attrs)) {
Object.keys(attrs).forEach(function(attr) {
this.$update(keyPath + '.' + attr, false);
}.bind(this))
}
Watcher.getWatchers(this, keyPath).forEach(function(watcher) {
watcher.update();
}.bind(this))
//数组冒泡的情况
if(isBubble) {

@@ -307,7 +312,2 @@ if(this.$parent) {

}
//更新数组长度
if(utils.isArray(attrs)) {
this.$update(keyPath + '.length', false);
}
}

@@ -314,0 +314,0 @@ , $watch: function (expression, callback) {

@@ -146,3 +146,3 @@ //表达式执行

}catch(e){
summaryCall || console.warn(e);
//summaryCall || console.warn(e);
}

@@ -149,0 +149,0 @@ break;

@@ -69,2 +69,15 @@ "use strict";

//获取某 keyPath 子路径的 watchers
Watcher.getWatchers = function getWatchers(vm, keyPath) {
var _watchers = vm._watchers, watchers = [];
var point;
for(var key in _watchers) {
point = key.charAt(keyPath.length);
if(key.indexOf(keyPath) === 0 && (point === '.')) {
watchers = watchers.concat(_watchers[key])
}
}
return watchers
}
function watcherUpdate (val) {

@@ -71,0 +84,0 @@ try{

var test = require('tape');
var Bee = require('../');
var $ = require('jquery')
if(typeof window === 'undefined') {
$ = $(Bee.doc.parentWindow)
}
test('$replace', function(t) {
var bee = new Bee({$data: {a: {b: 2}, c: 3}});
var bee = new Bee('<div>{{c}}</div>', {$data: {a: {b: 2}, c: 3}});

@@ -11,2 +15,3 @@ t.comment('替换简单类型')

t.equal(bee.c, 4)
t.equal($(bee.$el).html() * 1, 4)

@@ -26,2 +31,3 @@ bee.$set('a.c', 5)

t.equal(Object.keys(bee.$get('a')) + '', ['d'] + '')
t.equal($(bee.$el).html(), '4')

@@ -35,12 +41,12 @@ t.comment('$replace({e: 7})')

//t.comment('$replace("$data", {f: 8})')
//bee.$replace('$data', {f: 8})
//t.notOk(bee.$get('a'))
//t.notOk(bee.a)
//t.notOk(bee.$get('e'))
//t.notOk(bee.e)
//t.equal(bee.$get('f'), 8)
//t.equal(bee.f, 8)
t.comment('$replace("$data", {f: 8})')
bee.$replace('$data', {f: 8})
t.notOk(bee.$get('a'))
t.notOk(bee.a)
t.notOk(bee.$get('e'))
t.notOk(bee.e)
t.equal(bee.$get('f'), 8)
t.equal(bee.f, 8)
t.end()
})
var through = require('through2')
var fs = require('fs')
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
var pt = require('path')
var pkg = JSON.parse(fs.readFileSync(pt.join(__filename, '../../', 'package.json'), 'utf8'))

@@ -5,0 +6,0 @@ module.exports = function (file) {

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 not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc