diff --git a/bower.json b/bower.json index be8da979894..88f67678647 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "vue", - "version": "0.8.6", + "version": "0.8.7", "main": "dist/vue.js", "description": "Simple, Fast & Composable MVVM for building interative interfaces", "authors": ["Evan You "], diff --git a/component.json b/component.json index 76eb266cc59..821a0166925 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "vue", - "version": "0.8.6", + "version": "0.8.7", "main": "src/main.js", "author": "Evan You ", "description": "Simple, Fast & Composable MVVM for building interative interfaces", diff --git a/dist/vue.js b/dist/vue.js index d7badec7c71..56feaf33880 100644 --- a/dist/vue.js +++ b/dist/vue.js @@ -1,5 +1,5 @@ /* - Vue.js v0.8.6 + Vue.js v0.8.7 (c) 2014 Evan You License: MIT */ @@ -376,9 +376,37 @@ Emitter.prototype.hasListeners = function(event){ require.register("vue/src/main.js", function(exports, require, module){ var config = require('./config'), ViewModel = require('./viewmodel'), - directives = require('./directives'), - filters = require('./filters'), - utils = require('./utils') + utils = require('./utils'), + makeHash = utils.hash, + assetTypes = ['directive', 'filter', 'partial', 'transition', 'component'] + +ViewModel.options = config.globalAssets = { + directives : require('./directives'), + filters : require('./filters'), + partials : makeHash(), + transitions : 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) + } + hash[id] = value + return this + } +}) /** * Set config options @@ -396,51 +424,6 @@ ViewModel.config = function (opts, val) { return this } -/** - * Allows user to register/retrieve a directive definition - */ -ViewModel.directive = function (id, fn) { - if (!fn) return directives[id] - directives[id] = fn - return this -} - -/** - * Allows user to register/retrieve a filter function - */ -ViewModel.filter = function (id, fn) { - if (!fn) return filters[id] - filters[id] = fn - return this -} - -/** - * Allows user to register/retrieve a ViewModel constructor - */ -ViewModel.component = function (id, Ctor) { - if (!Ctor) return utils.components[id] - utils.components[id] = utils.toConstructor(Ctor) - return this -} - -/** - * Allows user to register/retrieve a template partial - */ -ViewModel.partial = function (id, partial) { - if (!partial) return utils.partials[id] - utils.partials[id] = utils.toFragment(partial) - return this -} - -/** - * Allows user to register/retrieve a transition definition object - */ -ViewModel.transition = function (id, transition) { - if (!transition) return utils.transitions[id] - utils.transitions[id] = transition - return this -} - /** * Expose internal modules for plugins */ @@ -459,10 +442,15 @@ ViewModel.use = function (plugin) { return utils.warn('Cannot find plugin: ' + plugin) } } - if (typeof plugin === 'function') { - plugin(ViewModel) - } else if (plugin.install) { - plugin.install(ViewModel) + + // additional parameters + var args = [].slice.call(arguments, 1) + args.unshift(ViewModel) + + if (typeof plugin.install === 'function') { + plugin.install.apply(plugin, args) + } else { + plugin.apply(null, args) } } @@ -509,6 +497,12 @@ function extend (options) { 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] + }) + return ExtendedVM } @@ -526,7 +520,7 @@ function extend (options) { * extension option, but only as an instance option. */ function inheritOptions (child, parent, topLevel) { - child = child || utils.hash() + child = child || makeHash() if (!parent) return child for (var key in parent) { if (key === 'el' || key === 'methods') continue @@ -617,35 +611,28 @@ updatePrefix() require.register("vue/src/utils.js", function(exports, require, module){ var config = require('./config'), attrs = config.attrs, - toString = Object.prototype.toString, - join = Array.prototype.join, - console = window.console, + toString = ({}).toString, + join = [].join, + win = window, + console = win.console, hasClassList = 'classList' in document.documentElement, ViewModel // late def var defer = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.setTimeout - -/** - * Create a prototype-less object - * which is a better hash/map - */ -function makeHash () { - return Object.create(null) -} + win.requestAnimationFrame || + win.webkitRequestAnimationFrame || + win.setTimeout var utils = module.exports = { - hash: makeHash, - - // global storage for user-registered - // vms, partials and transitions - components : makeHash(), - partials : makeHash(), - transitions : makeHash(), + /** + * Create a prototype-less object + * which is a better hash/map + */ + hash: function () { + return Object.create(null) + }, /** * get an attribute and remove it. @@ -865,12 +852,12 @@ var Emitter = require('./emitter'), ExpParser = require('./exp-parser'), // cache methods - slice = Array.prototype.slice, + slice = [].slice, log = utils.log, makeHash = utils.hash, extend = utils.extend, def = utils.defProtected, - hasOwn = Object.prototype.hasOwnProperty, + hasOwn = ({}).hasOwnProperty, // hooks to register hooks = [ @@ -954,12 +941,11 @@ function Compiler (vm, options) { // observe the data compiler.observeData(data) - // for repeated items, create an index binding - // which should be inenumerable but configurable + // for repeated items, create index/key bindings + // because they are ienumerable if (compiler.repeat) { - //data.$index = compiler.repeatIndex - def(data, '$index', compiler.repeatIndex, false, true) compiler.createBinding('$index') + if (data.$key) compiler.createBinding('$key') } // now parse the DOM, during which we will create necessary bindings @@ -973,6 +959,7 @@ function Compiler (vm, options) { compiler.parseDeps() // done! + compiler.rawContent = null compiler.init = false // post compile / ready hook @@ -993,6 +980,13 @@ CompilerProto.setupElement = function (options) { var template = options.template if (template) { + // collect anything already in there + /* jshint boss: true */ + var child, + frag = this.rawContent = document.createDocumentFragment() + while (child = el.firstChild) { + frag.appendChild(child) + } // replace option: use the first node in // the template directly if (options.replace && template.childNodes.length === 1) { @@ -1003,7 +997,6 @@ CompilerProto.setupElement = function (options) { } el = replacer } else { - el.innerHTML = '' el.appendChild(template.cloneNode(true)) } } @@ -1272,9 +1265,18 @@ CompilerProto.compileTextNode = function (node) { if (token.key) { // a binding if (token.key.charAt(0) === '>') { // a partial partialId = token.key.slice(1).trim() - partial = this.getOption('partials', partialId) - if (partial) { - el = partial.cloneNode(true) + if (partialId === 'yield') { + el = this.rawContent + } else { + partial = this.getOption('partials', partialId) + if (partial) { + el = partial.cloneNode(true) + } else { + utils.warn('Unknown partial: ' + partialId) + continue + } + } + if (el) { // save an Array reference of the partial's nodes // so we can compile them AFTER appending the fragment partialNodes = slice.call(el.childNodes) @@ -1406,7 +1408,7 @@ CompilerProto.defineProp = function (key, binding) { var compiler = this, data = compiler.data, - ob = data.__observer__ + ob = data.__emitter__ // make sure the key is present in data // so it can be observed @@ -1484,11 +1486,12 @@ CompilerProto.markComputed = function (binding, value) { */ CompilerProto.getOption = function (type, id) { var opts = this.options, - parent = this.parentCompiler + parent = this.parentCompiler, + globalAssets = config.globalAssets return (opts[type] && opts[type][id]) || ( parent ? parent.getOption(type, id) - : utils[type] && utils[type][id] + : globalAssets[type] && globalAssets[type][id] ) } @@ -1636,8 +1639,7 @@ var VMProto = ViewModel.prototype */ def(VMProto, '$set', function (key, value) { var path = key.split('.'), - obj = getTargetVM(this, path) - if (!obj) return + obj = this for (var d = 0, l = path.length - 1; d < l; d++) { obj = obj[path[d]] } @@ -1771,18 +1773,6 @@ function query (el) { : el } -/** - * If a VM doesn't contain a path, go up the prototype chain - * to locate the ancestor that has it. - */ -function getTargetVM (vm, path) { - var baseKey = path[0], - binding = vm.$compiler.bindings[baseKey] - return binding - ? binding.compiler.vm - : null -} - module.exports = ViewModel }); require.register("vue/src/binding.js", function(exports, require, module){ @@ -1889,7 +1879,7 @@ var Emitter = require('./emitter'), // cache methods typeOf = utils.typeOf, def = utils.defProtected, - slice = Array.prototype.slice, + slice = [].slice, // types OBJECT = 'Object', @@ -1915,7 +1905,7 @@ var ArrayProxy = Object.create(Array.prototype) methods.forEach(function (method) { def(ArrayProxy, method, function () { var result = Array.prototype[method].apply(this, arguments) - this.__observer__.emit('mutate', null, this, { + this.__emitter__.emit('mutate', null, this, { method: method, args: slice.call(arguments), result: result @@ -1993,10 +1983,10 @@ function watchObject (obj) { * and add augmentations by intercepting the prototype chain */ function watchArray (arr) { - var observer = arr.__observer__ - if (!observer) { - observer = new Emitter() - def(arr, '__observer__', observer) + var emitter = arr.__emitter__ + if (!emitter) { + emitter = new Emitter() + def(arr, '__emitter__', emitter) } if (hasProto) { arr.__proto__ = ArrayProxy @@ -2014,40 +2004,49 @@ function watchArray (arr) { */ function convert (obj, key) { var keyPrefix = key.charAt(0) - if ((keyPrefix === '$' || keyPrefix === '_') && key !== '$index') { + if ( + (keyPrefix === '$' || keyPrefix === '_') && + key !== '$index' && + key !== '$key' && + key !== '$value' + ) { return } // emit set on bind // this means when an object is observed it will emit // a first batch of set events. - var observer = obj.__observer__, - values = observer.values, - val = values[key] = obj[key] - observer.emit('set', key, val) - if (Array.isArray(val)) { - observer.emit('set', key + '.length', val.length) - } + var emitter = obj.__emitter__, + values = emitter.values + + init(obj[key]) + Object.defineProperty(obj, key, { get: function () { var value = values[key] // only emit get on tip values if (pub.shouldGet && typeOf(value) !== OBJECT) { - observer.emit('get', key) + emitter.emit('get', key) } return value }, set: function (newVal) { var oldVal = values[key] - unobserve(oldVal, key, observer) - values[key] = newVal + unobserve(oldVal, key, emitter) copyPaths(newVal, oldVal) // an immediate property should notify its parent // to emit set for itself too - observer.emit('set', key, newVal, true) - observe(newVal, key, observer) + init(newVal, true) } }) - observe(val, key, observer) + + function init (val, propagate) { + values[key] = val + emitter.emit('set', key, val, propagate) + if (Array.isArray(val)) { + emitter.emit('set', key + '.length', val.length) + } + observe(val, key, emitter) + } } /** @@ -2067,7 +2066,7 @@ function isWatchable (obj) { */ function emitSet (obj) { var type = typeOf(obj), - emitter = obj && obj.__observer__ + emitter = obj && obj.__emitter__ if (type === ARRAY) { emitter.emit('set', 'length', obj.length) } else if (type === OBJECT) { @@ -2117,7 +2116,7 @@ function ensurePath (obj, key) { sec = path[i] if (!obj[sec]) { obj[sec] = {} - if (obj.__observer__) convert(obj, sec) + if (obj.__emitter__) convert(obj, sec) } obj = obj[sec] } @@ -2125,7 +2124,7 @@ function ensurePath (obj, key) { sec = path[i] if (!(sec in obj)) { obj[sec] = undefined - if (obj.__observer__) convert(obj, sec) + if (obj.__emitter__) convert(obj, sec) } } } @@ -2134,54 +2133,54 @@ function ensurePath (obj, key) { * Observe an object with a given path, * and proxy get/set/mutate events to the provided observer. */ -function observe (obj, rawPath, parentOb) { +function observe (obj, rawPath, observer) { if (!isWatchable(obj)) return var path = rawPath ? rawPath + '.' : '', - alreadyConverted = !!obj.__observer__, - childOb + alreadyConverted = !!obj.__emitter__, + emitter if (!alreadyConverted) { - def(obj, '__observer__', new Emitter()) + def(obj, '__emitter__', new Emitter()) } - childOb = obj.__observer__ - childOb.values = childOb.values || utils.hash() + emitter = obj.__emitter__ + emitter.values = emitter.values || utils.hash() // 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. - parentOb.proxies = parentOb.proxies || {} - var proxies = parentOb.proxies[path] = { + observer.proxies = observer.proxies || {} + var proxies = observer.proxies[path] = { get: function (key) { - parentOb.emit('get', path + key) + observer.emit('get', path + key) }, set: function (key, val, propagate) { - parentOb.emit('set', path + key, val) + 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) { - parentOb.emit('set', rawPath, obj, true) + 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 - parentOb.emit('mutate', fixedPath, val, mutation) + 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') { - parentOb.emit('set', fixedPath + '.length', val.length) + observer.emit('set', fixedPath + '.length', val.length) } } } // attach the listeners to the child observer. // now all the events will propagate upwards. - childOb + emitter .on('get', proxies.get) .on('set', proxies.set) .on('mutate', proxies.mutate) @@ -2205,14 +2204,14 @@ function observe (obj, rawPath, parentOb) { */ function unobserve (obj, path, observer) { - if (!obj || !obj.__observer__) return + if (!obj || !obj.__emitter__) return path = path ? path + '.' : '' var proxies = observer.proxies[path] if (!proxies) return // turn off listeners - obj.__observer__ + obj.__emitter__ .off('get', proxies.get) .off('set', proxies.set) .off('mutate', proxies.mutate) @@ -2365,7 +2364,8 @@ DirProto.update = function (value, init) { this._update( this.filters ? this.applyFilters(value) - : value + : value, + init ) } } @@ -2871,20 +2871,25 @@ function applyTransitionClass (el, stage, changeState) { } else { // leave - // trigger hide transition - classList.add(config.leaveClass) - var onEnd = function (e) { - if (e.target === el) { - el.removeEventListener(endEvent, onEnd) - el.vue_trans_cb = null - // actually remove node here - changeState() - classList.remove(config.leaveClass) + if (el.offsetWidth || el.offsetHeight) { + // trigger hide transition + classList.add(config.leaveClass) + var onEnd = function (e) { + if (e.target === el) { + el.removeEventListener(endEvent, onEnd) + el.vue_trans_cb = null + // actually remove node here + changeState() + classList.remove(config.leaveClass) + } } + // attach transition end listener + el.addEventListener(endEvent, onEnd) + el.vue_trans_cb = onEnd + } else { + // directly remove invisible elements + changeState() } - // attach transition end listener - el.addEventListener(endEvent, onEnd) - el.vue_trans_cb = onEnd return codes.CSS_L } @@ -2974,7 +2979,9 @@ function reset () { require.register("vue/src/directives/index.js", function(exports, require, module){ var utils = require('../utils'), config = require('../config'), - transition = require('../transition') + transition = require('../transition'), + NumberRE = /^[\d\.]+$/, + CommaRE = /\\,/g module.exports = { @@ -3028,6 +3035,18 @@ module.exports = { el.removeAttribute(config.prefix + '-cloak') }) } + }, + + data: { + bind: function () { + var val = this.key + this.vm.$set( + this.arg, + NumberRE.test(val) + ? +val + : val.replace(CommaRE, ',') + ) + } } } @@ -3088,6 +3107,10 @@ module.exports = { unbind: function () { this.el.vue_ref = null + var ref = this.ref + if (ref.parentNode) { + ref.parentNode.removeChild(ref) + } } } }); @@ -3096,6 +3119,7 @@ var Observer = require('../observer'), utils = require('../utils'), config = require('../config'), transition = require('../transition'), + def = utils.defProtected, ViewModel // lazy def to avoid circular dependency /** @@ -3105,25 +3129,35 @@ var Observer = require('../observer'), var mutationHandlers = { push: function (m) { - var i, l = m.args.length, + var l = m.args.length, base = this.collection.length - l - for (i = 0; i < l; i++) { + for (var i = 0; i < l; i++) { this.buildItem(m.args[i], base + i) + this.updateObject(m.args[i], 1) } }, pop: function () { var vm = this.vms.pop() - if (vm) vm.$destroy() + if (vm) { + vm.$destroy() + this.updateObject(vm.$data, -1) + } }, unshift: function (m) { - m.args.forEach(this.buildItem, this) + for (var i = 0, l = m.args.length; i < l; i++) { + this.buildItem(m.args[i], i) + this.updateObject(m.args[i], 1) + } }, shift: function () { var vm = this.vms.shift() - if (vm) vm.$destroy() + if (vm) { + vm.$destroy() + this.updateObject(vm.$data, -1) + } }, splice: function (m) { @@ -3134,9 +3168,11 @@ var mutationHandlers = { removedVMs = this.vms.splice(index, removed) for (i = 0, l = removedVMs.length; i < l; i++) { removedVMs[i].$destroy() + this.updateObject(removedVMs[i].$data, -1) } for (i = 0; i < added; i++) { this.buildItem(m.args[i + 2], index + i) + this.updateObject(m.args[i + 2], 1) } }, @@ -3171,6 +3207,35 @@ var mutationHandlers = { } } +/** + * Convert an Object to a v-repeat friendly Array + */ +function objectToArray (obj) { + var res = [], val, data + for (var key in obj) { + val = obj[key] + data = utils.typeOf(val) === 'Object' + ? val + : { $value: val } + def(data, '$key', key, false, true) + res.push(data) + } + return res +} + +/** + * Find an object or a wrapped data object + * from an Array + */ +function indexOf (arr, obj) { + for (var i = 0, l = arr.length; i < l; i++) { + if (arr[i] === obj || (obj.$value && arr[i].$value === obj.$value)) { + return i + } + } + return -1 +} + module.exports = { bind: function () { @@ -3200,12 +3265,14 @@ module.exports = { var method = mutation.method mutationHandlers[method].call(self, mutation) if (method !== 'push' && method !== 'pop') { + // update index var i = arr.length while (i--) { arr[i].$index = i } } if (method === 'push' || method === 'unshift' || method === 'splice') { + // recalculate dependency self.changed() } } @@ -3213,8 +3280,20 @@ module.exports = { }, update: function (collection, init) { - - if (collection === this.collection) return + + if ( + collection === this.collection || + collection === this.object + ) return + + if (utils.typeOf(collection) === 'Object') { + if (this.object) { + delete this.object.$repeater + } + this.object = collection + collection = objectToArray(collection) + def(this.object, '$repeater', collection, false, true) + } this.reset() // attach an object to container to hold handlers @@ -3226,6 +3305,12 @@ module.exports = { this.buildItem() this.initiated = true } + + // keep reference of old data and VMs + // so we can reuse them if possible + this.old = this.collection + var oldVMs = this.oldVMs = this.vms + collection = this.collection = collection || [] this.vms = [] if (this.childId) { @@ -3234,14 +3319,28 @@ module.exports = { // listen for collection mutation events // the collection has been augmented during Binding.set() - if (!collection.__observer__) Observer.watchArray(collection) - collection.__observer__.on('mutate', this.mutationListener) + if (!collection.__emitter__) Observer.watchArray(collection) + collection.__emitter__.on('mutate', this.mutationListener) - // create child-vms and append to DOM + // create new VMs and append to DOM if (collection.length) { collection.forEach(this.buildItem, this) if (!init) this.changed() } + + // destroy unused old VMs + if (oldVMs) { + var i = oldVMs.length, vm + while (i--) { + vm = oldVMs[i] + if (vm.$reused) { + vm.$reused = false + } else { + vm.$destroy() + } + } + } + this.old = this.oldVMs = null }, /** @@ -3268,38 +3367,73 @@ module.exports = { */ buildItem: function (data, index) { - var el = this.el.cloneNode(true), - ctn = this.container, + var ctn = this.container, vms = this.vms, col = this.collection, - ref, item, primitive + el, i, ref, item, primitive, detached // append node into DOM first // so v-if can get access to parentNode if (data) { + + if (this.old) { + i = indexOf(this.old, data) + } + + if (i > -1) { // existing, reuse the old VM + + item = this.oldVMs[i] + // mark, so it won't be destroyed + item.$reused = true + el = item.$el + // don't forget to update index + data.$index = index + // existing VM's el can possibly be detached by v-if. + // in that case don't insert. + detached = !el.parentNode + + } else { // new data, need to create new VM + + el = this.el.cloneNode(true) + // process transition info before appending + el.vue_trans = utils.attr(el, 'transition', true) + // wrap primitive element in an object + if (utils.typeOf(data) !== 'Object') { + primitive = true + data = { $value: data } + } + // define index + def(data, '$index', index, false, true) + + } + ref = vms.length > index ? vms[index].$el : this.ref // make sure it works with v-if if (!ref.parentNode) ref = ref.vue_ref - // process transition info before appending - el.vue_trans = utils.attr(el, 'transition', true) - transition(el, 1, function () { - ctn.insertBefore(el, ref) - }, this.compiler) - // wrap primitive element in an object - if (utils.typeOf(data) !== 'Object') { - primitive = true - data = { value: data } + if (!detached) { + if (i > -1) { + // no need to transition existing node + ctn.insertBefore(el, ref) + } else { + // insert new node with transition + transition(el, 1, function () { + ctn.insertBefore(el, ref) + }, this.compiler) + } + } else { + // detached by v-if + // just move the comment ref node + ctn.insertBefore(el.vue_ref, ref) } } - item = new this.Ctor({ + item = item || new this.Ctor({ el: el, data: data, compilerOptions: { repeat: true, - repeatIndex: index, parentCompiler: this.compiler, delegator: ctn } @@ -3313,8 +3447,8 @@ module.exports = { vms.splice(index, 0, item) // for primitive values, listen for value change if (primitive) { - data.__observer__.on('set', function (key, val) { - if (key === 'value') { + data.__emitter__.on('set', function (key, val) { + if (key === '$value') { col[item.$index] = val } }) @@ -3322,15 +3456,37 @@ module.exports = { } }, - reset: function () { + /** + * Sync changes in the $repeater Array + * back to the represented Object + */ + updateObject: function (data, action) { + if (this.object && data.$key) { + var key = data.$key, + val = data.$value || data + if (action > 0) { // new property + // make key ienumerable + delete data.$key + def(data, '$key', key, false, true) + this.object[key] = val + } else { + delete this.object[key] + } + this.object.__emitter__.emit('set', key, val, true) + } + }, + + reset: function (destroyAll) { if (this.childId) { delete this.vm.$[this.childId] } if (this.collection) { - this.collection.__observer__.off('mutate', this.mutationListener) - var i = this.vms.length - while (i--) { - this.vms[i].$destroy() + this.collection.__emitter__.off('mutate', this.mutationListener) + if (destroyAll) { + var i = this.vms.length + while (i--) { + this.vms[i].$destroy() + } } } var ctn = this.container, @@ -3342,7 +3498,7 @@ module.exports = { }, unbind: function () { - this.reset() + this.reset(true) } } }); @@ -3434,13 +3590,14 @@ module.exports = { }); require.register("vue/src/directives/model.js", function(exports, require, module){ var utils = require('../utils'), - isIE9 = navigator.userAgent.indexOf('MSIE 9.0') > 0 + isIE9 = navigator.userAgent.indexOf('MSIE 9.0') > 0, + filter = [].filter /** * Returns an array of values from a multiple select */ function getMultipleSelectOptions (select) { - return Array.prototype.filter + return filter .call(select.options, function (option) { return option.selected }) @@ -3459,6 +3616,7 @@ module.exports = { tag = el.tagName self.lock = false + self.ownerVM = self.binding.compiler.vm // determine what event to listen to self.event = @@ -3546,15 +3704,19 @@ module.exports = { }, _set: function () { - this.vm.$set( + this.ownerVM.$set( this.key, this.multi ? getMultipleSelectOptions(this.el) : this.el[this.attr] ) }, - update: function (value) { + 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 @@ -3638,7 +3800,7 @@ module.exports = { }); require.register("vue/src/directives/html.js", function(exports, require, module){ var toText = require('../utils').toText, - slice = Array.prototype.slice + slice = [].slice module.exports = { @@ -3688,8 +3850,9 @@ function camelReplacer (m) { module.exports = { bind: function () { - var prop = this.arg, - first = prop.charAt(0) + var prop = this.arg + if (!prop) return + var first = prop.charAt(0) if (first === '$') { // properties that start with $ will be auto-prefixed prop = prop.slice(1) @@ -3703,13 +3866,17 @@ module.exports = { update: function (value) { var prop = this.prop - this.el.style[prop] = value - if (this.prefixed) { - prop = prop.charAt(0).toUpperCase() + prop.slice(1) - var i = prefixes.length - while (i--) { - this.el.style[prefixes[i] + prop] = value + if (prop) { + this.el.style[prop] = value + if (this.prefixed) { + prop = prop.charAt(0).toUpperCase() + prop.slice(1) + var i = prefixes.length + while (i--) { + this.el.style[prefixes[i] + prop] = value + } } + } else { + this.el.style.cssText = value } } diff --git a/dist/vue.min.js b/dist/vue.min.js index d4ba0e15e1c..57704c7c981 100644 --- a/dist/vue.min.js +++ b/dist/vue.min.js @@ -1,7 +1,7 @@ /* - Vue.js v0.8.6 + Vue.js v0.8.7 (c) 2014 Evan You License: MIT */ -!function(){"use strict";function e(t,i,n){var r=e.resolve(t);if(null==r){n=n||t,i=i||"root";var s=new Error('Failed to require "'+n+'" from "'+i+'"');throw s.path=n,s.parent=i,s.require=!0,s}var o=e.modules[r];if(!o._resolving&&!o.exports){var a={};a.exports={},a.client=a.component=!0,o._resolving=!0,o.call(this,a.exports,e.relative(r),a),delete o._resolving,o.exports=a.exports}return o.exports}e.modules={},e.aliases={},e.resolve=function(t){"/"===t.charAt(0)&&(t=t.slice(1));for(var i=[t,t+".js",t+".json",t+"/index.js",t+"/index.json"],n=0;nn;++n)i[n].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}}),e.register("vue/src/main.js",function(e,t,i){function n(e){var t=this;e=r(e,t.options,!0),u.processOptions(e);var i=function(i,n){n||(i=r(i,e,!0)),t.call(this,i,!0)},s=i.prototype=Object.create(t.prototype);u.defProtected(s,"constructor",i);var a=e.methods;if(a)for(var c in a)c in o.prototype||"function"!=typeof a[c]||(s[c]=a[c]);return i.extend=n,i.super=t,i.options=e,i}function r(e,t,i){if(e=e||u.hash(),!t)return e;for(var n in t)if("el"!==n&&"methods"!==n){var s=e[n],o=t[n],a=u.typeOf(s);i&&"Function"===a&&o?(e[n]=[s],Array.isArray(o)?e[n]=e[n].concat(o):e[n].push(o)):i&&"Object"===a?r(s,o):void 0===s&&(e[n]=o)}return e}var s=t("./config"),o=t("./viewmodel"),a=t("./directives"),c=t("./filters"),u=t("./utils");o.config=function(e,t){if("string"==typeof e){if(void 0===t)return s[e];s[e]=t}else u.extend(s,e);return this},o.directive=function(e,t){return t?(a[e]=t,this):a[e]},o.filter=function(e,t){return t?(c[e]=t,this):c[e]},o.component=function(e,t){return t?(u.components[e]=u.toConstructor(t),this):u.components[e]},o.partial=function(e,t){return t?(u.partials[e]=u.toFragment(t),this):u.partials[e]},o.transition=function(e,t){return t?(u.transitions[e]=t,this):u.transitions[e]},o.require=function(e){return t("./"+e)},o.use=function(e){if("string"==typeof e)try{e=t(e)}catch(i){return u.warn("Cannot find plugin: "+e)}"function"==typeof e?e(o):e.install&&e.install(o)},o.extend=n,o.nextTick=u.nextTick,i.exports=o}),e.register("vue/src/emitter.js",function(e,t,i){var n,r="emitter";try{n=t(r)}catch(s){n=t("events").EventEmitter,n.prototype.off=function(){var e=arguments.length>1?this.removeListener:this.removeAllListeners;return e.apply(this,arguments)}}i.exports=n}),e.register("vue/src/config.js",function(e,t,i){function n(){s.forEach(function(e){o.attrs[e]=r+"-"+e})}var r="v",s=["pre","ref","with","text","repeat","partial","component","transition"],o=i.exports={debug:!1,silent:!1,enterClass:"v-enter",leaveClass:"v-leave",attrs:{},get prefix(){return r},set prefix(e){r=e,n()}};n()}),e.register("vue/src/utils.js",function(e,t,i){function n(){return Object.create(null)}var r,s=t("./config"),o=s.attrs,a=Object.prototype.toString,c=Array.prototype.join,u=window.console,l="classList"in document.documentElement,h=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.setTimeout,f=i.exports={hash:n,components:n(),partials:n(),transitions:n(),attr:function(e,t,i){var n=o[t],r=e.getAttribute(n);return i||null===r||e.removeAttribute(n),r},defProtected:function(e,t,i,n,r){e.hasOwnProperty(t)||Object.defineProperty(e,t,{value:i,enumerable:!!n,configurable:!!r})},typeOf:function(e){return a.call(e).slice(8,-1)},bind:function(e,t){return function(i){return e.call(t,i)}},toText:function(e){var t=typeof e;return"string"===t||"boolean"===t||"number"===t&&e==e?e:"object"===t&&null!==e?JSON.stringify(e):""},extend:function(e,t,i){for(var n in t)i&&e[n]||(e[n]=t[n])},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},toFragment:function(e){if("string"!=typeof e)return e;if("#"===e.charAt(0)){var t=document.getElementById(e.slice(1));if(!t)return;e=t.innerHTML}var i,n=document.createElement("div"),r=document.createDocumentFragment();for(n.innerHTML=e.trim();i=n.firstChild;)1===n.nodeType&&r.appendChild(i);return r},toConstructor:function(e){return r=r||t("./viewmodel"),"Object"===f.typeOf(e)?r.extend(e):"function"==typeof e?e:null},processOptions:function(e){var t,i=e.components,n=e.partials,r=e.template;if(i)for(t in i)i[t]=f.toConstructor(i[t]);if(n)for(t in n)n[t]=f.toFragment(n[t]);r&&(e.template=f.toFragment(r))},log:function(){s.debug&&u&&u.log(c.call(arguments," "))},warn:function(){!s.silent&&u&&(u.warn(c.call(arguments," ")),s.debug&&u.trace())},nextTick:function(e){h(e,0)},addClass:function(e,t){if(l)e.classList.add(t);else{var i=" "+e.className+" ";i.indexOf(" "+t+" ")<0&&(e.className=(i+t).trim())}},removeClass:function(e,t){if(l)e.classList.remove(t);else{for(var i=" "+e.className+" ",n=" "+t+" ";i.indexOf(n)>=0;)i=i.replace(n," ");e.className=i.trim()}}}}),e.register("vue/src/compiler.js",function(e,t,i){function n(e,t){var i=this;i.init=!0,t=i.options=t||m(),c.processOptions(t);var n=i.data=t.data||{};g(e,n,!0),g(e,t.methods,!0),g(i,t.compilerOptions);var o=i.setupElement(t);v("\nnew VM instance:",o.tagName,"\n"),i.vm=e,i.bindings=m(),i.dirs=[],i.deferred=[],i.exps=[],i.computed=[],i.childCompilers=[],i.emitter=new s,b(e,"$",m()),b(e,"$el",o),b(e,"$compiler",i),b(e,"$root",r(i).vm);var a=i.parentCompiler,u=c.attr(o,"ref");a&&(a.childCompilers.push(i),b(e,"$parent",a.vm),u&&(i.childId=u,a.vm.$[u]=e)),i.setupObserver();var l=t.computed;if(l)for(var h in l)i.createBinding(h);i.execHook("created"),g(n,e),i.observeData(n),i.repeat&&(b(n,"$index",i.repeatIndex,!1,!0),i.createBinding("$index")),i.compile(o,!0),i.deferred.forEach(i.bindDirective,i),i.parseDeps(),i.init=!1,i.execHook("ready")}function r(e){for(;e.parentCompiler;)e=e.parentCompiler;return e}var s=t("./emitter"),o=t("./observer"),a=t("./config"),c=t("./utils"),u=t("./binding"),l=t("./directive"),h=t("./text-parser"),f=t("./deps-parser"),p=t("./exp-parser"),d=Array.prototype.slice,v=c.log,m=c.hash,g=c.extend,b=c.defProtected,y=Object.prototype.hasOwnProperty,_=["created","ready","beforeDestroy","afterDestroy","attached","detached"],x=n.prototype;x.setupElement=function(e){var t=this.el="string"==typeof e.el?document.querySelector(e.el):e.el||document.createElement(e.tagName||"div"),i=e.template;if(i)if(e.replace&&1===i.childNodes.length){var n=i.childNodes[0].cloneNode(!0);t.parentNode&&(t.parentNode.insertBefore(n,t),t.parentNode.removeChild(t)),t=n}else t.innerHTML="",t.appendChild(i.cloneNode(!0));e.id&&(t.id=e.id),e.className&&(t.className=e.className);var r=e.attributes;if(r)for(var s in r)t.setAttribute(s,r[s]);return t},x.setupObserver=function(){function e(e){n(e),f.catcher.emit("get",o[e])}function t(e,t,i){c.emit("change:"+e,t,i),n(e),o[e].update(t)}function i(e,t){c.on("hook:"+e,function(){t.call(r.vm,a)})}function n(e){o[e]||r.createBinding(e)}var r=this,o=r.bindings,a=r.options,c=r.observer=new s;c.proxies=m(),c.on("get",e).on("set",t).on("mutate",t),_.forEach(function(e){var t=a[e];if(Array.isArray(t))for(var n=t.length;n--;)i(e,t[n]);else t&&i(e,t)})},x.observeData=function(e){function t(e){"$data"!==e&&r.update(i.data)}var i=this,n=i.observer;o.observe(e,"",n);var r=i.bindings.$data=new u(i,"$data");r.update(e),Object.defineProperty(i.vm,"$data",{enumerable:!1,get:function(){return i.observer.emit("get","$data"),i.data},set:function(e){var t=i.data;o.unobserve(t,"",n),i.data=e,o.copyPaths(e,t),o.observe(e,"",n),i.observer.emit("set","$data",e)}}),n.on("set",t).on("mutate",t)},x.compile=function(e,t){var i=this,n=e.nodeType,r=e.tagName;if(1===n&&"SCRIPT"!==r){if(null!==c.attr(e,"pre"))return;var s,o,a,u,h=c.attr(e,"component")||r.toLowerCase(),f=i.getOption("components",h);if(s=c.attr(e,"repeat"))u=l.parse("repeat",s,i,e),u&&(u.Ctor=f,i.deferred.push(u));else if(t!==!0&&((o=c.attr(e,"with"))||f))u=l.parse("with",o||"",i,e),u&&(u.Ctor=f,i.deferred.push(u));else{if(e.vue_trans=c.attr(e,"transition"),a=c.attr(e,"partial")){var p=i.getOption("partials",a);p&&(e.innerHTML="",e.appendChild(p.cloneNode(!0)))}i.compileNode(e)}}else 3===n&&i.compileTextNode(e)},x.compileNode=function(e){var t,i,n=d.call(e.attributes),r=a.prefix+"-";if(n&&n.length){var s,o,c,u,f,p;for(t=n.length;t--;){if(s=n[t],o=!1,0===s.name.indexOf(r))for(o=!0,c=l.split(s.value),i=c.length;i--;)u=c[i],p=s.name.slice(r.length),f=l.parse(p,u,this,e),f&&this.bindDirective(f);else u=h.parseAttr(s.value),u&&(f=l.parse("attr",s.name+":"+u,this,e),f&&this.bindDirective(f));o&&"cloak"!==p&&e.removeAttribute(s.name)}}e.childNodes.length&&d.call(e.childNodes).forEach(this.compile,this)},x.compileTextNode=function(e){var t=h.parse(e.nodeValue);if(t){for(var i,n,r,s,o,c,u=0,f=t.length;f>u;u++)n=t[u],r=c=null,n.key?">"===n.key.charAt(0)?(o=n.key.slice(1).trim(),s=this.getOption("partials",o),s&&(i=s.cloneNode(!0),c=d.call(i.childNodes))):n.html?(i=document.createComment(a.prefix+"-html"),r=l.parse("html",n.key,this,i)):(i=document.createTextNode(""),r=l.parse("text",n.key,this,i)):i=document.createTextNode(n),e.parentNode.insertBefore(i,e),r&&this.bindDirective(r),c&&c.forEach(this.compile,this);e.parentNode.removeChild(e)}},x.bindDirective=function(e){if(this.dirs.push(e),e.isEmpty||!e._update)return e.bind&&e.bind(),void 0;var t,i=this,n=e.key;if(e.isExp)t=i.createBinding(n,!0,e.isFn);else{for(;i&&!i.hasKey(n);)i=i.parentCompiler;i=i||this,t=i.bindings[n]||i.createBinding(n)}t.dirs.push(e),e.binding=t,e.bind&&e.bind(),e.update(t.val(),!0)},x.createBinding=function(e,t,i){v(" created binding: "+e);var n=this,r=n.bindings,s=n.options.computed,a=new u(n,e,t,i);if(t)n.defineExp(e,a);else if(r[e]=a,a.root)s&&s[e]?n.defineComputed(e,a,s[e]):n.defineProp(e,a);else{o.ensurePath(n.data,e);var c=e.slice(0,e.lastIndexOf("."));r[c]||n.createBinding(c)}return a},x.defineProp=function(e,t){var i=this,n=i.data,r=n.__observer__;e in n||(n[e]=void 0),!r||e in r.values||o.convert(n,e),t.value=n[e],Object.defineProperty(i.vm,e,{get:function(){return i.data[e]},set:function(t){i.data[e]=t}})},x.defineExp=function(e,t){var i=p.parse(e,this);i&&(this.markComputed(t,i),this.exps.push(t))},x.defineComputed=function(e,t,i){this.markComputed(t,i),Object.defineProperty(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:c.bind(t.$get,this.vm),$set:t.$set?c.bind(t.$set,this.vm):void 0}),this.computed.push(e)},x.getOption=function(e,t){var i=this.options,n=this.parentCompiler;return i[e]&&i[e][t]||(n?n.getOption(e,t):c[e]&&c[e][t])},x.execHook=function(e){e="hook:"+e,this.observer.emit(e),this.emitter.emit(e)},x.hasKey=function(e){var t=e.split(".")[0];return y.call(this.data,t)||y.call(this.vm,t)},x.parseDeps=function(){this.computed.length&&f.parse(this.computed)},x.destroy=function(){if(!this.destroyed){var e,t,i,n,r,s=this,a=s.vm,c=s.el,u=s.dirs,l=s.exps,h=s.bindings;for(s.execHook("beforeDestroy"),o.unobserve(s.data,"",s.observer),e=u.length;e--;)i=u[e],i.binding&&i.binding.compiler!==s&&(n=i.binding.dirs,n&&n.splice(n.indexOf(i),1)),i.unbind();for(e=l.length;e--;)l[e].unbind();for(t in h)r=h[t],r&&r.unbind();var f=s.parentCompiler,p=s.childId;f&&(f.childCompilers.splice(f.childCompilers.indexOf(s),1),p&&delete f.vm.$[p]),c===document.body?c.innerHTML="":a.$remove(),this.destroyed=!0,s.execHook("afterDestroy"),s.observer.off(),s.emitter.off()}},i.exports=n}),e.register("vue/src/viewmodel.js",function(e,t,i){function n(e){new o(this,e)}function r(e){return"string"==typeof e?document.querySelector(e):e}function s(e,t){var i=t[0],n=e.$compiler.bindings[i];return n?n.compiler.vm:null}var o=t("./compiler"),a=t("./utils"),c=t("./transition"),u=a.defProtected,l=a.nextTick,h=n.prototype;u(h,"$set",function(e,t){var i=e.split("."),n=s(this,i);if(n){for(var r=0,o=i.length-1;o>r;r++)n=n[i[r]];n[i[r]]=t}}),u(h,"$watch",function(e,t){function i(){var e=arguments;a.nextTick(function(){t.apply(n,e)})}var n=this;t._fn=i,n.$compiler.observer.on("change:"+e,i)}),u(h,"$unwatch",function(e,t){var i=["change:"+e],n=this.$compiler.observer;t&&i.push(t._fn),n.off.apply(n,i)}),u(h,"$destroy",function(){this.$compiler.destroy()}),u(h,"$broadcast",function(){for(var e,t=this.$compiler.childCompilers,i=t.length;i--;)e=t[i],e.emitter.emit.apply(e.emitter,arguments),e.vm.$broadcast.apply(e.vm,arguments)}),u(h,"$dispatch",function(){var e=this.$compiler,t=e.emitter,i=e.parentCompiler;t.emit.apply(t,arguments),i&&i.vm.$dispatch.apply(i.vm,arguments)}),["emit","on","off","once"].forEach(function(e){u(h,"$"+e,function(){var t=this.$compiler.emitter;t[e].apply(t,arguments)})}),u(h,"$appendTo",function(e,t){e=r(e);var i=this.$el;c(i,1,function(){e.appendChild(i),t&&l(t)},this.$compiler)}),u(h,"$remove",function(e){var t=this.$el,i=t.parentNode;i&&c(t,-1,function(){i.removeChild(t),e&&l(e)},this.$compiler)}),u(h,"$before",function(e,t){e=r(e);var i=this.$el,n=e.parentNode;n&&c(i,1,function(){n.insertBefore(i,e),t&&l(t)},this.$compiler)}),u(h,"$after",function(e,t){e=r(e);var i=this.$el,n=e.parentNode,s=e.nextSibling;n&&c(i,1,function(){s?n.insertBefore(i,s):n.appendChild(i),t&&l(t)},this.$compiler)}),i.exports=n}),e.register("vue/src/binding.js",function(e,t,i){function n(e,t,i,n){this.id=s++,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=0,o=n.prototype;o.update=function(e){(!this.isComputed||this.isFn)&&(this.value=e),(this.dirs.length||this.subs.length)&&r.queue(this)},o._update=function(){for(var e=this.dirs.length,t=this.val();e--;)this.dirs[e].update(t);this.pub()},o.val=function(){return this.isComputed&&!this.isFn?this.value.$get():this.value},o.pub=function(){for(var e=this.subs.length;e--;)this.subs[e].update()},o.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,t.splice(t.indexOf(this),1)},i.exports=n}),e.register("vue/src/observer.js",function(e,t,i){function n(e){if("function"==typeof e){for(var t=this.length,i=[];t--;)e(this[t])&&i.push(this.splice(t,1)[0]);return i.reverse()}return"number"!=typeof e&&(e=this.indexOf(e)),e>-1?this.splice(e,1)[0]:void 0}function r(e,t){if("function"==typeof e){for(var i,n=this.length,r=[];n--;)i=e(this[n]),void 0!==i&&r.push(this.splice(n,1,i)[0]);return r.reverse()}return"number"!=typeof e&&(e=this.indexOf(e)),e>-1?this.splice(e,1,t)[0]:void 0}function s(e){for(var t in e)a(e,t)}function o(e){var t=e.__observer__;if(t||(t=new v,b(e,"__observer__",t)),w)e.__proto__=$;else for(var i in $)b(e,i,$[i])}function a(e,t){var i=t.charAt(0);if("$"!==i&&"_"!==i||"$index"===t){var n=e.__observer__,r=n.values,s=r[t]=e[t];n.emit("set",t,s),Array.isArray(s)&&n.emit("set",t+".length",s.length),Object.defineProperty(e,t,{get:function(){var e=r[t];return C.shouldGet&&g(e)!==_&&n.emit("get",t),e},set:function(e){var i=r[t];p(i,t,n),r[t]=e,l(e,i),n.emit("set",t,e,!0),f(e,t,n)}}),f(s,t,n)}}function c(e){d=d||t("./viewmodel");var i=g(e);return!(i!==_&&i!==x||e instanceof d)}function u(e){var t=g(e),i=e&&e.__observer__;if(t===x)i.emit("set","length",e.length);else if(t===_){var n,r;for(n in e)r=e[n],i.emit("set",n,r),u(r)}}function l(e,t){if(g(t)===_&&g(e)===_){var i,n,r,s;for(i in t)i in e||(r=t[i],n=g(r),n===_?(s=e[i]={},l(s,r)):e[i]=n===x?[]:void 0)}}function h(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.__observer__&&a(e,i)),e=e[i];g(e)===_&&(i=n[r],i in e||(e[i]=void 0,e.__observer__&&a(e,i)))}function f(e,t,i){if(c(e)){var n,r=t?t+".":"",a=!!e.__observer__;a||b(e,"__observer__",new v),n=e.__observer__,n.values=n.values||m.hash(),i.proxies=i.proxies||{};var l=i.proxies[r]={get:function(e){i.emit("get",r+e)},set:function(n,s,o){i.emit("set",r+n,s),t&&o&&i.emit("set",t,e,!0)},mutate:function(e,n,s){var o=e?r+e:t;i.emit("mutate",o,n,s);var a=s.method;"sort"!==a&&"reverse"!==a&&i.emit("set",o+".length",n.length)}};if(n.on("get",l.get).on("set",l.set).on("mutate",l.mutate),a)u(e);else{var h=g(e);h===_?s(e):h===x&&o(e)}}}function p(e,t,i){if(e&&e.__observer__){t=t?t+".":"";var n=i.proxies[t];n&&(e.__observer__.off("get",n.get).off("set",n.set).off("mutate",n.mutate),i.proxies[t]=null)}}var d,v=t("./emitter"),m=t("./utils"),g=m.typeOf,b=m.defProtected,y=Array.prototype.slice,_="Object",x="Array",k=["push","pop","shift","unshift","splice","sort","reverse"],w={}.__proto__,$=Object.create(Array.prototype);k.forEach(function(e){b($,e,function(){var t=Array.prototype[e].apply(this,arguments);return this.__observer__.emit("mutate",null,this,{method:e,args:y.call(arguments),result:t}),t},!w)}),b($,"remove",n,!w),b($,"set",r,!w),b($,"replace",r,!w);var C=i.exports={shouldGet:!1,observe:f,unobserve:p,ensurePath:h,convert:a,copyPaths:l,watchArray:o}}),e.register("vue/src/directive.js",function(e,t,i){function n(e,t,i,n,o){this.compiler=n,this.vm=n.vm,this.el=o;var a=""===t;if("function"==typeof e)this[a?"bind":"_update"]=e;else for(var c in e)"unbind"===c||"update"===c?this["_"+c]=e[c]:this[c]=e[c];if(a)return this.isEmpty=!0,void 0;this.expression=t.trim(),this.rawKey=i,r(this,i),this.isExp=!v.test(this.key)||d.test(this.key);var u=this.expression.slice(i.length).match(f);if(u){this.filters=[];for(var l,h=0,p=u.length;p>h;h++)l=s(u[h],this.compiler),l&&this.filters.push(l);this.filters.length||(this.filters=null)}else this.filters=null}function r(e,t){var i=t;if(t.indexOf(":")>-1){var n=t.match(h);i=n?n[2].trim():i,e.arg=n?n[1].trim():null}e.key=i}function s(e,t){var i=e.slice(1).match(p);if(i){i=i.map(function(e){return e.replace(/'/g,"").trim()});var n=i[0],r=t.getOption("filters",n)||c[n];return r?{name:n,apply:r,args:i.length>1?i.slice(1):null}:(o.warn("Unknown filter: "+n),void 0)}}var o=t("./utils"),a=t("./directives"),c=t("./filters"),u=/(?:['"](?:\\.|[^'"])*['"]|\((?:\\.|[^\)])*\)|\\.|[^,])+/g,l=/^(?:['"](?:\\.|[^'"])*['"]|\\.|[^\|]|\|\|)+/,h=/^([\w-$ ]+):(.+)$/,f=/\|[^\|]+/g,p=/[^\s']+|'[^']+'/g,d=/^\$(parent|root)\./,v=/^[\w\.$]+$/,m=n.prototype;m.update=function(e,t){var i=o.typeOf(e);(t||e!==this.value||"Object"===i||"Array"===i)&&(this.value=e,this._update&&this._update(this.filters?this.applyFilters(e):e))},m.applyFilters=function(e){for(var t,i=e,n=0,r=this.filters.length;r>n;n++)t=this.filters[n],i=t.apply.call(this.vm,i,t.args);return i},m.unbind=function(){this.el&&this.vm&&(this._unbind&&this._unbind(),this.vm=this.el=this.binding=this.compiler=null)},n.split=function(e){return e.indexOf(",")>-1?e.match(u)||[""]:[e]},n.parse=function(e,t,i,r){var s=i.getOption("directives",e)||a[e];if(!s)return o.warn("unknown directive: "+e);var c;if(t.indexOf("|")>-1){var u=t.match(l);u&&(c=u[0].trim())}else c=t.trim();return c||""===t?new n(s,t,c,i,r):o.warn("invalid directive expression: "+t)},i.exports=n}),e.register("vue/src/exp-parser.js",function(e,t,i){function n(e){return e=e.replace(d,"").replace(v,",").replace(p,"").replace(m,"").replace(g,""),e?e.split(/,+/):[]}function r(e,t){for(var i="",n=0,r=t;t&&!t.hasKey(e);)t=t.parentCompiler,n++;if(t){for(;n--;)i+="$parent.";t.bindings[e]||"$"===e.charAt(0)||t.createBinding(e)}else r.createBinding(e);return i}function s(e,t){var i;try{i=new Function(e)}catch(n){a.warn("Invalid expression: "+t)}return i}function o(e){return"$"===e.charAt(0)?"\\"+e:e}var a=t("./utils"),c=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,u=/"(\d+)"/g,l=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",p=new RegExp(["\\b"+f.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),d=/\/\*(?:.|\n)*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|'[^']*'|"[^"]*"|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g,v=/[^\w$]+/g,m=/\b\d[^,]*/g,g=/^,+|,+$/g;i.exports={parse:function(e,t){function i(e){var t=g.length;return g[t]=e,'"'+t+'"'}function f(e){var i=e.charAt(0);e=e.slice(1);var n="this."+r(e,t)+e;return m[e]||(v+=n+";",m[e]=1),i+n}function p(e,t){return g[t]}if(h.test(e)||l.test(e))return a.warn("Unsafe expression: "+e),function(){};var d=n(e);if(!d.length)return s("return "+e,e);d=a.unique(d);var v="",m=a.hash(),g=[],b=new RegExp("[^$\\w\\.]("+d.map(o).join("|")+")[$\\w\\.]*\\b","g"),y=("return "+e).replace(c,i).replace(b,f).replace(u,p);return y=v+y,s(y,e)}}}),e.register("vue/src/text-parser.js",function(e){function t(e){if(!n.test(e))return null;for(var t,i,s,o=[];t=e.match(n);)i=t.index,i>0&&o.push(e.slice(0,i)),s={key:t[1].trim()},r.test(t[0])&&(s.html=!0),o.push(s),e=e.slice(i+t[0].length);return e.length&&o.push(e),o}function i(e){var i=t(e);if(!i)return null;for(var n,r=[],s=0,o=i.length;o>s;s++)n=i[s],r.push(n.key||'"'+n+'"');return r.join("+")}var n=/{{{?([^{}]+?)}?}}/,r=/{{{[^{}]+}}}/;e.parse=t,e.parseAttr=i}),e.register("vue/src/deps-parser.js",function(e,t,i){function n(e){if(!e.isFn){s.log("\n- "+e.key);var t=s.hash();e.deps=[],a.on("get",function(i){var n=t[i.key];n&&n.compiler===i.compiler||(t[i.key]=i,s.log(" - "+i.key),e.deps.push(i),i.subs.push(e))}),e.value.$get(),a.off("get")}}var r=t("./emitter"),s=t("./utils"),o=t("./observer"),a=new r;i.exports={catcher:a,parse:function(e){s.log("\nparsing dependencies..."),o.shouldGet=!0,e.forEach(n),o.shouldGet=!1,s.log("\ndone.")}}}),e.register("vue/src/filters.js",function(e,t,i){var n={enter:13,tab:9,"delete":46,up:38,left:37,right:39,down:40,esc:27};i.exports={capitalize:function(e){return e||0===e?(e=e.toString(),e.charAt(0).toUpperCase()+e.slice(1)):""},uppercase:function(e){return e||0===e?e.toString().toUpperCase():""},lowercase:function(e){return e||0===e?e.toString().toLowerCase():""},currency:function(e,t){if(!e&&0!==e)return"";var i=t&&t[0]||"$",n=Math.floor(e).toString(),r=n.length%3,s=r>0?n.slice(0,r)+(n.length>3?",":""):"",o="."+e.toFixed(2).slice(-2);return i+s+n.slice(r).replace(/(\d{3})(?=\d)/g,"$1,")+o},pluralize:function(e,t){return t.length>1?t[e-1]||t[t.length-1]:t[e-1]||t[0]+"s"},key:function(e,t){if(e){var i=n[t[0]];return i||(i=parseInt(t[0],10)),function(t){t.keyCode===i&&e.call(this,t)}}}}}),e.register("vue/src/transition.js",function(e,t,i){function n(e,t,i){if(!o)return i(),c.CSS_SKIP;var n=e.classList,r=e.vue_trans_cb;if(t>0){r&&(e.removeEventListener(o,r),e.vue_trans_cb=null),n.add(a.enterClass),i();{e.clientHeight}return n.remove(a.enterClass),c.CSS_E}n.add(a.leaveClass);var s=function(t){t.target===e&&(e.removeEventListener(o,s),e.vue_trans_cb=null,i(),n.remove(a.leaveClass))};return e.addEventListener(o,s),e.vue_trans_cb=s,c.CSS_L}function r(e,t,i,n,r){var s=r.getOption("transitions",n);if(!s)return i(),c.JS_SKIP;var o=s.enter,a=s.leave;return t>0?"function"!=typeof o?(i(),c.JS_SKIP_E):(o(e,i),c.JS_E):"function"!=typeof a?(i(),c.JS_SKIP_L):(a(e,i),c.JS_L)}function s(){var e=document.createElement("vue"),t="transitionend",i={transition:t,mozTransition:t,webkitTransition:"webkitTransitionEnd"};for(var n in i)if(void 0!==e.style[n])return i[n]}var o=s(),a=t("./config"),c={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},u=i.exports=function(e,t,i,s){var o=function(){i(),s.execHook(t>0?"attached":"detached")};if(s.init)return o(),c.INIT;var a=e.vue_trans;return a?r(e,t,o,a,s):""===a?n(e,t,o):(o(),c.SKIP)};u.codes=c}),e.register("vue/src/batcher.js",function(e,t){function i(){for(var e=0;et;t++)this.buildItem(e.args[t],n+t)},pop:function(){var e=this.vms.pop();e&&e.$destroy()},unshift:function(e){e.args.forEach(this.buildItem,this)},shift:function(){var e=this.vms.shift();e&&e.$destroy()},splice:function(e){var t,i,n=e.args[0],r=e.args[1],s=e.args.length-2,o=this.vms.splice(n,r);for(t=0,i=o.length;i>t;t++)o[t].$destroy();for(t=0;s>t;t++)this.buildItem(e.args[t+2],n+t)},sort:function(){var e,t,i,n,r=this.vms,s=this.collection,o=s.length,a=new Array(o);for(e=0;o>e;e++)for(n=s[e],t=0;o>t;t++)if(i=r[t],i.$data===n){a[e]=i;break}for(e=0;o>e;e++)this.container.insertBefore(a[e].$el,this.ref);this.vms=a},reverse:function(){var e=this.vms;e.reverse();for(var t=0,i=e.length;i>t;t++)this.container.insertBefore(e[t].$el,this.ref)}};i.exports={bind:function(){var e=this.el,i=this.container=e.parentNode;n=n||t("../viewmodel"),this.Ctor=this.Ctor||n,this.hasTrans=e.hasAttribute(o.attrs.transition),this.childId=s.attr(e,"ref"),this.ref=document.createComment(o.prefix+"-repeat-"+this.key),i.insertBefore(this.ref,e),i.removeChild(e),this.initiated=!1,this.collection=null,this.vms=null;var r=this;this.mutationListener=function(e,t,i){var n=i.method;if(c[n].call(r,i),"push"!==n&&"pop"!==n)for(var s=t.length;s--;)t[s].$index=s;("push"===n||"unshift"===n||"splice"===n)&&r.changed()}},update:function(e,t){e!==this.collection&&(this.reset(),this.container.vue_dHandlers=s.hash(),this.initiated||e&&e.length||(this.buildItem(),this.initiated=!0),e=this.collection=e||[],this.vms=[],this.childId&&(this.vm.$[this.childId]=this.vms),e.__observer__||r.watchArray(e),e.__observer__.on("mutate",this.mutationListener),e.length&&(e.forEach(this.buildItem,this),t||this.changed()))},changed:function(){if(!this.queued){this.queued=!0;var e=this;setTimeout(function(){e.compiler&&(e.compiler.parseDeps(),e.queued=!1)},0)}},buildItem:function(e,t){var i,n,r,o=this.el.cloneNode(!0),c=this.container,u=this.vms,l=this.collection;e&&(i=u.length>t?u[t].$el:this.ref,i.parentNode||(i=i.vue_ref),o.vue_trans=s.attr(o,"transition",!0),a(o,1,function(){c.insertBefore(o,i)},this.compiler),"Object"!==s.typeOf(e)&&(r=!0,e={value:e})),n=new this.Ctor({el:o,data:e,compilerOptions:{repeat:!0,repeatIndex:t,parentCompiler:this.compiler,delegator:c}}),e?(u.splice(t,0,n),r&&e.__observer__.on("set",function(e,t){"value"===e&&(l[n.$index]=t)})):n.$destroy()},reset:function(){if(this.childId&&delete this.vm.$[this.childId],this.collection){this.collection.__observer__.off("mutate",this.mutationListener);for(var e=this.vms.length;e--;)this.vms[e].$destroy()}var t=this.container,i=t.vue_dHandlers;for(var n in i)t.removeEventListener(i[n].event,i[n]);t.vue_dHandlers=null},unbind:function(){this.reset()}}}),e.register("vue/src/directives/on.js",function(e,t,i){function n(e,t,i){for(;e&&e!==t;){if(e[i])return e;e=e.parentNode}}var r=t("../utils");i.exports={isFn:!0,bind:function(){this.compiler.repeat&&(this.el[this.expression]=!0,this.el.vue_viewmodel=this.vm)},update:function(e){if(this.reset(),"function"!=typeof e)return r.warn('Directive "on" expects a function value.');var t=this.compiler,i=this.arg,s=this.binding.isExp,o=this.binding.compiler.vm;if(t.repeat&&!this.vm.constructor.super&&"blur"!==i&&"focus"!==i){var a=t.delegator,c=this.expression,u=a.vue_dHandlers[c];if(u)return;u=a.vue_dHandlers[c]=function(t){var i=n(t.target,a,c);i&&(t.el=i,t.targetVM=i.vue_viewmodel,e.call(s?t.targetVM:o,t))},u.event=i,a.addEventListener(i,u)}else{var l=this.vm;this.handler=function(t){t.el=t.currentTarget,t.targetVM=l,e.call(o,t)},this.el.addEventListener(i,this.handler)}},reset:function(){this.el.removeEventListener(this.arg,this.handler),this.handler=null},unbind:function(){this.reset(),this.el.vue_viewmodel=null}}}),e.register("vue/src/directives/model.js",function(e,t,i){function n(e){return Array.prototype.filter.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;i.exports={bind:function(){var e=this,t=e.el,i=t.type,n=t.tagName;e.lock=!1,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.vm.$set(this.key,this.multi?n(this.el):this.el[this.attr])},update:function(e){if(!this.lock){var t=this.el;"SELECT"===t.tagName?(t.selectedIndex=-1,this.multi&&Array.isArray(e)?e.forEach(this.updateSelect,this):this.updateSelect(e)):"radio"===t.type?t.checked=e==t.value:"checkbox"===t.type?t.checked=!!e:t[this.attr]=r.toText(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;i.exports={bind:function(){this.isEmpty&&this.build()},update:function(e){this.component?this.component.$data=e:this.build(e)},build:function(e){n=n||t("../viewmodel");var i=this.Ctor||n;this.component=new i({el:this.el,data:e,compilerOptions:{parentCompiler:this.compiler}})},unbind:function(){this.component.$destroy()}}}),e.register("vue/src/directives/html.js",function(e,t,i){var n=t("../utils").toText,r=Array.prototype.slice;i.exports={bind:function(){8===this.el.nodeType&&(this.holder=document.createElement("div"),this.nodes=[])},update:function(e){e=n(e),this.holder?this.swap(e):this.el.innerHTML=e},swap:function(e){for(var t,i=this.el.parentNode,n=this.holder,s=this.nodes,o=s.length;o--;)i.removeChild(s[o]);for(n.innerHTML=e,s=this.nodes=r.call(n.childNodes),o=0,t=s.length;t>o;o++)i.insertBefore(s[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,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(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}}}}),e.alias("component-emitter/index.js","vue/deps/emitter/index.js"),e.alias("component-emitter/index.js","emitter/index.js"),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 +!function(){"use strict";function e(t,i,n){var r=e.resolve(t);if(null==r){n=n||t,i=i||"root";var s=new Error('Failed to require "'+n+'" from "'+i+'"');throw s.path=n,s.parent=i,s.require=!0,s}var o=e.modules[r];if(!o._resolving&&!o.exports){var a={};a.exports={},a.client=a.component=!0,o._resolving=!0,o.call(this,a.exports,e.relative(r),a),delete o._resolving,o.exports=a.exports}return o.exports}e.modules={},e.aliases={},e.resolve=function(t){"/"===t.charAt(0)&&(t=t.slice(1));for(var i=[t,t+".js",t+".json",t+"/index.js",t+"/index.json"],n=0;nn;++n)i[n].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}}),e.register("vue/src/main.js",function(e,t,i){function n(e){var t=this;e=r(e,t.options,!0),a.processOptions(e);var i=function(i,n){n||(i=r(i,e,!0)),t.call(this,i,!0)},s=i.prototype=Object.create(t.prototype);a.defProtected(s,"constructor",i);var c=e.methods;if(c)for(var u in c)u in o.prototype||"function"!=typeof c[u]||(s[u]=c[u]);return i.extend=n,i.super=t,i.options=e,l.forEach(function(e){i[e]=o[e]}),i}function r(e,t,i){if(e=e||c(),!t)return e;for(var n in t)if("el"!==n&&"methods"!==n){var s=e[n],o=t[n],l=a.typeOf(s);i&&"Function"===l&&o?(e[n]=[s],Array.isArray(o)?e[n]=e[n].concat(o):e[n].push(o)):i&&"Object"===l?r(s,o):void 0===s&&(e[n]=o)}return e}var s=t("./config"),o=t("./viewmodel"),a=t("./utils"),c=a.hash,l=["directive","filter","partial","transition","component"];o.options=s.globalAssets={directives:t("./directives"),filters:t("./filters"),partials:c(),transitions:c(),components:c()},l.forEach(function(e){o[e]=function(t,i){var n=this.options[e+"s"];return n||(n=this.options[e+"s"]=c()),i?("partial"===e?i=a.toFragment(i):"component"===e&&(i=a.toConstructor(i)),n[t]=i,this):n[t]}}),o.config=function(e,t){if("string"==typeof e){if(void 0===t)return s[e];s[e]=t}else a.extend(s,e);return this},o.require=function(e){return t("./"+e)},o.use=function(e){if("string"==typeof e)try{e=t(e)}catch(i){return a.warn("Cannot find plugin: "+e)}var n=[].slice.call(arguments,1);n.unshift(o),"function"==typeof e.install?e.install.apply(e,n):e.apply(null,n)},o.extend=n,o.nextTick=a.nextTick,i.exports=o}),e.register("vue/src/emitter.js",function(e,t,i){var n,r="emitter";try{n=t(r)}catch(s){n=t("events").EventEmitter,n.prototype.off=function(){var e=arguments.length>1?this.removeListener:this.removeAllListeners;return e.apply(this,arguments)}}i.exports=n}),e.register("vue/src/config.js",function(e,t,i){function n(){s.forEach(function(e){o.attrs[e]=r+"-"+e})}var r="v",s=["pre","ref","with","text","repeat","partial","component","transition"],o=i.exports={debug:!1,silent:!1,enterClass:"v-enter",leaveClass:"v-leave",attrs:{},get prefix(){return r},set prefix(e){r=e,n()}};n()}),e.register("vue/src/utils.js",function(e,t,i){var n,r=t("./config"),s=r.attrs,o={}.toString,a=[].join,c=window,l=c.console,u="classList"in document.documentElement,h=c.requestAnimationFrame||c.webkitRequestAnimationFrame||c.setTimeout,f=i.exports={hash:function(){return Object.create(null)},attr:function(e,t,i){var n=s[t],r=e.getAttribute(n);return i||null===r||e.removeAttribute(n),r},defProtected:function(e,t,i,n,r){e.hasOwnProperty(t)||Object.defineProperty(e,t,{value:i,enumerable:!!n,configurable:!!r})},typeOf:function(e){return o.call(e).slice(8,-1)},bind:function(e,t){return function(i){return e.call(t,i)}},toText:function(e){var t=typeof e;return"string"===t||"boolean"===t||"number"===t&&e==e?e:"object"===t&&null!==e?JSON.stringify(e):""},extend:function(e,t,i){for(var n in t)i&&e[n]||(e[n]=t[n])},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},toFragment:function(e){if("string"!=typeof e)return e;if("#"===e.charAt(0)){var t=document.getElementById(e.slice(1));if(!t)return;e=t.innerHTML}var i,n=document.createElement("div"),r=document.createDocumentFragment();for(n.innerHTML=e.trim();i=n.firstChild;)1===n.nodeType&&r.appendChild(i);return r},toConstructor:function(e){return n=n||t("./viewmodel"),"Object"===f.typeOf(e)?n.extend(e):"function"==typeof e?e:null},processOptions:function(e){var t,i=e.components,n=e.partials,r=e.template;if(i)for(t in i)i[t]=f.toConstructor(i[t]);if(n)for(t in n)n[t]=f.toFragment(n[t]);r&&(e.template=f.toFragment(r))},log:function(){r.debug&&l&&l.log(a.call(arguments," "))},warn:function(){!r.silent&&l&&(l.warn(a.call(arguments," ")),r.debug&&l.trace())},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()}}}}),e.register("vue/src/compiler.js",function(e,t,i){function n(e,t){var i=this;i.init=!0,t=i.options=t||m(),c.processOptions(t);var n=i.data=t.data||{};g(e,n,!0),g(e,t.methods,!0),g(i,t.compilerOptions);var o=i.setupElement(t);v("\nnew VM instance:",o.tagName,"\n"),i.vm=e,i.bindings=m(),i.dirs=[],i.deferred=[],i.exps=[],i.computed=[],i.childCompilers=[],i.emitter=new s,b(e,"$",m()),b(e,"$el",o),b(e,"$compiler",i),b(e,"$root",r(i).vm);var a=i.parentCompiler,l=c.attr(o,"ref");a&&(a.childCompilers.push(i),b(e,"$parent",a.vm),l&&(i.childId=l,a.vm.$[l]=e)),i.setupObserver();var u=t.computed;if(u)for(var h in u)i.createBinding(h);i.execHook("created"),g(n,e),i.observeData(n),i.repeat&&(i.createBinding("$index"),n.$key&&i.createBinding("$key")),i.compile(o,!0),i.deferred.forEach(i.bindDirective,i),i.parseDeps(),i.rawContent=null,i.init=!1,i.execHook("ready")}function r(e){for(;e.parentCompiler;)e=e.parentCompiler;return e}var s=t("./emitter"),o=t("./observer"),a=t("./config"),c=t("./utils"),l=t("./binding"),u=t("./directive"),h=t("./text-parser"),f=t("./deps-parser"),p=t("./exp-parser"),d=[].slice,v=c.log,m=c.hash,g=c.extend,b=c.defProtected,y={}.hasOwnProperty,_=["created","ready","beforeDestroy","afterDestroy","attached","detached"],x=n.prototype;x.setupElement=function(e){var t=this.el="string"==typeof e.el?document.querySelector(e.el):e.el||document.createElement(e.tagName||"div"),i=e.template;if(i){for(var n,r=this.rawContent=document.createDocumentFragment();n=t.firstChild;)r.appendChild(n);if(e.replace&&1===i.childNodes.length){var s=i.childNodes[0].cloneNode(!0);t.parentNode&&(t.parentNode.insertBefore(s,t),t.parentNode.removeChild(t)),t=s}else t.appendChild(i.cloneNode(!0))}e.id&&(t.id=e.id),e.className&&(t.className=e.className);var o=e.attributes;if(o)for(var a in o)t.setAttribute(a,o[a]);return t},x.setupObserver=function(){function e(e){n(e),f.catcher.emit("get",o[e])}function t(e,t,i){c.emit("change:"+e,t,i),n(e),o[e].update(t)}function i(e,t){c.on("hook:"+e,function(){t.call(r.vm,a)})}function n(e){o[e]||r.createBinding(e)}var r=this,o=r.bindings,a=r.options,c=r.observer=new s;c.proxies=m(),c.on("get",e).on("set",t).on("mutate",t),_.forEach(function(e){var t=a[e];if(Array.isArray(t))for(var n=t.length;n--;)i(e,t[n]);else t&&i(e,t)})},x.observeData=function(e){function t(e){"$data"!==e&&r.update(i.data)}var i=this,n=i.observer;o.observe(e,"",n);var r=i.bindings.$data=new l(i,"$data");r.update(e),Object.defineProperty(i.vm,"$data",{enumerable:!1,get:function(){return i.observer.emit("get","$data"),i.data},set:function(e){var t=i.data;o.unobserve(t,"",n),i.data=e,o.copyPaths(e,t),o.observe(e,"",n),i.observer.emit("set","$data",e)}}),n.on("set",t).on("mutate",t)},x.compile=function(e,t){var i=this,n=e.nodeType,r=e.tagName;if(1===n&&"SCRIPT"!==r){if(null!==c.attr(e,"pre"))return;var s,o,a,l,h=c.attr(e,"component")||r.toLowerCase(),f=i.getOption("components",h);if(s=c.attr(e,"repeat"))l=u.parse("repeat",s,i,e),l&&(l.Ctor=f,i.deferred.push(l));else if(t!==!0&&((o=c.attr(e,"with"))||f))l=u.parse("with",o||"",i,e),l&&(l.Ctor=f,i.deferred.push(l));else{if(e.vue_trans=c.attr(e,"transition"),a=c.attr(e,"partial")){var p=i.getOption("partials",a);p&&(e.innerHTML="",e.appendChild(p.cloneNode(!0)))}i.compileNode(e)}}else 3===n&&i.compileTextNode(e)},x.compileNode=function(e){var t,i,n=d.call(e.attributes),r=a.prefix+"-";if(n&&n.length){var s,o,c,l,f,p;for(t=n.length;t--;){if(s=n[t],o=!1,0===s.name.indexOf(r))for(o=!0,c=u.split(s.value),i=c.length;i--;)l=c[i],p=s.name.slice(r.length),f=u.parse(p,l,this,e),f&&this.bindDirective(f);else l=h.parseAttr(s.value),l&&(f=u.parse("attr",s.name+":"+l,this,e),f&&this.bindDirective(f));o&&"cloak"!==p&&e.removeAttribute(s.name)}}e.childNodes.length&&d.call(e.childNodes).forEach(this.compile,this)},x.compileTextNode=function(e){var t=h.parse(e.nodeValue);if(t){for(var i,n,r,s,o,l,f=0,p=t.length;p>f;f++){if(n=t[f],r=l=null,n.key)if(">"===n.key.charAt(0)){if(o=n.key.slice(1).trim(),"yield"===o)i=this.rawContent;else{if(s=this.getOption("partials",o),!s){c.warn("Unknown partial: "+o);continue}i=s.cloneNode(!0)}i&&(l=d.call(i.childNodes))}else n.html?(i=document.createComment(a.prefix+"-html"),r=u.parse("html",n.key,this,i)):(i=document.createTextNode(""),r=u.parse("text",n.key,this,i));else i=document.createTextNode(n);e.parentNode.insertBefore(i,e),r&&this.bindDirective(r),l&&l.forEach(this.compile,this)}e.parentNode.removeChild(e)}},x.bindDirective=function(e){if(this.dirs.push(e),e.isEmpty||!e._update)return void(e.bind&&e.bind());var t,i=this,n=e.key;if(e.isExp)t=i.createBinding(n,!0,e.isFn);else{for(;i&&!i.hasKey(n);)i=i.parentCompiler;i=i||this,t=i.bindings[n]||i.createBinding(n)}t.dirs.push(e),e.binding=t,e.bind&&e.bind(),e.update(t.val(),!0)},x.createBinding=function(e,t,i){v(" created binding: "+e);var n=this,r=n.bindings,s=n.options.computed,a=new l(n,e,t,i);if(t)n.defineExp(e,a);else if(r[e]=a,a.root)s&&s[e]?n.defineComputed(e,a,s[e]):n.defineProp(e,a);else{o.ensurePath(n.data,e);var c=e.slice(0,e.lastIndexOf("."));r[c]||n.createBinding(c)}return a},x.defineProp=function(e,t){var i=this,n=i.data,r=n.__emitter__;e in n||(n[e]=void 0),!r||e in r.values||o.convert(n,e),t.value=n[e],Object.defineProperty(i.vm,e,{get:function(){return i.data[e]},set:function(t){i.data[e]=t}})},x.defineExp=function(e,t){var i=p.parse(e,this);i&&(this.markComputed(t,i),this.exps.push(t))},x.defineComputed=function(e,t,i){this.markComputed(t,i),Object.defineProperty(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:c.bind(t.$get,this.vm),$set:t.$set?c.bind(t.$set,this.vm):void 0}),this.computed.push(e)},x.getOption=function(e,t){var i=this.options,n=this.parentCompiler,r=a.globalAssets;return i[e]&&i[e][t]||(n?n.getOption(e,t):r[e]&&r[e][t])},x.execHook=function(e){e="hook:"+e,this.observer.emit(e),this.emitter.emit(e)},x.hasKey=function(e){var t=e.split(".")[0];return y.call(this.data,t)||y.call(this.vm,t)},x.parseDeps=function(){this.computed.length&&f.parse(this.computed)},x.destroy=function(){if(!this.destroyed){var e,t,i,n,r,s=this,a=s.vm,c=s.el,l=s.dirs,u=s.exps,h=s.bindings;for(s.execHook("beforeDestroy"),o.unobserve(s.data,"",s.observer),e=l.length;e--;)i=l[e],i.binding&&i.binding.compiler!==s&&(n=i.binding.dirs,n&&n.splice(n.indexOf(i),1)),i.unbind();for(e=u.length;e--;)u[e].unbind();for(t in h)r=h[t],r&&r.unbind();var f=s.parentCompiler,p=s.childId;f&&(f.childCompilers.splice(f.childCompilers.indexOf(s),1),p&&delete f.vm.$[p]),c===document.body?c.innerHTML="":a.$remove(),this.destroyed=!0,s.execHook("afterDestroy"),s.observer.off(),s.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=o.defProtected,l=o.nextTick,u=n.prototype;c(u,"$set",function(e,t){for(var i=e.split("."),n=this,r=0,s=i.length-1;s>r;r++)n=n[i[r]];n[i[r]]=t}),c(u,"$watch",function(e,t){function i(){var e=arguments;o.nextTick(function(){t.apply(n,e)})}var n=this;t._fn=i,n.$compiler.observer.on("change:"+e,i)}),c(u,"$unwatch",function(e,t){var i=["change:"+e],n=this.$compiler.observer;t&&i.push(t._fn),n.off.apply(n,i)}),c(u,"$destroy",function(){this.$compiler.destroy()}),c(u,"$broadcast",function(){for(var e,t=this.$compiler.childCompilers,i=t.length;i--;)e=t[i],e.emitter.emit.apply(e.emitter,arguments),e.vm.$broadcast.apply(e.vm,arguments)}),c(u,"$dispatch",function(){var e=this.$compiler,t=e.emitter,i=e.parentCompiler;t.emit.apply(t,arguments),i&&i.vm.$dispatch.apply(i.vm,arguments)}),["emit","on","off","once"].forEach(function(e){c(u,"$"+e,function(){var t=this.$compiler.emitter;t[e].apply(t,arguments)})}),c(u,"$appendTo",function(e,t){e=r(e);var i=this.$el;a(i,1,function(){e.appendChild(i),t&&l(t)},this.$compiler)}),c(u,"$remove",function(e){var t=this.$el,i=t.parentNode;i&&a(t,-1,function(){i.removeChild(t),e&&l(e)},this.$compiler)}),c(u,"$before",function(e,t){e=r(e);var i=this.$el,n=e.parentNode;n&&a(i,1,function(){n.insertBefore(i,e),t&&l(t)},this.$compiler)}),c(u,"$after",function(e,t){e=r(e);var i=this.$el,n=e.parentNode,s=e.nextSibling;n&&a(i,1,function(){s?n.insertBefore(i,s):n.appendChild(i),t&&l(t)},this.$compiler)}),i.exports=n}),e.register("vue/src/binding.js",function(e,t,i){function n(e,t,i,n){this.id=s++,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=0,o=n.prototype;o.update=function(e){(!this.isComputed||this.isFn)&&(this.value=e),(this.dirs.length||this.subs.length)&&r.queue(this)},o._update=function(){for(var e=this.dirs.length,t=this.val();e--;)this.dirs[e].update(t);this.pub()},o.val=function(){return this.isComputed&&!this.isFn?this.value.$get():this.value},o.pub=function(){for(var e=this.subs.length;e--;)this.subs[e].update()},o.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,t.splice(t.indexOf(this),1)},i.exports=n}),e.register("vue/src/observer.js",function(e,t,i){function n(e){if("function"==typeof e){for(var t=this.length,i=[];t--;)e(this[t])&&i.push(this.splice(t,1)[0]);return i.reverse()}return"number"!=typeof e&&(e=this.indexOf(e)),e>-1?this.splice(e,1)[0]:void 0}function r(e,t){if("function"==typeof e){for(var i,n=this.length,r=[];n--;)i=e(this[n]),void 0!==i&&r.push(this.splice(n,1,i)[0]);return r.reverse()}return"number"!=typeof e&&(e=this.indexOf(e)),e>-1?this.splice(e,1,t)[0]:void 0}function s(e){for(var t in e)a(e,t)}function o(e){var t=e.__emitter__;if(t||(t=new v,b(e,"__emitter__",t)),k)e.__proto__=w;else for(var i in w)b(e,i,w[i])}function a(e,t){function i(e,i){s[t]=e,r.emit("set",t,e,i),Array.isArray(e)&&r.emit("set",t+".length",e.length),f(e,t,r)}var n=t.charAt(0);if("$"!==n&&"_"!==n||"$index"===t||"$key"===t||"$value"===t){var r=e.__emitter__,s=r.values;i(e[t]),Object.defineProperty(e,t,{get:function(){var e=s[t];return C.shouldGet&&g(e)!==_&&r.emit("get",t),e},set:function(e){var n=s[t];p(n,t,r),u(e,n),i(e,!0)}})}}function c(e){d=d||t("./viewmodel");var i=g(e);return!(i!==_&&i!==x||e instanceof d)}function l(e){var t=g(e),i=e&&e.__emitter__;if(t===x)i.emit("set","length",e.length);else if(t===_){var n,r;for(n in e)r=e[n],i.emit("set",n,r),l(r)}}function u(e,t){if(g(t)===_&&g(e)===_){var i,n,r,s;for(i in t)i in e||(r=t[i],n=g(r),n===_?(s=e[i]={},u(s,r)):e[i]=n===x?[]:void 0)}}function h(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__&&a(e,i)),e=e[i];g(e)===_&&(i=n[r],i in e||(e[i]=void 0,e.__emitter__&&a(e,i)))}function f(e,t,i){if(c(e)){var n,r=t?t+".":"",a=!!e.__emitter__;a||b(e,"__emitter__",new v),n=e.__emitter__,n.values=n.values||m.hash(),i.proxies=i.proxies||{};var u=i.proxies[r]={get:function(e){i.emit("get",r+e)},set:function(n,s,o){i.emit("set",r+n,s),t&&o&&i.emit("set",t,e,!0)},mutate:function(e,n,s){var o=e?r+e:t;i.emit("mutate",o,n,s);var a=s.method;"sort"!==a&&"reverse"!==a&&i.emit("set",o+".length",n.length)}};if(n.on("get",u.get).on("set",u.set).on("mutate",u.mutate),a)l(e);else{var h=g(e);h===_?s(e):h===x&&o(e)}}}function p(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 d,v=t("./emitter"),m=t("./utils"),g=m.typeOf,b=m.defProtected,y=[].slice,_="Object",x="Array",$=["push","pop","shift","unshift","splice","sort","reverse"],k={}.__proto__,w=Object.create(Array.prototype);$.forEach(function(e){b(w,e,function(){var t=Array.prototype[e].apply(this,arguments);return this.__emitter__.emit("mutate",null,this,{method:e,args:y.call(arguments),result:t}),t},!k)}),b(w,"remove",n,!k),b(w,"set",r,!k),b(w,"replace",r,!k);var C=i.exports={shouldGet:!1,observe:f,unobserve:p,ensurePath:h,convert:a,copyPaths:u,watchArray:o}}),e.register("vue/src/directive.js",function(e,t,i){function n(e,t,i,n,o){this.compiler=n,this.vm=n.vm,this.el=o;var a=""===t;if("function"==typeof e)this[a?"bind":"_update"]=e;else for(var c in e)"unbind"===c||"update"===c?this["_"+c]=e[c]:this[c]=e[c];if(a)return void(this.isEmpty=!0);this.expression=t.trim(),this.rawKey=i,r(this,i),this.isExp=!v.test(this.key)||d.test(this.key);var l=this.expression.slice(i.length).match(f);if(l){this.filters=[];for(var u,h=0,p=l.length;p>h;h++)u=s(l[h],this.compiler),u&&this.filters.push(u);this.filters.length||(this.filters=null)}else this.filters=null}function r(e,t){var i=t;if(t.indexOf(":")>-1){var n=t.match(h);i=n?n[2].trim():i,e.arg=n?n[1].trim():null}e.key=i}function s(e,t){var i=e.slice(1).match(p);if(i){i=i.map(function(e){return e.replace(/'/g,"").trim()});var n=i[0],r=t.getOption("filters",n)||c[n];return r?{name:n,apply:r,args:i.length>1?i.slice(1):null}:void o.warn("Unknown filter: "+n)}}var o=t("./utils"),a=t("./directives"),c=t("./filters"),l=/(?:['"](?:\\.|[^'"])*['"]|\((?:\\.|[^\)])*\)|\\.|[^,])+/g,u=/^(?:['"](?:\\.|[^'"])*['"]|\\.|[^\|]|\|\|)+/,h=/^([\w-$ ]+):(.+)$/,f=/\|[^\|]+/g,p=/[^\s']+|'[^']+'/g,d=/^\$(parent|root)\./,v=/^[\w\.$]+$/,m=n.prototype;m.update=function(e,t){var i=o.typeOf(e);(t||e!==this.value||"Object"===i||"Array"===i)&&(this.value=e,this._update&&this._update(this.filters?this.applyFilters(e):e,t))},m.applyFilters=function(e){for(var t,i=e,n=0,r=this.filters.length;r>n;n++)t=this.filters[n],i=t.apply.call(this.vm,i,t.args);return i},m.unbind=function(){this.el&&this.vm&&(this._unbind&&this._unbind(),this.vm=this.el=this.binding=this.compiler=null)},n.split=function(e){return e.indexOf(",")>-1?e.match(l)||[""]:[e]},n.parse=function(e,t,i,r){var s=i.getOption("directives",e)||a[e];if(!s)return o.warn("unknown directive: "+e);var c;if(t.indexOf("|")>-1){var l=t.match(u);l&&(c=l[0].trim())}else c=t.trim();return c||""===t?new n(s,t,c,i,r):o.warn("invalid directive expression: "+t)},i.exports=n}),e.register("vue/src/exp-parser.js",function(e,t,i){function n(e){return e=e.replace(d,"").replace(v,",").replace(p,"").replace(m,"").replace(g,""),e?e.split(/,+/):[]}function r(e,t){for(var i="",n=0,r=t;t&&!t.hasKey(e);)t=t.parentCompiler,n++;if(t){for(;n--;)i+="$parent.";t.bindings[e]||"$"===e.charAt(0)||t.createBinding(e)}else r.createBinding(e);return i}function s(e,t){var i;try{i=new Function(e)}catch(n){a.warn("Invalid expression: "+t)}return i}function o(e){return"$"===e.charAt(0)?"\\"+e:e}var a=t("./utils"),c=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,l=/"(\d+)"/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",p=new RegExp(["\\b"+f.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),d=/\/\*(?:.|\n)*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|'[^']*'|"[^"]*"|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g,v=/[^\w$]+/g,m=/\b\d[^,]*/g,g=/^,+|,+$/g;i.exports={parse:function(e,t){function i(e){var t=g.length;return g[t]=e,'"'+t+'"'}function f(e){var i=e.charAt(0);e=e.slice(1);var n="this."+r(e,t)+e;return m[e]||(v+=n+";",m[e]=1),i+n}function p(e,t){return g[t]}if(h.test(e)||u.test(e))return a.warn("Unsafe expression: "+e),function(){};var d=n(e);if(!d.length)return s("return "+e,e);d=a.unique(d);var v="",m=a.hash(),g=[],b=new RegExp("[^$\\w\\.]("+d.map(o).join("|")+")[$\\w\\.]*\\b","g"),y=("return "+e).replace(c,i).replace(b,f).replace(l,p);return y=v+y,s(y,e)}}}),e.register("vue/src/text-parser.js",function(e){function t(e){if(!n.test(e))return null;for(var t,i,s,o=[];t=e.match(n);)i=t.index,i>0&&o.push(e.slice(0,i)),s={key:t[1].trim()},r.test(t[0])&&(s.html=!0),o.push(s),e=e.slice(i+t[0].length);return e.length&&o.push(e),o}function i(e){var i=t(e);if(!i)return null;for(var n,r=[],s=0,o=i.length;o>s;s++)n=i[s],r.push(n.key||'"'+n+'"');return r.join("+")}var n=/{{{?([^{}]+?)}?}}/,r=/{{{[^{}]+}}}/;e.parse=t,e.parseAttr=i}),e.register("vue/src/deps-parser.js",function(e,t,i){function n(e){if(!e.isFn){s.log("\n- "+e.key);var t=s.hash();e.deps=[],a.on("get",function(i){var n=t[i.key];n&&n.compiler===i.compiler||(t[i.key]=i,s.log(" - "+i.key),e.deps.push(i),i.subs.push(e))}),e.value.$get(),a.off("get")}}var r=t("./emitter"),s=t("./utils"),o=t("./observer"),a=new r;i.exports={catcher:a,parse:function(e){s.log("\nparsing dependencies..."),o.shouldGet=!0,e.forEach(n),o.shouldGet=!1,s.log("\ndone.")}}}),e.register("vue/src/filters.js",function(e,t,i){var n={enter:13,tab:9,"delete":46,up:38,left:37,right:39,down:40,esc:27};i.exports={capitalize:function(e){return e||0===e?(e=e.toString(),e.charAt(0).toUpperCase()+e.slice(1)):""},uppercase:function(e){return e||0===e?e.toString().toUpperCase():""},lowercase:function(e){return e||0===e?e.toString().toLowerCase():""},currency:function(e,t){if(!e&&0!==e)return"";var i=t&&t[0]||"$",n=Math.floor(e).toString(),r=n.length%3,s=r>0?n.slice(0,r)+(n.length>3?",":""):"",o="."+e.toFixed(2).slice(-2);return i+s+n.slice(r).replace(/(\d{3})(?=\d)/g,"$1,")+o},pluralize:function(e,t){return t.length>1?t[e-1]||t[t.length-1]:t[e-1]||t[0]+"s"},key:function(e,t){if(e){var i=n[t[0]];return i||(i=parseInt(t[0],10)),function(t){t.keyCode===i&&e.call(this,t)}}}}}),e.register("vue/src/transition.js",function(e,t,i){function n(e,t,i){if(!o)return i(),c.CSS_SKIP;var n=e.classList,r=e.vue_trans_cb;if(t>0){r&&(e.removeEventListener(o,r),e.vue_trans_cb=null),n.add(a.enterClass),i();{e.clientHeight}return n.remove(a.enterClass),c.CSS_E}if(e.offsetWidth||e.offsetHeight){n.add(a.leaveClass);var s=function(t){t.target===e&&(e.removeEventListener(o,s),e.vue_trans_cb=null,i(),n.remove(a.leaveClass))};e.addEventListener(o,s),e.vue_trans_cb=s}else i();return c.CSS_L}function r(e,t,i,n,r){var s=r.getOption("transitions",n);if(!s)return i(),c.JS_SKIP;var o=s.enter,a=s.leave;return t>0?"function"!=typeof o?(i(),c.JS_SKIP_E):(o(e,i),c.JS_E):"function"!=typeof a?(i(),c.JS_SKIP_L):(a(e,i),c.JS_L)}function s(){var e=document.createElement("vue"),t="transitionend",i={transition:t,mozTransition:t,webkitTransition:"webkitTransitionEnd"};for(var n in i)if(void 0!==e.style[n])return i[n]}var o=s(),a=t("./config"),c={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=i.exports=function(e,t,i,s){var o=function(){i(),s.execHook(t>0?"attached":"detached")};if(s.init)return o(),c.INIT;var a=e.vue_trans;return a?r(e,t,o,a,s):""===a?n(e,t,o):(o(),c.SKIP)};l.codes=c}),e.register("vue/src/batcher.js",function(e,t){function i(){for(var e=0;ei;i++)if(e[i]===t||t.$value&&e[i].$value===t.$value)return i;return-1}var s,o=t("../observer"),a=t("../utils"),c=t("../config"),l=t("../transition"),u=a.defProtected,h={push:function(e){for(var t=e.args.length,i=this.collection.length-t,n=0;t>n;n++)this.buildItem(e.args[n],i+n),this.updateObject(e.args[n],1)},pop:function(){var e=this.vms.pop();e&&(e.$destroy(),this.updateObject(e.$data,-1))},unshift:function(e){for(var t=0,i=e.args.length;i>t;t++)this.buildItem(e.args[t],t),this.updateObject(e.args[t],1)},shift:function(){var e=this.vms.shift();e&&(e.$destroy(),this.updateObject(e.$data,-1))},splice:function(e){var t,i,n=e.args[0],r=e.args[1],s=e.args.length-2,o=this.vms.splice(n,r);for(t=0,i=o.length;i>t;t++)o[t].$destroy(),this.updateObject(o[t].$data,-1);for(t=0;s>t;t++)this.buildItem(e.args[t+2],n+t),this.updateObject(e.args[t+2],1)},sort:function(){var e,t,i,n,r=this.vms,s=this.collection,o=s.length,a=new Array(o);for(e=0;o>e;e++)for(n=s[e],t=0;o>t;t++)if(i=r[t],i.$data===n){a[e]=i;break}for(e=0;o>e;e++)this.container.insertBefore(a[e].$el,this.ref);this.vms=a},reverse:function(){var e=this.vms;e.reverse();for(var t=0,i=e.length;i>t;t++)this.container.insertBefore(e[t].$el,this.ref)}};i.exports={bind:function(){var e=this.el,i=this.container=e.parentNode;s=s||t("../viewmodel"),this.Ctor=this.Ctor||s,this.hasTrans=e.hasAttribute(c.attrs.transition),this.childId=a.attr(e,"ref"),this.ref=document.createComment(c.prefix+"-repeat-"+this.key),i.insertBefore(this.ref,e),i.removeChild(e),this.initiated=!1,this.collection=null,this.vms=null;var n=this;this.mutationListener=function(e,t,i){var r=i.method;if(h[r].call(n,i),"push"!==r&&"pop"!==r)for(var s=t.length;s--;)t[s].$index=s;("push"===r||"unshift"===r||"splice"===r)&&n.changed()}},update:function(e,t){if(e!==this.collection&&e!==this.object){"Object"===a.typeOf(e)&&(this.object&&delete this.object.$repeater,this.object=e,e=n(e),u(this.object,"$repeater",e,!1,!0)),this.reset(),this.container.vue_dHandlers=a.hash(),this.initiated||e&&e.length||(this.buildItem(),this.initiated=!0),this.old=this.collection;var i=this.oldVMs=this.vms;if(e=this.collection=e||[],this.vms=[],this.childId&&(this.vm.$[this.childId]=this.vms),e.__emitter__||o.watchArray(e),e.__emitter__.on("mutate",this.mutationListener),e.length&&(e.forEach(this.buildItem,this),t||this.changed()),i)for(var r,s=i.length;s--;)r=i[s],r.$reused?r.$reused=!1:r.$destroy();this.old=this.oldVMs=null}},changed:function(){if(!this.queued){this.queued=!0;var e=this;setTimeout(function(){e.compiler&&(e.compiler.parseDeps(),e.queued=!1)},0)}},buildItem:function(e,t){var i,n,s,o,c,h,f=this.container,p=this.vms,d=this.collection;e&&(this.old&&(n=r(this.old,e)),n>-1?(o=this.oldVMs[n],o.$reused=!0,i=o.$el,e.$index=t,h=!i.parentNode):(i=this.el.cloneNode(!0),i.vue_trans=a.attr(i,"transition",!0),"Object"!==a.typeOf(e)&&(c=!0,e={$value:e}),u(e,"$index",t,!1,!0)),s=p.length>t?p[t].$el:this.ref,s.parentNode||(s=s.vue_ref),h?f.insertBefore(i.vue_ref,s):n>-1?f.insertBefore(i,s):l(i,1,function(){f.insertBefore(i,s)},this.compiler)),o=o||new this.Ctor({el:i,data:e,compilerOptions:{repeat:!0,parentCompiler:this.compiler,delegator:f}}),e?(p.splice(t,0,o),c&&e.__emitter__.on("set",function(e,t){"$value"===e&&(d[o.$index]=t)})):o.$destroy()},updateObject:function(e,t){if(this.object&&e.$key){var i=e.$key,n=e.$value||e;t>0?(delete e.$key,u(e,"$key",i,!1,!0),this.object[i]=n):delete this.object[i],this.object.__emitter__.emit("set",i,n,!0)}},reset:function(e){if(this.childId&&delete this.vm.$[this.childId],this.collection&&(this.collection.__emitter__.off("mutate",this.mutationListener),e))for(var t=this.vms.length;t--;)this.vms[t].$destroy();var i=this.container,n=i.vue_dHandlers;for(var r in n)i.removeEventListener(n[r].event,n[r]);i.vue_dHandlers=null},unbind:function(){this.reset(!0)}}}),e.register("vue/src/directives/on.js",function(e,t,i){function n(e,t,i){for(;e&&e!==t;){if(e[i])return e;e=e.parentNode}}var r=t("../utils");i.exports={isFn:!0,bind:function(){this.compiler.repeat&&(this.el[this.expression]=!0,this.el.vue_viewmodel=this.vm)},update:function(e){if(this.reset(),"function"!=typeof e)return r.warn('Directive "on" expects a function value.'); +var t=this.compiler,i=this.arg,s=this.binding.isExp,o=this.binding.compiler.vm;if(t.repeat&&!this.vm.constructor.super&&"blur"!==i&&"focus"!==i){var a=t.delegator,c=this.expression,l=a.vue_dHandlers[c];if(l)return;l=a.vue_dHandlers[c]=function(t){var i=n(t.target,a,c);i&&(t.el=i,t.targetVM=i.vue_viewmodel,e.call(s?t.targetVM:o,t))},l.event=i,a.addEventListener(i,l)}else{var u=this.vm;this.handler=function(t){t.el=t.currentTarget,t.targetVM=u,e.call(o,t)},this.el.addEventListener(i,this.handler)}},reset:function(){this.el.removeEventListener(this.arg,this.handler),this.handler=null},unbind:function(){this.reset(),this.el.vue_viewmodel=null}}}),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.toText(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;i.exports={bind:function(){this.isEmpty&&this.build()},update:function(e){this.component?this.component.$data=e:this.build(e)},build:function(e){n=n||t("../viewmodel");var i=this.Ctor||n;this.component=new i({el:this.el,data:e,compilerOptions:{parentCompiler:this.compiler}})},unbind:function(){this.component.$destroy()}}}),e.register("vue/src/directives/html.js",function(e,t,i){var n=t("../utils").toText,r=[].slice;i.exports={bind:function(){8===this.el.nodeType&&(this.holder=document.createElement("div"),this.nodes=[])},update:function(e){e=n(e),this.holder?this.swap(e):this.el.innerHTML=e},swap:function(e){for(var t,i=this.el.parentNode,n=this.holder,s=this.nodes,o=s.length;o--;)i.removeChild(s[o]);for(n.innerHTML=e,s=this.nodes=r.call(n.childNodes),o=0,t=s.length;t>o;o++)i.insertBefore(s[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.alias("component-emitter/index.js","vue/deps/emitter/index.js"),e.alias("component-emitter/index.js","emitter/index.js"),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/package.json b/package.json index f1eb0c1b0d3..7d211ed32ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue", - "version": "0.8.6", + "version": "0.8.7", "author": { "name": "Evan You", "email": "yyx990803@gmail.com", diff --git a/src/queue.js b/src/queue.js new file mode 100644 index 00000000000..e69de29bb2d