made with requirebin
Created
November 26, 2014 08:08
-
-
Save agonbina/0db558174ce2c37891e2 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Vue = require('vue') | |
var sortableMixin = require('vue-sortable-mixin') | |
var appTemplate = | |
'<ul>' + | |
'<li v-repeat="positions">{{$index}} : {{$value}}<li>' + | |
'</ul>'; | |
var app = new Vue({ | |
mixins: [ sortableMixin ], | |
data: { | |
positions: [ 'striker', 'defender', 'midfielder' ], | |
$sortable: { | |
key: 'positions' | |
} | |
}, | |
template: appTemplate | |
}) | |
app.$mount(document.body); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var _=require("../util");exports.$addChild=function(opts,BaseCtor){BaseCtor=BaseCtor||_.Vue;opts=opts||{};var parent=this;var ChildVue;var inherit=opts.inherit!==undefined?opts.inherit:BaseCtor.options.inherit;if(inherit){var ctors=parent._childCtors;if(!ctors){ctors=parent._childCtors={}}ChildVue=ctors[BaseCtor.cid];if(!ChildVue){var optionName=BaseCtor.options.name;var className=optionName?_.camelize(optionName,true):"VueComponent";ChildVue=new Function("return function "+className+" (options) {"+"this.constructor = "+className+";"+"this._init(options) }")();ChildVue.options=BaseCtor.options;ChildVue.prototype=this;ctors[BaseCtor.cid]=ChildVue}}else{ChildVue=BaseCtor}opts._parent=parent;opts._root=parent.$root;var child=new ChildVue(opts);if(!this._children){this._children=[]}this._children.push(child);return child}},{"../util":57}],2:[function(require,module,exports){var _=require("../util");var Watcher=require("../watcher");var Path=require("../parse/path");var textParser=require("../parse/text");var dirParser=require("../parse/directive");var expParser=require("../parse/expression");var filterRE=/[^|]\|[^|]/;exports.$get=function(exp){var res=expParser.parse(exp);if(res){return res.get.call(this,this)}};exports.$set=function(exp,val){var res=expParser.parse(exp,true);if(res&&res.set){res.set.call(this,this,val)}};exports.$add=function(key,val){this._data.$add(key,val)};exports.$delete=function(key){this._data.$delete(key)};exports.$watch=function(exp,cb,deep,immediate){var vm=this;var key=deep?exp+"**deep**":exp;var watcher=vm._userWatchers[key];var wrappedCb=function(val,oldVal){cb.call(vm,val,oldVal)};if(!watcher){watcher=vm._userWatchers[key]=new Watcher(vm,exp,wrappedCb,null,false,deep)}else{watcher.addCb(wrappedCb)}if(immediate){wrappedCb(watcher.value)}return function unwatchFn(){watcher.removeCb(wrappedCb);if(!watcher.active){vm._userWatchers[key]=null}}};exports.$eval=function(text){if(filterRE.test(text)){var dir=dirParser.parse(text)[0];return dir.filters?_.applyFilters(this.$get(dir.expression),_.resolveFilters(this,dir.filters).read,this):this.$get(dir.expression)}else{return this.$get(text)}};exports.$interpolate=function(text){var tokens=textParser.parse(text);var vm=this;if(tokens){return tokens.length===1?vm.$eval(tokens[0].value):tokens.map(function(token){return token.tag?vm.$eval(token.value):token.value}).join("")}else{return text}};exports.$log=function(path){var data=path?Path.get(this,path):this._data;console.log(JSON.parse(JSON.stringify(data)))}},{"../parse/directive":45,"../parse/expression":46,"../parse/path":47,"../parse/text":49,"../util":57,"../watcher":60}],3:[function(require,module,exports){var _=require("../util");var transition=require("../transition");exports.$appendTo=function(target,cb,withTransition){target=query(target);var targetIsDetached=!_.inDoc(target);var op=withTransition===false||targetIsDetached?append:transition.append;insert(this,target,op,targetIsDetached,cb);return this};exports.$prependTo=function(target,cb,withTransition){target=query(target);if(target.hasChildNodes()){this.$before(target.firstChild,cb,withTransition)}else{this.$appendTo(target,cb,withTransition)}return this};exports.$before=function(target,cb,withTransition){target=query(target);var targetIsDetached=!_.inDoc(target);var op=withTransition===false||targetIsDetached?before:transition.before;insert(this,target,op,targetIsDetached,cb);return this};exports.$after=function(target,cb,withTransition){target=query(target);if(target.nextSibling){this.$before(target.nextSibling,cb,withTransition)}else{this.$appendTo(target.parentNode,cb,withTransition)}return this};exports.$remove=function(cb,withTransition){var inDoc=this._isAttached&&_.inDoc(this.$el);if(!inDoc)withTransition=false;var op;var self=this;var realCb=function(){if(inDoc)self._callHook("detached");if(cb)cb()};if(this._isBlock&&!this._blockFragment.hasChildNodes()){op=withTransition===false?append:transition.removeThenAppend;blockOp(this,this._blockFragment,op,realCb)}else{op=withTransition===false?remove:transition.remove;op(this.$el,this,realCb)}return this};function insert(vm,target,op,targetIsDetached,cb){var shouldCallHook=!targetIsDetached&&!vm._isAttached&&!_.inDoc(vm.$el);if(vm._isBlock){blockOp(vm,target,op,cb)}else{op(vm.$el,target,vm,cb)}if(shouldCallHook){vm._callHook("attached")}}function blockOp(vm,target,op,cb){var current=vm._blockStart;var end=vm._blockEnd;var next;while(next!==end){next=current.nextSibling;op(current,target,vm);current=next}op(end,target,vm,cb)}function query(el){return typeof el==="string"?document.querySelector(el):el}function append(el,target,vm,cb){target.appendChild(el);if(cb)cb()}function before(el,target,vm,cb){_.before(el,target);if(cb)cb()}function remove(el,vm,cb){_.remove(el);if(cb)cb()}},{"../transition":51,"../util":57}],4:[function(require,module,exports){var _=require("../util");exports.$on=function(event,fn){(this._events[event]||(this._events[event]=[])).push(fn);modifyListenerCount(this,event,1);return this};exports.$once=function(event,fn){var self=this;function on(){self.$off(event,on);fn.apply(this,arguments)}on.fn=fn;this.$on(event,on);return this};exports.$off=function(event,fn){var cbs;if(!arguments.length){if(this.$parent){for(event in this._events){cbs=this._events[event];if(cbs){modifyListenerCount(this,event,-cbs.length)}}}this._events={};return this}cbs=this._events[event];if(!cbs){return this}if(arguments.length===1){modifyListenerCount(this,event,-cbs.length);this._events[event]=null;return this}var cb;var i=cbs.length;while(i--){cb=cbs[i];if(cb===fn||cb.fn===fn){modifyListenerCount(this,event,-1);cbs.splice(i,1);break}}return this};exports.$emit=function(event){this._eventCancelled=false;var cbs=this._events[event];if(cbs){var i=arguments.length-1;var args=new Array(i);while(i--){args[i]=arguments[i+1]}i=0;cbs=cbs.length>1?_.toArray(cbs):cbs;for(var l=cbs.length;i<l;i++){if(cbs[i].apply(this,args)===false){this._eventCancelled=true}}}return this};exports.$broadcast=function(event){if(!this._eventsCount[event])return;var children=this._children;if(children){for(var i=0,l=children.length;i<l;i++){var child=children[i];child.$emit.apply(child,arguments);if(!child._eventCancelled){child.$broadcast.apply(child,arguments)}}}return this};exports.$dispatch=function(){var parent=this.$parent;while(parent){parent.$emit.apply(parent,arguments);parent=parent._eventCancelled?null:parent.$parent}return this};var hookRE=/^hook:/;function modifyListenerCount(vm,event,count){var parent=vm.$parent;if(!parent||!count||hookRE.test(event))return;while(parent){parent._eventsCount[event]=(parent._eventsCount[event]||0)+count;parent=parent.$parent}}},{"../util":57}],5:[function(require,module,exports){var _=require("../util");var mergeOptions=require("../util/merge-option");exports.util=_;exports.nextTick=_.nextTick;exports.config=require("../config");exports.cid=0;var cid=1;exports.extend=function(extendOptions){extendOptions=extendOptions||{};var Super=this;var Sub=createClass(extendOptions.name||"VueComponent");Sub.prototype=Object.create(Super.prototype);Sub.prototype.constructor=Sub;Sub.cid=cid++;Sub.options=mergeOptions(Super.options,extendOptions);Sub["super"]=Super;Sub.extend=Super.extend;createAssetRegisters(Sub);return Sub};function createClass(name){return new Function("return function "+_.camelize(name,true)+" (options) { this._init(options) }")()}exports.use=function(plugin){var args=_.toArray(arguments,1);args.unshift(this);if(typeof plugin.install==="function"){plugin.install.apply(plugin,args)}else{plugin.apply(null,args)}return this};var assetTypes=["directive","filter","partial","transition"];function createAssetRegisters(Constructor){assetTypes.forEach(function(type){Constructor[type]=function(id,definition){if(!definition){return this.options[type+"s"][id]}else{this.options[type+"s"][id]=definition}}});Constructor.component=function(id,definition){if(!definition){return this.options.components[id]}else{if(_.isPlainObject(definition)){definition.name=id;definition=_.Vue.extend(definition)}this.options.components[id]=definition}}}createAssetRegisters(exports)},{"../config":12,"../util":57,"../util/merge-option":59}],6:[function(require,module,exports){var _=require("../util");var compile=require("../compile/compile");exports.$mount=function(el){if(this._isCompiled){_.warn("$mount() should be called only once.");return}if(!el){el=document.createElement("div")}else if(typeof el==="string"){var selector=el;el=document.querySelector(el);if(!el){_.warn("Cannot find element: "+selector);return}}this._compile(el);this._isCompiled=true;this._callHook("compiled");if(_.inDoc(this.$el)){this._callHook("attached");this._initDOMHooks();ready.call(this)}else{this._initDOMHooks();this.$once("hook:attached",ready)}return this};function ready(){this._isAttached=true;this._isReady=true;this._callHook("ready")}exports.$destroy=function(remove){if(this._isBeingDestroyed){return}this._callHook("beforeDestroy");this._isBeingDestroyed=true;var i;var parent=this.$parent;if(parent&&!parent._isBeingDestroyed){i=parent._children.indexOf(this);parent._children.splice(i,1)}if(this._children){i=this._children.length;while(i--){this._children[i].$destroy()}}i=this._directives.length;while(i--){this._directives[i]._teardown()}for(i in this._userWatchers){this._userWatchers[i].teardown()}if(this.$el){this.$el.__vue__=null}var self=this;if(remove&&this.$el){this.$remove(function(){cleanup(self)})}else{cleanup(self)}};function cleanup(vm){vm._data.__ob__.removeVm(vm);vm._data=vm._watchers=vm._userWatchers=vm._watcherList=vm.$el=vm.$parent=vm.$root=vm._children=vm._bindings=vm._directives=null;vm._isDestroyed=true;vm._callHook("destroyed");vm.$off()}exports.$compile=function(el){return compile(el,this.$options,true)(this,el)}},{"../compile/compile":10,"../util":57}],7:[function(require,module,exports){var _=require("./util");function Batcher(){this.reset()}var p=Batcher.prototype;p.push=function(job){if(!job.id||!this.has[job.id]||this.flushing){this.queue.push(job);this.has[job.id]=job;if(!this.waiting){this.waiting=true;_.nextTick(this.flush,this)}}};p.flush=function(){this.flushing=true;for(var i=0;i<this.queue.length;i++){var job=this.queue[i];if(!job.cancelled){job.run()}}this.reset()};p.reset=function(){this.has={};this.queue=[];this.waiting=false;this.flushing=false};module.exports=Batcher},{"./util":57}],8:[function(require,module,exports){var uid=0;function Binding(){this.id=++uid;this.subs=[]}var p=Binding.prototype;p.addSub=function(sub){this.subs.push(sub)};p.removeSub=function(sub){if(this.subs.length){var i=this.subs.indexOf(sub);if(i>-1)this.subs.splice(i,1)}};p.notify=function(){for(var i=0,l=this.subs.length;i<l;i++){this.subs[i].update()}};module.exports=Binding},{}],9:[function(require,module,exports){function Cache(limit){this.size=0;this.limit=limit;this.head=this.tail=undefined;this._keymap={}}var p=Cache.prototype;p.put=function(key,value){var entry={key:key,value:value};this._keymap[key]=entry;if(this.tail){this.tail.newer=entry;entry.older=this.tail}else{this.head=entry}this.tail=entry;if(this.size===this.limit){return this.shift()}else{this.size++}};p.shift=function(){var entry=this.head;if(entry){this.head=this.head.newer;this.head.older=undefined;entry.newer=entry.older=undefined;this._keymap[entry.key]=undefined}return entry};p.get=function(key,returnEntry){var entry=this._keymap[key];if(entry===undefined)return;if(entry===this.tail){return returnEntry?entry:entry.value}if(entry.newer){if(entry===this.head){this.head=entry.newer}entry.newer.older=entry.older}if(entry.older){entry.older.newer=entry.newer}entry.newer=undefined;entry.older=this.tail;if(this.tail){this.tail.newer=entry}this.tail=entry;return returnEntry?entry:entry.value};module.exports=Cache},{}],10:[function(require,module,exports){var _=require("../util");var config=require("../config");var textParser=require("../parse/text");var dirParser=require("../parse/directive");var templateParser=require("../parse/template");module.exports=function compile(el,options,partial){var params=!partial&&options.paramAttributes;var paramsLinkFn=params?compileParamAttributes(el,params,options):null;var nodeLinkFn=el instanceof DocumentFragment?null:compileNode(el,options);var childLinkFn=(!nodeLinkFn||!nodeLinkFn.terminal)&&el.hasChildNodes()?compileNodeList(el.childNodes,options):null;return function link(vm,el){var originalDirCount=vm._directives.length;if(paramsLinkFn)paramsLinkFn(vm,el);if(nodeLinkFn)nodeLinkFn(vm,el);if(childLinkFn)childLinkFn(vm,el.childNodes);if(partial){var dirs=vm._directives.slice(originalDirCount);return function unlink(){var i=dirs.length;while(i--){dirs[i]._teardown()}i=vm._directives.indexOf(dirs[0]);vm._directives.splice(i,dirs.length)}}}};function compileNode(node,options){var type=node.nodeType;if(type===1&&node.tagName!=="SCRIPT"){return compileElement(node,options)}else if(type===3&&config.interpolate){return compileTextNode(node,options)}}function compileElement(el,options){var linkFn,tag,component;if(!el.__vue__){tag=el.tagName.toLowerCase();component=tag.indexOf("-")>0&&options.components[tag];if(component){el.setAttribute(config.prefix+"component",tag)}}if(component||el.hasAttributes()){linkFn=checkTerminalDirectives(el,options);if(!linkFn){var directives=collectDirectives(el,options);linkFn=directives.length?makeDirectivesLinkFn(directives):null}}if(el.tagName==="TEXTAREA"){var realLinkFn=linkFn;linkFn=function(vm,el){el.value=vm.$interpolate(el.value);if(realLinkFn)realLinkFn(vm,el)};linkFn.terminal=true}return linkFn}function makeDirectivesLinkFn(directives){return function directivesLinkFn(vm,el){var i=directives.length;var dir,j,k;while(i--){dir=directives[i];if(dir._link){dir._link(vm,el)}else{k=dir.descriptors.length;for(j=0;j<k;j++){vm._bindDir(dir.name,el,dir.descriptors[j],dir.def)}}}}}function compileTextNode(node,options){var tokens=textParser.parse(node.nodeValue);if(!tokens){return null}var frag=document.createDocumentFragment();var dirs=options.directives;var el,token,value;for(var i=0,l=tokens.length;i<l;i++){token=tokens[i];value=token.value;if(token.tag){if(token.oneTime){el=document.createTextNode(value)}else{if(token.html){el=document.createComment("v-html");token.type="html";token.def=dirs.html;token.descriptor=dirParser.parse(value)[0]}else if(token.partial){el=document.createComment("v-partial");token.type="partial";token.def=dirs.partial;token.descriptor=dirParser.parse(value)[0]}else{el=document.createTextNode(" ");token.type="text";token.def=dirs.text;token.descriptor=dirParser.parse(value)[0]}}}else{el=document.createTextNode(value)}frag.appendChild(el)}return makeTextNodeLinkFn(tokens,frag,options)}function makeTextNodeLinkFn(tokens,frag){return function textNodeLinkFn(vm,el){var fragClone=frag.cloneNode(true);var childNodes=_.toArray(fragClone.childNodes);var token,value,node;for(var i=0,l=tokens.length;i<l;i++){token=tokens[i];value=token.value;if(token.tag){node=childNodes[i];if(token.oneTime){value=vm.$eval(value);if(token.html){_.replace(node,templateParser.parse(value,true))}else{node.nodeValue=value}}else{vm._bindDir(token.type,node,token.descriptor,token.def)}}}_.replace(el,fragClone)}}function compileNodeList(nodeList,options){var linkFns=[];var nodeLinkFn,childLinkFn,node;for(var i=0,l=nodeList.length;i<l;i++){node=nodeList[i];nodeLinkFn=compileNode(node,options);childLinkFn=(!nodeLinkFn||!nodeLinkFn.terminal)&&node.hasChildNodes()?compileNodeList(node.childNodes,options):null;linkFns.push(nodeLinkFn,childLinkFn)}return linkFns.length?makeChildLinkFn(linkFns):null}function makeChildLinkFn(linkFns){return function childLinkFn(vm,nodes){nodes=_.toArray(nodes);var node,nodeLinkFn,childrenLinkFn;for(var i=0,n=0,l=linkFns.length;i<l;n++){node=nodes[n];nodeLinkFn=linkFns[i++];childrenLinkFn=linkFns[i++];if(nodeLinkFn){nodeLinkFn(vm,node)}if(childrenLinkFn){childrenLinkFn(vm,node.childNodes)}}}}function compileParamAttributes(el,attrs,options){var params=[];var i=attrs.length;var name,value,param;while(i--){name=attrs[i];value=el.getAttribute(name);if(value!==null){param={name:name,value:value};var tokens=textParser.parse(value);if(tokens){el.removeAttribute(name);if(tokens.length>1){_.warn('Invalid param attribute binding: "'+name+'="'+value+'"'+"\nDon't mix binding tags with plain text "+"in param attribute bindings.");continue}else{param.dynamic=true;param.value=tokens[0].value}}params.push(param)}}return makeParamsLinkFn(params,options)}var dataAttrRE=/^data-/;function makeParamsLinkFn(params,options){var def=options.directives["with"];return function paramsLinkFn(vm,el){var i=params.length;var param,path;while(i--){param=params[i];path=_.camelize(param.name.replace(dataAttrRE,""));if(param.dynamic){vm._bindDir("with",el,{arg:path,expression:param.value},def)}else{vm.$set(path,param.value)}}}}var terminalDirectives=["repeat","if","component"];function skip(){}skip.terminal=true;function checkTerminalDirectives(el,options){if(_.attr(el,"pre")!==null){return skip}var value,dirName;for(var i=0;i<3;i++){dirName=terminalDirectives[i];if(value=_.attr(el,dirName)){return makeTeriminalLinkFn(el,dirName,value,options)}}}function makeTeriminalLinkFn(el,dirName,value,options){var descriptor=dirParser.parse(value)[0];var def=options.directives[dirName];if(dirName==="component"){var dirs=collectDirectives(el,options,true);el._parentLinker=dirs.length?makeDirectivesLinkFn(dirs):null}var terminalLinkFn=function(vm,el){vm._bindDir(dirName,el,descriptor,def)};terminalLinkFn.terminal=true;return terminalLinkFn}function collectDirectives(el,options,asParent){var attrs=_.toArray(el.attributes);var i=attrs.length;var dirs=[];var attr,attrName,dir,dirName,dirDef;while(i--){attr=attrs[i];attrName=attr.name;if(attrName.indexOf(config.prefix)===0){dirName=attrName.slice(config.prefix.length);if(asParent&&(dirName==="with"||dirName==="ref")){continue}dirDef=options.directives[dirName];_.assertAsset(dirDef,"directive",dirName);if(dirDef){dirs.push({name:dirName,descriptors:dirParser.parse(attr.value),def:dirDef})}}else if(config.interpolate){dir=collectAttrDirective(el,attrName,attr.value,options);if(dir){dirs.push(dir)}}}dirs.sort(directiveComparator);return dirs}function collectAttrDirective(el,name,value,options){var tokens=textParser.parse(value);if(tokens){var def=options.directives.attr;var i=tokens.length;var allOneTime=true;while(i--){var token=tokens[i];if(token.tag&&!token.oneTime){allOneTime=false}}return{def:def,_link:allOneTime?function(vm,el){el.setAttribute(name,vm.$interpolate(value))}:function(vm,el){var value=textParser.tokensToExp(tokens,vm);var desc=dirParser.parse(name+":"+value)[0];vm._bindDir("attr",el,desc,def)}}}}function directiveComparator(a,b){a=a.def.priority||0;b=b.def.priority||0;return a>b?1:-1}},{"../config":12,"../parse/directive":45,"../parse/template":48,"../parse/text":49,"../util":57}],11:[function(require,module,exports){var _=require("../util");var templateParser=require("../parse/template");module.exports=function transclude(el,options){if(el.tagName==="TEMPLATE"){el=templateParser.parse(el)}if(options&&options.template){el=transcludeTemplate(el,options)}if(el instanceof DocumentFragment){_.prepend(document.createComment("v-start"),el);el.appendChild(document.createComment("v-end"))}return el};function transcludeTemplate(el,options){var template=options.template;var frag=templateParser.parse(template,true);if(!frag){_.warn("Invalid template option: "+template)}else{collectRawContent(el);if(options.replace){if(frag.childNodes.length>1){transcludeContent(frag);return frag}else{var replacer=frag.firstChild;_.copyAttributes(el,replacer);transcludeContent(replacer);return replacer}}else{el.appendChild(frag);transcludeContent(el);return el}}}var rawContent;function collectRawContent(el){var child;rawContent=null;if(el.hasChildNodes()){rawContent=document.createElement("div");while(child=el.firstChild){rawContent.appendChild(child)}}}function transcludeContent(el){var outlets=getOutlets(el);var i=outlets.length;if(!i)return;var outlet,select,selected,j,main;while(i--){outlet=outlets[i];if(rawContent){select=outlet.getAttribute("select");if(select){selected=rawContent.querySelectorAll(select);outlet.content=_.toArray(selected.length?selected:outlet.childNodes)}else{main=outlet}}else{outlet.content=_.toArray(outlet.childNodes)}}for(i=0,j=outlets.length;i<j;i++){outlet=outlets[i];if(outlet!==main){insertContentAt(outlet,outlet.content)}}if(main){insertContentAt(main,_.toArray(rawContent.childNodes))}}var concat=[].concat;function getOutlets(el){return _.isArray(el)?concat.apply([],el.map(getOutlets)):el.querySelectorAll?_.toArray(el.querySelectorAll("content")):[]}function insertContentAt(outlet,contents){var parent=outlet.parentNode;for(var i=0,j=contents.length;i<j;i++){parent.insertBefore(contents[i],outlet)}parent.removeChild(outlet)}},{"../parse/template":48,"../util":57}],12:[function(require,module,exports){module.exports={prefix:"v-",debug:false,silent:false,proto:true,interpolate:true,async:true,_delimitersChanged:true};var delimiters=["{{","}}"];Object.defineProperty(module.exports,"delimiters",{get:function(){return delimiters},set:function(val){delimiters=val;this._delimitersChanged=true}})},{}],13:[function(require,module,exports){var _=require("./util");var config=require("./config");var Watcher=require("./watcher");var textParser=require("./parse/text");var expParser=require("./parse/expression");function Directive(name,el,vm,descriptor,def,linker){this.name=name;this.el=el;this.vm=vm;this.raw=descriptor.raw;this.expression=descriptor.expression;this.arg=descriptor.arg;this.filters=_.resolveFilters(vm,descriptor.filters);this._linker=linker;this._locked=false;this._bound=false;this._bind(def)}var p=Directive.prototype;p._bind=function(def){if(this.name!=="cloak"&&this.el.removeAttribute){this.el.removeAttribute(config.prefix+this.name)}if(typeof def==="function"){this.update=def}else{_.extend(this,def)}this._watcherExp=this.expression;this._checkDynamicLiteral();if(this.bind){this.bind()}if(this.update&&this._watcherExp&&(!this.isLiteral||this._isDynamicLiteral)&&!this._checkStatement()){var watcher=this.vm._watchers[this.raw];var dir=this;var update=this._update=function(val,oldVal){if(!dir._locked){dir.update(val,oldVal)}};if(!watcher){watcher=this.vm._watchers[this.raw]=new Watcher(this.vm,this._watcherExp,update,this.filters,this.twoWay)}else{watcher.addCb(update)}this._watcher=watcher;if(this._initValue!=null){watcher.set(this._initValue)}else{this.update(watcher.value)}}this._bound=true};p._checkDynamicLiteral=function(){var expression=this.expression;if(expression&&this.isLiteral){var tokens=textParser.parse(expression);if(tokens){var exp=textParser.tokensToExp(tokens);this.expression=this.vm.$get(exp);this._watcherExp=exp;this._isDynamicLiteral=true}}};p._checkStatement=function(){var expression=this.expression;if(expression&&this.acceptStatement&&!expParser.pathTestRE.test(expression)){var fn=expParser.parse(expression).get;var vm=this.vm;var handler=function(){fn.call(vm,vm)};if(this.filters){handler=_.applyFilters(handler,this.filters.read,vm)}this.update(handler);return true}};p._teardown=function(){if(this._bound){if(this.unbind){this.unbind()}var watcher=this._watcher;if(watcher&&watcher.active){watcher.removeCb(this._update);if(!watcher.active){this.vm._watchers[this.raw]=null}}this._bound=false;this.vm=this.el=this._watcher=null}};p.set=function(value,lock){if(this.twoWay){if(lock){this._locked=true}this._watcher.set(value);if(lock){var self=this;_.nextTick(function(){self._locked=false})}}};module.exports=Directive},{"./config":12,"./parse/expression":46,"./parse/text":49,"./util":57,"./watcher":60}],14:[function(require,module,exports){var xlinkNS="http://www.w3.org/1999/xlink";var xlinkRE=/^xlink:/;module.exports={priority:850,bind:function(){var name=this.arg;this.update=xlinkRE.test(name)?xlinkHandler:defaultHandler}};function defaultHandler(value){if(value||value===0){this.el.setAttribute(this.arg,value)}else{this.el.removeAttribute(this.arg)}}function xlinkHandler(value){if(value!=null){this.el.setAttributeNS(xlinkNS,this.arg,value)}else{this.el.removeAttributeNS(xlinkNS,"href")}}},{}],15:[function(require,module,exports){var _=require("../util");var addClass=_.addClass;var removeClass=_.removeClass;module.exports=function(value){if(this.arg){var method=value?addClass:removeClass;method(this.el,this.arg)}else{if(this.lastVal){removeClass(this.el,this.lastVal)}if(value){addClass(this.el,value);this.lastVal=value}}}},{"../util":57}],16:[function(require,module,exports){var config=require("../config");module.exports={bind:function(){var el=this.el;this.vm.$once("hook:compiled",function(){el.removeAttribute(config.prefix+"cloak")})}}},{"../config":12}],17:[function(require,module,exports){var _=require("../util");var templateParser=require("../parse/template");module.exports={isLiteral:true,bind:function(){if(!this.el.__vue__){this.ref=document.createComment("v-component");_.replace(this.el,this.ref);this.checkKeepAlive();this.parentLinker=this.el._parentLinker;if(!this._isDynamicLiteral){this.resolveCtor(this.expression);this.build()}}else{_.warn('v-component="'+this.expression+'" cannot be '+"used on an already mounted instance.")}},checkKeepAlive:function(){this.keepAlive=this.el.hasAttribute("keep-alive");if(this.keepAlive){this.el.removeAttribute("keep-alive");this.cache={}}},resolveCtor:function(id){this.ctorId=id;this.Ctor=this.vm.$options.components[id];_.assertAsset(this.Ctor,"component",id)},build:function(){if(this.keepAlive){var cached=this.cache[this.ctorId];if(cached){this.childVM=cached;cached.$before(this.ref);return}}var vm=this.vm;if(this.Ctor&&!this.childVM){this.childVM=vm.$addChild({el:templateParser.clone(this.el)},this.Ctor);if(this.parentLinker){var dirCount=vm._directives.length;var targetVM=this.childVM.$options.inherit?this.childVM:vm;this.parentLinker(targetVM,this.childVM.$el);this.parentDirs=vm._directives.slice(dirCount)}if(this.keepAlive){this.cache[this.ctorId]=this.childVM}this.childVM.$before(this.ref)}},unbuild:function(remove){var child=this.childVM;if(!child){return}if(this.keepAlive){if(remove){child.$remove()}}else{child.$destroy(remove);var parentDirs=this.parentDirs;if(parentDirs){var i=parentDirs.length;while(i--){parentDirs[i]._teardown()}}}this.childVM=null},update:function(value){this.unbuild(true);if(value){this.resolveCtor(value);this.build()}},unbind:function(){this.keepAlive=false;this.unbuild()}}},{"../parse/template":48,"../util":57}],18:[function(require,module,exports){module.exports={isLiteral:true,bind:function(){this.vm.$$[this.expression]=this.el},unbind:function(){delete this.vm.$$[this.expression]}}},{}],19:[function(require,module,exports){var _=require("../util");var templateParser=require("../parse/template");module.exports={bind:function(){if(this.el.nodeType===8){this.nodes=[]}},update:function(value){value=_.toString(value);if(this.nodes){this.swap(value)}else{this.el.innerHTML=value}},swap:function(value){var i=this.nodes.length;while(i--){_.remove(this.nodes[i])}var frag=templateParser.parse(value,true);this.nodes=_.toArray(frag.childNodes);_.before(frag,this.el)}}},{"../parse/template":48,"../util":57}],20:[function(require,module,exports){var _=require("../util");var compile=require("../compile/compile");var templateParser=require("../parse/template");var transition=require("../transition");module.exports={bind:function(){var el=this.el;if(!el.__vue__){this.start=document.createComment("v-if-start");this.end=document.createComment("v-if-end");_.replace(el,this.end);_.before(this.start,this.end);if(el.tagName==="TEMPLATE"){this.template=templateParser.parse(el,true)}else{this.template=document.createDocumentFragment();this.template.appendChild(el)}this.linker=compile(this.template,this.vm.$options,true)}else{this.invalid=true;_.warn('v-if="'+this.expression+'" cannot be '+"used on an already mounted instance.")}},update:function(value){if(this.invalid)return;if(value){this.insert()}else{this.teardown()}},insert:function(){if(this.decompile){return}var vm=this.vm;var frag=templateParser.clone(this.template);var decompile=this.linker(vm,frag);this.decompile=function(){decompile();transition.blockRemove(this.start,this.end,vm)};transition.blockAppend(frag,this.end,vm)},teardown:function(){if(this.decompile){this.decompile();this.decompile=null}}}},{"../compile/compile":10,"../parse/template":48,"../transition":51,"../util":57}],21:[function(require,module,exports){exports.text=require("./text");exports.html=require("./html");exports.attr=require("./attr");exports.show=require("./show");exports["class"]=require("./class");exports.el=require("./el");exports.ref=require("./ref");exports.cloak=require("./cloak");exports.style=require("./style");exports.partial=require("./partial");exports.transition=require("./transition");exports.on=require("./on");exports.model=require("./model");exports.component=require("./component");exports.repeat=require("./repeat");exports["if"]=require("./if");exports["with"]=require("./with")},{"./attr":14,"./class":15,"./cloak":16,"./component":17,"./el":18,"./html":19,"./if":20,"./model":24,"./on":27,"./partial":28,"./ref":29,"./repeat":30,"./show":31,"./style":32,"./text":33,"./transition":34,"./with":35}],22:[function(require,module,exports){var _=require("../../util");module.exports={bind:function(){var self=this;var el=this.el;this.listener=function(){self.set(el.checked,true)};_.on(el,"change",this.listener);if(el.checked){this._initValue=el.checked}},update:function(value){this.el.checked=!!value},unbind:function(){_.off(this.el,"change",this.listener)}}},{"../../util":57}],23:[function(require,module,exports){var _=require("../../util");module.exports={bind:function(){var self=this;var el=this.el;var lazy=el.hasAttribute("lazy");if(lazy){el.removeAttribute("lazy")}var number=el.hasAttribute("number")||el.type==="number";if(number){el.removeAttribute("number")}var cpLocked=false;this.cpLock=function(){cpLocked=true};this.cpUnlock=function(){cpLocked=false;set()};_.on(el,"compositionstart",this.cpLock);_.on(el,"compositionend",this.cpUnlock);function set(){self.set(number?_.toNumber(el.value):el.value,true)}this.listener=function textInputListener(){if(cpLocked)return;var charsOffset;try{charsOffset=el.value.length-el.selectionStart}catch(e){}set();_.nextTick(function(){var newVal=self._watcher.value;self.update(newVal);if(charsOffset!=null){var cursorPos=_.toString(newVal).length-charsOffset;el.setSelectionRange(cursorPos,cursorPos)}})};this.event=lazy?"change":"input";_.on(el,this.event,this.listener);if(!lazy&&_.isIE9){this.onCut=function(){_.nextTick(self.listener)};this.onDel=function(e){if(e.keyCode===46||e.keyCode===8){self.listener()}};_.on(el,"cut",this.onCut);_.on(el,"keyup",this.onDel)}if(el.hasAttribute("value")||el.tagName==="TEXTAREA"&&el.value.trim()){this._initValue=number?_.toNumber(el.value):el.value}},update:function(value){this.el.value=_.toString(value)},unbind:function(){var el=this.el;_.off(el,this.event,this.listener);_.off(el,"compositionstart",this.cpLock);_.off(el,"compositionend",this.cpUnlock);if(this.onCut){_.off(el,"cut",this.onCut);_.off(el,"keyup",this.onDel)}}}},{"../../util":57}],24:[function(require,module,exports){var _=require("../../util");var handlers={_default:require("./default"),radio:require("./radio"),select:require("./select"),checkbox:require("./checkbox")};module.exports={priority:800,twoWay:true,handlers:handlers,bind:function(){var filters=this.filters; | |
if(filters&&filters.read&&!filters.write){_.warn("It seems you are using a read-only filter with "+"v-model. You might want to use a two-way filter "+"to ensure correct behavior.")}var el=this.el;var tag=el.tagName;var handler;if(tag==="INPUT"){handler=handlers[el.type]||handlers._default}else if(tag==="SELECT"){handler=handlers.select}else if(tag==="TEXTAREA"){handler=handlers._default}else{_.warn("v-model doesn't support element type: "+tag);return}handler.bind.call(this);this.update=handler.update;this.unbind=handler.unbind}}},{"../../util":57,"./checkbox":22,"./default":23,"./radio":25,"./select":26}],25:[function(require,module,exports){var _=require("../../util");module.exports={bind:function(){var self=this;var el=this.el;this.listener=function(){self.set(el.value,true)};_.on(el,"change",this.listener);if(el.checked){this._initValue=el.value}},update:function(value){this.el.checked=value==this.el.value},unbind:function(){_.off(this.el,"change",this.listener)}}},{"../../util":57}],26:[function(require,module,exports){var _=require("../../util");var Watcher=require("../../watcher");module.exports={bind:function(){var self=this;var el=this.el;var optionsParam=el.getAttribute("options");if(optionsParam){el.removeAttribute("options");initOptions.call(this,optionsParam)}this.multiple=el.hasAttribute("multiple");this.listener=function(){var value=self.multiple?getMultiValue(el):el.value;self.set(value,true)};_.on(el,"change",this.listener);checkInitialValue.call(this)},update:function(value){var el=this.el;el.selectedIndex=-1;var multi=this.multiple&&_.isArray(value);var options=el.options;var i=options.length;var option;while(i--){option=options[i];option.selected=multi?indexOf(value,option.value)>-1:value==option.value}},unbind:function(){_.off(this.el,"change",this.listener);if(this.optionWatcher){this.optionWatcher.teardown()}}};function initOptions(expression){var self=this;function optionUpdateWatcher(value){if(_.isArray(value)){self.el.innerHTML="";buildOptions(self.el,value);if(self._watcher){self.update(self._watcher.value)}}else{_.warn("Invalid options value for v-model: "+value)}}this.optionWatcher=new Watcher(this.vm,expression,optionUpdateWatcher);optionUpdateWatcher(this.optionWatcher.value)}function buildOptions(parent,options){var op,el;for(var i=0,l=options.length;i<l;i++){op=options[i];if(!op.options){el=document.createElement("option");if(typeof op==="string"){el.text=el.value=op}else{el.text=op.text;el.value=op.value}}else{el=document.createElement("optgroup");el.label=op.label;buildOptions(el,op.options)}parent.appendChild(el)}}function checkInitialValue(){var initValue;var options=this.el.options;for(var i=0,l=options.length;i<l;i++){if(options[i].hasAttribute("selected")){if(this.multiple){(initValue||(initValue=[])).push(options[i].value)}else{initValue=options[i].value}}}if(initValue){this._initValue=initValue}}function getMultiValue(el){return Array.prototype.filter.call(el.options,filterSelected).map(getOptionValue)}function filterSelected(op){return op.selected}function getOptionValue(op){return op.value||op.text}function indexOf(arr,val){var i=arr.length;while(i--){if(arr[i]==val)return i}return-1}},{"../../util":57,"../../watcher":60}],27:[function(require,module,exports){var _=require("../util");module.exports={acceptStatement:true,priority:700,bind:function(){if(this.el.tagName==="IFRAME"&&this.arg!=="load"){var self=this;this.iframeBind=function(){_.on(self.el.contentWindow,self.arg,self.handler)};_.on(this.el,"load",this.iframeBind)}},update:function(handler){if(typeof handler!=="function"){_.warn('Directive "v-on:'+this.expression+'" '+"expects a function value.");return}this.reset();var vm=this.vm;this.handler=function(e){e.targetVM=vm;vm.$event=e;var res=handler(e);vm.$event=null;return res};if(this.iframeBind){this.iframeBind()}else{_.on(this.el,this.arg,this.handler)}},reset:function(){var el=this.iframeBind?this.el.contentWindow:this.el;if(this.handler){_.off(el,this.arg,this.handler)}},unbind:function(){this.reset();_.off(this.el,"load",this.iframeBind)}}},{"../util":57}],28:[function(require,module,exports){var _=require("../util");var templateParser=require("../parse/template");var transition=require("../transition");module.exports={isLiteral:true,bind:function(){var el=this.el;this.start=document.createComment("v-partial-start");this.end=document.createComment("v-partial-end");if(el.nodeType!==8){el.innerHTML=""}if(el.tagName==="TEMPLATE"||el.nodeType===8){_.replace(el,this.end)}else{el.appendChild(this.end)}_.before(this.start,this.end);if(!this._isDynamicLiteral){this.compile(this.expression)}},update:function(id){this.teardown();this.compile(id)},compile:function(id){var partial=this.vm.$options.partials[id];_.assertAsset(partial,"partial",id);if(!partial){return}var vm=this.vm;var frag=templateParser.parse(partial,true);var decompile=vm.$compile(frag);this.decompile=function(){decompile();transition.blockRemove(this.start,this.end,vm)};transition.blockAppend(frag,this.end,vm)},teardown:function(){if(this.decompile){this.decompile();this.decompile=null}}}},{"../parse/template":48,"../transition":51,"../util":57}],29:[function(require,module,exports){var _=require("../util");module.exports={isLiteral:true,bind:function(){if(this.el!==this.vm.$el){_.warn("v-ref should only be used on instance root nodes.");return}this.owner=this.vm.$parent;this.owner.$[this.expression]=this.vm},unbind:function(){if(this.owner.$[this.expression]===this.vm){delete this.owner.$[this.expression]}}}},{"../util":57}],30:[function(require,module,exports){var _=require("../util");var isObject=_.isObject;var textParser=require("../parse/text");var expParser=require("../parse/expression");var templateParser=require("../parse/template");var compile=require("../compile/compile");var transclude=require("../compile/transclude");var mergeOptions=require("../util/merge-option");var uid=0;module.exports={bind:function(){this.id="__v_repeat_"+ ++uid;if(!this.filters){this.filters={}}var objectConverter=_.bind(objToArray,this);if(!this.filters.read){this.filters.read=[objectConverter]}else{this.filters.read.unshift(objectConverter)}this.ref=document.createComment("v-repeat");_.replace(this.el,this.ref);this.template=this.el.tagName==="TEMPLATE"?templateParser.parse(this.el,true):this.el;this.checkIf();this.checkRef();this.checkTrackById();this.checkComponent();this.cache=Object.create(null)},checkIf:function(){if(_.attr(this.el,"if")!==null){_.warn("Don't use v-if with v-repeat. "+'Use v-show or the "filterBy" filter instead.')}},checkRef:function(){var childId=_.attr(this.el,"ref");this.childId=childId?this.vm.$interpolate(childId):null;var elId=_.attr(this.el,"el");this.elId=elId?this.vm.$interpolate(elId):null},checkTrackById:function(){this.idKey=this.el.getAttribute("trackby");if(this.idKey!==null){this.el.removeAttribute("trackby")}},checkComponent:function(){var id=_.attr(this.el,"component");var options=this.vm.$options;if(!id){this.Ctor=_.Vue;this.inherit=true;this.template=transclude(this.template);this._linker=compile(this.template,options)}else{var tokens=textParser.parse(id);if(!tokens){var Ctor=this.Ctor=options.components[id];_.assertAsset(Ctor,"component",id);if(Ctor){var merged=mergeOptions(Ctor.options,{},{$parent:this.vm});this.template=transclude(this.template,merged);this._linker=compile(this.template,merged)}}else{var ctorExp=textParser.tokensToExp(tokens);this.ctorGetter=expParser.parse(ctorExp).get}}},update:function(data){if(typeof data==="number"){data=range(data)}this.vms=this.diff(data||[],this.vms);if(this.childId){this.vm.$[this.childId]=this.vms}if(this.elId){this.vm.$$[this.elId]=this.vms.map(function(vm){return vm.$el})}},diff:function(data,oldVms){var idKey=this.idKey;var converted=this.converted;var ref=this.ref;var alias=this.arg;var init=!oldVms;var vms=new Array(data.length);var obj,raw,vm,i,l;for(i=0,l=data.length;i<l;i++){obj=data[i];raw=converted?obj.value:obj;vm=!init&&this.getVm(raw);if(vm){vm._reused=true;vm.$index=i;if(converted){vm.$key=obj.key}if(idKey){if(alias){vm[alias]=raw}else{vm._setData(raw)}}}else{vm=this.build(obj,i);vm._new=true}vms[i]=vm;if(init){vm.$before(ref)}}if(init){return vms}for(i=0,l=oldVms.length;i<l;i++){vm=oldVms[i];if(!vm._reused){this.uncacheVm(vm);vm.$destroy(true)}}var targetNext,currentNext;i=vms.length;while(i--){vm=vms[i];targetNext=vms[i+1];if(!targetNext){if(!vm._reused){vm.$before(ref)}}else{if(vm._reused){currentNext=findNextVm(vm,ref);if(currentNext!==targetNext){vm.$before(targetNext.$el,null,false)}}else{vm.$before(targetNext.$el)}}vm._new=false;vm._reused=false}return vms},build:function(data,index){var original=data;var meta={$index:index};if(this.converted){meta.$key=original.key}var raw=this.converted?data.value:data;var alias=this.arg;var hasAlias=!isObject(raw)||alias;data=hasAlias?{}:raw;if(alias){data[alias]=raw}else if(hasAlias){meta.$value=raw}var Ctor=this.Ctor||this.resolveCtor(data,meta);var vm=this.vm.$addChild({el:templateParser.clone(this.template),_linker:this._linker,_meta:meta,data:data,inherit:this.inherit},Ctor);this.cacheVm(raw,vm);return vm},resolveCtor:function(data,meta){var context=Object.create(this.vm);var key;for(key in data){_.define(context,key,data[key])}for(key in meta){_.define(context,key,meta[key])}var id=this.ctorGetter.call(context,context);var Ctor=this.vm.$options.components[id];_.assertAsset(Ctor,"component",id);return Ctor},unbind:function(){if(this.childId){delete this.vm.$[this.childId]}if(this.vms){var i=this.vms.length;var vm;while(i--){vm=this.vms[i];this.uncacheVm(vm);vm.$destroy()}}},cacheVm:function(data,vm){var idKey=this.idKey;var cache=this.cache;var id;if(idKey){id=data[idKey];if(!cache[id]){cache[id]=vm}else{_.warn("Duplicate ID in v-repeat: "+id)}}else if(isObject(data)){id=this.id;if(data.hasOwnProperty(id)){if(data[id]===null){data[id]=vm}else{_.warn("Duplicate objects are not supported in v-repeat.")}}else{_.define(data,this.id,vm)}}else{if(!cache[data]){cache[data]=[vm]}else{cache[data].push(vm)}}vm._raw=data},getVm:function(data){if(this.idKey){return this.cache[data[this.idKey]]}else if(isObject(data)){return data[this.id]}else{var cached=this.cache[data];if(cached){var i=0;var vm=cached[i];while(vm&&(vm._reused||vm._new)){vm=cached[++i]}return vm}}},uncacheVm:function(vm){var data=vm._raw;if(this.idKey){this.cache[data[this.idKey]]=null}else if(isObject(data)){data[this.id]=null;vm._raw=null}else{this.cache[data].pop()}}};function findNextVm(vm,ref){var el=(vm._blockEnd||vm.$el).nextSibling;while(!el.__vue__&&el!==ref){el=el.nextSibling}return el.__vue__}function objToArray(obj){if(!_.isPlainObject(obj)){return obj}var keys=Object.keys(obj);var i=keys.length;var res=new Array(i);var key;while(i--){key=keys[i];res[i]={key:key,value:obj[key]}}this.converted=true;return res}function range(n){var i=-1;var ret=new Array(n);while(++i<n){ret[i]=i}return ret}},{"../compile/compile":10,"../compile/transclude":11,"../parse/expression":46,"../parse/template":48,"../parse/text":49,"../util":57,"../util/merge-option":59}],31:[function(require,module,exports){var transition=require("../transition");module.exports=function(value){var el=this.el;transition.apply(el,value?1:-1,function(){el.style.display=value?"":"none"},this.vm)}},{"../transition":51}],32:[function(require,module,exports){var prefixes=["-webkit-","-moz-","-ms-"];var importantRE=/!important;?$/;module.exports={bind:function(){var prop=this.arg;if(!prop)return;if(prop.charAt(0)==="$"){prop=prop.slice(1);this.prefixed=true}this.prop=prop},update:function(value){var prop=this.prop;if(value!=null){value+=""}if(prop){var isImportant=importantRE.test(value)?"important":"";if(isImportant){value=value.replace(importantRE,"").trim()}this.el.style.setProperty(prop,value,isImportant);if(this.prefixed){var i=prefixes.length;while(i--){this.el.style.setProperty(prefixes[i]+prop,value,isImportant)}}}else{this.el.style.cssText=value}}}},{}],33:[function(require,module,exports){var _=require("../util");module.exports={bind:function(){this.attr=this.el.nodeType===3?"nodeValue":"textContent"},update:function(value){this.el[this.attr]=_.toString(value)}}},{"../util":57}],34:[function(require,module,exports){module.exports={priority:1e3,isLiteral:true,bind:function(){this.el.__v_trans={id:this.expression}}}},{}],35:[function(require,module,exports){var _=require("../util");var Watcher=require("../watcher");module.exports={priority:900,bind:function(){var vm=this.vm;if(this.el!==vm.$el){_.warn("v-with can only be used on instance root elements.")}else if(!vm.$parent){_.warn("v-with must be used on an instance with a parent.")}else{var key=this.arg;this.watcher=new Watcher(vm.$parent,this.expression,key?function(val){vm.$set(key,val)}:function(val){vm.$data=val});var initialVal=this.watcher.value;if(key){vm.$set(key,initialVal)}else{vm.$data=initialVal}}},unbind:function(){if(this.watcher){this.watcher.teardown()}}}},{"../util":57,"../watcher":60}],36:[function(require,module,exports){var _=require("../util");var Path=require("../parse/path");exports.filterBy=function(arr,searchKey,delimiter,dataKey){if(delimiter&&delimiter!=="in"){dataKey=delimiter}var search=_.stripQuotes(searchKey)||this.$get(searchKey);if(!search){return arr}search=search.toLowerCase();dataKey=dataKey&&(_.stripQuotes(dataKey)||this.$get(dataKey));return arr.filter(function(item){return dataKey?contains(Path.get(item,dataKey),search):contains(item,search)})};exports.orderBy=function(arr,sortKey,reverseKey){var key=_.stripQuotes(sortKey)||this.$get(sortKey);if(!key){return arr}var order=1;if(reverseKey){if(reverseKey==="-1"){order=-1}else if(reverseKey.charCodeAt(0)===33){reverseKey=reverseKey.slice(1);order=this.$get(reverseKey)?1:-1}else{order=this.$get(reverseKey)?-1:1}}return arr.slice().sort(function(a,b){a=Path.get(a,key);b=Path.get(b,key);return a===b?0:a>b?order:-order})};function contains(val,search){if(_.isObject(val)){for(var key in val){if(contains(val[key],search)){return true}}}else if(val!=null){return val.toString().toLowerCase().indexOf(search)>-1}}},{"../parse/path":47,"../util":57}],37:[function(require,module,exports){var _=require("../util");exports.json=function(value,indent){return JSON.stringify(value,null,Number(indent)||2)};exports.capitalize=function(value){if(!value&&value!==0)return"";value=value.toString();return value.charAt(0).toUpperCase()+value.slice(1)};exports.uppercase=function(value){return value||value===0?value.toString().toUpperCase():""};exports.lowercase=function(value){return value||value===0?value.toString().toLowerCase():""};var digitsRE=/(\d{3})(?=\d)/g;exports.currency=function(value,sign){value=parseFloat(value);if(!value&&value!==0)return"";sign=sign||"$";var s=Math.floor(Math.abs(value)).toString(),i=s.length%3,h=i>0?s.slice(0,i)+(s.length>3?",":""):"",f="."+value.toFixed(2).slice(-2);return(value<0?"-":"")+sign+h+s.slice(i).replace(digitsRE,"$1,")+f};exports.pluralize=function(value){var args=_.toArray(arguments,1);return args.length>1?args[value%10-1]||args[args.length-1]:args[0]+(value===1?"":"s")};var keyCodes={enter:13,tab:9,"delete":46,up:38,left:37,right:39,down:40,esc:27};exports.key=function(handler,key){if(!handler)return;var code=keyCodes[key];if(!code){code=parseInt(key,10)}return function(e){if(e.keyCode===code){return handler.call(this,e)}}};_.extend(exports,require("./array-filters"))},{"../util":57,"./array-filters":36}],38:[function(require,module,exports){var _=require("../util");var Directive=require("../directive");var compile=require("../compile/compile");var transclude=require("../compile/transclude");exports._compile=function(el){var options=this.$options;if(options._linker){this._initElement(el);options._linker(this,el)}else{var raw=el;el=transclude(el,options);this._initElement(el);var linker=compile(el,options);linker(this,el);if(options.replace){_.replace(raw,el)}}return el};exports._initElement=function(el){if(el instanceof DocumentFragment){this._isBlock=true;this.$el=this._blockStart=el.firstChild;this._blockEnd=el.lastChild;this._blockFragment=el}else{this.$el=el}this.$el.__vue__=this;this._callHook("beforeCompile")};exports._bindDir=function(name,node,desc,def,linker){this._directives.push(new Directive(name,node,this,desc,def,linker))}},{"../compile/compile":10,"../compile/transclude":11,"../directive":13,"../util":57}],39:[function(require,module,exports){var _=require("../util");var inDoc=_.inDoc;exports._initEvents=function(){var options=this.$options;registerCallbacks(this,"$on",options.events);registerCallbacks(this,"$watch",options.watch)};function registerCallbacks(vm,action,hash){if(!hash)return;var handlers,key,i,j;for(key in hash){handlers=hash[key];if(_.isArray(handlers)){for(i=0,j=handlers.length;i<j;i++){register(vm,action,key,handlers[i])}}else{register(vm,action,key,handlers)}}}function register(vm,action,key,handler){var type=typeof handler;if(type==="function"){vm[action](key,handler)}else if(type==="string"){var methods=vm.$options.methods;var method=methods&&methods[handler];if(method){vm[action](key,method)}else{_.warn('Unknown method: "'+handler+'" when '+"registering callback for "+action+': "'+key+'".')}}}exports._initDOMHooks=function(){this.$on("hook:attached",onAttached);this.$on("hook:detached",onDetached)};function onAttached(){this._isAttached=true;var children=this._children;if(!children)return;for(var i=0,l=children.length;i<l;i++){var child=children[i];if(!child._isAttached&&inDoc(child.$el)){child._callHook("attached")}}}function onDetached(){this._isAttached=false;var children=this._children;if(!children)return;for(var i=0,l=children.length;i<l;i++){var child=children[i];if(child._isAttached&&!inDoc(child.$el)){child._callHook("detached")}}}exports._callHook=function(hook){var handlers=this.$options[hook];if(handlers){for(var i=0,j=handlers.length;i<j;i++){handlers[i].call(this)}}this.$emit("hook:"+hook)}},{"../util":57}],40:[function(require,module,exports){var mergeOptions=require("../util/merge-option");exports._init=function(options){options=options||{};this.$el=null;this.$parent=options._parent;this.$root=options._root||this;this.$={};this.$$={};this._watcherList=[];this._watchers={};this._userWatchers={};this._directives=[];this._isVue=true;this._events={};this._eventsCount={};this._eventCancelled=false;this._isBlock=false;this._blockStart=this._blockEnd=null;this._isCompiled=this._isDestroyed=this._isReady=this._isAttached=this._isBeingDestroyed=false;this._children=this._childCtors=null;options=this.$options=mergeOptions(this.constructor.options,options,this);this._data=options.data||{};this._initScope();this._initEvents();this._callHook("created");if(options.el){this.$mount(options.el)}}},{"../util/merge-option":59}],41:[function(require,module,exports){var _=require("../util");var Observer=require("../observer");var Binding=require("../binding");exports._initScope=function(){this._initData();this._initComputed();this._initMethods();this._initMeta()};exports._initData=function(){var data=this._data;var keys=Object.keys(data);var i=keys.length;var key;while(i--){key=keys[i];if(!_.isReserved(key)){this._proxy(key)}}Observer.create(data).addVm(this)};exports._setData=function(newData){newData=newData||{};var oldData=this._data;this._data=newData;var keys,key,i;keys=Object.keys(oldData);i=keys.length;while(i--){key=keys[i];if(!_.isReserved(key)&&!(key in newData)){this._unproxy(key)}}keys=Object.keys(newData);i=keys.length;while(i--){key=keys[i];if(!this.hasOwnProperty(key)&&!_.isReserved(key)){this._proxy(key)}}oldData.__ob__.removeVm(this);Observer.create(newData).addVm(this);this._digest()};exports._proxy=function(key){var self=this;Object.defineProperty(self,key,{configurable:true,enumerable:true,get:function proxyGetter(){return self._data[key]},set:function proxySetter(val){self._data[key]=val}})};exports._unproxy=function(key){delete this[key]};exports._digest=function(){var i=this._watcherList.length;while(i--){this._watcherList[i].update()}var children=this._children;var child;if(children){i=children.length;while(i--){child=children[i];if(child.$options.inherit){child._digest()}}}};function noop(){}exports._initComputed=function(){var computed=this.$options.computed;if(computed){for(var key in computed){var userDef=computed[key];var def={enumerable:true,configurable:true};if(typeof userDef==="function"){def.get=_.bind(userDef,this);def.set=noop}else{def.get=userDef.get?_.bind(userDef.get,this):noop;def.set=userDef.set?_.bind(userDef.set,this):noop}Object.defineProperty(this,key,def)}}};exports._initMethods=function(){var methods=this.$options.methods;if(methods){for(var key in methods){this[key]=_.bind(methods[key],this)}}};exports._initMeta=function(){var metas=this.$options._meta;if(metas){for(var key in metas){this._defineMeta(key,metas[key])}}};exports._defineMeta=function(key,value){var binding=new Binding;Object.defineProperty(this,key,{enumerable:true,configurable:true,get:function metaGetter(){if(Observer.target){Observer.target.addDep(binding)}return value},set:function metaSetter(val){if(val!==value){value=val;binding.notify()}}})}},{"../binding":8,"../observer":43,"../util":57}],42:[function(require,module,exports){var _=require("../util");var arrayProto=Array.prototype;var arrayMethods=Object.create(arrayProto);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(method){var original=arrayProto[method];_.define(arrayMethods,method,function mutator(){var i=arguments.length;var args=new Array(i);while(i--){args[i]=arguments[i]}var result=original.apply(this,args);var ob=this.__ob__;var inserted;switch(method){case"push":inserted=args;break;case"unshift":inserted=args;break;case"splice":inserted=args.slice(2);break}if(inserted)ob.observeArray(inserted);ob.notify();return result})});_.define(arrayProto,"$set",function $set(index,val){if(index>=this.length){this.length=index+1}return this.splice(index,1,val)[0]});_.define(arrayProto,"$remove",function $remove(index){if(typeof index!=="number"){index=this.indexOf(index)}if(index>-1){return this.splice(index,1)[0]}});module.exports=arrayMethods},{"../util":57}],43:[function(require,module,exports){var _=require("../util");var config=require("../config");var Binding=require("../binding");var arrayMethods=require("./array");var arrayKeys=Object.getOwnPropertyNames(arrayMethods);require("./object");var uid=0;var ARRAY=0;var OBJECT=1;function protoAugment(target,src){target.__proto__=src}function copyAugment(target,src,keys){var i=keys.length;var key;while(i--){key=keys[i];_.define(target,key,src[key])}}function Observer(value,type){this.id=++uid;this.value=value;this.active=true;this.bindings=[];_.define(value,"__ob__",this);if(type===ARRAY){var augment=config.proto&&_.hasProto?protoAugment:copyAugment;augment(value,arrayMethods,arrayKeys);this.observeArray(value)}else if(type===OBJECT){this.walk(value)}}Observer.target=null;var p=Observer.prototype;Observer.create=function(value){if(value&&value.hasOwnProperty("__ob__")&&value.__ob__ instanceof Observer){return value.__ob__}else if(_.isArray(value)){return new Observer(value,ARRAY)}else if(_.isPlainObject(value)&&!value._isVue){return new Observer(value,OBJECT)}};p.walk=function(obj){var keys=Object.keys(obj);var i=keys.length;var key,prefix;while(i--){key=keys[i];prefix=key.charCodeAt(0);if(prefix!==36&&prefix!==95){this.convert(key,obj[key])}}};p.observe=function(val){return Observer.create(val)};p.observeArray=function(items){var i=items.length;while(i--){this.observe(items[i])}};p.convert=function(key,val){var ob=this;var childOb=ob.observe(val);var binding=new Binding;if(childOb){childOb.bindings.push(binding)}Object.defineProperty(ob.value,key,{enumerable:true,configurable:true,get:function(){if(ob.active&&Observer.target){Observer.target.addDep(binding)}return val},set:function(newVal){if(newVal===val)return;var oldChildOb=val&&val.__ob__;if(oldChildOb){var oldBindings=oldChildOb.bindings;oldBindings.splice(oldBindings.indexOf(binding),1)}val=newVal;var newChildOb=ob.observe(newVal);if(newChildOb){newChildOb.bindings.push(binding)}binding.notify()}})};p.notify=function(){var bindings=this.bindings;for(var i=0,l=bindings.length;i<l;i++){bindings[i].notify()}};p.addVm=function(vm){(this.vms=this.vms||[]).push(vm)};p.removeVm=function(vm){this.vms.splice(this.vms.indexOf(vm),1)};module.exports=Observer},{"../binding":8,"../config":12,"../util":57,"./array":42,"./object":44}],44:[function(require,module,exports){var _=require("../util");var objProto=Object.prototype;_.define(objProto,"$add",function $add(key,val){var ob=this.__ob__;if(!ob){this[key]=val;return}if(_.isReserved(key)){_.warn("Refused to $add reserved key: "+key);return}if(this.hasOwnProperty(key))return;ob.convert(key,val);if(ob.vms){var i=ob.vms.length;while(i--){var vm=ob.vms[i];vm._proxy(key);vm._digest()}}else{ob.notify()}});_.define(objProto,"$delete",function $delete(key){var ob=this.__ob__;if(!ob){delete this[key];return}if(_.isReserved(key)){_.warn("Refused to $add reserved key: "+key);return}if(!this.hasOwnProperty(key))return;delete this[key];if(ob.vms){var i=ob.vms.length;while(i--){var vm=ob.vms[i];vm._unproxy(key);vm._digest()}}else{ob.notify()}})},{"../util":57}],45:[function(require,module,exports){var _=require("../util");var Cache=require("../cache");var cache=new Cache(1e3);var argRE=/^[^\{\?]+$|^'[^']*'$|^"[^"]*"$/;var filterTokenRE=/[^\s'"]+|'[^']+'|"[^"]+"/g;var str;var c,i,l;var inSingle;var inDouble;var curly;var square;var paren;var begin;var argIndex;var dirs;var dir;var lastFilterIndex;var arg;function pushDir(){dir.raw=str.slice(begin,i).trim();if(dir.expression===undefined){dir.expression=str.slice(argIndex,i).trim()}else if(lastFilterIndex!==begin){pushFilter()}if(i===0||dir.expression){dirs.push(dir)}}function pushFilter(){var exp=str.slice(lastFilterIndex,i).trim();var filter;if(exp){filter={};var tokens=exp.match(filterTokenRE);filter.name=tokens[0];filter.args=tokens.length>1?tokens.slice(1):null}if(filter){(dir.filters=dir.filters||[]).push(filter)}lastFilterIndex=i+1}exports.parse=function(s){var hit=cache.get(s);if(hit){return hit}str=s;inSingle=inDouble=false;curly=square=paren=begin=argIndex=0;lastFilterIndex=0;dirs=[];dir={};arg=null;for(i=0,l=str.length;i<l;i++){c=str.charCodeAt(i);if(inSingle){if(c===39)inSingle=!inSingle}else if(inDouble){if(c===34)inDouble=!inDouble}else if(c===44&&!paren&&!curly&&!square){pushDir();dir={};begin=argIndex=lastFilterIndex=i+1}else if(c===58&&!dir.expression&&!dir.arg){arg=str.slice(begin,i).trim();if(argRE.test(arg)){argIndex=i+1;dir.arg=_.stripQuotes(arg)||arg}}else if(c===124&&str.charCodeAt(i+1)!==124&&str.charCodeAt(i-1)!==124){if(dir.expression===undefined){lastFilterIndex=i+1;dir.expression=str.slice(argIndex,i).trim()}else{pushFilter()}}else{switch(c){case 34:inDouble=true;break;case 39:inSingle=true;break;case 40:paren++;break;case 41:paren--;break;case 91:square++;break;case 93:square--;break;case 123:curly++;break;case 125:curly--;break}}}if(i===0||begin!==i){pushDir()}cache.put(s,dirs);return dirs}},{"../cache":9,"../util":57}],46:[function(require,module,exports){var _=require("../util");var Path=require("./path");var Cache=require("../cache");var expressionCache=new Cache(1e3);var keywords="Math,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";var wsRE=/\s/g;var newlineRE=/\n/g;var saveRE=/[\{,]\s*[\w\$_]+\s*:|'[^']*'|"[^"]*"/g;var restoreRE=/"(\d+)"/g;var pathTestRE=/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*$/;var pathReplaceRE=/[^\w$\.]([A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*)/g;var keywordsRE=new RegExp("^("+keywords.replace(/,/g,"\\b|")+"\\b)");var saved=[];function save(str){var i=saved.length;saved[i]=str.replace(newlineRE,"\\n");return'"'+i+'"'}function rewrite(raw){var c=raw.charAt(0);var path=raw.slice(1);if(keywordsRE.test(path)){return raw}else{path=path.indexOf('"')>-1?path.replace(restoreRE,restore):path;return c+"scope."+path}}function restore(str,i){return saved[i]}function compileExpFns(exp,needSet){saved.length=0;var body=exp.replace(saveRE,save).replace(wsRE,"");body=(" "+body).replace(pathReplaceRE,rewrite).replace(restoreRE,restore);var getter=makeGetter(body);if(getter){return{get:getter,body:body,set:needSet?makeSetter(body):null}}}function compilePathFns(exp){var getter,path;if(exp.indexOf("[")<0){path=exp.split(".");getter=Path.compileGetter(path)}else{path=Path.parse(exp);getter=path.get}return{get:getter,set:function(obj,val){Path.set(obj,path,val)}}}function makeGetter(body){try{return new Function("scope","return "+body+";")}catch(e){_.warn("Invalid expression. "+"Generated function body: "+body)}}function makeSetter(body){try{return new Function("scope","value",body+"=value;")}catch(e){_.warn("Invalid setter function body: "+body)}}function checkSetter(hit){if(!hit.set){hit.set=makeSetter(hit.body)}}exports.parse=function(exp,needSet){exp=exp.trim();var hit=expressionCache.get(exp);if(hit){if(needSet){checkSetter(hit)}return hit}var res=pathTestRE.test(exp)?compilePathFns(exp):compileExpFns(exp,needSet);expressionCache.put(exp,res);return res};exports.pathTestRE=pathTestRE},{"../cache":9,"../util":57,"./path":47}],47:[function(require,module,exports){var _=require("../util");var Cache=require("../cache");var pathCache=new Cache(1e3);var identRE=/^[$_a-zA-Z]+[\w$]*$/;var pathStateMachine={beforePath:{ws:["beforePath"],ident:["inIdent","append"],"[":["beforeElement"],eof:["afterPath"]},inPath:{ws:["inPath"],".":["beforeIdent"],"[":["beforeElement"],eof:["afterPath"]},beforeIdent:{ws:["beforeIdent"],ident:["inIdent","append"]},inIdent:{ident:["inIdent","append"],0:["inIdent","append"],number:["inIdent","append"],ws:["inPath","push"],".":["beforeIdent","push"],"[":["beforeElement","push"],eof:["afterPath","push"]},beforeElement:{ws:["beforeElement"],0:["afterZero","append"],number:["inIndex","append"],"'":["inSingleQuote","append",""],'"':["inDoubleQuote","append",""]},afterZero:{ws:["afterElement","push"],"]":["inPath","push"]},inIndex:{0:["inIndex","append"],number:["inIndex","append"],ws:["afterElement"],"]":["inPath","push"]},inSingleQuote:{"'":["afterElement"],eof:"error","else":["inSingleQuote","append"]},inDoubleQuote:{'"':["afterElement"],eof:"error","else":["inDoubleQuote","append"]},afterElement:{ws:["afterElement"],"]":["inPath","push"]}};function noop(){}function getPathCharType(char){if(char===undefined){return"eof"}var code=char.charCodeAt(0);switch(code){case 91:case 93:case 46:case 34:case 39:case 48:return char;case 95:case 36:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}if(97<=code&&code<=122||65<=code&&code<=90){return"ident"}if(49<=code&&code<=57){return"number"}return"else"}function parsePath(path){var keys=[];var index=-1;var mode="beforePath";var c,newChar,key,type,transition,action,typeMap;var actions={push:function(){if(key===undefined){return}keys.push(key);key=undefined},append:function(){if(key===undefined){key=newChar}else{key+=newChar}}};function maybeUnescapeQuote(){var nextChar=path[index+1];if(mode==="inSingleQuote"&&nextChar==="'"||mode==="inDoubleQuote"&&nextChar==='"'){index++;newChar=nextChar;actions.append();return true}}while(mode){index++;c=path[index];if(c==="\\"&&maybeUnescapeQuote()){continue}type=getPathCharType(c);typeMap=pathStateMachine[mode];transition=typeMap[type]||typeMap["else"]||"error";if(transition==="error"){return}mode=transition[0];action=actions[transition[1]]||noop;newChar=transition[2]===undefined?c:transition[2];action();if(mode==="afterPath"){return keys}}}function formatAccessor(key){if(identRE.test(key)){return"."+key | |
}else if(+key===key>>>0){return"["+key+"]"}else{return'["'+key.replace(/"/g,'\\"')+'"]'}}exports.compileGetter=function(path){var body="try{return o"+path.map(formatAccessor).join("")+"}catch(e){};";return new Function("o",body)};exports.parse=function(path){var hit=pathCache.get(path);if(!hit){hit=parsePath(path);if(hit){hit.get=exports.compileGetter(hit);pathCache.put(path,hit)}}return hit};exports.get=function(obj,path){path=exports.parse(path);if(path){return path.get(obj)}};exports.set=function(obj,path,val){if(typeof path==="string"){path=exports.parse(path)}if(!path||!_.isObject(obj)){return false}var last,key;for(var i=0,l=path.length-1;i<l;i++){last=obj;key=path[i];obj=obj[key];if(!_.isObject(obj)){obj={};last.$add(key,obj)}}key=path[i];if(key in obj){obj[key]=val}else{obj.$add(key,val)}return true}},{"../cache":9,"../util":57}],48:[function(require,module,exports){var _=require("../util");var Cache=require("../cache");var templateCache=new Cache(100);var hasBrokenTemplate=_.inBrowser?function(){var a=document.createElement("div");a.innerHTML="<template>1</template>";return!a.cloneNode(true).firstChild.innerHTML}():false;var map={_default:[0,"",""],legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]};map.td=map.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];map.option=map.optgroup=[1,'<select multiple="multiple">',"</select>"];map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"<table>","</table>"];map.g=map.defs=map.symbol=map.use=map.image=map.text=map.circle=map.ellipse=map.line=map.path=map.polygon=map.polyline=map.rect=[1,"<svg "+'xmlns="http://www.w3.org/2000/svg" '+'xmlns:xlink="http://www.w3.org/1999/xlink" '+'xmlns:ev="http://www.w3.org/2001/xml-events"'+'version="1.1">',"</svg>"];var TAG_RE=/<([\w:]+)/;function stringToFragment(templateString){var hit=templateCache.get(templateString);if(hit){return hit}var frag=document.createDocumentFragment();var tagMatch=TAG_RE.exec(templateString);if(!tagMatch){frag.appendChild(document.createTextNode(templateString))}else{var tag=tagMatch[1];var wrap=map[tag]||map._default;var depth=wrap[0];var prefix=wrap[1];var suffix=wrap[2];var node=document.createElement("div");node.innerHTML=prefix+templateString.trim()+suffix;while(depth--){node=node.lastChild}var child;while(child=node.firstChild){frag.appendChild(child)}}templateCache.put(templateString,frag);return frag}function nodeToFragment(node){var tag=node.tagName;if(tag==="TEMPLATE"&&node.content instanceof DocumentFragment){return node.content}return tag==="SCRIPT"?stringToFragment(node.textContent):stringToFragment(node.innerHTML)}exports.clone=function(node){var res=node.cloneNode(true);if(hasBrokenTemplate){var templates=node.querySelectorAll("template");if(templates.length){var cloned=res.querySelectorAll("template");var i=cloned.length;while(i--){cloned[i].parentNode.replaceChild(templates[i].cloneNode(true),cloned[i])}}}return res};exports.parse=function(template,clone){var node,frag;if(template instanceof DocumentFragment){return clone?template.cloneNode(true):template}if(typeof template==="string"){if(template.charAt(0)==="#"){frag=templateCache.get(template);if(!frag){node=document.getElementById(template.slice(1));if(node){frag=nodeToFragment(node);templateCache.put(template,frag)}}}else{frag=stringToFragment(template)}}else if(template.nodeType){frag=nodeToFragment(template)}return frag&&clone?exports.clone(frag):frag}},{"../cache":9,"../util":57}],49:[function(require,module,exports){var Cache=require("../cache");var config=require("../config");var dirParser=require("./directive");var regexEscapeRE=/[-.*+?^${}()|[\]\/\\]/g;var cache,tagRE,htmlRE,firstChar,lastChar;function escapeRegex(str){return str.replace(regexEscapeRE,"\\$&")}function compileRegex(){config._delimitersChanged=false;var open=config.delimiters[0];var close=config.delimiters[1];firstChar=open.charAt(0);lastChar=close.charAt(close.length-1);var firstCharRE=escapeRegex(firstChar);var lastCharRE=escapeRegex(lastChar);var openRE=escapeRegex(open);var closeRE=escapeRegex(close);tagRE=new RegExp(firstCharRE+"?"+openRE+"(.+?)"+closeRE+lastCharRE+"?","g");htmlRE=new RegExp("^"+firstCharRE+openRE+".*"+closeRE+lastCharRE+"$");cache=new Cache(1e3)}exports.parse=function(text){if(config._delimitersChanged){compileRegex()}var hit=cache.get(text);if(hit){return hit}if(!tagRE.test(text)){return null}var tokens=[];var lastIndex=tagRE.lastIndex=0;var match,index,value,first,oneTime,partial;while(match=tagRE.exec(text)){index=match.index;if(index>lastIndex){tokens.push({value:text.slice(lastIndex,index)})}first=match[1].charCodeAt(0);oneTime=first===42;partial=first===62;value=oneTime||partial?match[1].slice(1):match[1];tokens.push({tag:true,value:value.trim(),html:htmlRE.test(match[0]),oneTime:oneTime,partial:partial});lastIndex=index+match[0].length}if(lastIndex<text.length){tokens.push({value:text.slice(lastIndex)})}cache.put(text,tokens);return tokens};exports.tokensToExp=function(tokens,vm){return tokens.length>1?tokens.map(function(token){return formatToken(token,vm)}).join("+"):formatToken(tokens[0],vm,true)};function formatToken(token,vm,single){return token.tag?vm&&token.oneTime?'"'+vm.$eval(token.value)+'"':single?token.value:inlineFilters(token.value):'"'+token.value+'"'}var filterRE=/[^|]\|[^|]/;function inlineFilters(exp){if(!filterRE.test(exp)){return"("+exp+")"}else{var dir=dirParser.parse(exp)[0];if(!dir.filters){return"("+exp+")"}else{exp=dir.expression;for(var i=0,l=dir.filters.length;i<l;i++){var filter=dir.filters[i];var args=filter.args?',"'+filter.args.join('","')+'"':"";exp='this.$options.filters["'+filter.name+'"]'+".apply(this,["+exp+args+"])"}return exp}}}},{"../cache":9,"../config":12,"./directive":45}],50:[function(require,module,exports){var _=require("../util");var addClass=_.addClass;var removeClass=_.removeClass;var transDurationProp=_.transitionProp+"Duration";var animDurationProp=_.animationProp+"Duration";var queue=[];var queued=false;function push(el,dir,op,cls,cb){queue.push({el:el,dir:dir,cb:cb,cls:cls,op:op});if(!queued){queued=true;_.nextTick(flush)}}function flush(){var f=document.documentElement.offsetHeight;queue.forEach(run);queue=[];queued=false}function run(job){var el=job.el;var data=el.__v_trans;var cls=job.cls;var cb=job.cb;var op=job.op;var transitionType=getTransitionType(el,data,cls);if(job.dir>0){if(transitionType===1){removeClass(el,cls);if(cb)setupTransitionCb(_.transitionEndEvent)}else if(transitionType===2){setupTransitionCb(_.animationEndEvent,function(){removeClass(el,cls)})}else{removeClass(el,cls);if(cb)cb()}}else{if(transitionType){var event=transitionType===1?_.transitionEndEvent:_.animationEndEvent;setupTransitionCb(event,function(){op();removeClass(el,cls)})}else{op();removeClass(el,cls);if(cb)cb()}}function setupTransitionCb(event,cleanupFn){data.event=event;var onEnd=data.callback=function transitionCb(e){if(e.target===el){_.off(el,event,onEnd);data.event=data.callback=null;if(cleanupFn)cleanupFn();if(cb)cb()}};_.on(el,event,onEnd)}}function getTransitionType(el,data,className){var type=data.cache&&data.cache[className];if(type)return type;var inlineStyles=el.style;var computedStyles=window.getComputedStyle(el);var transDuration=inlineStyles[transDurationProp]||computedStyles[transDurationProp];if(transDuration&&transDuration!=="0s"){type=1}else{var animDuration=inlineStyles[animDurationProp]||computedStyles[animDurationProp];if(animDuration&&animDuration!=="0s"){type=2}}if(type){if(!data.cache)data.cache={};data.cache[className]=type}return type}module.exports=function(el,direction,op,data,cb){var prefix=data.id||"v";var enterClass=prefix+"-enter";var leaveClass=prefix+"-leave";if(data.callback){_.off(el,data.event,data.callback);removeClass(el,enterClass);removeClass(el,leaveClass);data.event=data.callback=null}if(direction>0){addClass(el,enterClass);op();push(el,direction,null,enterClass,cb)}else{addClass(el,leaveClass);push(el,direction,op,leaveClass,cb)}}},{"../util":57}],51:[function(require,module,exports){var _=require("../util");var applyCSSTransition=require("./css");var applyJSTransition=require("./js");exports.append=function(el,target,vm,cb){apply(el,1,function(){target.appendChild(el)},vm,cb)};exports.before=function(el,target,vm,cb){apply(el,1,function(){_.before(el,target)},vm,cb)};exports.remove=function(el,vm,cb){apply(el,-1,function(){_.remove(el)},vm,cb)};exports.removeThenAppend=function(el,target,vm,cb){apply(el,-1,function(){target.appendChild(el)},vm,cb)};exports.blockAppend=function(block,target,vm){var nodes=_.toArray(block.childNodes);for(var i=0,l=nodes.length;i<l;i++){exports.before(nodes[i],target,vm)}};exports.blockRemove=function(start,end,vm){var node=start.nextSibling;var next;while(node!==end){next=node.nextSibling;exports.remove(node,vm);node=next}};var apply=exports.apply=function(el,direction,op,vm,cb){var transData=el.__v_trans;if(!transData||!vm._isCompiled||vm.$parent&&!vm.$parent._isCompiled){op();if(cb)cb();return}var jsTransition=vm.$options.transitions[transData.id];if(jsTransition){applyJSTransition(el,direction,op,transData,jsTransition,vm,cb)}else if(_.transitionEndEvent){applyCSSTransition(el,direction,op,transData,cb)}else{op();if(cb)cb()}}},{"../util":57,"./css":50,"./js":52}],52:[function(require,module,exports){module.exports=function(el,direction,op,data,def,vm,cb){if(data.cancel){data.cancel();data.cancel=null}if(direction>0){if(def.beforeEnter){def.beforeEnter.call(vm,el)}op();if(def.enter){data.cancel=def.enter.call(vm,el,function(){data.cancel=null;if(cb)cb()})}else if(cb){cb()}}else{if(def.leave){data.cancel=def.leave.call(vm,el,function(){data.cancel=null;op();if(cb)cb()})}else{op();if(cb)cb()}}}},{}],53:[function(require,module,exports){var config=require("../config");enableDebug();function enableDebug(){var hasConsole=typeof console!=="undefined";exports.log=function(msg){if(hasConsole&&config.debug){console.log("[Vue info]: "+msg)}};exports.warn=function(msg){if(hasConsole&&!config.silent){console.warn("[Vue warn]: "+msg);if(config.debug&&console.trace){console.trace()}}};exports.assertAsset=function(val,type,id){if(!val){exports.warn("Failed to resolve "+type+": "+id)}}}},{"../config":12}],54:[function(require,module,exports){var config=require("../config");var doc=typeof document!=="undefined"&&document.documentElement;exports.inDoc=function(node){return doc&&doc.contains(node)};exports.attr=function(node,attr){attr=config.prefix+attr;var val=node.getAttribute(attr);if(val!==null){node.removeAttribute(attr)}return val};exports.before=function(el,target){target.parentNode.insertBefore(el,target)};exports.after=function(el,target){if(target.nextSibling){exports.before(el,target.nextSibling)}else{target.parentNode.appendChild(el)}};exports.remove=function(el){el.parentNode.removeChild(el)};exports.prepend=function(el,target){if(target.firstChild){exports.before(el,target.firstChild)}else{target.appendChild(el)}};exports.replace=function(target,el){var parent=target.parentNode;if(parent){parent.replaceChild(el,target)}};exports.copyAttributes=function(from,to){if(from.hasAttributes()){var attrs=from.attributes;for(var i=0,l=attrs.length;i<l;i++){var attr=attrs[i];to.setAttribute(attr.name,attr.value)}}};exports.on=function(el,event,cb){el.addEventListener(event,cb)};exports.off=function(el,event,cb){el.removeEventListener(event,cb)};exports.addClass=function(el,cls){if(el.classList){el.classList.add(cls)}else{var cur=" "+(el.getAttribute("class")||"")+" ";if(cur.indexOf(" "+cls+" ")<0){el.setAttribute("class",(cur+cls).trim())}}};exports.removeClass=function(el,cls){if(el.classList){el.classList.remove(cls)}else{var cur=" "+(el.getAttribute("class")||"")+" ";var tar=" "+cls+" ";while(cur.indexOf(tar)>=0){cur=cur.replace(tar," ")}el.setAttribute("class",cur.trim())}}},{"../config":12}],55:[function(require,module,exports){exports.hasProto="__proto__"in{};var toString=Object.prototype.toString;var inBrowser=exports.inBrowser=typeof window!=="undefined"&&toString.call(window)!=="[object Object]";var defer=inBrowser?window.requestAnimationFrame||window.webkitRequestAnimationFrame||setTimeout:setTimeout;exports.nextTick=function(cb,ctx){if(ctx){defer(function(){cb.call(ctx)},0)}else{defer(cb,0)}};exports.isIE9=inBrowser&&navigator.userAgent.indexOf("MSIE 9.0")>0;if(inBrowser&&!exports.isIE9){var isWebkitTrans=window.ontransitionend===undefined&&window.onwebkittransitionend!==undefined;var isWebkitAnim=window.onanimationend===undefined&&window.onwebkitanimationend!==undefined;exports.transitionProp=isWebkitTrans?"WebkitTransition":"transition";exports.transitionEndEvent=isWebkitTrans?"webkitTransitionEnd":"transitionend";exports.animationProp=isWebkitAnim?"WebkitAnimation":"animation";exports.animationEndEvent=isWebkitAnim?"webkitAnimationEnd":"animationend"}},{}],56:[function(require,module,exports){var _=require("./debug");exports.resolveFilters=function(vm,filters,target){if(!filters){return}var res=target||{};filters.forEach(function(f){var def=vm.$options.filters[f.name];_.assertAsset(def,"filter",f.name);if(!def)return;var args=f.args;var reader,writer;if(typeof def==="function"){reader=def}else{reader=def.read;writer=def.write}if(reader){if(!res.read)res.read=[];res.read.push(function(value){return args?reader.apply(vm,[value].concat(args)):reader.call(vm,value)})}if(writer){if(!res.write)res.write=[];res.write.push(function(value,oldVal){return args?writer.apply(vm,[value,oldVal].concat(args)):writer.call(vm,value,oldVal)})}});return res};exports.applyFilters=function(value,filters,vm,oldVal){if(!filters){return value}for(var i=0,l=filters.length;i<l;i++){value=filters[i].call(vm,value,oldVal)}return value}},{"./debug":53}],57:[function(require,module,exports){var lang=require("./lang");var extend=lang.extend;extend(exports,lang);extend(exports,require("./env"));extend(exports,require("./dom"));extend(exports,require("./filter"));extend(exports,require("./debug"))},{"./debug":53,"./dom":54,"./env":55,"./filter":56,"./lang":58}],58:[function(require,module,exports){exports.isReserved=function(str){var c=str.charCodeAt(0);return c===36||c===95};exports.toString=function(value){return value==null?"":value.toString()};exports.toNumber=function(value){return isNaN(value)||value===null||typeof value==="boolean"?value:Number(value)};exports.stripQuotes=function(str){var a=str.charCodeAt(0);var b=str.charCodeAt(str.length-1);return a===b&&(a===34||a===39)?str.slice(1,-1):false};var camelRE=/[-_](\w)/g;var capitalCamelRE=/(?:^|[-_])(\w)/g;exports.camelize=function(str,cap){var RE=cap?capitalCamelRE:camelRE;return str.replace(RE,function(_,c){return c?c.toUpperCase():""})};exports.bind=function(fn,ctx){return function(){return fn.apply(ctx,arguments)}};exports.toArray=function(list,start){start=start||0;var i=list.length-start;var ret=new Array(i);while(i--){ret[i]=list[i+start]}return ret};exports.extend=function(to,from){for(var key in from){to[key]=from[key]}};exports.isObject=function(obj){return obj&&typeof obj==="object"};var toString=Object.prototype.toString;exports.isPlainObject=function(obj){return toString.call(obj)==="[object Object]"};exports.isArray=function(obj){return Array.isArray(obj)};exports.define=function(obj,key,val,enumerable){Object.defineProperty(obj,key,{value:val,enumerable:!!enumerable,writable:true,configurable:true})}},{}],59:[function(require,module,exports){var _=require("./index");var extend=_.extend;var strats=Object.create(null);strats.data=function(parentVal,childVal,vm){if(!vm){if(childVal&&typeof childVal!=="function"){_.warn('The "data" option should be a function '+"that returns a per-instance value in component "+"definitions.");return}return childVal||parentVal}var instanceData=typeof childVal==="function"?childVal.call(vm):childVal;var defaultData=typeof parentVal==="function"?parentVal.call(vm):undefined;if(instanceData){for(var key in defaultData){if(!instanceData.hasOwnProperty(key)){instanceData.$add(key,defaultData[key])}}return instanceData}else{return defaultData}};strats.el=function(parentVal,childVal,vm){if(!vm&&childVal&&typeof childVal!=="function"){_.warn('The "el" option should be a function '+"that returns a per-instance value in component "+"definitions.");return}var ret=childVal||parentVal;return vm&&typeof ret==="function"?ret.call(vm):ret};strats.created=strats.ready=strats.attached=strats.detached=strats.beforeCompile=strats.compiled=strats.beforeDestroy=strats.destroyed=strats.paramAttributes=function(parentVal,childVal){return childVal?parentVal?parentVal.concat(childVal):_.isArray(childVal)?childVal:[childVal]:parentVal};strats.directives=strats.filters=strats.partials=strats.transitions=strats.components=function(parentVal,childVal,vm,key){var ret=Object.create(vm&&vm.$parent?vm.$parent.$options[key]:_.Vue.options[key]);if(parentVal){var keys=Object.keys(parentVal);var i=keys.length;var field;while(i--){field=keys[i];ret[field]=parentVal[field]}}if(childVal)extend(ret,childVal);return ret};strats.watch=strats.events=function(parentVal,childVal){if(!childVal)return parentVal;if(!parentVal)return childVal;var ret={};extend(ret,parentVal);for(var key in childVal){var parent=ret[key];var child=childVal[key];ret[key]=parent?parent.concat(child):[child]}return ret};strats.methods=strats.computed=function(parentVal,childVal){if(!childVal)return parentVal;if(!parentVal)return childVal;var ret=Object.create(parentVal);extend(ret,childVal);return ret};var defaultStrat=function(parentVal,childVal){return childVal===undefined?parentVal:childVal};function guardComponents(components){if(components){var def;for(var key in components){def=components[key];if(_.isPlainObject(def)){def.name=key;components[key]=_.Vue.extend(def)}}}}module.exports=function mergeOptions(parent,child,vm){guardComponents(child.components);var options={};var key;for(key in parent){merge(parent[key],child[key],key)}for(key in child){if(!parent.hasOwnProperty(key)){merge(parent[key],child[key],key)}}var mixins=child.mixins;if(mixins){for(var i=0,l=mixins.length;i<l;i++){for(key in mixins[i]){merge(options[key],mixins[i][key],key)}}}function merge(parentVal,childVal,key){var strat=strats[key]||defaultStrat;options[key]=strat(parentVal,childVal,vm,key)}return options}},{"./index":57}],60:[function(require,module,exports){var _=require("./util");var config=require("./config");var Observer=require("./observer");var expParser=require("./parse/expression");var Batcher=require("./batcher");var batcher=new Batcher;var uid=0;function Watcher(vm,expression,cb,filters,needSet,deep){this.vm=vm;vm._watcherList.push(this);this.expression=expression;this.cbs=[cb];this.id=++uid;this.active=true;this.deep=deep;this.deps=Object.create(null);this.readFilters=filters&&filters.read;this.writeFilters=filters&&filters.write;var res=expParser.parse(expression,needSet);this.getter=res.get;this.setter=res.set;this.value=this.get()}var p=Watcher.prototype;p.addDep=function(binding){var id=binding.id;if(!this.newDeps[id]){this.newDeps[id]=binding;if(!this.deps[id]){this.deps[id]=binding;binding.addSub(this)}}};p.get=function(){this.beforeGet();var vm=this.vm;var value;try{value=this.getter.call(vm,vm)}catch(e){}if(this.deep)JSON.stringify(value);value=_.applyFilters(value,this.readFilters,vm);this.afterGet();return value};p.set=function(value){var vm=this.vm;value=_.applyFilters(value,this.writeFilters,vm,this.value);try{this.setter.call(vm,vm,value)}catch(e){}};p.beforeGet=function(){Observer.target=this;this.newDeps={}};p.afterGet=function(){Observer.target=null;for(var id in this.deps){if(!this.newDeps[id]){this.deps[id].removeSub(this)}}this.deps=this.newDeps};p.update=function(){if(config.async){batcher.push(this)}else{this.run()}};p.run=function(){if(this.active){var value=this.get();if(typeof value==="object"&&value!==null||value!==this.value){var oldValue=this.value;this.value=value;var cbs=this.cbs;for(var i=0,l=cbs.length;i<l;i++){cbs[i](value,oldValue);var removed=l-cbs.length;if(removed){i-=removed;l-=removed}}}}};p.addCb=function(cb){this.cbs.push(cb)};p.removeCb=function(cb){var cbs=this.cbs;if(cbs.length>1){var i=cbs.indexOf(cb);if(i>-1){cbs.splice(i,1)}}else if(cb===cbs[0]){this.teardown()}};p.teardown=function(){if(this.active){if(!this.vm._isBeingDestroyed){var list=this.vm._watcherList;list.splice(list.indexOf(this))}for(var id in this.deps){this.deps[id].removeSub(this)}this.active=false;this.vm=this.cbs=this.value=null}};module.exports=Watcher},{"./batcher":7,"./config":12,"./observer":43,"./parse/expression":46,"./util":57}],vue:[function(require,module,exports){var _=require("./util");var extend=_.extend;function Vue(options){this._init(options)}extend(Vue,require("./api/global"));Vue.options={directives:require("./directives"),filters:require("./filters"),partials:{},transitions:{},components:{}};var p=Vue.prototype;Object.defineProperty(p,"$data",{get:function(){return this._data},set:function(newData){this._setData(newData)}});extend(p,require("./instance/init"));extend(p,require("./instance/events"));extend(p,require("./instance/scope"));extend(p,require("./instance/compile"));extend(p,require("./api/data"));extend(p,require("./api/dom"));extend(p,require("./api/events"));extend(p,require("./api/child"));extend(p,require("./api/lifecycle"));module.exports=_.Vue=Vue},{"./api/child":1,"./api/data":2,"./api/dom":3,"./api/events":4,"./api/global":5,"./api/lifecycle":6,"./directives":21,"./filters":37,"./instance/compile":38,"./instance/events":39,"./instance/init":40,"./instance/scope":41,"./util":57}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"vue-sortable-mixin":[function(require,module,exports){module.exports={ready:function(){var vm=this;var options=this.$data.$sortable||{};var $el=options.$el||this.$el;var prevStart=options.start?options.start:function(){};options.start=function(event,ui){ui.item.data("start",ui.item.index());prevStart(event,ui)};var prevUpdate=options.update?options.update:function(){};options.update=function(event,ui){var start=ui.item.data("start");var end=ui.item.index();var listKey=options.key?options.key:"elements";var swappedEl=vm[listKey].splice(start,1)[0];vm[listKey].splice(end,0,swappedEl);prevUpdate(event,ui)};if(options.key)delete options.key;$($el).sortable(options)}}},{}]},{},[]);var Vue=require("vue");var sortableMixin=require("vue-sortable-mixin");var appTemplate="<ul>"+'<li v-repeat="positions">{{$index}} : {{$value}}<li>'+"</ul>";var app=new Vue({mixins:[sortableMixin],data:{positions:["striker","defender","midfielder"],$sortable:{key:"positions"}},template:appTemplate});app.$mount(document.body); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"vue": "0.11.0", | |
"vue-sortable-mixin": "0.1.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment