diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 90838e0..43d6e1d 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -15,6 +15,6 @@ //= require sb-admin-v2/bootstrap //= require sb-admin-v2/plugins/dataTables/jquery.dataTables //= require sb-admin-v2/plugins/dataTables/dataTables.bootstrap -//= require vue-0.10.4 -//= require promise-1.0.0 +//= require bower/vue/dist/vue +//= require bower/es6-promise/promise //= require_tree . diff --git a/vendor/assets/javascripts/bower/es6-promise/.bower.json b/vendor/assets/javascripts/bower/es6-promise/.bower.json new file mode 100644 index 0000000..cba4168 --- /dev/null +++ b/vendor/assets/javascripts/bower/es6-promise/.bower.json @@ -0,0 +1,15 @@ +{ + "name": "es6-promise", + "version": "1.0.0", + "main": "./promise.js", + "homepage": "https://github.com/components/es6-promise", + "_release": "1.0.0", + "_resolution": { + "type": "version", + "tag": "v1.0.0", + "commit": "c95149ffaa2e8162601c57d4282362eac84f929b" + }, + "_source": "git://github.com/components/es6-promise.git", + "_target": "~1.0.0", + "_originalSource": "es6-promise" +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/es6-promise/bower.json b/vendor/assets/javascripts/bower/es6-promise/bower.json new file mode 100644 index 0000000..809e37c --- /dev/null +++ b/vendor/assets/javascripts/bower/es6-promise/bower.json @@ -0,0 +1,5 @@ +{ + "name": "es6-promise", + "version": "1.0.0", + "main": "./promise.js" +} diff --git a/vendor/assets/javascripts/promise-1.0.0.js b/vendor/assets/javascripts/bower/es6-promise/promise.js similarity index 100% rename from vendor/assets/javascripts/promise-1.0.0.js rename to vendor/assets/javascripts/bower/es6-promise/promise.js diff --git a/vendor/assets/javascripts/bower/es6-promise/promise.min.js b/vendor/assets/javascripts/bower/es6-promise/promise.min.js new file mode 100644 index 0000000..8c87983 --- /dev/null +++ b/vendor/assets/javascripts/bower/es6-promise/promise.min.js @@ -0,0 +1 @@ +!function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)"exports"===i[l]?k.push(g={}):k.push(b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j" + ], + "license": "MIT", + "ignore": [ + ".*", + "examples", + "test", + "tasks", + "Gruntfile.js", + "*.json", + "*.md" + ], + "homepage": "https://github.com/yyx990803/vue", + "_release": "0.10.4", + "_resolution": { + "type": "version", + "tag": "v0.10.4", + "commit": "d3758fc7e17a0e115092c5fc89264ec7fff7ea39" + }, + "_source": "git://github.com/yyx990803/vue.git", + "_target": "~0.10.0", + "_originalSource": "vue" +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/LICENSE b/vendor/assets/javascripts/bower/vue/LICENSE new file mode 100644 index 0000000..17a9b2f --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Yuxi Evan You + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/vendor/assets/javascripts/vue-0.10.4.js b/vendor/assets/javascripts/bower/vue/dist/vue.js similarity index 100% rename from vendor/assets/javascripts/vue-0.10.4.js rename to vendor/assets/javascripts/bower/vue/dist/vue.js diff --git a/vendor/assets/javascripts/bower/vue/dist/vue.min.js b/vendor/assets/javascripts/bower/vue/dist/vue.min.js new file mode 100644 index 0000000..541b975 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/dist/vue.min.js @@ -0,0 +1,7 @@ +/* + Vue.js v0.10.4 + (c) 2014 Evan You + License: MIT +*/ +!function(){"use strict";function e(t,i,n){var r=e.resolve(t);if(null!=r){var s=e.modules[r];if(!s._resolving&&!s.exports){var o={};o.exports={},o.client=o.component=!0,s._resolving=!0,s.call(this,o.exports,e.relative(r),o),delete s._resolving,s.exports=o.exports}return s.exports}}e.modules={},e.aliases={},e.exts=["",".js",".json","/index.js","/index.json"],e.resolve=function(t){"/"===t.charAt(0)&&(t=t.slice(1));for(var i=0;5>i;i++){var n=t+e.exts[i];if(e.modules.hasOwnProperty(n))return n;if(e.aliases.hasOwnProperty(n))return e.aliases[n]}},e.normalize=function(e,t){var i=[];if("."!=t.charAt(0))return t;e=e.split("/"),t=t.split("/");for(var n=0;ns;s++)r[s].call(this._ctx,t,i,n)}return this},s.applyEmit=function(e){this._cbs=this._cbs||{};var t,i=this._cbs[e];if(i){i=i.slice(0),t=r.call(arguments,1);for(var n=0,s=i.length;s>n;n++)i[n].apply(this._ctx,t)}return this},i.exports=n}),e.register("vue/src/config.js",function(e,t,i){var n=t("./text-parser");i.exports={prefix:"v",debug:!1,silent:!1,enterClass:"v-enter",leaveClass:"v-leave",interpolate:!0},Object.defineProperty(i.exports,"delimiters",{get:function(){return n.delimiters},set:function(e){n.setDelimiters(e)}})}),e.register("vue/src/utils.js",function(e,t,i){var n,r=t("./config"),s={}.toString,o=window,a=(o.console,Object.defineProperty),c="object",l=/[^\w]this[^\w]/,u="classList"in document.documentElement,h=o.requestAnimationFrame||o.webkitRequestAnimationFrame||o.setTimeout,f=i.exports={toFragment:t("./fragment"),get:function(e,t){if(t.indexOf(".")<0)return e[t];for(var i=t.split("."),n=-1,r=i.length;++n0?e.split(".")[0]:e},hash:function(){return Object.create(null)},attr:function(e,t){var i=r.prefix+"-"+t,n=e.getAttribute(i);return null!==n&&e.removeAttribute(i),n},defProtected:function(e,t,i,n,r){a(e,t,{value:i,enumerable:n,writable:r,configurable:!0})},isObject:function(e){return typeof e===c&&e&&!Array.isArray(e)},isTrueObject:function(e){return"[object Object]"===s.call(e)},bind:function(e,t){return function(i){return e.call(t,i)}},guard:function(e){return null==e?"":"object"==typeof e?JSON.stringify(e):e},checkNumber:function(e){return isNaN(e)||null===e||"boolean"==typeof e?e:Number(e)},extend:function(e,t){for(var i in t)e[i]!==t[i]&&(e[i]=t[i]);return e},unique:function(e){for(var t,i=f.hash(),n=e.length,r=[];n--;)t=e[n],i[t]||(i[t]=1,r.push(t));return r},toConstructor:function(e){return n=n||t("./viewmodel"),f.isObject(e)?n.extend(e):"function"==typeof e?e:null},checkFilter:function(e){l.test(e.toString())&&(e.computed=!0)},processOptions:function(e){var t,i=e.components,n=e.partials,r=e.template,s=e.filters;if(i)for(t in i)i[t]=f.toConstructor(i[t]);if(n)for(t in n)n[t]=f.toFragment(n[t]);if(s)for(t in s)f.checkFilter(s[t]);r&&(e.template=f.toFragment(r))},nextTick:function(e){h(e,0)},addClass:function(e,t){if(u)e.classList.add(t);else{var i=" "+e.className+" ";i.indexOf(" "+t+" ")<0&&(e.className=(i+t).trim())}},removeClass:function(e,t){if(u)e.classList.remove(t);else{for(var i=" "+e.className+" ",n=" "+t+" ";i.indexOf(n)>=0;)i=i.replace(n," ");e.className=i.trim()}},objectToArray:function(e){var t,i,n=[];for(var r in e)t=e[r],i=f.isObject(t)?t:{$value:t},i.$key=r,n.push(i);return n}}}),e.register("vue/src/fragment.js",function(e,t,i){var n={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:[0,"",""]};n.td=n.th=[3,"","
"],n.option=n.optgroup=[1,'"],n.thead=n.tbody=n.colgroup=n.caption=n.tfoot=[1,"","
"],n.text=n.circle=n.ellipse=n.line=n.path=n.polygon=n.polyline=n.rect=[1,'',""];var r=/<([\w:]+)/;i.exports=function(e){if("string"!=typeof e)return e;if("#"===e.charAt(0)){var t=document.getElementById(e.slice(1));if(!t)return;if("TEMPLATE"===t.tagName&&t.content)return t.content;e=t.innerHTML}var i=document.createDocumentFragment(),s=r.exec(e);if(!s)return i.appendChild(document.createTextNode(e)),i;var o=s[1],a=n[o]||n._default,c=a[0],l=a[1],u=a[2],h=document.createElement("div");for(h.innerHTML=l+e.trim()+u;c--;)h=h.lastChild;if(h.firstChild===h.lastChild)return i.appendChild(h.firstChild),i;for(var f;f=h.firstChild;)1===h.nodeType&&i.appendChild(f);return i}}),e.register("vue/src/compiler.js",function(e,t,i){function n(e,t){var i,n,s=this;s.init=!0,s.destroyed=!1,t=s.options=t||{},l.processOptions(t),m(s,t.compilerOptions),s.repeat=s.repeat||!1,s.expCache=s.expCache||{};var a=s.el=s.setupElement(t);if(s.vm=a.vue_vm=e,s.bindings=l.hash(),s.dirs=[],s.deferred=[],s.computed=[],s.children=[],s.emitter=new o(e),t.methods)for(i in t.methods)s.createBinding(i);if(t.computed)for(i in t.computed)s.createBinding(i);e.$={},e.$el=a,e.$options=t,e.$compiler=s,e.$event=null;var c=t.parent;c&&(s.parent=c.$compiler,c.$compiler.children.push(s),e.$parent=c),e.$root=r(s).vm,s.setupObserver();var u=s.data=t.data||{},h=t.defaultData;if(h)for(i in h)g.call(u,i)||(u[i]=h[i]);var f=t.paramAttributes;if(f)for(n=f.length;n--;)u[f[n]]=l.checkNumber(s.eval(a.getAttribute(f[n])));m(e,u),e.$data=u,s.execHook("created"),u=s.data=e.$data;var p;for(i in e)p=e[i],"$"!==i.charAt(0)&&u[i]!==p&&"function"!=typeof p&&(u[i]=p);for(s.observeData(u),t.template&&this.resolveContent(),s.compile(a,!0),n=s.deferred.length;n--;)s.bindDirective(s.deferred[n]);s.deferred=null,this.computed.length&&d.parse(this.computed),s.init=!1,s.execHook("ready")}function r(e){for(;e.parent;)e=e.parent;return e}var s,o=t("./emitter"),a=t("./observer"),c=t("./config"),l=t("./utils"),u=t("./binding"),h=t("./directive"),f=t("./text-parser"),d=t("./deps-parser"),p=t("./exp-parser"),v=[].slice,m=l.extend,g={}.hasOwnProperty,b=Object.defineProperty,y=["created","ready","beforeDestroy","afterDestroy","attached","detached"],_=["if","repeat","view","component"],x=n.prototype;x.setupElement=function(e){var t,i,n,r,s,o="string"==typeof e.el?document.querySelector(e.el):e.el||document.createElement(e.tagName||"div"),a=e.template;if(a){if(o.hasChildNodes())for(this.rawContent=document.createElement("div");t=o.firstChild;)this.rawContent.appendChild(t);if(e.replace&&a.firstChild===a.lastChild){if(i=a.firstChild.cloneNode(!0),o.parentNode&&(o.parentNode.insertBefore(i,o),o.parentNode.removeChild(o)),o.hasAttributes())for(n=o.attributes.length;n--;)r=o.attributes[n],i.setAttribute(r.name,r.value);o=i}else o.appendChild(a.cloneNode(!0))}if(e.id&&(o.id=e.id),e.className&&(o.className=e.className),s=e.attributes)for(r in s)o.setAttribute(r,s[r]);return o},x.resolveContent=function(){function e(e,t){for(var i=e.parentNode,n=0,r=t.length;r>n;n++)i.insertBefore(t[n],e);i.removeChild(e)}var t,i,n,r,s,o=v.call(this.el.getElementsByTagName("content")),a=this.rawContent;if(n=o.length){for(;n--;)t=o[n],a?(i=t.getAttribute("select"),i?t.content=v.call(a.querySelectorAll(i)):s=t):t.content=v.call(t.childNodes);for(n=0,r=o.length;r>n;n++)t=o[n],t!==s&&e(t,t.content);a&&s&&e(s,v.call(a.childNodes))}this.rawContent=null},x.setupObserver=function(){function e(e){r(e),d.catcher.emit("get",a[e])}function t(e,t,i){l.emit("change:"+e,t,i),r(e),a[e].update(t)}function i(e,t){l.on("hook:"+e,function(){t.call(s.vm)})}function n(e){var t=s.children;if(t)for(var i,n=t.length;n--;)i=t[n],i.el.parentNode&&(e="hook:"+(e?"attached":"detached"),i.observer.emit(e),i.emitter.emit(e))}function r(e){a[e]||s.createBinding(e)}var s=this,a=s.bindings,c=s.options,l=s.observer=new o(s.vm);l.proxies={},l.on("get",e).on("set",t).on("mutate",t);for(var u,h,f,p=y.length;p--;)if(h=y[p],f=c[h],Array.isArray(f))for(u=f.length;u--;)i(h,f[u]);else f&&i(h,f);l.on("hook:attached",function(){n(1)}).on("hook:detached",function(){n(0)})},x.observeData=function(e){function t(e){"$data"!==e&&i()}function i(){s.update(n.data),r.emit("change:$data",n.data)}var n=this,r=n.observer;a.observe(e,"",r);var s=n.bindings.$data=new u(n,"$data");s.update(e),b(n.vm,"$data",{get:function(){return n.observer.emit("get","$data"),n.data},set:function(e){var t=n.data;a.unobserve(t,"",r),n.data=e,a.copyPaths(e,t),a.observe(e,"",r),i()}}),r.on("set",t).on("mutate",t)},x.compile=function(e,t){var i=e.nodeType;1===i&&"SCRIPT"!==e.tagName?this.compileElement(e,t):3===i&&c.interpolate&&this.compileTextNode(e)},x.checkPriorityDir=function(e,t,i){var n,r,s;if("component"===e&&i!==!0&&(s=this.resolveComponent(t,void 0,!0))?(r=this.parseDirective(e,"",t),r.Ctor=s):(n=l.attr(t,e),r=n&&this.parseDirective(e,n,t)),r){if(i===!0)return;return this.deferred.push(r),!0}},x.compileElement=function(e,t){if("TEXTAREA"===e.tagName&&e.value&&(e.value=this.eval(e.value)),e.hasAttributes()||e.tagName.indexOf("-")>-1){if(null!==l.attr(e,"pre"))return;var i,n,r,s;for(i=0,n=_.length;n>i;i++)if(this.checkPriorityDir(_[i],e,t))return;e.vue_trans=l.attr(e,"transition"),e.vue_anim=l.attr(e,"animation"),e.vue_effect=this.eval(l.attr(e,"effect"));var o,a,u,h,d,p,m=c.prefix+"-",g=v.call(e.attributes),b=this.options.paramAttributes;for(i=0,n=g.length;n>i;i++){if(o=g[i],a=!1,0===o.name.indexOf(m))for(a=!0,p=o.name.slice(m.length),h=this.parseDirective(p,o.value,e,!0),r=0,s=h.length;s>r;r++)d=h[r],"with"===p?this.bindDirective(d,this.parent):this.bindDirective(d);else c.interpolate&&(u=f.parseAttr(o.value),u&&(d=this.parseDirective("attr",o.name+":"+u,e),b&&b.indexOf(o.name)>-1?this.bindDirective(d,this.parent):this.bindDirective(d)));a&&"cloak"!==p&&e.removeAttribute(o.name)}}e.hasChildNodes()&&v.call(e.childNodes).forEach(this.compile,this)},x.compileTextNode=function(e){var t=f.parse(e.nodeValue);if(t){for(var i,n,r,s=0,o=t.length;o>s;s++)n=t[s],r=null,n.key?">"===n.key.charAt(0)?(i=document.createComment("ref"),r=this.parseDirective("partial",n.key.slice(1),i)):n.html?(i=document.createComment(c.prefix+"-html"),r=this.parseDirective("html",n.key,i)):(i=document.createTextNode(""),r=this.parseDirective("text",n.key,i)):i=document.createTextNode(n),e.parentNode.insertBefore(i,e),this.bindDirective(r);e.parentNode.removeChild(e)}},x.parseDirective=function(e,t,i,n){function r(t){return new h(e,t,o,s,i)}var s=this,o=s.getOption("directives",e);if(o){var a=h.parse(t);return n?a.map(r):r(a[0])}},x.bindDirective=function(e,t){if(e){if(this.dirs.push(e),e.isEmpty||e.isLiteral)return void(e.bind&&e.bind());var i,n=t||this,r=e.key;if(e.isExp)i=n.createBinding(r,e);else{for(;n&&!n.hasKey(r);)n=n.parent;n=n||this,i=n.bindings[r]||n.createBinding(r)}i.dirs.push(e),e.binding=i;var s=i.val();e.bind&&e.bind(s),e.$update(s,!0)}},x.createBinding=function(e,t){var i=this,n=i.options.methods,r=t&&t.isExp,s=t&&t.isFn||n&&n[e],o=i.bindings,c=i.options.computed,h=new u(i,e,r,s);if(r)i.defineExp(e,h,t);else if(s)o[e]=h,h.value=i.vm[e]=n[e];else if(o[e]=h,h.root)c&&c[e]?i.defineComputed(e,h,c[e]):"$"!==e.charAt(0)?i.defineProp(e,h):i.defineMeta(e,h);else if(c&&c[l.baseKey(e)])i.defineExp(e,h);else{a.ensurePath(i.data,e);var f=e.slice(0,e.lastIndexOf("."));o[f]||i.createBinding(f)}return h},x.defineProp=function(e,t){var i=this,n=i.data,r=n.__emitter__;g.call(n,e)||(n[e]=void 0),r&&!g.call(r.values,e)&&a.convertKey(n,e),t.value=n[e],b(i.vm,e,{get:function(){return i.data[e]},set:function(t){i.data[e]=t}})},x.defineMeta=function(e,t){var i=this.observer;t.value=this.data[e],delete this.data[e],b(this.vm,e,{get:function(){return a.shouldGet&&i.emit("get",e),t.value},set:function(t){i.emit("set",e,t)}})},x.defineExp=function(e,t,i){var n=i&&i.computedKey,r=n?i.expression:e,s=this.expCache[r];s||(s=this.expCache[r]=p.parse(n||e,this)),s&&this.markComputed(t,s)},x.defineComputed=function(e,t,i){this.markComputed(t,i),b(this.vm,e,{get:t.value.$get,set:t.value.$set})},x.markComputed=function(e,t){e.isComputed=!0,e.isFn?e.value=t:("function"==typeof t&&(t={$get:t}),e.value={$get:l.bind(t.$get,this.vm),$set:t.$set?l.bind(t.$set,this.vm):void 0}),this.computed.push(e)},x.getOption=function(e,t,i){var n=this.options,r=this.parent,s=c.globalAssets,o=n[e]&&n[e][t]||(r?r.getOption(e,t,i):s[e]&&s[e][t]);return o},x.execHook=function(e){e="hook:"+e,this.observer.emit(e),this.emitter.emit(e)},x.hasKey=function(e){var t=l.baseKey(e);return g.call(this.data,t)||g.call(this.vm,t)},x.eval=function(e,t){var i=f.parseAttr(e);return i?p.eval(i,this,t):e},x.resolveComponent=function(e,i,n){s=s||t("./viewmodel");var r=l.attr(e,"component"),o=e.tagName,a=this.eval(r,i),c=o.indexOf("-")>0&&o.toLowerCase(),u=this.getOption("components",a||c,!0);return n?""===r?s:u:u||s},x.destroy=function(){if(!this.destroyed){var e,t,i,n,r,s,o=this,c=o.vm,l=o.el,u=o.dirs,h=o.computed,f=o.bindings,d=o.children,p=o.parent;for(o.execHook("beforeDestroy"),a.unobserve(o.data,"",o.observer),e=u.length;e--;)n=u[e],n.binding&&n.binding.compiler!==o&&(r=n.binding.dirs,r&&(t=r.indexOf(n),t>-1&&r.splice(t,1))),n.$unbind();for(e=h.length;e--;)h[e].unbind();for(i in f)s=f[i],s&&s.unbind();for(e=d.length;e--;)d[e].destroy();p&&(t=p.children.indexOf(o),t>-1&&p.children.splice(t,1)),l===document.body?l.innerHTML="":c.$remove(),l.vue_vm=null,o.destroyed=!0,o.execHook("afterDestroy"),o.observer.off(),o.emitter.off()}},i.exports=n}),e.register("vue/src/viewmodel.js",function(e,t,i){function n(e){new s(this,e)}function r(e){return"string"==typeof e?document.querySelector(e):e}var s=t("./compiler"),o=t("./utils"),a=t("./transition"),c=t("./batcher"),l=[].slice,u=o.defProtected,h=o.nextTick,f=new c,d=1,p=n.prototype;u(p,"$get",function(e){var t=o.get(this,e);return void 0===t&&this.$parent?this.$parent.$get(e):t}),u(p,"$set",function(e,t){o.set(this,e,t)}),u(p,"$watch",function(e,t){function i(){var e=l.call(arguments);f.push({id:n,override:!0,execute:function(){t.apply(r,e)}})}var n=d++,r=this;t._fn=i,r.$compiler.observer.on("change:"+e,i)}),u(p,"$unwatch",function(e,t){var i=["change:"+e],n=this.$compiler.observer;t&&i.push(t._fn),n.off.apply(n,i)}),u(p,"$destroy",function(){this.$compiler.destroy()}),u(p,"$broadcast",function(){for(var e,t=this.$compiler.children,i=t.length;i--;)e=t[i],e.emitter.applyEmit.apply(e.emitter,arguments),e.vm.$broadcast.apply(e.vm,arguments)}),u(p,"$dispatch",function(){var e=this.$compiler,t=e.emitter,i=e.parent;t.applyEmit.apply(t,arguments),i&&i.vm.$dispatch.apply(i.vm,arguments)}),["emit","on","off","once"].forEach(function(e){var t="emit"===e?"applyEmit":e;u(p,"$"+e,function(){var e=this.$compiler.emitter;e[t].apply(e,arguments)})}),u(p,"$appendTo",function(e,t){e=r(e);var i=this.$el;a(i,1,function(){e.appendChild(i),t&&h(t)},this.$compiler)}),u(p,"$remove",function(e){var t=this.$el;a(t,-1,function(){t.parentNode&&t.parentNode.removeChild(t),e&&h(e)},this.$compiler)}),u(p,"$before",function(e,t){e=r(e);var i=this.$el;a(i,1,function(){e.parentNode.insertBefore(i,e),t&&h(t)},this.$compiler)}),u(p,"$after",function(e,t){e=r(e);var i=this.$el;a(i,1,function(){e.nextSibling?e.parentNode.insertBefore(i,e.nextSibling):e.parentNode.appendChild(i),t&&h(t)},this.$compiler)}),i.exports=n}),e.register("vue/src/binding.js",function(e,t,i){function n(e,t,i,n){this.id=o++,this.value=void 0,this.isExp=!!i,this.isFn=n,this.root=!this.isExp&&-1===t.indexOf("."),this.compiler=e,this.key=t,this.dirs=[],this.subs=[],this.deps=[],this.unbound=!1}var r=t("./batcher"),s=new r,o=1,a=n.prototype;a.update=function(e){if((!this.isComputed||this.isFn)&&(this.value=e),this.dirs.length||this.subs.length){var t=this;s.push({id:this.id,execute:function(){t.unbound||t._update()}})}},a._update=function(){for(var e=this.dirs.length,t=this.val();e--;)this.dirs[e].$update(t);this.pub()},a.val=function(){return this.isComputed&&!this.isFn?this.value.$get():this.value},a.pub=function(){for(var e=this.subs.length;e--;)this.subs[e].update()},a.unbind=function(){this.unbound=!0;for(var e=this.dirs.length;e--;)this.dirs[e].$unbind();e=this.deps.length;for(var t;e--;){t=this.deps[e].subs;var i=t.indexOf(this);i>-1&&t.splice(i,1)}},i.exports=n}),e.register("vue/src/observer.js",function(e,t,i){function n(e){x(j,e,function(){var t,i,n=E.call(arguments),o=Array.prototype[e].apply(this,n);return"push"===e||"unshift"===e?t=n:"pop"===e||"shift"===e?i=[o]:"splice"===e&&(t=n.slice(2),i=o),r(this,t),s(this,i),this.__emitter__.emit("mutate","",this,{method:e,args:n,result:o,inserted:t,removed:i}),o},!A)}function r(e,t){if(t)for(var i,n,r=t.length;r--;)i=t[r],o(i)&&(i.__emitter__||(a(i),l(i)),n=i.__emitter__.owners,n.indexOf(e)<0&&n.push(e))}function s(e,t){if(t)for(var i,n=t.length;n--;)if(i=t[n],i&&i.__emitter__){var r=i.__emitter__.owners;r&&r.splice(r.indexOf(e))}}function o(e){return"object"==typeof e&&e&&!e.$compiler}function a(e){if(e.__emitter__)return!0;var t=new y;return x(e,"__emitter__",t),t.on("set",function(t,i,n){n&&c(e)}).on("mutate",function(){c(e)}),t.values=_.hash(),t.owners=[],!1}function c(e){for(var t=e.__emitter__.owners,i=t.length;i--;)t[i].__emitter__.emit("set","","",!0)}function l(e){k(e)?f(e):h(e)}function u(e,t){if(A)e.__proto__=t;else for(var i in t)x(e,i,t[i])}function h(e){u(e,O);for(var t in e)d(e,t)}function f(e){u(e,j),r(e,e)}function d(e,t,i){function n(e,i){o[t]=e,s.emit("set",t,e,i),k(e)&&s.emit("set",t+".length",e.length,i),g(e,t,s)}var r=t.charAt(0);if("$"!==r&&"_"!==r){var s=e.__emitter__,o=s.values;n(e[t],i),w(e,t,{enumerable:!0,configurable:!0,get:function(){var e=o[t];return N.shouldGet&&s.emit("get",t),e},set:function(e){var i=o[t];b(i,t,s),v(e,i),n(e,!0)}})}}function p(e){var t=e&&e.__emitter__;if(t)if(k(e))t.emit("set","length",e.length);else{var i,n;for(i in e)n=e[i],t.emit("set",i,n),p(n)}}function v(e,t){if($(e)&&$(t)){var i,n,r;for(i in t)C.call(e,i)||(n=t[i],k(n)?e[i]=[]:$(n)?(r=e[i]={},v(r,n)):e[i]=void 0)}}function m(e,t){for(var i,n=t.split("."),r=0,s=n.length-1;s>r;r++)i=n[r],e[i]||(e[i]={},e.__emitter__&&d(e,i)),e=e[i];$(e)&&(i=n[r],C.call(e,i)||(e[i]=void 0,e.__emitter__&&d(e,i)))}function g(e,t,i){if(o(e)){var n=t?t+".":"",r=a(e),s=e.__emitter__;i.proxies=i.proxies||{};var c=i.proxies[n]={get:function(e){i.emit("get",n+e)},set:function(r,s,o){r&&i.emit("set",n+r,s),t&&o&&i.emit("set",t,e,!0)},mutate:function(e,r,s){var o=e?n+e:t;i.emit("mutate",o,r,s);var a=s.method;"sort"!==a&&"reverse"!==a&&i.emit("set",o+".length",r.length)}};s.on("get",c.get).on("set",c.set).on("mutate",c.mutate),r?p(e):l(e)}}function b(e,t,i){if(e&&e.__emitter__){t=t?t+".":"";var n=i.proxies[t];n&&(e.__emitter__.off("get",n.get).off("set",n.set).off("mutate",n.mutate),i.proxies[t]=null)}}var y=t("./emitter"),_=t("./utils"),x=_.defProtected,$=_.isObject,k=Array.isArray,C={}.hasOwnProperty,w=Object.defineProperty,E=[].slice,A={}.__proto__,j=Object.create(Array.prototype);["push","pop","shift","unshift","splice","sort","reverse"].forEach(n),x(j,"$set",function(e,t){return this.splice(e,1,t)[0]},!A),x(j,"$remove",function(e){return"number"!=typeof e&&(e=this.indexOf(e)),e>-1?this.splice(e,1)[0]:void 0},!A);var O=Object.create(Object.prototype);x(O,"$add",function(e,t){C.call(this,e)||(this[e]=t,d(this,e,!0))},!A),x(O,"$delete",function(e){C.call(this,e)&&(this[e]=void 0,delete this[e],this.__emitter__.emit("delete",e))},!A);var N=i.exports={shouldGet:!1,observe:g,unobserve:b,ensurePath:m,copyPaths:v,watch:l,convert:a,convertKey:d}}),e.register("vue/src/directive.js",function(e,t,i){function n(e,t,i,r,o){this.id=s++,this.name=e,this.compiler=r,this.vm=r.vm,this.el=o,this.computeFilters=!1,this.key=t.key,this.arg=t.arg,this.expression=t.expression;var a=""===this.expression;if("function"==typeof i)this[a?"bind":"update"]=i;else for(var u in i)this[u]=i[u];if(a||this.isEmpty)return void(this.isEmpty=!0);this.expression=(this.isLiteral?r.eval(this.expression):this.expression).trim();var h,f,d,p,v,m=t.filters;if(m)for(this.filters=[],d=0,p=m.length;p>d;d++)h=m[d],f=this.compiler.getOption("filters",h.name),f&&(h.apply=f,this.filters.push(h),f.computed&&(v=!0));this.filters&&this.filters.length||(this.filters=null),v&&(this.computedKey=n.inlineFilters(this.key,this.filters),this.filters=null),this.isExp=v||!l.test(this.key)||c.test(this.key)}function r(e){return e.indexOf('"')>-1?e.replace(u,"'"):e}var s=1,o=/^[\w\$-]+$/,a=/[^\s'"]+|'[^']+'|"[^"]+"/g,c=/^\$(parent|root)\./,l=/^[\w\.$]+$/,u=/"/g,h=n.prototype;h.$update=function(e,t){this.$lock||(t||e!==this.value||e&&"object"==typeof e)&&(this.value=e,this.update&&this.update(this.filters&&!this.computeFilters?this.$applyFilters(e):e,t))},h.$applyFilters=function(e){for(var t,i=e,n=0,r=this.filters.length;r>n;n++)t=this.filters[n],i=t.apply.apply(this.vm,[i].concat(t.args));return i},h.$unbind=function(){this.el&&this.vm&&(this.unbind&&this.unbind(),this.vm=this.el=this.binding=this.compiler=null)},n.parse=function(e){function t(){v.expression=e.slice(f,g).trim(),void 0===v.key?v.key=e.slice(d,g).trim():m!==f&&i(),(0===g||v.key)&&p.push(v)}function i(){var t,i=e.slice(m,g).trim();if(i){t={};var n=i.match(a);t.name=n[0],t.args=n.length>1?n.slice(1):null}t&&(v.filters=v.filters||[]).push(t),m=g+1}for(var n,r,s=!1,c=!1,l=0,u=0,h=0,f=0,d=0,p=[],v={},m=0,g=0,b=e.length;b>g;g++)r=e.charAt(g),s?"'"===r&&(s=!s):c?'"'===r&&(c=!c):","!==r||h||l||u?":"!==r||v.key||v.arg?"|"===r&&"|"!==e.charAt(g+1)&&"|"!==e.charAt(g-1)?void 0===v.key?(m=g+1,v.key=e.slice(d,g).trim()):i():'"'===r?c=!0:"'"===r?s=!0:"("===r?h++:")"===r?h--:"["===r?u++:"]"===r?u--:"{"===r?l++:"}"===r&&l--:(n=e.slice(f,g).trim(),o.test(n)&&(d=g+1,v.arg=e.slice(f,g).trim())):(t(),v={},f=d=m=g+1);return(0===g||f!==g)&&t(),p},n.inlineFilters=function(e,t){for(var i,n,s=0,o=t.length;o>s;s++)n=t[s],i=n.args?',"'+n.args.map(r).join('","')+'"':"",e='this.$compiler.getOption("filters", "'+n.name+'").call(this,'+e+i+")";return e},i.exports=n}),e.register("vue/src/exp-parser.js",function(e,t){function i(e){return e=e.replace(p,"").replace(v,",").replace(d,"").replace(m,"").replace(g,""),e?e.split(/,+/):[]}function n(e,t,i){var n="",r=0,s=t;if(i&&void 0!==o.get(i,e))return"$temp.";for(;t&&!t.hasKey(e);)t=t.parent,r++;if(t){for(;r--;)n+="$parent.";t.bindings[e]||"$"===e.charAt(0)||t.createBinding(e)}else s.createBinding(e);return n}function r(e,t){var i;try{i=new Function(e)}catch(n){}return i}function s(e){return"$"===e.charAt(0)?"\\"+e:e}var o=t("./utils"),a=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,c=/"(\d+)"/g,l=/\n/g,u=new RegExp("constructor".split("").join("['\"+, ]*")),h=/\\u\d\d\d\d/,f="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,undefined,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,Math",d=new RegExp(["\\b"+f.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),p=/\/\*(?:.|\n)*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|'[^']*'|"[^"]*"|[\s\t\n]*\.[\s\t\n]*[$\w\.]+|[\{,]\s*[\w\$_]+\s*:/g,v=/[^\w$]+/g,m=/\b\d[^,]*/g,g=/^,+|,+$/g;e.parse=function(e,t,f){function d(e){var t=y.length;return y[t]=e.replace(l,"\\n"),'"'+t+'"'}function p(e){var i=e.charAt(0);e=e.slice(1);var r="this."+n(e,t,f)+e;return b[e]||(g+=r+";",b[e]=1),i+r}function v(e,t){return y[t]}if(!h.test(e)&&!u.test(e)){var m=i(e);if(!m.length)return r("return "+e,e);m=o.unique(m);var g="",b=o.hash(),y=[],_=new RegExp("[^$\\w\\.]("+m.map(s).join("|")+")[$\\w\\.]*\\b","g"),x=(" "+e).replace(a,d).replace(_,p).replace(c,v);return x=g+"return "+x,r(x,e)}},e.eval=function(t,i,n){var r,s=e.parse(t,i,n);return s&&(i.vm.$temp=n,r=s.call(i.vm),delete i.vm.$temp),r}}),e.register("vue/src/text-parser.js",function(e,t){function i(){var e=n(l),t=n(u);return new RegExp(e+e+e+"?(.+?)"+t+"?"+t+t)}function n(e){return e.replace(h,"\\$&")}function r(t){e.delimiters=t,l=t[0],u=t[1],f=i()}function s(e){if(!f.test(e))return null;for(var t,i,n,r,s=[];t=e.match(f);)i=t.index,i>0&&s.push(e.slice(0,i)),n={key:t[1].trim()},r=t[0],n.html=r.charAt(2)===l&&r.charAt(r.length-3)===u,s.push(n),e=e.slice(i+t[0].length);return e.length&&s.push(e),s}function o(e){c=c||t("./directive");var i=s(e);if(!i)return null;if(1===i.length)return i[0].key;for(var n,r=[],o=0,l=i.length;l>o;o++)n=i[o],r.push(n.key?a(n.key):'"'+n+'"');return r.join("+")}function a(e){if(e.indexOf("|")>-1){var t=c.parse(e),i=t&&t[0];i&&i.filters&&(e=c.inlineFilters(i.key,i.filters))}return"("+e+")"}var c,l="{",u="}",h=/[-.*+?^${}()|[\]\/\\]/g,f=i();e.parse=s,e.parseAttr=o,e.setDelimiters=r,e.delimiters=[l,u]}),e.register("vue/src/deps-parser.js",function(e,t,i){function n(e){if(!e.isFn){var t=o.hash();e.deps=[],c.on("get",function(i){var n=t[i.key];n&&n.compiler===i.compiler||i.compiler.repeat&&!r(i.compiler,e.compiler)||(t[i.key]=i,e.deps.push(i),i.subs.push(e))}),e.value.$get(),c.off("get")}}function r(e,t){for(;t;){if(e===t)return!0;t=t.parent}}var s=t("./emitter"),o=t("./utils"),a=t("./observer"),c=new s;i.exports={catcher:c,parse:function(e){a.shouldGet=!0,e.forEach(n),a.shouldGet=!1}}}),e.register("vue/src/filters.js",function(e,t,i){function n(e,t){if(s.isObject(e)){for(var i in e)if(n(e[i],t))return!0}else if(null!=e)return e.toString().toLowerCase().indexOf(t)>-1}function r(e){return c.test(e)?e.slice(1,-1):void 0}var s=t("./utils"),o=s.get,a=[].slice,c=/^'.*'$/,l=i.exports=s.hash();l.capitalize=function(e){return e||0===e?(e=e.toString(),e.charAt(0).toUpperCase()+e.slice(1)):""},l.uppercase=function(e){return e||0===e?e.toString().toUpperCase():""},l.lowercase=function(e){return e||0===e?e.toString().toLowerCase():""},l.currency=function(e,t){if(!e&&0!==e)return"";t=t||"$";var i=Math.floor(e).toString(),n=i.length%3,r=n>0?i.slice(0,n)+(i.length>3?",":""):"",s="."+e.toFixed(2).slice(-2);return t+r+i.slice(n).replace(/(\d{3})(?=\d)/g,"$1,")+s},l.pluralize=function(e){var t=a.call(arguments,1);return t.length>1?t[e-1]||t[t.length-1]:t[e-1]||t[0]+"s"};var u={enter:13,tab:9,"delete":46,up:38,left:37,right:39,down:40,esc:27};l.key=function(e,t){if(e){var i=u[t];return i||(i=parseInt(t,10)),function(t){return t.keyCode===i?e.call(this,t):void 0}}},l.filterBy=function(e,t,i,a){i&&"in"!==i&&(a=i);var c=r(t)||this.$get(t);return c?(c=c.toLowerCase(),a=a&&(r(a)||this.$get(a)),Array.isArray(e)||(e=s.objectToArray(e)),e.filter(function(e){return a?n(o(e,a),c):n(e,c)})):e},l.filterBy.computed=!0,l.orderBy=function(e,t,i){var n=r(t)||this.$get(t);if(!n)return e;Array.isArray(e)||(e=s.objectToArray(e));var a=1;return i&&("-1"===i?a=-1:"!"===i.charAt(0)?(i=i.slice(1),a=this.$get(i)?1:-1):a=this.$get(i)?-1:1),e.slice().sort(function(e,t){return e=o(e,n),t=o(t,n),e===t?0:e>t?a:-a})},l.orderBy.computed=!0}),e.register("vue/src/transition.js",function(e,t,i){function n(e,t,i,n){if(!o.trans)return i(),f.CSS_SKIP;var r,s=e.classList,c=e.vue_trans_cb,u=a.enterClass,h=a.leaveClass,d=n?o.anim:o.trans;return c&&(e.removeEventListener(d,c),s.remove(u),s.remove(h),e.vue_trans_cb=null),t>0?(s.add(u),i(),n?(r=function(t){t.target===e&&(e.removeEventListener(d,r),e.vue_trans_cb=null,s.remove(u))},e.addEventListener(d,r),e.vue_trans_cb=r):l.push({execute:function(){s.remove(u)}}),f.CSS_E):(e.offsetWidth||e.offsetHeight?(s.add(h),r=function(t){t.target===e&&(e.removeEventListener(d,r),e.vue_trans_cb=null,i(),s.remove(h))},e.addEventListener(d,r),e.vue_trans_cb=r):i(),f.CSS_L)}function r(e,t,i,n,r){function s(t,i){var n=u(function(){t(),l.splice(l.indexOf(n),1),l.length||(e.vue_timeouts=null)},i);l.push(n)}var o=r.getOption("effects",n);if(!o)return i(),f.JS_SKIP;var a=o.enter,c=o.leave,l=e.vue_timeouts;if(l)for(var d=l.length;d--;)h(l[d]);return l=e.vue_timeouts=[],t>0?"function"!=typeof a?(i(),f.JS_SKIP_E):(a(e,i,s),f.JS_E):"function"!=typeof c?(i(),f.JS_SKIP_L):(c(e,i,s),f.JS_L)}function s(){var e=document.createElement("vue"),t="transitionend",i={transition:t,mozTransition:t,webkitTransition:"webkitTransitionEnd"},n={};for(var r in i)if(void 0!==e.style[r]){n.trans=i[r];break}return n.anim=""===e.style.animation?"animationend":"webkitAnimationEnd",n}var o=s(),a=t("./config"),c=t("./batcher"),l=new c,u=window.setTimeout,h=window.clearTimeout,f={CSS_E:1,CSS_L:2,JS_E:3,JS_L:4,CSS_SKIP:-1,JS_SKIP:-2,JS_SKIP_E:-3,JS_SKIP_L:-4,INIT:-5,SKIP:-6};l._preFlush=function(){document.body.offsetHeight};var d=i.exports=function(e,t,i,s){var o=function(){i(),s.execHook(t>0?"attached":"detached")};if(s.init)return o(),f.INIT;var a=""===e.vue_trans,c=""===e.vue_anim,l=e.vue_effect;return l?r(e,t,o,l,s):a||c?n(e,t,o,c):(o(),f.SKIP)};d.codes=f}),e.register("vue/src/batcher.js",function(e,t,i){function n(){this.reset()}var r=t("./utils"),s=n.prototype;s.push=function(e){if(e.id&&this.has[e.id]){if(e.override){var t=this.has[e.id];t.cancelled=!0,this.queue.push(e),this.has[e.id]=e}}else this.queue.push(e),this.has[e.id]=e,this.waiting||(this.waiting=!0,r.nextTick(r.bind(this.flush,this)))},s.flush=function(){this._preFlush&&this._preFlush();for(var e=0;e-1},update:function(e){e||0===e?this.el.setAttribute(this.arg,e):this.el.removeAttribute(this.arg),this.isParam&&(this.vm[this.arg]=n.checkNumber(e))}},o.text={bind:function(){this.attr=3===this.el.nodeType?"nodeValue":"textContent"},update:function(e){this.el[this.attr]=n.guard(e)}},o.show=function(e){var t=this.el,i=e?"":"none",n=function(){t.style.display=i};s(t,e?1:-1,n,this.compiler)},o["class"]=function(e){this.arg?n[e?"addClass":"removeClass"](this.el,this.arg):(this.lastVal&&n.removeClass(this.el,this.lastVal),e&&(n.addClass(this.el,e),this.lastVal=e))},o.cloak={isEmpty:!0,bind:function(){var e=this.el;this.compiler.observer.once("hook:ready",function(){e.removeAttribute(r.prefix+"-cloak")})}},o.ref={isLiteral:!0,bind:function(){var e=this.expression;e&&(this.vm.$parent.$[e]=this.vm)},unbind:function(){var e=this.expression;e&&delete this.vm.$parent.$[e]}},o.on=t("./on"),o.repeat=t("./repeat"),o.model=t("./model"),o["if"]=t("./if"),o["with"]=t("./with"),o.html=t("./html"),o.style=t("./style"),o.partial=t("./partial"),o.view=t("./view")}),e.register("vue/src/directives/if.js",function(e,t,i){var n=t("../utils");i.exports={bind:function(){this.parent=this.el.parentNode,this.ref=document.createComment("vue-if"),this.Ctor=this.compiler.resolveComponent(this.el),this.parent.insertBefore(this.ref,this.el),this.parent.removeChild(this.el),n.attr(this.el,"view"),n.attr(this.el,"repeat")},update:function(e){e?this.childVM||(this.childVM=new this.Ctor({el:this.el.cloneNode(!0),parent:this.vm}),this.compiler.init?this.parent.insertBefore(this.childVM.$el,this.ref):this.childVM.$before(this.ref)):this.unbind()},unbind:function(){this.childVM&&(this.childVM.$destroy(),this.childVM=null)}}}),e.register("vue/src/directives/repeat.js",function(e,t,i){function n(e,t){for(var i,n=0,r=e.length;r>n;n++)if(i=e[n],!i.$reused&&i.$value===t)return n;return-1}var r=t("../utils"),s=t("../config");i.exports={bind:function(){this.identifier="$r"+this.id,this.expCache=r.hash();var e=this.el,t=this.container=e.parentNode;this.childId=this.compiler.eval(r.attr(e,"ref")),this.ref=document.createComment(s.prefix+"-repeat-"+this.key),t.insertBefore(this.ref,e),t.removeChild(e),this.collection=null,this.vms=null},update:function(e){Array.isArray(e)||r.isObject(e)&&(e=r.objectToArray(e)),this.oldVMs=this.vms,this.oldCollection=this.collection,e=this.collection=e||[];var t=e[0]&&r.isObject(e[0]);this.vms=this.oldCollection?this.diff(e,t):this.init(e,t),this.childId&&(this.vm.$[this.childId]=this.vms)},init:function(e,t){for(var i,n=[],r=0,s=e.length;s>r;r++)i=this.build(e[r],r,t),n.push(i),this.compiler.init?this.container.insertBefore(i.$el,this.ref):i.$before(this.ref);return n},diff:function(e,t){var i,r,s,o,a,c,l,u,h=this.container,f=this.oldVMs,d=[];for(d.length=e.length,i=0,r=e.length;r>i;i++)s=e[i],t?(s.$index=i,s.__emitter__&&s.__emitter__[this.identifier]?s.$reused=!0:d[i]=this.build(s,i,t)):(a=n(f,s),a>-1?(f[a].$reused=!0,f[a].$data.$index=i):d[i]=this.build(s,i,t));for(i=0,r=f.length;r>i;i++)o=f[i],s=this.arg?o.$data[this.arg]:o.$data,s.$reused&&(o.$reused=!0,delete s.$reused),o.$reused?(o.$index=s.$index,s.$key&&s.$key!==o.$key&&(o.$key=s.$key),d[o.$index]=o):(s.__emitter__&&delete s.__emitter__[this.identifier],o.$destroy());for(i=d.length;i--;)if(o=d[i],s=o.$data,c=d[i+1],o.$reused){for(u=o.$el.nextSibling;!u.vue_vm&&u!==this.ref;)u=u.nextSibling;if(l=u.vue_vm,l!==c)if(c){for(u=c.$el;!u.parentNode;)c=d[u.vue_vm.$index+1],u=c?c.$el:this.ref;h.insertBefore(o.$el,u)}else h.insertBefore(o.$el,this.ref);delete o.$reused,delete s.$index,delete s.$key}else o.$before(c?c.$el:this.ref);return d},build:function(e,t,i){var n,r,s=!i||this.arg;s&&(n=e,r=this.arg||"$value",e={},e[r]=n),e.$index=t;var o=this.el.cloneNode(!0),a=this.compiler.resolveComponent(o,e),c=new a({el:o,data:e,parent:this.vm,compilerOptions:{repeat:!0,expCache:this.expCache}});return i&&((n||e).__emitter__[this.identifier]=!0),c},unbind:function(){if(this.childId&&delete this.vm.$[this.childId],this.vms)for(var e=this.vms.length;e--;)this.vms[e].$destroy()}}}),e.register("vue/src/directives/on.js",function(e,t,i){t("../utils");i.exports={isFn:!0,bind:function(){this.context=this.binding.isExp?this.vm:this.binding.compiler.vm},update:function(e){if("function"==typeof e){this.unbind();var t=this.vm,i=this.context;this.handler=function(n){n.targetVM=t,i.$event=n;var r=e.call(i,n);return i.$event=null,r},this.el.addEventListener(this.arg,this.handler)}},unbind:function(){this.el.removeEventListener(this.arg,this.handler)}}}),e.register("vue/src/directives/model.js",function(e,t,i){function n(e){return o.call(e.options,function(e){return e.selected}).map(function(e){return e.value||e.text})}var r=t("../utils"),s=navigator.userAgent.indexOf("MSIE 9.0")>0,o=[].filter;i.exports={bind:function(){var e=this,t=e.el,i=t.type,n=t.tagName;e.lock=!1,e.ownerVM=e.binding.compiler.vm,e.event=e.compiler.options.lazy||"SELECT"===n||"checkbox"===i||"radio"===i?"change":"input",e.attr="checkbox"===i?"checked":"INPUT"===n||"SELECT"===n||"TEXTAREA"===n?"value":"innerHTML","SELECT"===n&&t.hasAttribute("multiple")&&(this.multi=!0);var o=!1;e.cLock=function(){o=!0},e.cUnlock=function(){o=!1},t.addEventListener("compositionstart",this.cLock),t.addEventListener("compositionend",this.cUnlock),e.set=e.filters?function(){if(!o){var i;try{i=t.selectionStart}catch(n){}e._set(),r.nextTick(function(){void 0!==i&&t.setSelectionRange(i,i)})}}:function(){o||(e.lock=!0,e._set(),r.nextTick(function(){e.lock=!1}))},t.addEventListener(e.event,e.set),s&&(e.onCut=function(){r.nextTick(function(){e.set()})},e.onDel=function(t){(46===t.keyCode||8===t.keyCode)&&e.set()},t.addEventListener("cut",e.onCut),t.addEventListener("keyup",e.onDel))},_set:function(){this.ownerVM.$set(this.key,this.multi?n(this.el):this.el[this.attr])},update:function(e,t){if(t&&void 0===e)return this._set();if(!this.lock){var i=this.el;"SELECT"===i.tagName?(i.selectedIndex=-1,this.multi&&Array.isArray(e)?e.forEach(this.updateSelect,this):this.updateSelect(e)):"radio"===i.type?i.checked=e==i.value:"checkbox"===i.type?i.checked=!!e:i[this.attr]=r.guard(e)}},updateSelect:function(e){for(var t=this.el.options,i=t.length;i--;)if(t[i].value==e){t[i].selected=!0;break}},unbind:function(){var e=this.el;e.removeEventListener(this.event,this.set),e.removeEventListener("compositionstart",this.cLock),e.removeEventListener("compositionend",this.cUnlock),s&&(e.removeEventListener("cut",this.onCut),e.removeEventListener("keyup",this.onDel))}}}),e.register("vue/src/directives/with.js",function(e,t,i){var n=t("../utils");i.exports={bind:function(){var e=this,t=e.arg,i=e.key,r=e.compiler,s=e.binding.compiler;return r===s?void(this.alone=!0):void(t&&(r.bindings[t]||r.createBinding(t),r.observer.on("change:"+t,function(t){r.init||(e.lock||(e.lock=!0,n.nextTick(function(){e.lock=!1})),s.vm.$set(i,t))})))},update:function(e){this.alone||this.lock||(this.arg?this.vm.$set(this.arg,e):this.vm.$data=e)}}}),e.register("vue/src/directives/html.js",function(e,t,i){var n=t("../utils"),r=[].slice;i.exports={bind:function(){8===this.el.nodeType&&(this.nodes=[])},update:function(e){e=n.guard(e),this.nodes?this.swap(e):this.el.innerHTML=e},swap:function(e){for(var t=this.el.parentNode,i=this.nodes,s=i.length;s--;)t.removeChild(i[s]);var o=n.toFragment(e);this.nodes=r.call(o.childNodes),t.insertBefore(o,this.el)}}}),e.register("vue/src/directives/style.js",function(e,t,i){function n(e){return e[1].toUpperCase()}var r=/-([a-z])/g,s=["webkit","moz","ms"];i.exports={bind:function(){var e=this.arg;if(e){var t=e.charAt(0);"$"===t?(e=e.slice(1),this.prefixed=!0):"-"===t&&(e=e.slice(1)),this.prop=e.replace(r,n)}},update:function(e){var t=this.prop;if(t){if(this.el.style[t]=e,this.prefixed){t=t.charAt(0).toUpperCase()+t.slice(1);for(var i=s.length;i--;)this.el.style[s[i]+t]=e}}else this.el.style.cssText=e}}}),e.register("vue/src/directives/partial.js",function(e,t,i){t("../utils");i.exports={isLiteral:!0,bind:function(){var e=this.expression;if(e){var t=this.el,i=this.compiler,n=i.getOption("partials",e);if(n)if(n=n.cloneNode(!0),8===t.nodeType){var r=[].slice.call(n.childNodes),s=t.parentNode;s.insertBefore(n,t),s.removeChild(t),r.forEach(i.compile,i)}else t.innerHTML="",t.appendChild(n.cloneNode(!0))}}}}),e.register("vue/src/directives/view.js",function(e,t,i){i.exports={bind:function(){var e=this.raw=this.el,t=e.parentNode,i=this.ref=document.createComment("v-view");t.insertBefore(i,e),t.removeChild(e);for(var n,r=this.inner=document.createElement("div");n=e.firstChild;)r.appendChild(n)},update:function(e){this.unbind();var t=this.compiler.getOption("components",e);t&&(this.childVM=new t({el:this.raw.cloneNode(!0),parent:this.vm,compilerOptions:{rawContent:this.inner.cloneNode(!0)}}),this.el=this.childVM.$el,this.compiler.init?this.ref.parentNode.insertBefore(this.el,this.ref):this.childVM.$before(this.ref))},unbind:function(){this.childVM&&this.childVM.$destroy()}}}),e.alias("vue/src/main.js","vue/index.js"),"object"==typeof exports?module.exports=e("vue"):"function"==typeof define&&define.amd?define(function(){return e("vue")}):window.Vue=e("vue")}(); \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/batcher.js b/vendor/assets/javascripts/bower/vue/src/batcher.js new file mode 100644 index 0000000..1082ba1 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/batcher.js @@ -0,0 +1,45 @@ +var utils = require('./utils') + +function Batcher () { + this.reset() +} + +var BatcherProto = Batcher.prototype + +BatcherProto.push = function (job) { + if (!job.id || !this.has[job.id]) { + this.queue.push(job) + this.has[job.id] = job + if (!this.waiting) { + this.waiting = true + utils.nextTick(utils.bind(this.flush, this)) + } + } else if (job.override) { + var oldJob = this.has[job.id] + oldJob.cancelled = true + this.queue.push(job) + this.has[job.id] = job + } +} + +BatcherProto.flush = function () { + // before flush hook + if (this._preFlush) this._preFlush() + // do not cache length because more jobs might be pushed + // as we execute existing jobs + for (var i = 0; i < this.queue.length; i++) { + var job = this.queue[i] + if (!job.cancelled) { + job.execute() + } + } + this.reset() +} + +BatcherProto.reset = function () { + this.has = utils.hash() + this.queue = [] + this.waiting = false +} + +module.exports = Batcher \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/binding.js b/vendor/assets/javascripts/bower/vue/src/binding.js new file mode 100644 index 0000000..bd554d4 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/binding.js @@ -0,0 +1,103 @@ +var Batcher = require('./batcher'), + bindingBatcher = new Batcher(), + bindingId = 1 + +/** + * Binding class. + * + * each property on the viewmodel has one corresponding Binding object + * which has multiple directive instances on the DOM + * and multiple computed property dependents + */ +function Binding (compiler, key, isExp, isFn) { + this.id = bindingId++ + this.value = undefined + this.isExp = !!isExp + this.isFn = isFn + this.root = !this.isExp && key.indexOf('.') === -1 + this.compiler = compiler + this.key = key + this.dirs = [] + this.subs = [] + this.deps = [] + this.unbound = false +} + +var BindingProto = Binding.prototype + +/** + * Update value and queue instance updates. + */ +BindingProto.update = function (value) { + if (!this.isComputed || this.isFn) { + this.value = value + } + if (this.dirs.length || this.subs.length) { + var self = this + bindingBatcher.push({ + id: this.id, + execute: function () { + if (!self.unbound) { + self._update() + } + } + }) + } +} + +/** + * Actually update the directives. + */ +BindingProto._update = function () { + var i = this.dirs.length, + value = this.val() + while (i--) { + this.dirs[i].$update(value) + } + this.pub() +} + +/** + * Return the valuated value regardless + * of whether it is computed or not + */ +BindingProto.val = function () { + return this.isComputed && !this.isFn + ? this.value.$get() + : this.value +} + +/** + * Notify computed properties that depend on this binding + * to update themselves + */ +BindingProto.pub = function () { + var i = this.subs.length + while (i--) { + this.subs[i].update() + } +} + +/** + * Unbind the binding, remove itself from all of its dependencies + */ +BindingProto.unbind = function () { + // Indicate this has been unbound. + // It's possible this binding will be in + // the batcher's flush queue when its owner + // compiler has already been destroyed. + this.unbound = true + var i = this.dirs.length + while (i--) { + this.dirs[i].$unbind() + } + i = this.deps.length + var subs + while (i--) { + subs = this.deps[i].subs + var j = subs.indexOf(this) + if (j > -1) subs.splice(j, 1) + } +} + +module.exports = Binding \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/compiler.js b/vendor/assets/javascripts/bower/vue/src/compiler.js new file mode 100644 index 0000000..e6c6376 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/compiler.js @@ -0,0 +1,1016 @@ +var Emitter = require('./emitter'), + Observer = require('./observer'), + config = require('./config'), + utils = require('./utils'), + Binding = require('./binding'), + Directive = require('./directive'), + TextParser = require('./text-parser'), + DepsParser = require('./deps-parser'), + ExpParser = require('./exp-parser'), + ViewModel, + + // cache methods + slice = [].slice, + extend = utils.extend, + hasOwn = ({}).hasOwnProperty, + def = Object.defineProperty, + + // hooks to register + hooks = [ + 'created', 'ready', + 'beforeDestroy', 'afterDestroy', + 'attached', 'detached' + ], + + // list of priority directives + // that needs to be checked in specific order + priorityDirectives = [ + 'if', + 'repeat', + 'view', + 'component' + ] + +/** + * The DOM compiler + * scans a DOM node and compile bindings for a ViewModel + */ +function Compiler (vm, options) { + + var compiler = this, + key, i + + // default state + compiler.init = true + compiler.destroyed = false + + // process and extend options + options = compiler.options = options || {} + utils.processOptions(options) + + // copy compiler options + extend(compiler, options.compilerOptions) + // repeat indicates this is a v-repeat instance + compiler.repeat = compiler.repeat || false + // expCache will be shared between v-repeat instances + compiler.expCache = compiler.expCache || {} + + // initialize element + var el = compiler.el = compiler.setupElement(options) + utils.log('\nnew VM instance: ' + el.tagName + '\n') + + // set other compiler properties + compiler.vm = el.vue_vm = vm + compiler.bindings = utils.hash() + compiler.dirs = [] + compiler.deferred = [] + compiler.computed = [] + compiler.children = [] + compiler.emitter = new Emitter(vm) + + // create bindings for computed properties + if (options.methods) { + for (key in options.methods) { + compiler.createBinding(key) + } + } + + // create bindings for methods + if (options.computed) { + for (key in options.computed) { + compiler.createBinding(key) + } + } + + // VM --------------------------------------------------------------------- + + // set VM properties + vm.$ = {} + vm.$el = el + vm.$options = options + vm.$compiler = compiler + vm.$event = null + + // set parent & root + var parentVM = options.parent + if (parentVM) { + compiler.parent = parentVM.$compiler + parentVM.$compiler.children.push(compiler) + vm.$parent = parentVM + } + vm.$root = getRoot(compiler).vm + + // DATA ------------------------------------------------------------------- + + // setup observer + // this is necesarry for all hooks and data observation events + compiler.setupObserver() + + // initialize data + var data = compiler.data = options.data || {}, + defaultData = options.defaultData + if (defaultData) { + for (key in defaultData) { + if (!hasOwn.call(data, key)) { + data[key] = defaultData[key] + } + } + } + + // copy paramAttributes + var params = options.paramAttributes + if (params) { + i = params.length + while (i--) { + data[params[i]] = utils.checkNumber( + compiler.eval( + el.getAttribute(params[i]) + ) + ) + } + } + + // copy data properties to vm + // so user can access them in the created hook + extend(vm, data) + vm.$data = data + + // beforeCompile hook + compiler.execHook('created') + + // the user might have swapped the data ... + data = compiler.data = vm.$data + + // user might also set some properties on the vm + // in which case we should copy back to $data + var vmProp + for (key in vm) { + vmProp = vm[key] + if ( + key.charAt(0) !== '$' && + data[key] !== vmProp && + typeof vmProp !== 'function' + ) { + data[key] = vmProp + } + } + + // now we can observe the data. + // this will convert data properties to getter/setters + // and emit the first batch of set events, which will + // in turn create the corresponding bindings. + compiler.observeData(data) + + // COMPILE ---------------------------------------------------------------- + + // before compiling, resolve content insertion points + if (options.template) { + this.resolveContent() + } + + // now parse the DOM and bind directives. + // During this stage, we will also create bindings for + // encountered keypaths that don't have a binding yet. + compiler.compile(el, true) + + // Any directive that creates child VMs are deferred + // so that when they are compiled, all bindings on the + // parent VM have been created. + i = compiler.deferred.length + while (i--) { + compiler.bindDirective(compiler.deferred[i]) + } + compiler.deferred = null + + // extract dependencies for computed properties. + // this will evaluated all collected computed bindings + // and collect get events that are emitted. + if (this.computed.length) { + DepsParser.parse(this.computed) + } + + // done! + compiler.init = false + + // post compile / ready hook + compiler.execHook('ready') +} + +var CompilerProto = Compiler.prototype + +/** + * Initialize the VM/Compiler's element. + * Fill it in with the template if necessary. + */ +CompilerProto.setupElement = function (options) { + // create the node first + var el = typeof options.el === 'string' + ? document.querySelector(options.el) + : options.el || document.createElement(options.tagName || 'div') + + var template = options.template, + child, replacer, i, attr, attrs + + if (template) { + // collect anything already in there + if (el.hasChildNodes()) { + this.rawContent = document.createElement('div') + /* jshint boss: true */ + while (child = el.firstChild) { + this.rawContent.appendChild(child) + } + } + // replace option: use the first node in + // the template directly + if (options.replace && template.firstChild === template.lastChild) { + replacer = template.firstChild.cloneNode(true) + if (el.parentNode) { + el.parentNode.insertBefore(replacer, el) + el.parentNode.removeChild(el) + } + // copy over attributes + if (el.hasAttributes()) { + i = el.attributes.length + while (i--) { + attr = el.attributes[i] + replacer.setAttribute(attr.name, attr.value) + } + } + // replace + el = replacer + } else { + el.appendChild(template.cloneNode(true)) + } + + } + + // apply element options + if (options.id) el.id = options.id + if (options.className) el.className = options.className + attrs = options.attributes + if (attrs) { + for (attr in attrs) { + el.setAttribute(attr, attrs[attr]) + } + } + + return el +} + +/** + * Deal with insertion points + * per the Web Components spec + */ +CompilerProto.resolveContent = function () { + + var outlets = slice.call(this.el.getElementsByTagName('content')), + raw = this.rawContent, + outlet, select, i, j, main + + i = outlets.length + if (i) { + // first pass, collect corresponding content + // for each outlet. + while (i--) { + outlet = outlets[i] + if (raw) { + select = outlet.getAttribute('select') + if (select) { // select content + outlet.content = + slice.call(raw.querySelectorAll(select)) + } else { // default content + main = outlet + } + } else { // fallback content + outlet.content = + slice.call(outlet.childNodes) + } + } + // second pass, actually insert the contents + for (i = 0, j = outlets.length; i < j; i++) { + outlet = outlets[i] + if (outlet === main) continue + insert(outlet, outlet.content) + } + // finally insert the main content + if (raw && main) { + insert(main, slice.call(raw.childNodes)) + } + } + + function insert (outlet, contents) { + var parent = outlet.parentNode, + i = 0, j = contents.length + for (; i < j; i++) { + parent.insertBefore(contents[i], outlet) + } + parent.removeChild(outlet) + } + + this.rawContent = null +} + +/** + * Setup observer. + * The observer listens for get/set/mutate events on all VM + * values/objects and trigger corresponding binding updates. + * It also listens for lifecycle hooks. + */ +CompilerProto.setupObserver = function () { + + var compiler = this, + bindings = compiler.bindings, + options = compiler.options, + observer = compiler.observer = new Emitter(compiler.vm) + + // a hash to hold event proxies for each root level key + // so they can be referenced and removed later + observer.proxies = {} + + // add own listeners which trigger binding updates + observer + .on('get', onGet) + .on('set', onSet) + .on('mutate', onSet) + + // register hooks + var i = hooks.length, j, hook, fns + while (i--) { + hook = hooks[i] + fns = options[hook] + if (Array.isArray(fns)) { + j = fns.length + // since hooks were merged with child at head, + // we loop reversely. + while (j--) { + registerHook(hook, fns[j]) + } + } else if (fns) { + registerHook(hook, fns) + } + } + + // broadcast attached/detached hooks + observer + .on('hook:attached', function () { + broadcast(1) + }) + .on('hook:detached', function () { + broadcast(0) + }) + + function onGet (key) { + check(key) + DepsParser.catcher.emit('get', bindings[key]) + } + + function onSet (key, val, mutation) { + observer.emit('change:' + key, val, mutation) + check(key) + bindings[key].update(val) + } + + function registerHook (hook, fn) { + observer.on('hook:' + hook, function () { + fn.call(compiler.vm) + }) + } + + function broadcast (event) { + var children = compiler.children + if (children) { + var child, i = children.length + while (i--) { + child = children[i] + if (child.el.parentNode) { + event = 'hook:' + (event ? 'attached' : 'detached') + child.observer.emit(event) + child.emitter.emit(event) + } + } + } + } + + function check (key) { + if (!bindings[key]) { + compiler.createBinding(key) + } + } +} + +CompilerProto.observeData = function (data) { + + var compiler = this, + observer = compiler.observer + + // recursively observe nested properties + Observer.observe(data, '', observer) + + // also create binding for top level $data + // so it can be used in templates too + var $dataBinding = compiler.bindings['$data'] = new Binding(compiler, '$data') + $dataBinding.update(data) + + // allow $data to be swapped + def(compiler.vm, '$data', { + get: function () { + compiler.observer.emit('get', '$data') + return compiler.data + }, + set: function (newData) { + var oldData = compiler.data + Observer.unobserve(oldData, '', observer) + compiler.data = newData + Observer.copyPaths(newData, oldData) + Observer.observe(newData, '', observer) + update() + } + }) + + // emit $data change on all changes + observer + .on('set', onSet) + .on('mutate', onSet) + + function onSet (key) { + if (key !== '$data') update() + } + + function update () { + $dataBinding.update(compiler.data) + observer.emit('change:$data', compiler.data) + } +} + +/** + * Compile a DOM node (recursive) + */ +CompilerProto.compile = function (node, root) { + var nodeType = node.nodeType + if (nodeType === 1 && node.tagName !== 'SCRIPT') { // a normal node + this.compileElement(node, root) + } else if (nodeType === 3 && config.interpolate) { + this.compileTextNode(node) + } +} + +/** + * Check for a priority directive + * If it is present and valid, return true to skip the rest + */ +CompilerProto.checkPriorityDir = function (dirname, node, root) { + var expression, directive, Ctor + if ( + dirname === 'component' && + root !== true && + (Ctor = this.resolveComponent(node, undefined, true)) + ) { + directive = this.parseDirective(dirname, '', node) + directive.Ctor = Ctor + } else { + expression = utils.attr(node, dirname) + directive = expression && this.parseDirective(dirname, expression, node) + } + if (directive) { + if (root === true) { + utils.warn( + 'Directive v-' + dirname + ' cannot be used on an already instantiated ' + + 'VM\'s root node. Use it from the parent\'s template instead.' + ) + return + } + this.deferred.push(directive) + return true + } +} + +/** + * Compile normal directives on a node + */ +CompilerProto.compileElement = function (node, root) { + + // textarea is pretty annoying + // because its value creates childNodes which + // we don't want to compile. + if (node.tagName === 'TEXTAREA' && node.value) { + node.value = this.eval(node.value) + } + + // only compile if this element has attributes + // or its tagName contains a hyphen (which means it could + // potentially be a custom element) + if (node.hasAttributes() || node.tagName.indexOf('-') > -1) { + + // skip anything with v-pre + if (utils.attr(node, 'pre') !== null) { + return + } + + var i, l, j, k + + // check priority directives. + // if any of them are present, it will take over the node with a childVM + // so we can skip the rest + for (i = 0, l = priorityDirectives.length; i < l; i++) { + if (this.checkPriorityDir(priorityDirectives[i], node, root)) { + return + } + } + + // check transition & animation properties + node.vue_trans = utils.attr(node, 'transition') + node.vue_anim = utils.attr(node, 'animation') + node.vue_effect = this.eval(utils.attr(node, 'effect')) + + var prefix = config.prefix + '-', + attrs = slice.call(node.attributes), + params = this.options.paramAttributes, + attr, isDirective, exp, directives, directive, dirname + + for (i = 0, l = attrs.length; i < l; i++) { + + attr = attrs[i] + isDirective = false + + if (attr.name.indexOf(prefix) === 0) { + // a directive - split, parse and bind it. + isDirective = true + dirname = attr.name.slice(prefix.length) + // build with multiple: true + directives = this.parseDirective(dirname, attr.value, node, true) + // loop through clauses (separated by ",") + // inside each attribute + for (j = 0, k = directives.length; j < k; j++) { + directive = directives[j] + if (dirname === 'with') { + this.bindDirective(directive, this.parent) + } else { + this.bindDirective(directive) + } + } + } else if (config.interpolate) { + // non directive attribute, check interpolation tags + exp = TextParser.parseAttr(attr.value) + if (exp) { + directive = this.parseDirective('attr', attr.name + ':' + exp, node) + if (params && params.indexOf(attr.name) > -1) { + // a param attribute... we should use the parent binding + // to avoid circular updates like size={{size}} + this.bindDirective(directive, this.parent) + } else { + this.bindDirective(directive) + } + } + } + + if (isDirective && dirname !== 'cloak') { + node.removeAttribute(attr.name) + } + } + + } + + // recursively compile childNodes + if (node.hasChildNodes()) { + slice.call(node.childNodes).forEach(this.compile, this) + } +} + +/** + * Compile a text node + */ +CompilerProto.compileTextNode = function (node) { + + var tokens = TextParser.parse(node.nodeValue) + if (!tokens) return + var el, token, directive + + for (var i = 0, l = tokens.length; i < l; i++) { + + token = tokens[i] + directive = null + + if (token.key) { // a binding + if (token.key.charAt(0) === '>') { // a partial + el = document.createComment('ref') + directive = this.parseDirective('partial', token.key.slice(1), el) + } else { + if (!token.html) { // text binding + el = document.createTextNode('') + directive = this.parseDirective('text', token.key, el) + } else { // html binding + el = document.createComment(config.prefix + '-html') + directive = this.parseDirective('html', token.key, el) + } + } + } else { // a plain string + el = document.createTextNode(token) + } + + // insert node + node.parentNode.insertBefore(el, node) + // bind directive + this.bindDirective(directive) + + } + node.parentNode.removeChild(node) +} + +/** + * Parse a directive name/value pair into one or more + * directive instances + */ +CompilerProto.parseDirective = function (name, value, el, multiple) { + var compiler = this, + definition = compiler.getOption('directives', name) + if (definition) { + // parse into AST-like objects + var asts = Directive.parse(value) + return multiple + ? asts.map(build) + : build(asts[0]) + } + function build (ast) { + return new Directive(name, ast, definition, compiler, el) + } +} + +/** + * Add a directive instance to the correct binding & viewmodel + */ +CompilerProto.bindDirective = function (directive, bindingOwner) { + + if (!directive) return + + // keep track of it so we can unbind() later + this.dirs.push(directive) + + // for empty or literal directives, simply call its bind() + // and we're done. + if (directive.isEmpty || directive.isLiteral) { + if (directive.bind) directive.bind() + return + } + + // otherwise, we got more work to do... + var binding, + compiler = bindingOwner || this, + key = directive.key + + if (directive.isExp) { + // expression bindings are always created on current compiler + binding = compiler.createBinding(key, directive) + } else { + // recursively locate which compiler owns the binding + while (compiler) { + if (compiler.hasKey(key)) { + break + } else { + compiler = compiler.parent + } + } + compiler = compiler || this + binding = compiler.bindings[key] || compiler.createBinding(key) + } + binding.dirs.push(directive) + directive.binding = binding + + var value = binding.val() + // invoke bind hook if exists + if (directive.bind) { + directive.bind(value) + } + // set initial value + directive.$update(value, true) +} + +/** + * Create binding and attach getter/setter for a key to the viewmodel object + */ +CompilerProto.createBinding = function (key, directive) { + + utils.log(' created binding: ' + key) + + var compiler = this, + methods = compiler.options.methods, + isExp = directive && directive.isExp, + isFn = (directive && directive.isFn) || (methods && methods[key]), + bindings = compiler.bindings, + computed = compiler.options.computed, + binding = new Binding(compiler, key, isExp, isFn) + + if (isExp) { + // expression bindings are anonymous + compiler.defineExp(key, binding, directive) + } else if (isFn) { + bindings[key] = binding + binding.value = compiler.vm[key] = methods[key] + } else { + bindings[key] = binding + if (binding.root) { + // this is a root level binding. we need to define getter/setters for it. + if (computed && computed[key]) { + // computed property + compiler.defineComputed(key, binding, computed[key]) + } else if (key.charAt(0) !== '$') { + // normal property + compiler.defineProp(key, binding) + } else { + compiler.defineMeta(key, binding) + } + } else if (computed && computed[utils.baseKey(key)]) { + // nested path on computed property + compiler.defineExp(key, binding) + } else { + // ensure path in data so that computed properties that + // access the path don't throw an error and can collect + // dependencies + Observer.ensurePath(compiler.data, key) + var parentKey = key.slice(0, key.lastIndexOf('.')) + if (!bindings[parentKey]) { + // this is a nested value binding, but the binding for its parent + // has not been created yet. We better create that one too. + compiler.createBinding(parentKey) + } + } + } + return binding +} + +/** + * Define the getter/setter for a root-level property on the VM + * and observe the initial value + */ +CompilerProto.defineProp = function (key, binding) { + var compiler = this, + data = compiler.data, + ob = data.__emitter__ + + // make sure the key is present in data + // so it can be observed + if (!(hasOwn.call(data, key))) { + data[key] = undefined + } + + // if the data object is already observed, but the key + // is not observed, we need to add it to the observed keys. + if (ob && !(hasOwn.call(ob.values, key))) { + Observer.convertKey(data, key) + } + + binding.value = data[key] + + def(compiler.vm, key, { + get: function () { + return compiler.data[key] + }, + set: function (val) { + compiler.data[key] = val + } + }) +} + +/** + * Define a meta property, e.g. $index or $key, + * which is bindable but only accessible on the VM, + * not in the data. + */ +CompilerProto.defineMeta = function (key, binding) { + var ob = this.observer + binding.value = this.data[key] + delete this.data[key] + def(this.vm, key, { + get: function () { + if (Observer.shouldGet) ob.emit('get', key) + return binding.value + }, + set: function (val) { + ob.emit('set', key, val) + } + }) +} + +/** + * Define an expression binding, which is essentially + * an anonymous computed property + */ +CompilerProto.defineExp = function (key, binding, directive) { + var computedKey = directive && directive.computedKey, + exp = computedKey ? directive.expression : key, + getter = this.expCache[exp] + if (!getter) { + getter = this.expCache[exp] = ExpParser.parse(computedKey || key, this) + } + if (getter) { + this.markComputed(binding, getter) + } +} + +/** + * Define a computed property on the VM + */ +CompilerProto.defineComputed = function (key, binding, value) { + this.markComputed(binding, value) + def(this.vm, key, { + get: binding.value.$get, + set: binding.value.$set + }) +} + +/** + * Process a computed property binding + * so its getter/setter are bound to proper context + */ +CompilerProto.markComputed = function (binding, value) { + binding.isComputed = true + // bind the accessors to the vm + if (binding.isFn) { + binding.value = value + } else { + if (typeof value === 'function') { + value = { $get: value } + } + binding.value = { + $get: utils.bind(value.$get, this.vm), + $set: value.$set + ? utils.bind(value.$set, this.vm) + : undefined + } + } + // keep track for dep parsing later + this.computed.push(binding) +} + +/** + * Retrive an option from the compiler + */ +CompilerProto.getOption = function (type, id, silent) { + var opts = this.options, + parent = this.parent, + globalAssets = config.globalAssets, + res = (opts[type] && opts[type][id]) || ( + parent + ? parent.getOption(type, id, silent) + : globalAssets[type] && globalAssets[type][id] + ) + if (!res && !silent && typeof id === 'string') { + utils.warn('Unknown ' + type.slice(0, -1) + ': ' + id) + } + return res +} + +/** + * Emit lifecycle events to trigger hooks + */ +CompilerProto.execHook = function (event) { + event = 'hook:' + event + this.observer.emit(event) + this.emitter.emit(event) +} + +/** + * Check if a compiler's data contains a keypath + */ +CompilerProto.hasKey = function (key) { + var baseKey = utils.baseKey(key) + return hasOwn.call(this.data, baseKey) || + hasOwn.call(this.vm, baseKey) +} + +/** + * Do a one-time eval of a string that potentially + * includes bindings. It accepts additional raw data + * because we need to dynamically resolve v-component + * before a childVM is even compiled... + */ +CompilerProto.eval = function (exp, data) { + var parsed = TextParser.parseAttr(exp) + return parsed + ? ExpParser.eval(parsed, this, data) + : exp +} + +/** + * Resolve a Component constructor for an element + * with the data to be used + */ +CompilerProto.resolveComponent = function (node, data, test) { + + // late require to avoid circular deps + ViewModel = ViewModel || require('./viewmodel') + + var exp = utils.attr(node, 'component'), + tagName = node.tagName, + id = this.eval(exp, data), + tagId = (tagName.indexOf('-') > 0 && tagName.toLowerCase()), + Ctor = this.getOption('components', id || tagId, true) + + if (id && !Ctor) { + utils.warn('Unknown component: ' + id) + } + + return test + ? exp === '' + ? ViewModel + : Ctor + : Ctor || ViewModel +} + +/** + * Unbind and remove element + */ +CompilerProto.destroy = function () { + + // avoid being called more than once + // this is irreversible! + if (this.destroyed) return + + var compiler = this, + i, j, key, dir, dirs, binding, + vm = compiler.vm, + el = compiler.el, + directives = compiler.dirs, + computed = compiler.computed, + bindings = compiler.bindings, + children = compiler.children, + parent = compiler.parent + + compiler.execHook('beforeDestroy') + + // unobserve data + Observer.unobserve(compiler.data, '', compiler.observer) + + // unbind all direcitves + i = directives.length + while (i--) { + dir = directives[i] + // if this directive is an instance of an external binding + // e.g. a directive that refers to a variable on the parent VM + // we need to remove it from that binding's directives + // * empty and literal bindings do not have binding. + if (dir.binding && dir.binding.compiler !== compiler) { + dirs = dir.binding.dirs + if (dirs) { + j = dirs.indexOf(dir) + if (j > -1) dirs.splice(j, 1) + } + } + dir.$unbind() + } + + // unbind all computed, anonymous bindings + i = computed.length + while (i--) { + computed[i].unbind() + } + + // unbind all keypath bindings + for (key in bindings) { + binding = bindings[key] + if (binding) { + binding.unbind() + } + } + + // destroy all children + i = children.length + while (i--) { + children[i].destroy() + } + + // remove self from parent + if (parent) { + j = parent.children.indexOf(compiler) + if (j > -1) parent.children.splice(j, 1) + } + + // finally remove dom element + if (el === document.body) { + el.innerHTML = '' + } else { + vm.$remove() + } + el.vue_vm = null + + compiler.destroyed = true + // emit destroy hook + compiler.execHook('afterDestroy') + + // finally, unregister all listeners + compiler.observer.off() + compiler.emitter.off() +} + +// Helpers -------------------------------------------------------------------- + +/** + * shorthand for getting root compiler + */ +function getRoot (compiler) { + while (compiler.parent) { + compiler = compiler.parent + } + return compiler +} + +module.exports = Compiler \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/config.js b/vendor/assets/javascripts/bower/vue/src/config.js new file mode 100644 index 0000000..9a18434 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/config.js @@ -0,0 +1,19 @@ +var TextParser = require('./text-parser') + +module.exports = { + prefix : 'v', + debug : false, + silent : false, + enterClass : 'v-enter', + leaveClass : 'v-leave', + interpolate : true +} + +Object.defineProperty(module.exports, 'delimiters', { + get: function () { + return TextParser.delimiters + }, + set: function (delimiters) { + TextParser.setDelimiters(delimiters) + } +}) \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/deps-parser.js b/vendor/assets/javascripts/bower/vue/src/deps-parser.js new file mode 100644 index 0000000..2480336 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/deps-parser.js @@ -0,0 +1,65 @@ +var Emitter = require('./emitter'), + utils = require('./utils'), + Observer = require('./observer'), + catcher = new Emitter() + +/** + * Auto-extract the dependencies of a computed property + * by recording the getters triggered when evaluating it. + */ +function catchDeps (binding) { + if (binding.isFn) return + utils.log('\n- ' + binding.key) + var got = utils.hash() + binding.deps = [] + catcher.on('get', function (dep) { + var has = got[dep.key] + if ( + // avoid duplicate bindings + (has && has.compiler === dep.compiler) || + // avoid repeated items as dependency + // only when the binding is from self or the parent chain + (dep.compiler.repeat && !isParentOf(dep.compiler, binding.compiler)) + ) { + return + } + got[dep.key] = dep + utils.log(' - ' + dep.key) + binding.deps.push(dep) + dep.subs.push(binding) + }) + binding.value.$get() + catcher.off('get') +} + +/** + * Test if A is a parent of or equals B + */ +function isParentOf (a, b) { + while (b) { + if (a === b) { + return true + } + b = b.parent + } +} + +module.exports = { + + /** + * the observer that catches events triggered by getters + */ + catcher: catcher, + + /** + * parse a list of computed property bindings + */ + parse: function (bindings) { + utils.log('\nparsing dependencies...') + Observer.shouldGet = true + bindings.forEach(catchDeps) + Observer.shouldGet = false + utils.log('\ndone.') + } + +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/directive.js b/vendor/assets/javascripts/bower/vue/src/directive.js new file mode 100644 index 0000000..d68615f --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/directive.js @@ -0,0 +1,256 @@ +var dirId = 1, + ARG_RE = /^[\w\$-]+$/, + FILTER_TOKEN_RE = /[^\s'"]+|'[^']+'|"[^"]+"/g, + NESTING_RE = /^\$(parent|root)\./, + SINGLE_VAR_RE = /^[\w\.$]+$/, + QUOTE_RE = /"/g + +/** + * Directive class + * represents a single directive instance in the DOM + */ +function Directive (name, ast, definition, compiler, el) { + + this.id = dirId++ + this.name = name + this.compiler = compiler + this.vm = compiler.vm + this.el = el + this.computeFilters = false + this.key = ast.key + this.arg = ast.arg + this.expression = ast.expression + + var isEmpty = this.expression === '' + + // mix in properties from the directive definition + if (typeof definition === 'function') { + this[isEmpty ? 'bind' : 'update'] = definition + } else { + for (var prop in definition) { + this[prop] = definition[prop] + } + } + + // empty expression, we're done. + if (isEmpty || this.isEmpty) { + this.isEmpty = true + return + } + + this.expression = ( + this.isLiteral + ? compiler.eval(this.expression) + : this.expression + ).trim() + + var filters = ast.filters, + filter, fn, i, l, computed + if (filters) { + this.filters = [] + for (i = 0, l = filters.length; i < l; i++) { + filter = filters[i] + fn = this.compiler.getOption('filters', filter.name) + if (fn) { + filter.apply = fn + this.filters.push(filter) + if (fn.computed) { + computed = true + } + } + } + } + + if (!this.filters || !this.filters.length) { + this.filters = null + } + + if (computed) { + this.computedKey = Directive.inlineFilters(this.key, this.filters) + this.filters = null + } + + this.isExp = + computed || + !SINGLE_VAR_RE.test(this.key) || + NESTING_RE.test(this.key) + +} + +var DirProto = Directive.prototype + +/** + * called when a new value is set + * for computed properties, this will only be called once + * during initialization. + */ +DirProto.$update = function (value, init) { + if (this.$lock) return + if (init || value !== this.value || (value && typeof value === 'object')) { + this.value = value + if (this.update) { + this.update( + this.filters && !this.computeFilters + ? this.$applyFilters(value) + : value, + init + ) + } + } +} + +/** + * pipe the value through filters + */ +DirProto.$applyFilters = function (value) { + var filtered = value, filter + for (var i = 0, l = this.filters.length; i < l; i++) { + filter = this.filters[i] + filtered = filter.apply.apply(this.vm, [filtered].concat(filter.args)) + } + return filtered +} + +/** + * Unbind diretive + */ +DirProto.$unbind = function () { + // this can be called before the el is even assigned... + if (!this.el || !this.vm) return + if (this.unbind) this.unbind() + this.vm = this.el = this.binding = this.compiler = null +} + +// Exposed static methods ----------------------------------------------------- + +/** + * Parse a directive string into an Array of + * AST-like objects representing directives + */ +Directive.parse = function (str) { + + var inSingle = false, + inDouble = false, + curly = 0, + square = 0, + paren = 0, + begin = 0, + argIndex = 0, + dirs = [], + dir = {}, + lastFilterIndex = 0, + arg + + for (var c, i = 0, l = str.length; i < l; i++) { + c = str.charAt(i) + if (inSingle) { + // check single quote + if (c === "'") inSingle = !inSingle + } else if (inDouble) { + // check double quote + if (c === '"') inDouble = !inDouble + } else if (c === ',' && !paren && !curly && !square) { + // reached the end of a directive + pushDir() + // reset & skip the comma + dir = {} + begin = argIndex = lastFilterIndex = i + 1 + } else if (c === ':' && !dir.key && !dir.arg) { + // argument + arg = str.slice(begin, i).trim() + if (ARG_RE.test(arg)) { + argIndex = i + 1 + dir.arg = str.slice(begin, i).trim() + } + } else if (c === '|' && str.charAt(i + 1) !== '|' && str.charAt(i - 1) !== '|') { + if (dir.key === undefined) { + // first filter, end of key + lastFilterIndex = i + 1 + dir.key = str.slice(argIndex, i).trim() + } else { + // already has filter + pushFilter() + } + } else if (c === '"') { + inDouble = true + } else if (c === "'") { + inSingle = true + } else if (c === '(') { + paren++ + } else if (c === ')') { + paren-- + } else if (c === '[') { + square++ + } else if (c === ']') { + square-- + } else if (c === '{') { + curly++ + } else if (c === '}') { + curly-- + } + } + if (i === 0 || begin !== i) { + pushDir() + } + + function pushDir () { + dir.expression = str.slice(begin, i).trim() + if (dir.key === undefined) { + dir.key = str.slice(argIndex, i).trim() + } else if (lastFilterIndex !== begin) { + pushFilter() + } + if (i === 0 || dir.key) { + dirs.push(dir) + } + } + + function pushFilter () { + var exp = str.slice(lastFilterIndex, i).trim(), + filter + if (exp) { + filter = {} + var tokens = exp.match(FILTER_TOKEN_RE) + filter.name = tokens[0] + filter.args = tokens.length > 1 ? tokens.slice(1) : null + } + if (filter) { + (dir.filters = dir.filters || []).push(filter) + } + lastFilterIndex = i + 1 + } + + return dirs +} + +/** + * Inline computed filters so they become part + * of the expression + */ +Directive.inlineFilters = function (key, filters) { + var args, filter + for (var i = 0, l = filters.length; i < l; i++) { + filter = filters[i] + args = filter.args + ? ',"' + filter.args.map(escapeQuote).join('","') + '"' + : '' + key = 'this.$compiler.getOption("filters", "' + + filter.name + + '").call(this,' + + key + args + + ')' + } + return key +} + +/** + * Convert double quotes to single quotes + * so they don't mess up the generated function body + */ +function escapeQuote (v) { + return v.indexOf('"') > -1 + ? v.replace(QUOTE_RE, '\'') + : v +} + +module.exports = Directive \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/directives/html.js b/vendor/assets/javascripts/bower/vue/src/directives/html.js new file mode 100644 index 0000000..028a31b --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/directives/html.js @@ -0,0 +1,41 @@ +var utils = require('../utils'), + slice = [].slice + +/** + * Binding for innerHTML + */ +module.exports = { + + bind: function () { + // a comment node means this is a binding for + // {{{ inline unescaped html }}} + if (this.el.nodeType === 8) { + // hold nodes + this.nodes = [] + } + }, + + update: function (value) { + value = utils.guard(value) + if (this.nodes) { + this.swap(value) + } else { + this.el.innerHTML = value + } + }, + + swap: function (value) { + var parent = this.el.parentNode, + nodes = this.nodes, + i = nodes.length + // remove old nodes + while (i--) { + parent.removeChild(nodes[i]) + } + // convert new value to a fragment + var frag = utils.toFragment(value) + // save a reference to these nodes so we can remove later + this.nodes = slice.call(frag.childNodes) + parent.insertBefore(frag, this.el) + } +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/directives/if.js b/vendor/assets/javascripts/bower/vue/src/directives/if.js new file mode 100644 index 0000000..387ff29 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/directives/if.js @@ -0,0 +1,56 @@ +var utils = require('../utils') + +/** + * Manages a conditional child VM + */ +module.exports = { + + bind: function () { + + this.parent = this.el.parentNode + this.ref = document.createComment('vue-if') + this.Ctor = this.compiler.resolveComponent(this.el) + + // insert ref + this.parent.insertBefore(this.ref, this.el) + this.parent.removeChild(this.el) + + if (utils.attr(this.el, 'view')) { + utils.warn( + 'Conflict: v-if cannot be used together with v-view. ' + + 'Just set v-view\'s binding value to empty string to empty it.' + ) + } + if (utils.attr(this.el, 'repeat')) { + utils.warn( + 'Conflict: v-if cannot be used together with v-repeat. ' + + 'Use `v-show` or the `filterBy` filter instead.' + ) + } + }, + + update: function (value) { + + if (!value) { + this.unbind() + } else if (!this.childVM) { + this.childVM = new this.Ctor({ + el: this.el.cloneNode(true), + parent: this.vm + }) + if (this.compiler.init) { + this.parent.insertBefore(this.childVM.$el, this.ref) + } else { + this.childVM.$before(this.ref) + } + } + + }, + + unbind: function () { + if (this.childVM) { + this.childVM.$destroy() + this.childVM = null + } + } +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/directives/index.js b/vendor/assets/javascripts/bower/vue/src/directives/index.js new file mode 100644 index 0000000..cd8ab83 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/directives/index.js @@ -0,0 +1,129 @@ +var utils = require('../utils'), + config = require('../config'), + transition = require('../transition'), + directives = module.exports = utils.hash() + +/** + * Nest and manage a Child VM + */ +directives.component = { + isLiteral: true, + bind: function () { + if (!this.el.vue_vm) { + this.childVM = new this.Ctor({ + el: this.el, + parent: this.vm + }) + } + }, + unbind: function () { + if (this.childVM) { + this.childVM.$destroy() + } + } +} + +/** + * Binding HTML attributes + */ +directives.attr = { + bind: function () { + var params = this.vm.$options.paramAttributes + this.isParam = params && params.indexOf(this.arg) > -1 + }, + update: function (value) { + if (value || value === 0) { + this.el.setAttribute(this.arg, value) + } else { + this.el.removeAttribute(this.arg) + } + if (this.isParam) { + this.vm[this.arg] = utils.checkNumber(value) + } + } +} + +/** + * Binding textContent + */ +directives.text = { + bind: function () { + this.attr = this.el.nodeType === 3 + ? 'nodeValue' + : 'textContent' + }, + update: function (value) { + this.el[this.attr] = utils.guard(value) + } +} + +/** + * Binding CSS display property + */ +directives.show = function (value) { + var el = this.el, + target = value ? '' : 'none', + change = function () { + el.style.display = target + } + transition(el, value ? 1 : -1, change, this.compiler) +} + +/** + * Binding CSS classes + */ +directives['class'] = function (value) { + if (this.arg) { + utils[value ? 'addClass' : 'removeClass'](this.el, this.arg) + } else { + if (this.lastVal) { + utils.removeClass(this.el, this.lastVal) + } + if (value) { + utils.addClass(this.el, value) + this.lastVal = value + } + } +} + +/** + * Only removed after the owner VM is ready + */ +directives.cloak = { + isEmpty: true, + bind: function () { + var el = this.el + this.compiler.observer.once('hook:ready', function () { + el.removeAttribute(config.prefix + '-cloak') + }) + } +} + +/** + * Store a reference to self in parent VM's $ + */ +directives.ref = { + isLiteral: true, + bind: function () { + var id = this.expression + if (id) { + this.vm.$parent.$[id] = this.vm + } + }, + unbind: function () { + var id = this.expression + if (id) { + delete this.vm.$parent.$[id] + } + } +} + +directives.on = require('./on') +directives.repeat = require('./repeat') +directives.model = require('./model') +directives['if'] = require('./if') +directives['with'] = require('./with') +directives.html = require('./html') +directives.style = require('./style') +directives.partial = require('./partial') +directives.view = require('./view') \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/directives/model.js b/vendor/assets/javascripts/bower/vue/src/directives/model.js new file mode 100644 index 0000000..2946ce6 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/directives/model.js @@ -0,0 +1,174 @@ +var utils = require('../utils'), + isIE9 = navigator.userAgent.indexOf('MSIE 9.0') > 0, + filter = [].filter + +/** + * Returns an array of values from a multiple select + */ +function getMultipleSelectOptions (select) { + return filter + .call(select.options, function (option) { + return option.selected + }) + .map(function (option) { + return option.value || option.text + }) +} + +/** + * Two-way binding for form input elements + */ +module.exports = { + + bind: function () { + + var self = this, + el = self.el, + type = el.type, + tag = el.tagName + + self.lock = false + self.ownerVM = self.binding.compiler.vm + + // determine what event to listen to + self.event = + (self.compiler.options.lazy || + tag === 'SELECT' || + type === 'checkbox' || type === 'radio') + ? 'change' + : 'input' + + // determine the attribute to change when updating + self.attr = type === 'checkbox' + ? 'checked' + : (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA') + ? 'value' + : 'innerHTML' + + // select[multiple] support + if(tag === 'SELECT' && el.hasAttribute('multiple')) { + this.multi = true + } + + var compositionLock = false + self.cLock = function () { + compositionLock = true + } + self.cUnlock = function () { + compositionLock = false + } + el.addEventListener('compositionstart', this.cLock) + el.addEventListener('compositionend', this.cUnlock) + + // attach listener + self.set = self.filters + ? function () { + if (compositionLock) return + // if this directive has filters + // we need to let the vm.$set trigger + // update() so filters are applied. + // therefore we have to record cursor position + // so that after vm.$set changes the input + // value we can put the cursor back at where it is + var cursorPos + try { cursorPos = el.selectionStart } catch (e) {} + + self._set() + + // since updates are async + // we need to reset cursor position async too + utils.nextTick(function () { + if (cursorPos !== undefined) { + el.setSelectionRange(cursorPos, cursorPos) + } + }) + } + : function () { + if (compositionLock) return + // no filters, don't let it trigger update() + self.lock = true + + self._set() + + utils.nextTick(function () { + self.lock = false + }) + } + el.addEventListener(self.event, self.set) + + // fix shit for IE9 + // since it doesn't fire input on backspace / del / cut + if (isIE9) { + self.onCut = function () { + // cut event fires before the value actually changes + utils.nextTick(function () { + self.set() + }) + } + self.onDel = function (e) { + if (e.keyCode === 46 || e.keyCode === 8) { + self.set() + } + } + el.addEventListener('cut', self.onCut) + el.addEventListener('keyup', self.onDel) + } + }, + + _set: function () { + this.ownerVM.$set( + this.key, this.multi + ? getMultipleSelectOptions(this.el) + : this.el[this.attr] + ) + }, + + update: function (value, init) { + /* jshint eqeqeq: false */ + // sync back inline value if initial data is undefined + if (init && value === undefined) { + return this._set() + } + if (this.lock) return + var el = this.el + if (el.tagName === 'SELECT') { // select dropdown + el.selectedIndex = -1 + if(this.multi && Array.isArray(value)) { + value.forEach(this.updateSelect, this) + } else { + this.updateSelect(value) + } + } else if (el.type === 'radio') { // radio button + el.checked = value == el.value + } else if (el.type === 'checkbox') { // checkbox + el.checked = !!value + } else { + el[this.attr] = utils.guard(value) + } + }, + + updateSelect: function (value) { + /* jshint eqeqeq: false */ + // setting ', ''] + +map.thead = +map.tbody = +map.colgroup = +map.caption = +map.tfoot = [1, '', '
'] + +map.text = +map.circle = +map.ellipse = +map.line = +map.path = +map.polygon = +map.polyline = +map.rect = [1, '',''] + +var TAG_RE = /<([\w:]+)/ + +module.exports = function (template) { + + if (typeof template !== 'string') { + return template + } + + // template by ID + if (template.charAt(0) === '#') { + var templateNode = document.getElementById(template.slice(1)) + if (!templateNode) return + // if its a template tag and the browser supports it, + // its content is already a document fragment! + if (templateNode.tagName === 'TEMPLATE' && templateNode.content) { + return templateNode.content + } + template = templateNode.innerHTML + } + + var frag = document.createDocumentFragment(), + m = TAG_RE.exec(template) + // text only + if (!m) { + frag.appendChild(document.createTextNode(template)) + return frag + } + + var tag = m[1], + wrap = map[tag] || map._default, + depth = wrap[0], + prefix = wrap[1], + suffix = wrap[2], + node = document.createElement('div') + + node.innerHTML = prefix + template.trim() + suffix + while (depth--) node = node.lastChild + + // one element + if (node.firstChild === node.lastChild) { + frag.appendChild(node.firstChild) + return frag + } + + // multiple nodes, return a fragment + var child + /* jshint boss: true */ + while (child = node.firstChild) { + if (node.nodeType === 1) { + frag.appendChild(child) + } + } + return frag +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/main.js b/vendor/assets/javascripts/bower/vue/src/main.js new file mode 100644 index 0000000..449a3bc --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/main.js @@ -0,0 +1,186 @@ +var config = require('./config'), + ViewModel = require('./viewmodel'), + utils = require('./utils'), + makeHash = utils.hash, + assetTypes = ['directive', 'filter', 'partial', 'effect', 'component'] + +// require these so Browserify can catch them +// so they can be used in Vue.require +require('./observer') +require('./transition') + +ViewModel.options = config.globalAssets = { + directives : require('./directives'), + filters : require('./filters'), + partials : makeHash(), + effects : makeHash(), + components : makeHash() +} + +/** + * Expose asset registration methods + */ +assetTypes.forEach(function (type) { + ViewModel[type] = function (id, value) { + var hash = this.options[type + 's'] + if (!hash) { + hash = this.options[type + 's'] = makeHash() + } + if (!value) return hash[id] + if (type === 'partial') { + value = utils.toFragment(value) + } else if (type === 'component') { + value = utils.toConstructor(value) + } else if (type === 'filter') { + utils.checkFilter(value) + } + hash[id] = value + return this + } +}) + +/** + * Set config options + */ +ViewModel.config = function (opts, val) { + if (typeof opts === 'string') { + if (val === undefined) { + return config[opts] + } else { + config[opts] = val + } + } else { + utils.extend(config, opts) + } + return this +} + +/** + * Expose an interface for plugins + */ +ViewModel.use = function (plugin) { + if (typeof plugin === 'string') { + try { + plugin = require(plugin) + } catch (e) { + utils.warn('Cannot find plugin: ' + plugin) + return + } + } + + // additional parameters + var args = [].slice.call(arguments, 1) + args.unshift(this) + + if (typeof plugin.install === 'function') { + plugin.install.apply(plugin, args) + } else { + plugin.apply(null, args) + } + return this +} + +/** + * Expose internal modules for plugins + */ +ViewModel.require = function (path) { + return require('./' + path) +} + +ViewModel.extend = extend +ViewModel.nextTick = utils.nextTick + +/** + * Expose the main ViewModel class + * and add extend method + */ +function extend (options) { + + var ParentVM = this + + // extend data options need to be copied + // on instantiation + if (options.data) { + options.defaultData = options.data + delete options.data + } + + // inherit options + // but only when the super class is not the native Vue. + if (ParentVM !== ViewModel) { + options = inheritOptions(options, ParentVM.options, true) + } + utils.processOptions(options) + + var ExtendedVM = function (opts, asParent) { + if (!asParent) { + opts = inheritOptions(opts, options, true) + } + ParentVM.call(this, opts, true) + } + + // inherit prototype props + var proto = ExtendedVM.prototype = Object.create(ParentVM.prototype) + utils.defProtected(proto, 'constructor', ExtendedVM) + + // allow extended VM to be further extended + ExtendedVM.extend = extend + ExtendedVM.super = ParentVM + ExtendedVM.options = options + + // allow extended VM to add its own assets + assetTypes.forEach(function (type) { + ExtendedVM[type] = ViewModel[type] + }) + + // allow extended VM to use plugins + ExtendedVM.use = ViewModel.use + ExtendedVM.require = ViewModel.require + + return ExtendedVM +} + +/** + * Inherit options + * + * For options such as `data`, `vms`, `directives`, 'partials', + * they should be further extended. However extending should only + * be done at top level. + * + * `proto` is an exception because it's handled directly on the + * prototype. + * + * `el` is an exception because it's not allowed as an + * extension option, but only as an instance option. + */ +function inheritOptions (child, parent, topLevel) { + child = child || {} + if (!parent) return child + for (var key in parent) { + if (key === 'el') continue + var val = child[key], + parentVal = parent[key] + if (topLevel && typeof val === 'function' && parentVal) { + // merge hook functions into an array + child[key] = [val] + if (Array.isArray(parentVal)) { + child[key] = child[key].concat(parentVal) + } else { + child[key].push(parentVal) + } + } else if ( + topLevel && + (utils.isTrueObject(val) || utils.isTrueObject(parentVal)) + && !(parentVal instanceof ViewModel) + ) { + // merge toplevel object options + child[key] = inheritOptions(val, parentVal) + } else if (val === undefined) { + // inherit if child doesn't override + child[key] = parentVal + } + } + return child +} + +module.exports = ViewModel \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/observer.js b/vendor/assets/javascripts/bower/vue/src/observer.js new file mode 100644 index 0000000..ba7dfd0 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/observer.js @@ -0,0 +1,446 @@ +/* jshint proto:true */ + +var Emitter = require('./emitter'), + utils = require('./utils'), + // cache methods + def = utils.defProtected, + isObject = utils.isObject, + isArray = Array.isArray, + hasOwn = ({}).hasOwnProperty, + oDef = Object.defineProperty, + slice = [].slice, + // fix for IE + __proto__ problem + // define methods as inenumerable if __proto__ is present, + // otherwise enumerable so we can loop through and manually + // attach to array instances + hasProto = ({}).__proto__ + +// Array Mutation Handlers & Augmentations ------------------------------------ + +// The proxy prototype to replace the __proto__ of +// an observed array +var ArrayProxy = Object.create(Array.prototype) + +// intercept mutation methods +;[ + 'push', + 'pop', + 'shift', + 'unshift', + 'splice', + 'sort', + 'reverse' +].forEach(watchMutation) + +// Augment the ArrayProxy with convenience methods +def(ArrayProxy, '$set', function (index, data) { + return this.splice(index, 1, data)[0] +}, !hasProto) + +def(ArrayProxy, '$remove', function (index) { + if (typeof index !== 'number') { + index = this.indexOf(index) + } + if (index > -1) { + return this.splice(index, 1)[0] + } +}, !hasProto) + +/** + * Intercep a mutation event so we can emit the mutation info. + * we also analyze what elements are added/removed and link/unlink + * them with the parent Array. + */ +function watchMutation (method) { + def(ArrayProxy, method, function () { + + var args = slice.call(arguments), + result = Array.prototype[method].apply(this, args), + inserted, removed + + // determine new / removed elements + if (method === 'push' || method === 'unshift') { + inserted = args + } else if (method === 'pop' || method === 'shift') { + removed = [result] + } else if (method === 'splice') { + inserted = args.slice(2) + removed = result + } + + // link & unlink + linkArrayElements(this, inserted) + unlinkArrayElements(this, removed) + + // emit the mutation event + this.__emitter__.emit('mutate', '', this, { + method : method, + args : args, + result : result, + inserted : inserted, + removed : removed + }) + + return result + + }, !hasProto) +} + +/** + * Link new elements to an Array, so when they change + * and emit events, the owner Array can be notified. + */ +function linkArrayElements (arr, items) { + if (items) { + var i = items.length, item, owners + while (i--) { + item = items[i] + if (isWatchable(item)) { + // if object is not converted for observing + // convert it... + if (!item.__emitter__) { + convert(item) + watch(item) + } + owners = item.__emitter__.owners + if (owners.indexOf(arr) < 0) { + owners.push(arr) + } + } + } + } +} + +/** + * Unlink removed elements from the ex-owner Array. + */ +function unlinkArrayElements (arr, items) { + if (items) { + var i = items.length, item + while (i--) { + item = items[i] + if (item && item.__emitter__) { + var owners = item.__emitter__.owners + if (owners) owners.splice(owners.indexOf(arr)) + } + } + } +} + +// Object add/delete key augmentation ----------------------------------------- + +var ObjProxy = Object.create(Object.prototype) + +def(ObjProxy, '$add', function (key, val) { + if (hasOwn.call(this, key)) return + this[key] = val + convertKey(this, key, true) +}, !hasProto) + +def(ObjProxy, '$delete', function (key) { + if (!(hasOwn.call(this, key))) return + // trigger set events + this[key] = undefined + delete this[key] + this.__emitter__.emit('delete', key) +}, !hasProto) + +// Watch Helpers -------------------------------------------------------------- + +/** + * Check if a value is watchable + */ +function isWatchable (obj) { + return typeof obj === 'object' && obj && !obj.$compiler +} + +/** + * Convert an Object/Array to give it a change emitter. + */ +function convert (obj) { + if (obj.__emitter__) return true + var emitter = new Emitter() + def(obj, '__emitter__', emitter) + emitter + .on('set', function (key, val, propagate) { + if (propagate) propagateChange(obj) + }) + .on('mutate', function () { + propagateChange(obj) + }) + emitter.values = utils.hash() + emitter.owners = [] + return false +} + +/** + * Propagate an array element's change to its owner arrays + */ +function propagateChange (obj) { + var owners = obj.__emitter__.owners, + i = owners.length + while (i--) { + owners[i].__emitter__.emit('set', '', '', true) + } +} + +/** + * Watch target based on its type + */ +function watch (obj) { + if (isArray(obj)) { + watchArray(obj) + } else { + watchObject(obj) + } +} + +/** + * Augment target objects with modified + * methods + */ +function augment (target, src) { + if (hasProto) { + target.__proto__ = src + } else { + for (var key in src) { + def(target, key, src[key]) + } + } +} + +/** + * Watch an Object, recursive. + */ +function watchObject (obj) { + augment(obj, ObjProxy) + for (var key in obj) { + convertKey(obj, key) + } +} + +/** + * Watch an Array, overload mutation methods + * and add augmentations by intercepting the prototype chain + */ +function watchArray (arr) { + augment(arr, ArrayProxy) + linkArrayElements(arr, arr) +} + +/** + * Define accessors for a property on an Object + * so it emits get/set events. + * Then watch the value itself. + */ +function convertKey (obj, key, propagate) { + var keyPrefix = key.charAt(0) + if (keyPrefix === '$' || keyPrefix === '_') { + return + } + // emit set on bind + // this means when an object is observed it will emit + // a first batch of set events. + var emitter = obj.__emitter__, + values = emitter.values + + init(obj[key], propagate) + + oDef(obj, key, { + enumerable: true, + configurable: true, + get: function () { + var value = values[key] + // only emit get on tip values + if (pub.shouldGet) { + emitter.emit('get', key) + } + return value + }, + set: function (newVal) { + var oldVal = values[key] + unobserve(oldVal, key, emitter) + copyPaths(newVal, oldVal) + // an immediate property should notify its parent + // to emit set for itself too + init(newVal, true) + } + }) + + function init (val, propagate) { + values[key] = val + emitter.emit('set', key, val, propagate) + if (isArray(val)) { + emitter.emit('set', key + '.length', val.length, propagate) + } + observe(val, key, emitter) + } +} + +/** + * When a value that is already converted is + * observed again by another observer, we can skip + * the watch conversion and simply emit set event for + * all of its properties. + */ +function emitSet (obj) { + var emitter = obj && obj.__emitter__ + if (!emitter) return + if (isArray(obj)) { + emitter.emit('set', 'length', obj.length) + } else { + var key, val + for (key in obj) { + val = obj[key] + emitter.emit('set', key, val) + emitSet(val) + } + } +} + +/** + * Make sure all the paths in an old object exists + * in a new object. + * So when an object changes, all missing keys will + * emit a set event with undefined value. + */ +function copyPaths (newObj, oldObj) { + if (!isObject(newObj) || !isObject(oldObj)) { + return + } + var path, oldVal, newVal + for (path in oldObj) { + if (!(hasOwn.call(newObj, path))) { + oldVal = oldObj[path] + if (isArray(oldVal)) { + newObj[path] = [] + } else if (isObject(oldVal)) { + newVal = newObj[path] = {} + copyPaths(newVal, oldVal) + } else { + newObj[path] = undefined + } + } + } +} + +/** + * walk along a path and make sure it can be accessed + * and enumerated in that object + */ +function ensurePath (obj, key) { + var path = key.split('.'), sec + for (var i = 0, d = path.length - 1; i < d; i++) { + sec = path[i] + if (!obj[sec]) { + obj[sec] = {} + if (obj.__emitter__) convertKey(obj, sec) + } + obj = obj[sec] + } + if (isObject(obj)) { + sec = path[i] + if (!(hasOwn.call(obj, sec))) { + obj[sec] = undefined + if (obj.__emitter__) convertKey(obj, sec) + } + } +} + +// Main API Methods ----------------------------------------------------------- + +/** + * Observe an object with a given path, + * and proxy get/set/mutate events to the provided observer. + */ +function observe (obj, rawPath, observer) { + + if (!isWatchable(obj)) return + + var path = rawPath ? rawPath + '.' : '', + alreadyConverted = convert(obj), + emitter = obj.__emitter__ + + // setup proxy listeners on the parent observer. + // we need to keep reference to them so that they + // can be removed when the object is un-observed. + observer.proxies = observer.proxies || {} + var proxies = observer.proxies[path] = { + get: function (key) { + observer.emit('get', path + key) + }, + set: function (key, val, propagate) { + if (key) observer.emit('set', path + key, val) + // also notify observer that the object itself changed + // but only do so when it's a immediate property. this + // avoids duplicate event firing. + if (rawPath && propagate) { + observer.emit('set', rawPath, obj, true) + } + }, + mutate: function (key, val, mutation) { + // if the Array is a root value + // the key will be null + var fixedPath = key ? path + key : rawPath + observer.emit('mutate', fixedPath, val, mutation) + // also emit set for Array's length when it mutates + var m = mutation.method + if (m !== 'sort' && m !== 'reverse') { + observer.emit('set', fixedPath + '.length', val.length) + } + } + } + + // attach the listeners to the child observer. + // now all the events will propagate upwards. + emitter + .on('get', proxies.get) + .on('set', proxies.set) + .on('mutate', proxies.mutate) + + if (alreadyConverted) { + // for objects that have already been converted, + // emit set events for everything inside + emitSet(obj) + } else { + watch(obj) + } +} + +/** + * Cancel observation, turn off the listeners. + */ +function unobserve (obj, path, observer) { + + if (!obj || !obj.__emitter__) return + + path = path ? path + '.' : '' + var proxies = observer.proxies[path] + if (!proxies) return + + // turn off listeners + obj.__emitter__ + .off('get', proxies.get) + .off('set', proxies.set) + .off('mutate', proxies.mutate) + + // remove reference + observer.proxies[path] = null +} + +// Expose API ----------------------------------------------------------------- + +var pub = module.exports = { + + // whether to emit get events + // only enabled during dependency parsing + shouldGet : false, + + observe : observe, + unobserve : unobserve, + ensurePath : ensurePath, + copyPaths : copyPaths, + watch : watch, + convert : convert, + convertKey : convertKey +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/text-parser.js b/vendor/assets/javascripts/bower/vue/src/text-parser.js new file mode 100644 index 0000000..e6c9350 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/text-parser.js @@ -0,0 +1,95 @@ +var openChar = '{', + endChar = '}', + ESCAPE_RE = /[-.*+?^${}()|[\]\/\\]/g, + BINDING_RE = buildInterpolationRegex(), + // lazy require + Directive + +function buildInterpolationRegex () { + var open = escapeRegex(openChar), + end = escapeRegex(endChar) + return new RegExp(open + open + open + '?(.+?)' + end + '?' + end + end) +} + +function escapeRegex (str) { + return str.replace(ESCAPE_RE, '\\$&') +} + +function setDelimiters (delimiters) { + exports.delimiters = delimiters + openChar = delimiters[0] + endChar = delimiters[1] + BINDING_RE = buildInterpolationRegex() +} + +/** + * Parse a piece of text, return an array of tokens + * token types: + * 1. plain string + * 2. object with key = binding key + * 3. object with key & html = true + */ +function parse (text) { + if (!BINDING_RE.test(text)) return null + var m, i, token, match, tokens = [] + /* jshint boss: true */ + while (m = text.match(BINDING_RE)) { + i = m.index + if (i > 0) tokens.push(text.slice(0, i)) + token = { key: m[1].trim() } + match = m[0] + token.html = + match.charAt(2) === openChar && + match.charAt(match.length - 3) === endChar + tokens.push(token) + text = text.slice(i + m[0].length) + } + if (text.length) tokens.push(text) + return tokens +} + +/** + * Parse an attribute value with possible interpolation tags + * return a Directive-friendly expression + * + * e.g. a {{b}} c => "a " + b + " c" + */ +function parseAttr (attr) { + Directive = Directive || require('./directive') + var tokens = parse(attr) + if (!tokens) return null + if (tokens.length === 1) return tokens[0].key + var res = [], token + for (var i = 0, l = tokens.length; i < l; i++) { + token = tokens[i] + res.push( + token.key + ? inlineFilters(token.key) + : ('"' + token + '"') + ) + } + return res.join('+') +} + +/** + * Inlines any possible filters in a binding + * so that we can combine everything into a huge expression + */ +function inlineFilters (key) { + if (key.indexOf('|') > -1) { + var dirs = Directive.parse(key), + dir = dirs && dirs[0] + if (dir && dir.filters) { + key = Directive.inlineFilters( + dir.key, + dir.filters + ) + } + } + return '(' + key + ')' +} + +exports.parse = parse +exports.parseAttr = parseAttr +exports.setDelimiters = setDelimiters +exports.delimiters = [openChar, endChar] \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/transition.js b/vendor/assets/javascripts/bower/vue/src/transition.js new file mode 100644 index 0000000..d708b36 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/transition.js @@ -0,0 +1,226 @@ +var endEvents = sniffEndEvents(), + config = require('./config'), + // batch enter animations so we only force the layout once + Batcher = require('./batcher'), + batcher = new Batcher(), + // cache timer functions + setTO = window.setTimeout, + clearTO = window.clearTimeout, + // exit codes for testing + codes = { + CSS_E : 1, + CSS_L : 2, + JS_E : 3, + JS_L : 4, + CSS_SKIP : -1, + JS_SKIP : -2, + JS_SKIP_E : -3, + JS_SKIP_L : -4, + INIT : -5, + SKIP : -6 + } + +// force layout before triggering transitions/animations +batcher._preFlush = function () { + /* jshint unused: false */ + var f = document.body.offsetHeight +} + +/** + * stage: + * 1 = enter + * 2 = leave + */ +var transition = module.exports = function (el, stage, cb, compiler) { + + var changeState = function () { + cb() + compiler.execHook(stage > 0 ? 'attached' : 'detached') + } + + if (compiler.init) { + changeState() + return codes.INIT + } + + var hasTransition = el.vue_trans === '', + hasAnimation = el.vue_anim === '', + effectId = el.vue_effect + + if (effectId) { + return applyTransitionFunctions( + el, + stage, + changeState, + effectId, + compiler + ) + } else if (hasTransition || hasAnimation) { + return applyTransitionClass( + el, + stage, + changeState, + hasAnimation + ) + } else { + changeState() + return codes.SKIP + } + +} + +transition.codes = codes + +/** + * Togggle a CSS class to trigger transition + */ +function applyTransitionClass (el, stage, changeState, hasAnimation) { + + if (!endEvents.trans) { + changeState() + return codes.CSS_SKIP + } + + // if the browser supports transition, + // it must have classList... + var onEnd, + classList = el.classList, + existingCallback = el.vue_trans_cb, + enterClass = config.enterClass, + leaveClass = config.leaveClass, + endEvent = hasAnimation ? endEvents.anim : endEvents.trans + + // cancel unfinished callbacks and jobs + if (existingCallback) { + el.removeEventListener(endEvent, existingCallback) + classList.remove(enterClass) + classList.remove(leaveClass) + el.vue_trans_cb = null + } + + if (stage > 0) { // enter + + // set to enter state before appending + classList.add(enterClass) + // append + changeState() + // trigger transition + if (!hasAnimation) { + batcher.push({ + execute: function () { + classList.remove(enterClass) + } + }) + } else { + onEnd = function (e) { + if (e.target === el) { + el.removeEventListener(endEvent, onEnd) + el.vue_trans_cb = null + classList.remove(enterClass) + } + } + el.addEventListener(endEvent, onEnd) + el.vue_trans_cb = onEnd + } + return codes.CSS_E + + } else { // leave + + if (el.offsetWidth || el.offsetHeight) { + // trigger hide transition + classList.add(leaveClass) + onEnd = function (e) { + if (e.target === el) { + el.removeEventListener(endEvent, onEnd) + el.vue_trans_cb = null + // actually remove node here + changeState() + classList.remove(leaveClass) + } + } + // attach transition end listener + el.addEventListener(endEvent, onEnd) + el.vue_trans_cb = onEnd + } else { + // directly remove invisible elements + changeState() + } + return codes.CSS_L + + } + +} + +function applyTransitionFunctions (el, stage, changeState, effectId, compiler) { + + var funcs = compiler.getOption('effects', effectId) + if (!funcs) { + changeState() + return codes.JS_SKIP + } + + var enter = funcs.enter, + leave = funcs.leave, + timeouts = el.vue_timeouts + + // clear previous timeouts + if (timeouts) { + var i = timeouts.length + while (i--) { + clearTO(timeouts[i]) + } + } + + timeouts = el.vue_timeouts = [] + function timeout (cb, delay) { + var id = setTO(function () { + cb() + timeouts.splice(timeouts.indexOf(id), 1) + if (!timeouts.length) { + el.vue_timeouts = null + } + }, delay) + timeouts.push(id) + } + + if (stage > 0) { // enter + if (typeof enter !== 'function') { + changeState() + return codes.JS_SKIP_E + } + enter(el, changeState, timeout) + return codes.JS_E + } else { // leave + if (typeof leave !== 'function') { + changeState() + return codes.JS_SKIP_L + } + leave(el, changeState, timeout) + return codes.JS_L + } + +} + +/** + * Sniff proper transition end event name + */ +function sniffEndEvents () { + var el = document.createElement('vue'), + defaultEvent = 'transitionend', + events = { + 'transition' : defaultEvent, + 'mozTransition' : defaultEvent, + 'webkitTransition' : 'webkitTransitionEnd' + }, + ret = {} + for (var name in events) { + if (el.style[name] !== undefined) { + ret.trans = events[name] + break + } + } + ret.anim = el.style.animation === '' + ? 'animationend' + : 'webkitAnimationEnd' + return ret +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/utils.js b/vendor/assets/javascripts/bower/vue/src/utils.js new file mode 100644 index 0000000..b41aaf9 --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/utils.js @@ -0,0 +1,307 @@ +var config = require('./config'), + toString = ({}).toString, + win = window, + console = win.console, + def = Object.defineProperty, + OBJECT = 'object', + THIS_RE = /[^\w]this[^\w]/, + hasClassList = 'classList' in document.documentElement, + ViewModel // late def + +var defer = + win.requestAnimationFrame || + win.webkitRequestAnimationFrame || + win.setTimeout + +var utils = module.exports = { + + /** + * Convert a string template to a dom fragment + */ + toFragment: require('./fragment'), + + /** + * get a value from an object keypath + */ + get: function (obj, key) { + /* jshint eqeqeq: false */ + if (key.indexOf('.') < 0) { + return obj[key] + } + var path = key.split('.'), + d = -1, l = path.length + while (++d < l && obj != null) { + obj = obj[path[d]] + } + return obj + }, + + /** + * set a value to an object keypath + */ + set: function (obj, key, val) { + /* jshint eqeqeq: false */ + if (key.indexOf('.') < 0) { + obj[key] = val + return + } + var path = key.split('.'), + d = -1, l = path.length - 1 + while (++d < l) { + if (obj[path[d]] == null) { + obj[path[d]] = {} + } + obj = obj[path[d]] + } + obj[path[d]] = val + }, + + /** + * return the base segment of a keypath + */ + baseKey: function (key) { + return key.indexOf('.') > 0 + ? key.split('.')[0] + : key + }, + + /** + * Create a prototype-less object + * which is a better hash/map + */ + hash: function () { + return Object.create(null) + }, + + /** + * get an attribute and remove it. + */ + attr: function (el, type) { + var attr = config.prefix + '-' + type, + val = el.getAttribute(attr) + if (val !== null) { + el.removeAttribute(attr) + } + return val + }, + + /** + * Define an ienumerable property + * This avoids it being included in JSON.stringify + * or for...in loops. + */ + defProtected: function (obj, key, val, enumerable, writable) { + def(obj, key, { + value : val, + enumerable : enumerable, + writable : writable, + configurable : true + }) + }, + + /** + * A less bullet-proof but more efficient type check + * than Object.prototype.toString + */ + isObject: function (obj) { + return typeof obj === OBJECT && obj && !Array.isArray(obj) + }, + + /** + * A more accurate but less efficient type check + */ + isTrueObject: function (obj) { + return toString.call(obj) === '[object Object]' + }, + + /** + * Most simple bind + * enough for the usecase and fast than native bind() + */ + bind: function (fn, ctx) { + return function (arg) { + return fn.call(ctx, arg) + } + }, + + /** + * Make sure null and undefined output empty string + */ + guard: function (value) { + /* jshint eqeqeq: false, eqnull: true */ + return value == null + ? '' + : (typeof value == 'object') + ? JSON.stringify(value) + : value + }, + + /** + * When setting value on the VM, parse possible numbers + */ + checkNumber: function (value) { + return (isNaN(value) || value === null || typeof value === 'boolean') + ? value + : Number(value) + }, + + /** + * simple extend + */ + extend: function (obj, ext) { + for (var key in ext) { + if (obj[key] !== ext[key]) { + obj[key] = ext[key] + } + } + return obj + }, + + /** + * filter an array with duplicates into uniques + */ + unique: function (arr) { + var hash = utils.hash(), + i = arr.length, + key, res = [] + while (i--) { + key = arr[i] + if (hash[key]) continue + hash[key] = 1 + res.push(key) + } + return res + }, + + /** + * Convert the object to a ViewModel constructor + * if it is not already one + */ + toConstructor: function (obj) { + ViewModel = ViewModel || require('./viewmodel') + return utils.isObject(obj) + ? ViewModel.extend(obj) + : typeof obj === 'function' + ? obj + : null + }, + + /** + * Check if a filter function contains references to `this` + * If yes, mark it as a computed filter. + */ + checkFilter: function (filter) { + if (THIS_RE.test(filter.toString())) { + filter.computed = true + } + }, + + /** + * convert certain option values to the desired format. + */ + processOptions: function (options) { + var components = options.components, + partials = options.partials, + template = options.template, + filters = options.filters, + key + if (components) { + for (key in components) { + components[key] = utils.toConstructor(components[key]) + } + } + if (partials) { + for (key in partials) { + partials[key] = utils.toFragment(partials[key]) + } + } + if (filters) { + for (key in filters) { + utils.checkFilter(filters[key]) + } + } + if (template) { + options.template = utils.toFragment(template) + } + }, + + /** + * used to defer batch updates + */ + nextTick: function (cb) { + defer(cb, 0) + }, + + /** + * add class for IE9 + * uses classList if available + */ + addClass: function (el, cls) { + if (hasClassList) { + el.classList.add(cls) + } else { + var cur = ' ' + el.className + ' ' + if (cur.indexOf(' ' + cls + ' ') < 0) { + el.className = (cur + cls).trim() + } + } + }, + + /** + * remove class for IE9 + */ + removeClass: function (el, cls) { + if (hasClassList) { + el.classList.remove(cls) + } else { + var cur = ' ' + el.className + ' ', + tar = ' ' + cls + ' ' + while (cur.indexOf(tar) >= 0) { + cur = cur.replace(tar, ' ') + } + el.className = cur.trim() + } + }, + + /** + * Convert an object to Array + * used in v-repeat and array filters + */ + objectToArray: function (obj) { + var res = [], val, data + for (var key in obj) { + val = obj[key] + data = utils.isObject(val) + ? val + : { $value: val } + data.$key = key + res.push(data) + } + return res + } +} + +enableDebug() +function enableDebug () { + /** + * log for debugging + */ + utils.log = function (msg) { + if (config.debug && console) { + console.log(msg) + } + } + + /** + * warnings, traces by default + * can be suppressed by `silent` option. + */ + utils.warn = function (msg) { + if (!config.silent && console) { + console.warn(msg) + if (config.debug && console.trace) { + console.trace() + } + } + } +} \ No newline at end of file diff --git a/vendor/assets/javascripts/bower/vue/src/viewmodel.js b/vendor/assets/javascripts/bower/vue/src/viewmodel.js new file mode 100644 index 0000000..3dfb54d --- /dev/null +++ b/vendor/assets/javascripts/bower/vue/src/viewmodel.js @@ -0,0 +1,180 @@ +var Compiler = require('./compiler'), + utils = require('./utils'), + transition = require('./transition'), + Batcher = require('./batcher'), + slice = [].slice, + def = utils.defProtected, + nextTick = utils.nextTick, + + // batch $watch callbacks + watcherBatcher = new Batcher(), + watcherId = 1 + +/** + * ViewModel exposed to the user that holds data, + * computed properties, event handlers + * and a few reserved methods + */ +function ViewModel (options) { + // just compile. options are passed directly to compiler + new Compiler(this, options) +} + +// All VM prototype methods are inenumerable +// so it can be stringified/looped through as raw data +var VMProto = ViewModel.prototype + +/** + * Convenience function to get a value from + * a keypath + */ +def(VMProto, '$get', function (key) { + var val = utils.get(this, key) + return val === undefined && this.$parent + ? this.$parent.$get(key) + : val +}) + +/** + * Convenience function to set an actual nested value + * from a flat key string. Used in directives. + */ +def(VMProto, '$set', function (key, value) { + utils.set(this, key, value) +}) + +/** + * watch a key on the viewmodel for changes + * fire callback with new value + */ +def(VMProto, '$watch', function (key, callback) { + // save a unique id for each watcher + var id = watcherId++, + self = this + function on () { + var args = slice.call(arguments) + watcherBatcher.push({ + id: id, + override: true, + execute: function () { + callback.apply(self, args) + } + }) + } + callback._fn = on + self.$compiler.observer.on('change:' + key, on) +}) + +/** + * unwatch a key + */ +def(VMProto, '$unwatch', function (key, callback) { + // workaround here + // since the emitter module checks callback existence + // by checking the length of arguments + var args = ['change:' + key], + ob = this.$compiler.observer + if (callback) args.push(callback._fn) + ob.off.apply(ob, args) +}) + +/** + * unbind everything, remove everything + */ +def(VMProto, '$destroy', function () { + this.$compiler.destroy() +}) + +/** + * broadcast an event to all child VMs recursively. + */ +def(VMProto, '$broadcast', function () { + var children = this.$compiler.children, + i = children.length, + child + while (i--) { + child = children[i] + child.emitter.applyEmit.apply(child.emitter, arguments) + child.vm.$broadcast.apply(child.vm, arguments) + } +}) + +/** + * emit an event that propagates all the way up to parent VMs. + */ +def(VMProto, '$dispatch', function () { + var compiler = this.$compiler, + emitter = compiler.emitter, + parent = compiler.parent + emitter.applyEmit.apply(emitter, arguments) + if (parent) { + parent.vm.$dispatch.apply(parent.vm, arguments) + } +}) + +/** + * delegate on/off/once to the compiler's emitter + */ +;['emit', 'on', 'off', 'once'].forEach(function (method) { + // internal emit has fixed number of arguments. + // exposed emit uses the external version + // with fn.apply. + var realMethod = method === 'emit' + ? 'applyEmit' + : method + def(VMProto, '$' + method, function () { + var emitter = this.$compiler.emitter + emitter[realMethod].apply(emitter, arguments) + }) +}) + +// DOM convenience methods + +def(VMProto, '$appendTo', function (target, cb) { + target = query(target) + var el = this.$el + transition(el, 1, function () { + target.appendChild(el) + if (cb) nextTick(cb) + }, this.$compiler) +}) + +def(VMProto, '$remove', function (cb) { + var el = this.$el + transition(el, -1, function () { + if (el.parentNode) { + el.parentNode.removeChild(el) + } + if (cb) nextTick(cb) + }, this.$compiler) +}) + +def(VMProto, '$before', function (target, cb) { + target = query(target) + var el = this.$el + transition(el, 1, function () { + target.parentNode.insertBefore(el, target) + if (cb) nextTick(cb) + }, this.$compiler) +}) + +def(VMProto, '$after', function (target, cb) { + target = query(target) + var el = this.$el + transition(el, 1, function () { + if (target.nextSibling) { + target.parentNode.insertBefore(el, target.nextSibling) + } else { + target.parentNode.appendChild(el) + } + if (cb) nextTick(cb) + }, this.$compiler) +}) + +function query (el) { + return typeof el === 'string' + ? document.querySelector(el) + : el +} + +module.exports = ViewModel \ No newline at end of file