a-template
Advanced tools
Comparing version 0.2.4 to 0.3.0
@@ -8,4 +8,67 @@ /** | ||
* author: steelydylan | ||
* version: 0.2.3 | ||
* version: 0.2.4 | ||
* | ||
* array.prototype.find: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Paul Miller <http://paulmillr.com> | ||
* contributors: Duncan Hall <himself@duncanhall.net> | ||
* version: 2.0.4 | ||
* | ||
* define-properties: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband | ||
* version: 1.1.2 | ||
* | ||
* es-abstract: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband <ljharb@gmail.com> | ||
* contributors: Jordan Harband <ljharb@gmail.com> | ||
* version: 1.7.0 | ||
* | ||
* es-to-primitive: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband | ||
* version: 1.1.1 | ||
* | ||
* foreach: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Manuel Stofer <manuel@takimata.ch> | ||
* contributors: Manuel Stofer, Jordan Harband | ||
* version: 2.0.5 | ||
* | ||
* function-bind: | ||
* licenses: MIT (http://opensource.org/licenses/MIT) | ||
* author: Raynos <raynos2@gmail.com> | ||
* contributors: Raynos, Jordan Harband | ||
* homepage: https://github.com/Raynos/function-bind | ||
* version: 1.1.0 | ||
* | ||
* has: | ||
* licenses: MIT (http://opensource.org/licenses/MIT) | ||
* author: Thiago de Arruda <tpadilha84@gmail.com> | ||
* homepage: https://github.com/tarruda/has | ||
* version: 1.0.1 | ||
* | ||
* is-callable: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband <ljharb@gmail.com> | ||
* contributors: Jordan Harband <ljharb@gmail.com> | ||
* version: 1.1.3 | ||
* | ||
* is-date-object: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband | ||
* version: 1.0.1 | ||
* | ||
* is-regex: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband | ||
* homepage: https://github.com/ljharb/is-regex | ||
* version: 1.0.4 | ||
* | ||
* is-symbol: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband | ||
* version: 1.0.1 | ||
* | ||
* morphdom: | ||
@@ -16,4 +79,11 @@ * license: MIT (http://opensource.org/licenses/MIT) | ||
* | ||
* object-keys: | ||
* license: MIT (http://opensource.org/licenses/MIT) | ||
* author: Jordan Harband <ljharb@gmail.com> | ||
* contributors: Jordan Harband <ljharb@gmail.com>, Raynos <raynos2@gmail.com>, Nathan Rajlich <nathan@tootallnate.net>, Ivan Starkov <istarkov@gmail.com>, Gary Katsevman <git@gkatsev.com> | ||
* version: 1.0.11 | ||
* | ||
* This header is generated by licensify (https://github.com/twada/licensify) | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.aTemplate=f()}})(function(){var define,module,exports;return 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){"use strict";var range;var NS_XHTML="http://www.w3.org/1999/xhtml";var doc=typeof document==="undefined"?undefined:document;var testEl=doc?doc.body||doc.createElement("div"):{};var actualHasAttributeNS;if(testEl.hasAttributeNS){actualHasAttributeNS=function(el,namespaceURI,name){return el.hasAttributeNS(namespaceURI,name)}}else if(testEl.hasAttribute){actualHasAttributeNS=function(el,namespaceURI,name){return el.hasAttribute(name)}}else{actualHasAttributeNS=function(el,namespaceURI,name){return el.getAttributeNode(namespaceURI,name)!=null}}var hasAttributeNS=actualHasAttributeNS;function toElement(str){if(!range&&doc.createRange){range=doc.createRange();range.selectNode(doc.body)}var fragment;if(range&&range.createContextualFragment){fragment=range.createContextualFragment(str)}else{fragment=doc.createElement("body");fragment.innerHTML=str}return fragment.childNodes[0]}function compareNodeNames(fromEl,toEl){var fromNodeName=fromEl.nodeName;var toNodeName=toEl.nodeName;if(fromNodeName===toNodeName){return true}if(toEl.actualize&&fromNodeName.charCodeAt(0)<91&&toNodeName.charCodeAt(0)>90){return fromNodeName===toNodeName.toUpperCase()}else{return false}}function createElementNS(name,namespaceURI){return!namespaceURI||namespaceURI===NS_XHTML?doc.createElement(name):doc.createElementNS(namespaceURI,name)}function moveChildren(fromEl,toEl){var curChild=fromEl.firstChild;while(curChild){var nextChild=curChild.nextSibling;toEl.appendChild(curChild);curChild=nextChild}return toEl}function morphAttrs(fromNode,toNode){var attrs=toNode.attributes;var i;var attr;var attrName;var attrNamespaceURI;var attrValue;var fromValue;for(i=attrs.length-1;i>=0;--i){attr=attrs[i];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;attrValue=attr.value;if(attrNamespaceURI){attrName=attr.localName||attrName;fromValue=fromNode.getAttributeNS(attrNamespaceURI,attrName);if(fromValue!==attrValue){fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue)}}else{fromValue=fromNode.getAttribute(attrName);if(fromValue!==attrValue){fromNode.setAttribute(attrName,attrValue)}}}attrs=fromNode.attributes;for(i=attrs.length-1;i>=0;--i){attr=attrs[i];if(attr.specified!==false){attrName=attr.name;attrNamespaceURI=attr.namespaceURI;if(attrNamespaceURI){attrName=attr.localName||attrName;if(!hasAttributeNS(toNode,attrNamespaceURI,attrName)){fromNode.removeAttributeNS(attrNamespaceURI,attrName)}}else{if(!hasAttributeNS(toNode,null,attrName)){fromNode.removeAttribute(attrName)}}}}}function syncBooleanAttrProp(fromEl,toEl,name){if(fromEl[name]!==toEl[name]){fromEl[name]=toEl[name];if(fromEl[name]){fromEl.setAttribute(name,"")}else{fromEl.removeAttribute(name,"")}}}var specialElHandlers={OPTION:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked");syncBooleanAttrProp(fromEl,toEl,"disabled");if(fromEl.value!==toEl.value){fromEl.value=toEl.value}if(!hasAttributeNS(toEl,null,"value")){fromEl.removeAttribute("value")}},TEXTAREA:function(fromEl,toEl){var newValue=toEl.value;if(fromEl.value!==newValue){fromEl.value=newValue}if(fromEl.firstChild){if(newValue===""&&fromEl.firstChild.nodeValue===fromEl.placeholder){return}fromEl.firstChild.nodeValue=newValue}},SELECT:function(fromEl,toEl){if(!hasAttributeNS(toEl,null,"multiple")){var selectedIndex=-1;var i=0;var curChild=toEl.firstChild;while(curChild){var nodeName=curChild.nodeName;if(nodeName&&nodeName.toUpperCase()==="OPTION"){if(hasAttributeNS(curChild,null,"selected")){selectedIndex=i;break}i++}curChild=curChild.nextSibling}fromEl.selectedIndex=i}}};var ELEMENT_NODE=1;var TEXT_NODE=3;var COMMENT_NODE=8;function noop(){}function defaultGetNodeKey(node){return node.id}function morphdomFactory(morphAttrs){return function morphdom(fromNode,toNode,options){if(!options){options={}}if(typeof toNode==="string"){if(fromNode.nodeName==="#document"||fromNode.nodeName==="HTML"){var toNodeHtml=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeHtml}else{toNode=toElement(toNode)}}var getNodeKey=options.getNodeKey||defaultGetNodeKey;var onBeforeNodeAdded=options.onBeforeNodeAdded||noop;var onNodeAdded=options.onNodeAdded||noop;var onBeforeElUpdated=options.onBeforeElUpdated||noop;var onElUpdated=options.onElUpdated||noop;var onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop;var onNodeDiscarded=options.onNodeDiscarded||noop;var onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop;var childrenOnly=options.childrenOnly===true;var fromNodesLookup={};var keyedRemovalList;function addKeyedRemoval(key){if(keyedRemovalList){keyedRemovalList.push(key)}else{keyedRemovalList=[key]}}function walkDiscardedChildNodes(node,skipKeyedNodes){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=undefined;if(skipKeyedNodes&&(key=getNodeKey(curChild))){addKeyedRemoval(key)}else{onNodeDiscarded(curChild);if(curChild.firstChild){walkDiscardedChildNodes(curChild,skipKeyedNodes)}}curChild=curChild.nextSibling}}}function removeNode(node,parentNode,skipKeyedNodes){if(onBeforeNodeDiscarded(node)===false){return}if(parentNode){parentNode.removeChild(node)}onNodeDiscarded(node);walkDiscardedChildNodes(node,skipKeyedNodes)}function indexTree(node){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=getNodeKey(curChild);if(key){fromNodesLookup[key]=curChild}indexTree(curChild);curChild=curChild.nextSibling}}}indexTree(fromNode);function handleNodeAdded(el){onNodeAdded(el);var curChild=el.firstChild;while(curChild){var nextSibling=curChild.nextSibling;var key=getNodeKey(curChild);if(key){var unmatchedFromEl=fromNodesLookup[key];if(unmatchedFromEl&&compareNodeNames(curChild,unmatchedFromEl)){curChild.parentNode.replaceChild(unmatchedFromEl,curChild);morphEl(unmatchedFromEl,curChild)}}handleNodeAdded(curChild);curChild=nextSibling}}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);var curFromNodeKey;if(toElKey){delete fromNodesLookup[toElKey]}if(toNode.isSameNode&&toNode.isSameNode(fromNode)){return}if(!childrenOnly){if(onBeforeElUpdated(fromEl,toEl)===false){return}morphAttrs(fromEl,toEl);onElUpdated(fromEl);if(onBeforeElChildrenUpdated(fromEl,toEl)===false){return}}if(fromEl.nodeName!=="TEXTAREA"){var curToNodeChild=toEl.firstChild;var curFromNodeChild=fromEl.firstChild;var curToNodeKey;var fromNextSibling;var toNextSibling;var matchingFromEl;outer:while(curToNodeChild){toNextSibling=curToNodeChild.nextSibling;curToNodeKey=getNodeKey(curToNodeChild);while(curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType;var isCompatible=undefined;if(curFromNodeType===curToNodeChild.nodeType){if(curFromNodeType===ELEMENT_NODE){if(curToNodeKey){if(curToNodeKey!==curFromNodeKey){if(matchingFromEl=fromNodesLookup[curToNodeKey]){if(curFromNodeChild.nextSibling===matchingFromEl){isCompatible=false}else{fromEl.insertBefore(matchingFromEl,curFromNodeChild);fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=matchingFromEl}}else{isCompatible=false}}}else if(curFromNodeKey){isCompatible=false}isCompatible=isCompatible!==false&&compareNodeNames(curFromNodeChild,curToNodeChild);if(isCompatible){morphEl(curFromNodeChild,curToNodeChild)}}else if(curFromNodeType===TEXT_NODE||curFromNodeType==COMMENT_NODE){isCompatible=true;curFromNodeChild.nodeValue=curToNodeChild.nodeValue}}if(isCompatible){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}if(curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)){fromEl.appendChild(matchingFromEl);morphEl(matchingFromEl,curToNodeChild)}else{var onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild);if(onBeforeNodeAddedResult!==false){if(onBeforeNodeAddedResult){curToNodeChild=onBeforeNodeAddedResult}if(curToNodeChild.actualize){curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)}fromEl.appendChild(curToNodeChild);handleNodeAdded(curToNodeChild)}}curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling}while(curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey=getNodeKey(curFromNodeChild)){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}}var specialElHandler=specialElHandlers[fromEl.nodeName];if(specialElHandler){specialElHandler(fromEl,toEl)}}var morphedNode=fromNode;var morphedNodeType=morphedNode.nodeType;var toNodeType=toNode.nodeType;if(!childrenOnly){if(morphedNodeType===ELEMENT_NODE){if(toNodeType===ELEMENT_NODE){if(!compareNodeNames(fromNode,toNode)){onNodeDiscarded(fromNode);morphedNode=moveChildren(fromNode,createElementNS(toNode.nodeName,toNode.namespaceURI))}}else{morphedNode=toNode}}else if(morphedNodeType===TEXT_NODE||morphedNodeType===COMMENT_NODE){if(toNodeType===morphedNodeType){morphedNode.nodeValue=toNode.nodeValue;return morphedNode}else{morphedNode=toNode}}}if(morphedNode===toNode){onNodeDiscarded(fromNode)}else{morphEl(morphedNode,toNode,childrenOnly);if(keyedRemovalList){for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];if(elToRemove){removeNode(elToRemove,elToRemove.parentNode,false)}}}}if(!childrenOnly&&morphedNode!==fromNode&&fromNode.parentNode){if(morphedNode.actualize){morphedNode=morphedNode.actualize(fromNode.ownerDocument||doc)}fromNode.parentNode.replaceChild(morphedNode,fromNode)}return morphedNode}}var morphdom=morphdomFactory(morphAttrs);module.exports=morphdom},{}],2:[function(require,module,exports){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var morphdom=require("morphdom");var objs=[];var eventType="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend";var dataAction=eventType.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";if(!Array.prototype.find){Array.prototype.find=function(predicate){if(this===null){throw new TypeError("Array.prototype.find called on null or undefined")}if(typeof predicate!=="function"){throw new TypeError("predicate must be a function")}var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value=void 0;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list)){return value}}return undefined}}var matches=function matches(element,query){var matches=(element.document||element.ownerDocument).querySelectorAll(query);var i=matches.length;while(--i>=0&&matches.item(i)!==element){}return i>-1};var selector=function selector(_selector){return document.querySelector(_selector)};var getObjectById=function getObjectById(id){for(var i=0,n=objs.length;i<n;i++){var obj=objs[i];var templates=obj.templates;for(var t=0,m=templates.length;t<m;t++){if(templates[t]==id){return obj}}}return null};var findAncestor=function findAncestor(element,selector){if(typeof element.closest==="function"){return element.closest(selector)||null}while(element&&element!==document){if(matches(element,selector)){return element}element=element.parentElement}return null};var on=function on(element,query,eventNames,fn){var events=eventNames.split(" ");events.forEach(function(event){element.addEventListener(event,function(e){var target=e.target;var delegateTarget=findAncestor(e.target,query);if(delegateTarget){e.delegateTarget=delegateTarget;fn(e)}})})};if(typeof document!=="undefined"){on(document,"[data-bind]","input change click",function(e){var target=e.delegateTarget;var data=target.getAttribute("data-bind");var attr=target.getAttribute("href");var id=findAncestor(target,"[data-id]").getAttribute("data-id");var value=target.value;if(attr){value=value.replace("#","")}if(id){var obj=getObjectById(id);if(!obj){return}if(target.getAttribute("type")==="radio"){}else if(target.getAttribute("type")==="checkbox"){(function(){var arr=[];var items=document.querySelectorAll('[data-bind="'+data+'"]');[].forEach.call(items,function(item){if(item.checked){arr.push(item.value)}})})()}else{obj.updateDataByString(data,value)}}});on(document,dataAction,eventType,function(e){var target=e.delegateTarget;if(e.type==="click"&&target.tagName==="select"){return}if(e.type==="input"&&target.getAttribute("type")==="button"){return}var events=eventType.split(" ");var action="action";events.forEach(function(event){if(target.getAttribute("data-action-"+event)){if(e.type===event){action+="-"+event}}});var string=target.getAttribute("data-"+action);if(!string){return}var method=string.replace(/\(.*?\);?/,"");var parameter=string.replace(/(.*?)\((.*?)\);?/,"$2");var pts=parameter.split(",");var id=findAncestor(target,"[data-id]").getAttribute("data-id");if(!id){return}var obj=getObjectById(id);if(!obj){return}obj.e=e;if(obj.method&&obj.method[method]){obj.method[method].apply(obj,pts)}else if(obj[method]){obj[method].apply(obj,pts)}})}var aTemplate=function(){function aTemplate(opt){_classCallCheck(this,aTemplate);this.atemplate=[];objs.push(this);for(var i in opt){this[i]=opt[i]}if(!this.data){this.data={}}if(!this.templates){this.templates=[]}var templates=this.templates;var length=templates.length;for(var _i=0,n=length;_i<n;_i++){var template=this.templates[_i];var html=selector("#"+template).innerHTML;this.atemplate.push({id:template,html:html})}this.setId()}_createClass(aTemplate,[{key:"addTemplate",value:function addTemplate(id,html){this.atemplate.push({id:id,html:html});this.templates.push(id)}},{key:"loadHtml",value:function loadHtml(){var templates=this.templates;var promises=[];templates.forEach(function(template){var d=new $.Deferred;promises.push(d);var src=selector("#"+template).getAttribute("src");$.ajax({url:src,type:"GET",dataType:"text"}).success(function(data){selector("#"+template).innerHTML=data;d.resolve()})});return $.when.apply($,promises)}},{key:"getData",value:function getData(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function saveData(key){var data=JSON.stringify(this.data);localStorage.setItem(key,data)}},{key:"setData",value:function setData(val){for(var i in val){if(typeof val[i]!=="function"){this.data[i]=val[i]}}}},{key:"loadData",value:function loadData(key){var data=JSON.parse(localStorage.getItem(key));if(data){for(var i in data){if(typeof data[i]!=="function"){this.data[i]=data[i]}}}}},{key:"getRand",value:function getRand(a,b){return~~(Math.random()*(b-a+1))+a}},{key:"getRandText",value:function getRandText(limit){var ret="";var strings="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";var length=strings.length;for(var i=0;i<limit;i++){ret+=strings.charAt(Math.floor(this.getRand(0,length)))}return ret}},{key:"setId",value:function setId(){var text=void 0;var ids=aTemplate.ids;var flag=false;while(1){text=this.getRandText(10);for(var i=0,n=aTemplate.ids;i<n;i++){if(aTemplate.ids[i]===text){flag=true}}if(flag===false){break}}this.data.aTemplate_id=text}},{key:"getDataFromObj",value:function getDataFromObj(s,o){s=s.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1");s=s.replace(/^\./,"");var a=s.split(".");while(a.length){var n=a.shift();if(n in o){o=o[n]}else{return}}return o}},{key:"getDataByString",value:function getDataByString(s){var o=this.data;return this.getDataFromObj(s,o)}},{key:"updateDataByString",value:function updateDataByString(path,newValue){var object=this.data;var stack=path.split(".");while(stack.length>1){object=object[stack.shift()]}object[stack.shift()]=newValue}},{key:"removeDataByString",value:function removeDataByString(path){var object=this.data;var stack=path.split(".");while(stack.length>1){object=object[stack.shift()]}var shift=stack.shift();if(shift.match(/^\d+$/)){object.splice(Number(shift),1)}else{delete object[shift]}}},{key:"resolveBlock",value:function resolveBlock(html,item,i){var that=this;var touchs=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g);var touchnots=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g);var exists=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g);var empties=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(touchs){for(var k=0,n=touchs.length;k<n;k++){var start=touchs[k];start=start.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var end=start.replace(/BEGIN/,"END");var reg=new RegExp(start+"(([\\n\\r\\t]|.)*?)"+end,"g");html=html.replace(reg,function(m,key2,val,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(itemkey==val){return next}else{return""}})}}if(touchnots){for(var _k=0,_n=touchnots.length;_k<_n;_k++){var _start=touchnots[_k];_start=_start.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($1):touchnot#($2)");var _end=_start.replace(/BEGIN/,"END");var _reg=new RegExp(_start+"(([\\n\\r\\t]|.)*?)"+_end,"g");html=html.replace(_reg,function(m,key2,val,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(itemkey!=val){return next}else{return""}})}}if(exists){for(var _k2=0,_n2=exists.length;_k2<_n2;_k2++){var _start2=exists[_k2];_start2=_start2.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var _end2=_start2.replace(/BEGIN/,"END");var _reg2=new RegExp(_start2+"(([\\n\\r\\t]|.)*?)"+_end2,"g");html=html.replace(_reg2,function(m,key2,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(itemkey||itemkey===0){return next}else{return""}})}}if(empties){for(var _k3=0,_n3=empties.length;_k3<_n3;_k3++){var _start3=empties[_k3];_start3=_start3.replace(/([a-zA-Z0-9._-]+):empty/,"($1):empty");var _end3=_start3.replace(/BEGIN/,"END");var empty=new RegExp(_start3+"(([\\n\\r\\t]|.)*?)"+_end3,"g");html=html.replace(empty,function(m,key2,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(!itemkey&&itemkey!==0){return next}else{return""}})}}html=html.replace(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/g,function(n,key3,key4,converter){var data=void 0;if(key3=="i"){data=i}else{if(item[key3]||item[key3]===0){if(typeof item[key3]==="function"){data=item[key3].apply(that)}else{data=item[key3]}}else{if(converter&&that.convert&&that.convert[converter]){return that.convert[converter].call(that,"")}else{return""}}}if(converter&&that.convert&&that.convert[converter]){return that.convert[converter].call(that,data)}else{return data}});return html}},{key:"resolveAbsBlock",value:function resolveAbsBlock(html){var that=this;html=html.replace(/{(.*?)}/g,function(n,key3){var data=that.getDataByString(key3);if(typeof data!=="undefined"){if(typeof data==="function"){return data.apply(that)}else{return data}}else{return n}});return html}},{key:"resolveInclude",value:function resolveInclude(html){var include=/<!-- #include id="(.*?)" -->/g;html=html.replace(include,function(m,key){return selector("#"+key).innerHTML});return html}},{key:"resolveWith",value:function resolveWith(html){var width=/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g;html=html.replace(width,function(m,key,val){m=m.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+key+".$1'");return m});return html}},{key:"resolveLoop",value:function resolveLoop(html){var loop=/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g;var that=this;html=html.replace(loop,function(m,key,val){var keyItem=that.getDataByString(key);var keys=[];if(typeof keyItem==="function"){keys=keyItem.apply(that)}else{keys=keyItem}var ret="";if(keys instanceof Array){for(var i=0,n=keys.length;i<n;i++){ret+=that.resolveBlock(val,keys[i],i)}}ret=ret.replace(/\\([^\\])/g,"$1");return ret});return html}},{key:"removeData",value:function removeData(arr){var data=this.data;for(var i in data){for(var t=0,n=arr.length;t<n;t++){if(i===arr[t]){delete data[i]}}}return this}},{key:"hasLoop",value:function hasLoop(txt){var loop=/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g;if(txt.match(loop)){return true}else{return false}}},{key:"getHtml",value:function getHtml(selector,row){var template=this.atemplate.find(function(item){return item.id===selector});var html="";if(template&&template.html){html=template.html}if(row){html=selector}if(!html){return""}var data=this.data;html=this.resolveInclude(html);html=this.resolveWith(html);while(this.hasLoop(html)){html=this.resolveLoop(html)}html=this.resolveBlock(html,data);html=html.replace(/\\([^\\])/g,"$1");html=this.resolveAbsBlock(html);return html.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function update(txt,part){var html=this.getHtml();var templates=this.templates;var renderWay=txt||"html";if(this.beforeUpdated){this.beforeUpdated()}for(var i=0,n=templates.length;i<n;i++){var tem=templates[i];var query="#"+tem;var _html=this.getHtml(tem);var target=selector("[data-id='"+tem+"']");if(!part||part==tem){if(!target){selector(query).insertAdjacentHTML("afterend",'<div data-id="'+tem+'"></div>');if(renderWay==="text"){selector("[data-id='"+tem+"']").innerText=_html}else{selector("[data-id='"+tem+"']").innerHTML=_html}}else{if(renderWay==="text"){target.innerText=_html}else{morphdom(target,"<div data-id='"+tem+"'>"+_html+"</div>")}}if(part){break}}}this.updateBindingData(part);if(this.onUpdated){this.onUpdated(part)}return this}},{key:"updateBindingData",value:function updateBindingData(part){var _this=this;var templates=this.templates;for(var i=0,n=templates.length;i<n;i++){var temp=templates[i];if(!part||part==temp){var template=selector("[data-id='"+temp+"']");var binds=template.querySelectorAll("[data-bind]");[].forEach.call(binds,function(item){var data=_this.getDataByString(item.getAttribute("data-bind"));if(item.getAttribute("type")==="checkbox"||item.getAttribute("type")==="radio"){if(data==item.value){item.checked=true}}else{item.value=data}});if(part){break}}}return this}},{key:"applyMethod",value:function applyMethod(method){var args=[].splice.call(arguments,0);args.shift();return this.method[method].apply(this,args)}},{key:"getComputedProp",value:function getComputedProp(prop){return this.data[prop].apply(this)}},{key:"remove",value:function remove(path){var object=this.data;var stack=path.split(".");while(stack.length>1){object=object[stack.shift()]}var shift=stack.shift();if(shift.match(/^\d+$/)){object.splice(Number(shift),1)}else{delete object[shift]}return this}}]);return aTemplate}();module.exports=aTemplate},{morphdom:1}]},{},[2])(2)}); | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.aTemplate=f()}})(function(){var define,module,exports;return 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){"use strict";var ES=require("es-abstract/es6");module.exports=function find(predicate){var list=ES.ToObject(this);var length=ES.ToInteger(ES.ToLength(list.length));if(!ES.IsCallable(predicate)){throw new TypeError("Array#find: predicate must be a function")}if(length===0){return undefined}var thisArg=arguments[1];for(var i=0,value;i<length;i++){value=list[i];if(ES.Call(predicate,thisArg,[value,i,list])){return value}}return undefined}},{"es-abstract/es6":7}],2:[function(require,module,exports){"use strict";var define=require("define-properties");var ES=require("es-abstract/es6");var implementation=require("./implementation");var getPolyfill=require("./polyfill");var shim=require("./shim");var slice=Array.prototype.slice;var polyfill=getPolyfill();var boundFindShim=function find(array,predicate){ES.RequireObjectCoercible(array);var args=slice.call(arguments,1);return polyfill.apply(array,args)};define(boundFindShim,{getPolyfill:getPolyfill,implementation:implementation,shim:shim});module.exports=boundFindShim},{"./implementation":1,"./polyfill":3,"./shim":4,"define-properties":5,"es-abstract/es6":7}],3:[function(require,module,exports){"use strict";module.exports=function getPolyfill(){var implemented=Array.prototype.find&&[,1].find(function(){return true})!==1;return implemented?Array.prototype.find:require("./implementation")}},{"./implementation":1}],4:[function(require,module,exports){"use strict";var define=require("define-properties");var getPolyfill=require("./polyfill");module.exports=function shimArrayPrototypeFind(){var polyfill=getPolyfill();define(Array.prototype,{find:polyfill},{find:function(){return Array.prototype.find!==polyfill}});return polyfill}},{"./polyfill":3,"define-properties":5}],5:[function(require,module,exports){"use strict";var keys=require("object-keys");var foreach=require("foreach");var hasSymbols=typeof Symbol==="function"&&typeof Symbol()==="symbol";var toStr=Object.prototype.toString;var isFunction=function(fn){return typeof fn==="function"&&toStr.call(fn)==="[object Function]"};var arePropertyDescriptorsSupported=function(){var obj={};try{Object.defineProperty(obj,"x",{enumerable:false,value:obj});for(var _ in obj){return false}return obj.x===obj}catch(e){return false}};var supportsDescriptors=Object.defineProperty&&arePropertyDescriptorsSupported();var defineProperty=function(object,name,value,predicate){if(name in object&&(!isFunction(predicate)||!predicate())){return}if(supportsDescriptors){Object.defineProperty(object,name,{configurable:true,enumerable:false,value:value,writable:true})}else{object[name]=value}};var defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{};var props=keys(map);if(hasSymbols){props=props.concat(Object.getOwnPropertySymbols(map))}foreach(props,function(name){defineProperty(object,name,map[name],predicates[name])})};defineProperties.supportsDescriptors=!!supportsDescriptors;module.exports=defineProperties},{foreach:17,"object-keys":26}],6:[function(require,module,exports){"use strict";var $isNaN=require("./helpers/isNaN");var $isFinite=require("./helpers/isFinite");var sign=require("./helpers/sign");var mod=require("./helpers/mod");var IsCallable=require("is-callable");var toPrimitive=require("es-to-primitive/es5");var ES5={ToPrimitive:toPrimitive,ToBoolean:function ToBoolean(value){return Boolean(value)},ToNumber:function ToNumber(value){return Number(value)},ToInteger:function ToInteger(value){var number=this.ToNumber(value);if($isNaN(number)){return 0}if(number===0||!$isFinite(number)){return number}return sign(number)*Math.floor(Math.abs(number))},ToInt32:function ToInt32(x){return this.ToNumber(x)>>0},ToUint32:function ToUint32(x){return this.ToNumber(x)>>>0},ToUint16:function ToUint16(value){var number=this.ToNumber(value);if($isNaN(number)||number===0||!$isFinite(number)){return 0}var posInt=sign(number)*Math.floor(Math.abs(number));return mod(posInt,65536)},ToString:function ToString(value){return String(value)},ToObject:function ToObject(value){this.CheckObjectCoercible(value);return Object(value)},CheckObjectCoercible:function CheckObjectCoercible(value,optMessage){if(value==null){throw new TypeError(optMessage||"Cannot call method on "+value)}return value},IsCallable:IsCallable,SameValue:function SameValue(x,y){if(x===y){if(x===0){return 1/x===1/y}return true}return $isNaN(x)&&$isNaN(y)},Type:function Type(x){if(x===null){return"Null"}if(typeof x==="undefined"){return"Undefined"}if(typeof x==="function"||typeof x==="object"){return"Object"}if(typeof x==="number"){return"Number"}if(typeof x==="boolean"){return"Boolean"}if(typeof x==="string"){return"String"}}};module.exports=ES5},{"./helpers/isFinite":9,"./helpers/isNaN":10,"./helpers/mod":12,"./helpers/sign":13,"es-to-primitive/es5":14,"is-callable":21}],7:[function(require,module,exports){"use strict";var toStr=Object.prototype.toString;var hasSymbols=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol";var symbolToStr=hasSymbols?Symbol.prototype.toString:toStr;var $isNaN=require("./helpers/isNaN");var $isFinite=require("./helpers/isFinite");var MAX_SAFE_INTEGER=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1;var assign=require("./helpers/assign");var sign=require("./helpers/sign");var mod=require("./helpers/mod");var isPrimitive=require("./helpers/isPrimitive");var toPrimitive=require("es-to-primitive/es6");var parseInteger=parseInt;var bind=require("function-bind");var strSlice=bind.call(Function.call,String.prototype.slice);var isBinary=bind.call(Function.call,RegExp.prototype.test,/^0b[01]+$/i);var isOctal=bind.call(Function.call,RegExp.prototype.test,/^0o[0-7]+$/i);var nonWS=[" ","",""].join("");var nonWSregex=new RegExp("["+nonWS+"]","g");var hasNonWS=bind.call(Function.call,RegExp.prototype.test,nonWSregex);var invalidHexLiteral=/^[-+]0x[0-9a-f]+$/i;var isInvalidHexLiteral=bind.call(Function.call,RegExp.prototype.test,invalidHexLiteral);var ws=[" \n\f\r "," \u2028","\u2029\ufeff"].join("");var trimRegex=new RegExp("(^["+ws+"]+)|(["+ws+"]+$)","g");var replace=bind.call(Function.call,String.prototype.replace);var trim=function(value){return replace(value,trimRegex,"")};var ES5=require("./es5");var hasRegExpMatcher=require("is-regex");var ES6=assign(assign({},ES5),{Call:function Call(F,V){var args=arguments.length>2?arguments[2]:[];if(!this.IsCallable(F)){throw new TypeError(F+" is not a function")}return F.apply(V,args)},ToPrimitive:toPrimitive,ToNumber:function ToNumber(argument){var value=isPrimitive(argument)?argument:toPrimitive(argument,"number");if(typeof value==="symbol"){throw new TypeError("Cannot convert a Symbol value to a number")}if(typeof value==="string"){if(isBinary(value)){return this.ToNumber(parseInteger(strSlice(value,2),2))}else if(isOctal(value)){return this.ToNumber(parseInteger(strSlice(value,2),8))}else if(hasNonWS(value)||isInvalidHexLiteral(value)){return NaN}else{var trimmed=trim(value);if(trimmed!==value){return this.ToNumber(trimmed)}}}return Number(value)},ToInt16:function ToInt16(argument){var int16bit=this.ToUint16(argument);return int16bit>=32768?int16bit-65536:int16bit},ToInt8:function ToInt8(argument){var int8bit=this.ToUint8(argument);return int8bit>=128?int8bit-256:int8bit},ToUint8:function ToUint8(argument){var number=this.ToNumber(argument);if($isNaN(number)||number===0||!$isFinite(number)){return 0}var posInt=sign(number)*Math.floor(Math.abs(number));return mod(posInt,256)},ToUint8Clamp:function ToUint8Clamp(argument){var number=this.ToNumber(argument);if($isNaN(number)||number<=0){return 0}if(number>=255){return 255}var f=Math.floor(argument);if(f+.5<number){return f+1}if(number<f+.5){return f}if(f%2!==0){return f+1}return f},ToString:function ToString(argument){if(typeof argument==="symbol"){throw new TypeError("Cannot convert a Symbol value to a string")}return String(argument)},ToObject:function ToObject(value){this.RequireObjectCoercible(value);return Object(value)},ToPropertyKey:function ToPropertyKey(argument){var key=this.ToPrimitive(argument,String);return typeof key==="symbol"?symbolToStr.call(key):this.ToString(key)},ToLength:function ToLength(argument){var len=this.ToInteger(argument);if(len<=0){return 0}if(len>MAX_SAFE_INTEGER){return MAX_SAFE_INTEGER}return len},CanonicalNumericIndexString:function CanonicalNumericIndexString(argument){if(toStr.call(argument)!=="[object String]"){throw new TypeError("must be a string")}if(argument==="-0"){return-0}var n=this.ToNumber(argument);if(this.SameValue(this.ToString(n),argument)){return n}return void 0},RequireObjectCoercible:ES5.CheckObjectCoercible,IsArray:Array.isArray||function IsArray(argument){return toStr.call(argument)==="[object Array]"},IsConstructor:function IsConstructor(argument){return typeof argument==="function"&&!!argument.prototype},IsExtensible:function IsExtensible(obj){if(!Object.preventExtensions){return true}if(isPrimitive(obj)){return false}return Object.isExtensible(obj)},IsInteger:function IsInteger(argument){if(typeof argument!=="number"||$isNaN(argument)||!$isFinite(argument)){return false}var abs=Math.abs(argument);return Math.floor(abs)===abs},IsPropertyKey:function IsPropertyKey(argument){return typeof argument==="string"||typeof argument==="symbol"},IsRegExp:function IsRegExp(argument){if(!argument||typeof argument!=="object"){return false}if(hasSymbols){var isRegExp=argument[Symbol.match];if(typeof isRegExp!=="undefined"){return ES5.ToBoolean(isRegExp)}}return hasRegExpMatcher(argument)},SameValueZero:function SameValueZero(x,y){return x===y||$isNaN(x)&&$isNaN(y)},GetV:function GetV(V,P){if(!this.IsPropertyKey(P)){throw new TypeError("Assertion failed: IsPropertyKey(P) is not true")}var O=this.ToObject(V);return O[P]},GetMethod:function GetMethod(O,P){if(!this.IsPropertyKey(P)){throw new TypeError("Assertion failed: IsPropertyKey(P) is not true")}var func=this.GetV(O,P);if(func==null){return undefined}if(!this.IsCallable(func)){throw new TypeError(P+"is not a function")}return func},Get:function Get(O,P){if(this.Type(O)!=="Object"){throw new TypeError("Assertion failed: Type(O) is not Object")}if(!this.IsPropertyKey(P)){throw new TypeError("Assertion failed: IsPropertyKey(P) is not true")}return O[P]},Type:function Type(x){if(typeof x==="symbol"){return"Symbol"}return ES5.Type(x)},SpeciesConstructor:function SpeciesConstructor(O,defaultConstructor){if(this.Type(O)!=="Object"){throw new TypeError("Assertion failed: Type(O) is not Object")}var C=O.constructor;if(typeof C==="undefined"){return defaultConstructor}if(this.Type(C)!=="Object"){throw new TypeError("O.constructor is not an Object")}var S=hasSymbols&&Symbol.species?C[Symbol.species]:undefined;if(S==null){return defaultConstructor}if(this.IsConstructor(S)){return S}throw new TypeError("no constructor found")}});delete ES6.CheckObjectCoercible;module.exports=ES6},{"./es5":6,"./helpers/assign":8,"./helpers/isFinite":9,"./helpers/isNaN":10,"./helpers/isPrimitive":11,"./helpers/mod":12,"./helpers/sign":13,"es-to-primitive/es6":15,"function-bind":19,"is-regex":23}],8:[function(require,module,exports){var has=Object.prototype.hasOwnProperty;module.exports=Object.assign||function assign(target,source){for(var key in source){if(has.call(source,key)){target[key]=source[key]}}return target}},{}],9:[function(require,module,exports){var $isNaN=Number.isNaN||function(a){return a!==a};module.exports=Number.isFinite||function(x){return typeof x==="number"&&!$isNaN(x)&&x!==Infinity&&x!==-Infinity}},{}],10:[function(require,module,exports){module.exports=Number.isNaN||function isNaN(a){return a!==a}},{}],11:[function(require,module,exports){module.exports=function isPrimitive(value){return value===null||typeof value!=="function"&&typeof value!=="object"}},{}],12:[function(require,module,exports){module.exports=function mod(number,modulo){var remain=number%modulo;return Math.floor(remain>=0?remain:remain+modulo)}},{}],13:[function(require,module,exports){module.exports=function sign(number){return number>=0?1:-1}},{}],14:[function(require,module,exports){"use strict";var toStr=Object.prototype.toString;var isPrimitive=require("./helpers/isPrimitive");var isCallable=require("is-callable");var ES5internalSlots={"[[DefaultValue]]":function(O,hint){var actualHint=hint||(toStr.call(O)==="[object Date]"?String:Number);if(actualHint===String||actualHint===Number){var methods=actualHint===String?["toString","valueOf"]:["valueOf","toString"];var value,i;for(i=0;i<methods.length;++i){if(isCallable(O[methods[i]])){value=O[methods[i]]();if(isPrimitive(value)){return value}}}throw new TypeError("No default value")}throw new TypeError("invalid [[DefaultValue]] hint supplied")}};module.exports=function ToPrimitive(input,PreferredType){if(isPrimitive(input)){return input}return ES5internalSlots["[[DefaultValue]]"](input,PreferredType)}},{"./helpers/isPrimitive":16,"is-callable":21}],15:[function(require,module,exports){"use strict";var hasSymbols=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol";var isPrimitive=require("./helpers/isPrimitive");var isCallable=require("is-callable");var isDate=require("is-date-object");var isSymbol=require("is-symbol");var ordinaryToPrimitive=function OrdinaryToPrimitive(O,hint){if(typeof O==="undefined"||O===null){throw new TypeError("Cannot call method on "+O)}if(typeof hint!=="string"||hint!=="number"&&hint!=="string"){throw new TypeError('hint must be "string" or "number"')}var methodNames=hint==="string"?["toString","valueOf"]:["valueOf","toString"];var method,result,i;for(i=0;i<methodNames.length;++i){method=O[methodNames[i]];if(isCallable(method)){result=method.call(O);if(isPrimitive(result)){return result}}}throw new TypeError("No default value")};var GetMethod=function GetMethod(O,P){var func=O[P];if(func!==null&&typeof func!=="undefined"){if(!isCallable(func)){throw new TypeError(func+" returned for property "+P+" of object "+O+" is not a function")}return func}};module.exports=function ToPrimitive(input,PreferredType){if(isPrimitive(input)){return input}var hint="default";if(arguments.length>1){if(PreferredType===String){hint="string"}else if(PreferredType===Number){hint="number"}}var exoticToPrim;if(hasSymbols){if(Symbol.toPrimitive){exoticToPrim=GetMethod(input,Symbol.toPrimitive)}else if(isSymbol(input)){exoticToPrim=Symbol.prototype.valueOf}}if(typeof exoticToPrim!=="undefined"){var result=exoticToPrim.call(input,hint);if(isPrimitive(result)){return result}throw new TypeError("unable to convert exotic object to primitive")}if(hint==="default"&&(isDate(input)||isSymbol(input))){hint="string"}return ordinaryToPrimitive(input,hint==="default"?"number":hint)}},{"./helpers/isPrimitive":16,"is-callable":21,"is-date-object":22,"is-symbol":24}],16:[function(require,module,exports){arguments[4][11][0].apply(exports,arguments)},{dup:11}],17:[function(require,module,exports){var hasOwn=Object.prototype.hasOwnProperty;var toString=Object.prototype.toString;module.exports=function forEach(obj,fn,ctx){if(toString.call(fn)!=="[object Function]"){throw new TypeError("iterator must be a function")}var l=obj.length;if(l===+l){for(var i=0;i<l;i++){fn.call(ctx,obj[i],i,obj)}}else{for(var k in obj){if(hasOwn.call(obj,k)){fn.call(ctx,obj[k],k,obj)}}}}},{}],18:[function(require,module,exports){var ERROR_MESSAGE="Function.prototype.bind called on incompatible ";var slice=Array.prototype.slice;var toStr=Object.prototype.toString;var funcType="[object Function]";module.exports=function bind(that){var target=this;if(typeof target!=="function"||toStr.call(target)!==funcType){throw new TypeError(ERROR_MESSAGE+target)}var args=slice.call(arguments,1);var bound;var binder=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));if(Object(result)===result){return result}return this}else{return target.apply(that,args.concat(slice.call(arguments)))}};var boundLength=Math.max(0,target.length-args.length);var boundArgs=[];for(var i=0;i<boundLength;i++){boundArgs.push("$"+i)}bound=Function("binder","return function ("+boundArgs.join(",")+"){ return binder.apply(this,arguments); }")(binder);if(target.prototype){var Empty=function Empty(){};Empty.prototype=target.prototype;bound.prototype=new Empty;Empty.prototype=null}return bound}},{}],19:[function(require,module,exports){var implementation=require("./implementation");module.exports=Function.prototype.bind||implementation},{"./implementation":18}],20:[function(require,module,exports){var bind=require("function-bind");module.exports=bind.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":19}],21:[function(require,module,exports){"use strict";var fnToStr=Function.prototype.toString;var constructorRegex=/^\s*class /;var isES6ClassFn=function isES6ClassFn(value){try{var fnStr=fnToStr.call(value);var singleStripped=fnStr.replace(/\/\/.*\n/g,"");var multiStripped=singleStripped.replace(/\/\*[.\s\S]*\*\//g,"");var spaceStripped=multiStripped.replace(/\n/gm," ").replace(/ {2}/g," ");return constructorRegex.test(spaceStripped)}catch(e){return false}};var tryFunctionObject=function tryFunctionObject(value){try{if(isES6ClassFn(value)){return false}fnToStr.call(value);return true}catch(e){return false}};var toStr=Object.prototype.toString;var fnClass="[object Function]";var genClass="[object GeneratorFunction]";var hasToStringTag=typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol";module.exports=function isCallable(value){if(!value){return false}if(typeof value!=="function"&&typeof value!=="object"){return false}if(hasToStringTag){return tryFunctionObject(value)}if(isES6ClassFn(value)){return false}var strClass=toStr.call(value);return strClass===fnClass||strClass===genClass}},{}],22:[function(require,module,exports){"use strict";var getDay=Date.prototype.getDay;var tryDateObject=function tryDateObject(value){try{getDay.call(value);return true}catch(e){return false}};var toStr=Object.prototype.toString;var dateClass="[object Date]";var hasToStringTag=typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol";module.exports=function isDateObject(value){if(typeof value!=="object"||value===null){return false}return hasToStringTag?tryDateObject(value):toStr.call(value)===dateClass}},{}],23:[function(require,module,exports){"use strict";var has=require("has");var regexExec=RegExp.prototype.exec;var gOPD=Object.getOwnPropertyDescriptor;var tryRegexExecCall=function tryRegexExec(value){try{var lastIndex=value.lastIndex;value.lastIndex=0;regexExec.call(value);return true}catch(e){return false}finally{value.lastIndex=lastIndex}};var toStr=Object.prototype.toString;var regexClass="[object RegExp]";var hasToStringTag=typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol";module.exports=function isRegex(value){if(!value||typeof value!=="object"){return false}if(!hasToStringTag){return toStr.call(value)===regexClass}var descriptor=gOPD(value,"lastIndex");var hasLastIndexDataProperty=descriptor&&has(descriptor,"value");if(!hasLastIndexDataProperty){return false}return tryRegexExecCall(value)}},{has:20}],24:[function(require,module,exports){"use strict";var toStr=Object.prototype.toString;var hasSymbols=typeof Symbol==="function"&&typeof Symbol()==="symbol";if(hasSymbols){var symToStr=Symbol.prototype.toString;var symStringRegex=/^Symbol\(.*\)$/;var isSymbolObject=function isSymbolObject(value){if(typeof value.valueOf()!=="symbol"){return false}return symStringRegex.test(symToStr.call(value))};module.exports=function isSymbol(value){if(typeof value==="symbol"){return true}if(toStr.call(value)!=="[object Symbol]"){return false}try{return isSymbolObject(value)}catch(e){return false}}}else{module.exports=function isSymbol(value){return false}}},{}],25:[function(require,module,exports){"use strict";var range;var NS_XHTML="http://www.w3.org/1999/xhtml";var doc=typeof document==="undefined"?undefined:document;var testEl=doc?doc.body||doc.createElement("div"):{};var actualHasAttributeNS;if(testEl.hasAttributeNS){actualHasAttributeNS=function(el,namespaceURI,name){return el.hasAttributeNS(namespaceURI,name)}}else if(testEl.hasAttribute){actualHasAttributeNS=function(el,namespaceURI,name){return el.hasAttribute(name)}}else{actualHasAttributeNS=function(el,namespaceURI,name){return el.getAttributeNode(namespaceURI,name)!=null}}var hasAttributeNS=actualHasAttributeNS;function toElement(str){if(!range&&doc.createRange){range=doc.createRange();range.selectNode(doc.body)}var fragment;if(range&&range.createContextualFragment){fragment=range.createContextualFragment(str)}else{fragment=doc.createElement("body");fragment.innerHTML=str}return fragment.childNodes[0]}function compareNodeNames(fromEl,toEl){var fromNodeName=fromEl.nodeName;var toNodeName=toEl.nodeName;if(fromNodeName===toNodeName){return true}if(toEl.actualize&&fromNodeName.charCodeAt(0)<91&&toNodeName.charCodeAt(0)>90){return fromNodeName===toNodeName.toUpperCase()}else{return false}}function createElementNS(name,namespaceURI){return!namespaceURI||namespaceURI===NS_XHTML?doc.createElement(name):doc.createElementNS(namespaceURI,name)}function moveChildren(fromEl,toEl){var curChild=fromEl.firstChild;while(curChild){var nextChild=curChild.nextSibling;toEl.appendChild(curChild);curChild=nextChild}return toEl}function morphAttrs(fromNode,toNode){var attrs=toNode.attributes;var i;var attr;var attrName;var attrNamespaceURI;var attrValue;var fromValue;for(i=attrs.length-1;i>=0;--i){attr=attrs[i];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;attrValue=attr.value;if(attrNamespaceURI){attrName=attr.localName||attrName;fromValue=fromNode.getAttributeNS(attrNamespaceURI,attrName);if(fromValue!==attrValue){fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue)}}else{fromValue=fromNode.getAttribute(attrName);if(fromValue!==attrValue){fromNode.setAttribute(attrName,attrValue)}}}attrs=fromNode.attributes;for(i=attrs.length-1;i>=0;--i){attr=attrs[i];if(attr.specified!==false){attrName=attr.name;attrNamespaceURI=attr.namespaceURI;if(attrNamespaceURI){attrName=attr.localName||attrName;if(!hasAttributeNS(toNode,attrNamespaceURI,attrName)){fromNode.removeAttributeNS(attrNamespaceURI,attrName)}}else{if(!hasAttributeNS(toNode,null,attrName)){fromNode.removeAttribute(attrName)}}}}}function syncBooleanAttrProp(fromEl,toEl,name){if(fromEl[name]!==toEl[name]){fromEl[name]=toEl[name];if(fromEl[name]){fromEl.setAttribute(name,"")}else{fromEl.removeAttribute(name,"")}}}var specialElHandlers={OPTION:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked");syncBooleanAttrProp(fromEl,toEl,"disabled");if(fromEl.value!==toEl.value){fromEl.value=toEl.value}if(!hasAttributeNS(toEl,null,"value")){fromEl.removeAttribute("value")}},TEXTAREA:function(fromEl,toEl){var newValue=toEl.value;if(fromEl.value!==newValue){fromEl.value=newValue}if(fromEl.firstChild){if(newValue===""&&fromEl.firstChild.nodeValue===fromEl.placeholder){return}fromEl.firstChild.nodeValue=newValue}},SELECT:function(fromEl,toEl){if(!hasAttributeNS(toEl,null,"multiple")){var selectedIndex=-1;var i=0;var curChild=toEl.firstChild;while(curChild){var nodeName=curChild.nodeName;if(nodeName&&nodeName.toUpperCase()==="OPTION"){if(hasAttributeNS(curChild,null,"selected")){selectedIndex=i;break}i++}curChild=curChild.nextSibling}fromEl.selectedIndex=i}}};var ELEMENT_NODE=1;var TEXT_NODE=3;var COMMENT_NODE=8;function noop(){}function defaultGetNodeKey(node){return node.id}function morphdomFactory(morphAttrs){return function morphdom(fromNode,toNode,options){if(!options){options={}}if(typeof toNode==="string"){if(fromNode.nodeName==="#document"||fromNode.nodeName==="HTML"){var toNodeHtml=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeHtml}else{toNode=toElement(toNode)}}var getNodeKey=options.getNodeKey||defaultGetNodeKey;var onBeforeNodeAdded=options.onBeforeNodeAdded||noop;var onNodeAdded=options.onNodeAdded||noop;var onBeforeElUpdated=options.onBeforeElUpdated||noop;var onElUpdated=options.onElUpdated||noop;var onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop;var onNodeDiscarded=options.onNodeDiscarded||noop;var onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop;var childrenOnly=options.childrenOnly===true;var fromNodesLookup={};var keyedRemovalList;function addKeyedRemoval(key){if(keyedRemovalList){keyedRemovalList.push(key)}else{keyedRemovalList=[key]}}function walkDiscardedChildNodes(node,skipKeyedNodes){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=undefined;if(skipKeyedNodes&&(key=getNodeKey(curChild))){addKeyedRemoval(key)}else{onNodeDiscarded(curChild);if(curChild.firstChild){walkDiscardedChildNodes(curChild,skipKeyedNodes)}}curChild=curChild.nextSibling}}}function removeNode(node,parentNode,skipKeyedNodes){if(onBeforeNodeDiscarded(node)===false){return}if(parentNode){parentNode.removeChild(node)}onNodeDiscarded(node);walkDiscardedChildNodes(node,skipKeyedNodes)}function indexTree(node){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=getNodeKey(curChild);if(key){fromNodesLookup[key]=curChild}indexTree(curChild);curChild=curChild.nextSibling}}}indexTree(fromNode);function handleNodeAdded(el){onNodeAdded(el);var curChild=el.firstChild;while(curChild){var nextSibling=curChild.nextSibling;var key=getNodeKey(curChild);if(key){var unmatchedFromEl=fromNodesLookup[key];if(unmatchedFromEl&&compareNodeNames(curChild,unmatchedFromEl)){curChild.parentNode.replaceChild(unmatchedFromEl,curChild);morphEl(unmatchedFromEl,curChild)}}handleNodeAdded(curChild);curChild=nextSibling}}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);var curFromNodeKey;if(toElKey){delete fromNodesLookup[toElKey]}if(toNode.isSameNode&&toNode.isSameNode(fromNode)){return}if(!childrenOnly){if(onBeforeElUpdated(fromEl,toEl)===false){return}morphAttrs(fromEl,toEl);onElUpdated(fromEl);if(onBeforeElChildrenUpdated(fromEl,toEl)===false){return}}if(fromEl.nodeName!=="TEXTAREA"){var curToNodeChild=toEl.firstChild;var curFromNodeChild=fromEl.firstChild;var curToNodeKey;var fromNextSibling;var toNextSibling;var matchingFromEl;outer:while(curToNodeChild){toNextSibling=curToNodeChild.nextSibling;curToNodeKey=getNodeKey(curToNodeChild);while(curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType;var isCompatible=undefined;if(curFromNodeType===curToNodeChild.nodeType){if(curFromNodeType===ELEMENT_NODE){if(curToNodeKey){if(curToNodeKey!==curFromNodeKey){if(matchingFromEl=fromNodesLookup[curToNodeKey]){if(curFromNodeChild.nextSibling===matchingFromEl){isCompatible=false}else{fromEl.insertBefore(matchingFromEl,curFromNodeChild);fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=matchingFromEl}}else{isCompatible=false}}}else if(curFromNodeKey){isCompatible=false}isCompatible=isCompatible!==false&&compareNodeNames(curFromNodeChild,curToNodeChild);if(isCompatible){morphEl(curFromNodeChild,curToNodeChild)}}else if(curFromNodeType===TEXT_NODE||curFromNodeType==COMMENT_NODE){isCompatible=true;curFromNodeChild.nodeValue=curToNodeChild.nodeValue}}if(isCompatible){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}if(curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)){fromEl.appendChild(matchingFromEl);morphEl(matchingFromEl,curToNodeChild)}else{var onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild);if(onBeforeNodeAddedResult!==false){if(onBeforeNodeAddedResult){curToNodeChild=onBeforeNodeAddedResult}if(curToNodeChild.actualize){curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)}fromEl.appendChild(curToNodeChild);handleNodeAdded(curToNodeChild)}}curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling}while(curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey=getNodeKey(curFromNodeChild)){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}}var specialElHandler=specialElHandlers[fromEl.nodeName];if(specialElHandler){specialElHandler(fromEl,toEl)}}var morphedNode=fromNode;var morphedNodeType=morphedNode.nodeType;var toNodeType=toNode.nodeType;if(!childrenOnly){if(morphedNodeType===ELEMENT_NODE){if(toNodeType===ELEMENT_NODE){if(!compareNodeNames(fromNode,toNode)){onNodeDiscarded(fromNode);morphedNode=moveChildren(fromNode,createElementNS(toNode.nodeName,toNode.namespaceURI))}}else{morphedNode=toNode}}else if(morphedNodeType===TEXT_NODE||morphedNodeType===COMMENT_NODE){if(toNodeType===morphedNodeType){morphedNode.nodeValue=toNode.nodeValue;return morphedNode}else{morphedNode=toNode}}}if(morphedNode===toNode){onNodeDiscarded(fromNode)}else{morphEl(morphedNode,toNode,childrenOnly);if(keyedRemovalList){for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];if(elToRemove){removeNode(elToRemove,elToRemove.parentNode,false)}}}}if(!childrenOnly&&morphedNode!==fromNode&&fromNode.parentNode){if(morphedNode.actualize){morphedNode=morphedNode.actualize(fromNode.ownerDocument||doc)}fromNode.parentNode.replaceChild(morphedNode,fromNode)}return morphedNode}}var morphdom=morphdomFactory(morphAttrs);module.exports=morphdom},{}],26:[function(require,module,exports){"use strict";var has=Object.prototype.hasOwnProperty;var toStr=Object.prototype.toString;var slice=Array.prototype.slice;var isArgs=require("./isArguments");var isEnumerable=Object.prototype.propertyIsEnumerable;var hasDontEnumBug=!isEnumerable.call({toString:null},"toString");var hasProtoEnumBug=isEnumerable.call(function(){},"prototype");var dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o};var excludedKeys={$console:true,$external:true,$frame:true,$frameElement:true,$frames:true,$innerHeight:true,$innerWidth:true,$outerHeight:true,$outerWidth:true,$pageXOffset:true,$pageYOffset:true,$parent:true,$scrollLeft:true,$scrollTop:true,$scrollX:true,$scrollY:true,$self:true,$webkitIndexedDB:true,$webkitStorageInfo:true,$window:true};var hasAutomationEqualityBug=function(){if(typeof window==="undefined"){return false}for(var k in window){try{if(!excludedKeys["$"+k]&&has.call(window,k)&&window[k]!==null&&typeof window[k]==="object"){try{equalsConstructorPrototype(window[k])}catch(e){return true}}}catch(e){return true}}return false}();var equalsConstructorPrototypeIfNotBuggy=function(o){if(typeof window==="undefined"||!hasAutomationEqualityBug){return equalsConstructorPrototype(o)}try{return equalsConstructorPrototype(o)}catch(e){ | ||
return false}};var keysShim=function keys(object){var isObject=object!==null&&typeof object==="object";var isFunction=toStr.call(object)==="[object Function]";var isArguments=isArgs(object);var isString=isObject&&toStr.call(object)==="[object String]";var theKeys=[];if(!isObject&&!isFunction&&!isArguments){throw new TypeError("Object.keys called on a non-object")}var skipProto=hasProtoEnumBug&&isFunction;if(isString&&object.length>0&&!has.call(object,0)){for(var i=0;i<object.length;++i){theKeys.push(String(i))}}if(isArguments&&object.length>0){for(var j=0;j<object.length;++j){theKeys.push(String(j))}}else{for(var name in object){if(!(skipProto&&name==="prototype")&&has.call(object,name)){theKeys.push(String(name))}}}if(hasDontEnumBug){var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object);for(var k=0;k<dontEnums.length;++k){if(!(skipConstructor&&dontEnums[k]==="constructor")&&has.call(object,dontEnums[k])){theKeys.push(dontEnums[k])}}}return theKeys};keysShim.shim=function shimObjectKeys(){if(Object.keys){var keysWorksWithArguments=function(){return(Object.keys(arguments)||"").length===2}(1,2);if(!keysWorksWithArguments){var originalKeys=Object.keys;Object.keys=function keys(object){if(isArgs(object)){return originalKeys(slice.call(object))}else{return originalKeys(object)}}}}else{Object.keys=keysShim}return Object.keys||keysShim};module.exports=keysShim},{"./isArguments":27}],27:[function(require,module,exports){"use strict";var toStr=Object.prototype.toString;module.exports=function isArguments(value){var str=toStr.call(value);var isArgs=str==="[object Arguments]";if(!isArgs){isArgs=str!=="[object Array]"&&value!==null&&typeof value==="object"&&typeof value.length==="number"&&value.length>=0&&toStr.call(value.callee)==="[object Function]"}return isArgs}},{}],28:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();var _util=require("./util");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var morphdom=require("morphdom");var eventType="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend";var bindType="input change click";var dataAction=eventType.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";var find=require("array.prototype.find");var aTemplate=function(){function aTemplate(opt){_classCallCheck(this,aTemplate);this.atemplate=[];for(var i in opt){this[i]=opt[i]}if(!this.data){this.data={}}if(!this.templates){this.templates=[]}var templates=this.templates;var length=templates.length;for(var _i=0,n=length;_i<n;_i++){var template=this.templates[_i];var html=(0,_util.selector)("#"+template).innerHTML;this.atemplate.push({id:template,html:html,binded:false})}}_createClass(aTemplate,[{key:"addDataBind",value:function addDataBind(ele){var _this=this;(0,_util.on)(ele,"[data-bind]",bindType,function(e){var target=e.delegateTarget;var data=target.getAttribute("data-bind");var attr=target.getAttribute("href");var value=target.value;if(attr){value=value.replace("#","")}if(target.getAttribute("type")==="checkbox"){(function(){var arr=[];var items=document.querySelectorAll('[data-bind="'+data+'"]');[].forEach.call(items,function(item){if(item.checked){arr.push(item.value)}})})()}else if(target.getAttribute("type")!=="radio"){_this.updateDataByString(data,value)}})}},{key:"addActionBind",value:function addActionBind(ele){var _this2=this;(0,_util.on)(ele,dataAction,eventType,function(e){var target=e.delegateTarget;var events=eventType.split(" ");var action="action";events.forEach(function(event){if(target.getAttribute("data-action-"+event)){if(e.type===event){action+="-"+event}}});var string=target.getAttribute("data-"+action);if(!string){return}var method=string.replace(/\(.*?\);?/,"");var parameter=string.replace(/(.*?)\((.*?)\);?/,"$2");var pts=parameter.split(",");_this2.e=e;if(_this2.method&&_this2.method[method]){_this2.method[method].apply(_this2,pts)}else if(_this2[method]){_this2[method].apply(_this2,pts)}})}},{key:"addTemplate",value:function addTemplate(id,html){this.atemplate.push({id:id,html:html,binded:false});this.templates.push(id)}},{key:"loadHtml",value:function loadHtml(){var templates=this.templates;var promises=[];templates.forEach(function(template){var d=new $.Deferred;promises.push(d);var src=(0,_util.selector)("#"+template).getAttribute("src");$.ajax({url:src,type:"GET",dataType:"text"}).success(function(data){(0,_util.selector)("#"+template).innerHTML=data;d.resolve()})});return $.when.apply($,promises)}},{key:"getData",value:function getData(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function saveData(key){var data=JSON.stringify(this.data);localStorage.setItem(key,data)}},{key:"setData",value:function setData(val){for(var i in val){if(typeof val[i]!=="function"){this.data[i]=val[i]}}}},{key:"loadData",value:function loadData(key){var data=JSON.parse(localStorage.getItem(key));if(data){for(var i in data){if(typeof data[i]!=="function"){this.data[i]=data[i]}}}}},{key:"getRand",value:function getRand(a,b){return~~(Math.random()*(b-a+1))+a}},{key:"getRandText",value:function getRandText(limit){var ret="";var strings="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";var length=strings.length;for(var i=0;i<limit;i++){ret+=strings.charAt(Math.floor(this.getRand(0,length)))}return ret}},{key:"getDataFromObj",value:function getDataFromObj(s,o){s=s.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1");s=s.replace(/^\./,"");var a=s.split(".");while(a.length){var n=a.shift();if(n in o){o=o[n]}else{return}}return o}},{key:"getDataByString",value:function getDataByString(s){var o=this.data;return this.getDataFromObj(s,o)}},{key:"updateDataByString",value:function updateDataByString(path,newValue){var object=this.data;var stack=path.split(".");while(stack.length>1){object=object[stack.shift()]}object[stack.shift()]=newValue}},{key:"removeDataByString",value:function removeDataByString(path){var object=this.data;var stack=path.split(".");while(stack.length>1){object=object[stack.shift()]}var shift=stack.shift();if(shift.match(/^\d+$/)){object.splice(Number(shift),1)}else{delete object[shift]}}},{key:"resolveBlock",value:function resolveBlock(html,item,i){var that=this;var touchs=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g);var touchnots=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g);var exists=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g);var empties=html.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(touchs){for(var k=0,n=touchs.length;k<n;k++){var start=touchs[k];start=start.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var end=start.replace(/BEGIN/,"END");var reg=new RegExp(start+"(([\\n\\r\\t]|.)*?)"+end,"g");html=html.replace(reg,function(m,key2,val,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(itemkey==val){return next}else{return""}})}}if(touchnots){for(var _k=0,_n=touchnots.length;_k<_n;_k++){var _start=touchnots[_k];_start=_start.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($1):touchnot#($2)");var _end=_start.replace(/BEGIN/,"END");var _reg=new RegExp(_start+"(([\\n\\r\\t]|.)*?)"+_end,"g");html=html.replace(_reg,function(m,key2,val,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(itemkey!=val){return next}else{return""}})}}if(exists){for(var _k2=0,_n2=exists.length;_k2<_n2;_k2++){var _start2=exists[_k2];_start2=_start2.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var _end2=_start2.replace(/BEGIN/,"END");var _reg2=new RegExp(_start2+"(([\\n\\r\\t]|.)*?)"+_end2,"g");html=html.replace(_reg2,function(m,key2,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(itemkey||itemkey===0){return next}else{return""}})}}if(empties){for(var _k3=0,_n3=empties.length;_k3<_n3;_k3++){var _start3=empties[_k3];_start3=_start3.replace(/([a-zA-Z0-9._-]+):empty/,"($1):empty");var _end3=_start3.replace(/BEGIN/,"END");var empty=new RegExp(_start3+"(([\\n\\r\\t]|.)*?)"+_end3,"g");html=html.replace(empty,function(m,key2,next){var itemkey=typeof item[key2]==="function"?item[key2].apply(that):that.getDataFromObj(key2,item);if(!itemkey&&itemkey!==0){return next}else{return""}})}}html=html.replace(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/g,function(n,key3,key4,converter){var data=void 0;if(key3=="i"){data=i}else{if(item[key3]||item[key3]===0){if(typeof item[key3]==="function"){data=item[key3].apply(that)}else{data=item[key3]}}else{if(converter&&that.convert&&that.convert[converter]){return that.convert[converter].call(that,"")}else{return""}}}if(converter&&that.convert&&that.convert[converter]){return that.convert[converter].call(that,data)}else{return data}});return html}},{key:"resolveAbsBlock",value:function resolveAbsBlock(html){var that=this;html=html.replace(/{(.*?)}/g,function(n,key3){var data=that.getDataByString(key3);if(typeof data!=="undefined"){if(typeof data==="function"){return data.apply(that)}else{return data}}else{return n}});return html}},{key:"resolveInclude",value:function resolveInclude(html){var include=/<!-- #include id="(.*?)" -->/g;html=html.replace(include,function(m,key){return(0,_util.selector)("#"+key).innerHTML});return html}},{key:"resolveWith",value:function resolveWith(html){var width=/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g;html=html.replace(width,function(m,key,val){m=m.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+key+".$1'");return m});return html}},{key:"resolveLoop",value:function resolveLoop(html){var loop=/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g;var that=this;html=html.replace(loop,function(m,key,val){var keyItem=that.getDataByString(key);var keys=[];if(typeof keyItem==="function"){keys=keyItem.apply(that)}else{keys=keyItem}var ret="";if(keys instanceof Array){for(var i=0,n=keys.length;i<n;i++){ret+=that.resolveBlock(val,keys[i],i)}}ret=ret.replace(/\\([^\\])/g,"$1");return ret});return html}},{key:"removeData",value:function removeData(arr){var data=this.data;for(var i in data){for(var t=0,n=arr.length;t<n;t++){if(i===arr[t]){delete data[i]}}}return this}},{key:"hasLoop",value:function hasLoop(txt){var loop=/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g;if(txt.match(loop)){return true}else{return false}}},{key:"getHtml",value:function getHtml(selector,row){var template=find(this.atemplate,function(item){return item.id===selector});var html="";if(template&&template.html){html=template.html}if(row){html=selector}if(!html){return""}var data=this.data;html=this.resolveInclude(html);html=this.resolveWith(html);while(this.hasLoop(html)){html=this.resolveLoop(html)}html=this.resolveBlock(html,data);html=html.replace(/\\([^\\])/g,"$1");html=this.resolveAbsBlock(html);return html.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function update(){var _this3=this;var renderWay=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"html";var part=arguments[1];var html=this.getHtml();var templates=this.templates;if(this.beforeUpdated){this.beforeUpdated()}var _loop=function _loop(i,n){var tem=templates[i];var query="#"+tem;var html=_this3.getHtml(tem);var target=(0,_util.selector)("[data-id='"+tem+"']");if(!part||part==tem){if(!target){(0,_util.selector)(query).insertAdjacentHTML("afterend",'<div data-id="'+tem+'"></div>');if(renderWay==="text"){(0,_util.selector)("[data-id='"+tem+"']").innerText=html}else{(0,_util.selector)("[data-id='"+tem+"']").innerHTML=html}}else{if(renderWay==="text"){target.innerText=html}else{morphdom(target,"<div data-id='"+tem+"'>"+html+"</div>")}}var template=find(_this3.atemplate,function(item){return item.id===tem});if(!template.binded){template.binded=true;_this3.addDataBind((0,_util.selector)("[data-id='"+tem+"']"));_this3.addActionBind((0,_util.selector)("[data-id='"+tem+"']"))}if(part){return"break"}}};for(var i=0,n=templates.length;i<n;i++){var _ret2=_loop(i,n);if(_ret2==="break")break}this.updateBindingData(part);if(this.onUpdated){this.onUpdated(part)}return this}},{key:"updateBindingData",value:function updateBindingData(part){var _this4=this;var templates=this.templates;for(var i=0,n=templates.length;i<n;i++){var temp=templates[i];if(!part||part==temp){var template=(0,_util.selector)("[data-id='"+temp+"']");var binds=template.querySelectorAll("[data-bind]");[].forEach.call(binds,function(item){var data=_this4.getDataByString(item.getAttribute("data-bind"));if(item.getAttribute("type")==="checkbox"||item.getAttribute("type")==="radio"){if(data==item.value){item.checked=true}}else{item.value=data}});if(part){break}}}return this}},{key:"applyMethod",value:function applyMethod(method){var args=[].splice.call(arguments,0);args.shift();return this.method[method].apply(this,args)}},{key:"getComputedProp",value:function getComputedProp(prop){return this.data[prop].apply(this)}},{key:"remove",value:function remove(path){var object=this.data;var stack=path.split(".");while(stack.length>1){object=object[stack.shift()]}var shift=stack.shift();if(shift.match(/^\d+$/)){object.splice(Number(shift),1)}else{delete object[shift]}return this}}]);return aTemplate}();exports.default=aTemplate;module.exports=exports["default"]},{"./util":29,"array.prototype.find":2,morphdom:25}],29:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var matches=exports.matches=function matches(element,query){var matches=(element.document||element.ownerDocument).querySelectorAll(query);var i=matches.length;while(--i>=0&&matches.item(i)!==element){}return i>-1};var selector=exports.selector=function selector(_selector){return document.querySelector(_selector)};var findAncestor=exports.findAncestor=function findAncestor(element,selector){if(typeof element.closest==="function"){return element.closest(selector)||null}while(element&&element!==document){if(matches(element,selector)){return element}element=element.parentElement}return null};var on=exports.on=function on(element,query,eventNames,fn){var events=eventNames.split(" ");events.forEach(function(event){element.addEventListener(event,function(e){var target=e.target;var delegateTarget=findAncestor(e.target,query);if(delegateTarget){e.delegateTarget=delegateTarget;fn(e)}})})}},{}]},{},[28])(28)}); |
{ | ||
"name": "a-template", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"author": "steelydylan", | ||
@@ -8,6 +8,6 @@ "description": "Simple Template Engine", | ||
"scripts": { | ||
"bundle": "browserify ./src/index.js -t [ babelify --presets [ es2015 ] ] -p licensify --standalone aTemplate --outfile ./build/a-template.js", | ||
"bundle": "browserify ./src/index.js -t babelify -p licensify --standalone aTemplate --outfile ./build/a-template.js", | ||
"minifyjs": "uglifyjs ./build/a-template.js --comments 'license' -o ./build/a-template.min.js", | ||
"build": "npm run bundle && npm run minifyjs", | ||
"build:lib": "babel ./src/index.js --presets es2015 --out-file ./index.js", | ||
"build:lib": "babel src --out-dir lib", | ||
"watch": "watch 'npm run build && npm run build:lib' ./src/", | ||
@@ -18,5 +18,6 @@ "patch": "npm version patch && node ./tools/index.js", | ||
}, | ||
"main": "./index.js", | ||
"main": "./lib/index.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.18.0", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-es2015": "^6.18.0", | ||
@@ -34,6 +35,7 @@ "babelify": "^7.3.0", | ||
"uglifyjs": "^2.4.10", | ||
"watch": "^1.0.2", | ||
"watch": "^1.0.1", | ||
"watchify": "^3.7.0" | ||
}, | ||
"dependencies": { | ||
"array.prototype.find": "^2.0.4", | ||
"delegate": "^3.1.2", | ||
@@ -40,0 +42,0 @@ "morphdom": "^2.3.1" |
255
src/index.js
@@ -0,158 +1,12 @@ | ||
import { selector, on } from './util'; | ||
const morphdom = require('morphdom'); | ||
const objs = []; | ||
const eventType = "input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend"; | ||
const eventType = 'input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend'; | ||
const bindType = 'input change click'; | ||
const dataAction = eventType.replace(/([a-z]+)/g,"[data-action-$1],") + "[data-action]"; | ||
const find = require('array.prototype.find'); | ||
if (!Array.prototype.find) { | ||
Array.prototype.find = function(predicate) { | ||
if (this === null) { | ||
throw new TypeError('Array.prototype.find called on null or undefined'); | ||
} | ||
if (typeof predicate !== 'function') { | ||
throw new TypeError('predicate must be a function'); | ||
} | ||
let list = Object(this); | ||
let length = list.length >>> 0; | ||
let thisArg = arguments[1]; | ||
let value; | ||
export default class aTemplate { | ||
for (let i = 0; i < length; i++) { | ||
value = list[i]; | ||
if (predicate.call(thisArg, value, i, list)) { | ||
return value; | ||
} | ||
} | ||
return undefined; | ||
}; | ||
} | ||
const matches = (element, query) => { | ||
const matches = (element.document || element.ownerDocument).querySelectorAll(query); | ||
let i = matches.length; | ||
while (--i >= 0 && matches.item(i) !== element) {} | ||
return i > -1; | ||
} | ||
const selector = (selector) => { | ||
return document.querySelector(selector); | ||
} | ||
const getObjectById = (id) => { | ||
for (let i = 0, n = objs.length; i < n; i++) { | ||
let obj = objs[i]; | ||
let templates = obj.templates; | ||
for (let t = 0, m = templates.length; t < m; t++) { | ||
if (templates[t] == id) { | ||
return obj; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
const findAncestor = (element, selector) => { | ||
if (typeof element.closest === 'function') { | ||
return element.closest(selector) || null; | ||
} | ||
while (element && element !== document) { | ||
if (matches(element, selector)) { | ||
return element; | ||
} | ||
element = element.parentElement; | ||
} | ||
return null; | ||
} | ||
const on = (element, query, eventNames, fn) => { | ||
const events = eventNames.split(' '); | ||
events.forEach((event) => { | ||
element.addEventListener(event, (e) => { | ||
let target = e.target; | ||
const delegateTarget = findAncestor(e.target, query); | ||
if(delegateTarget) { | ||
e.delegateTarget = delegateTarget; | ||
fn(e); | ||
} | ||
}); | ||
}); | ||
}; | ||
if(typeof document !== "undefined"){ | ||
//data binding | ||
on(document,'[data-bind]','input change click',(e) => { | ||
const target = e.delegateTarget; | ||
const data = target.getAttribute('data-bind'); | ||
const attr = target.getAttribute('href'); | ||
const id = findAncestor(target,'[data-id]').getAttribute('data-id'); | ||
let value = target.value; | ||
if (attr) { | ||
value = value.replace('#',''); | ||
} | ||
if (id) { | ||
const obj = getObjectById(id); | ||
if (!obj){ | ||
return; | ||
} | ||
if(target.getAttribute('type') === 'radio') { | ||
} else if (target.getAttribute('type') === 'checkbox') { | ||
const arr = []; | ||
const items = document.querySelectorAll(`[data-bind="${data}"]`); | ||
[].forEach.call(items, (item) => { | ||
if(item.checked) { | ||
arr.push(item.value); | ||
} | ||
}); | ||
} else { | ||
obj.updateDataByString(data, value); | ||
} | ||
} | ||
}); | ||
//action | ||
on(document,dataAction,eventType,(e) => { | ||
const target = e.delegateTarget; | ||
if(e.type === "click" && target.tagName === 'select'){ | ||
return; | ||
} | ||
if(e.type === "input" && target.getAttribute("type") === "button"){ | ||
return; | ||
} | ||
let events = eventType.split(" "); | ||
let action = "action"; | ||
events.forEach((event) => { | ||
if (target.getAttribute("data-action-"+event)) { | ||
if(e.type === event){ | ||
action += "-"+event; | ||
} | ||
} | ||
}); | ||
const string = target.getAttribute(`data-${action}`); | ||
if(!string){ | ||
return; | ||
} | ||
let method = string.replace(/\(.*?\);?/,""); | ||
let parameter = string.replace(/(.*?)\((.*?)\);?/,"$2"); | ||
let pts = parameter.split(",");//引き数 | ||
const id = findAncestor(target,'[data-id]').getAttribute('data-id'); | ||
if(!id) { | ||
return; | ||
} | ||
const obj = getObjectById(id); | ||
if (!obj){ | ||
return; | ||
} | ||
obj.e = e; | ||
if(obj.method && obj.method[method]){ | ||
obj.method[method].apply(obj,pts); | ||
}else if(obj[method]){ | ||
obj[method].apply(obj,pts); | ||
} | ||
}); | ||
} | ||
class aTemplate { | ||
constructor(opt) { | ||
this.atemplate = []; | ||
objs.push(this); | ||
for(let i in opt){ | ||
@@ -164,3 +18,3 @@ this[i] = opt[i]; | ||
} | ||
if(!this.templates){ | ||
if(!this.templates) { | ||
this.templates = []; | ||
@@ -173,9 +27,59 @@ } | ||
let html = selector(`#${template}`).innerHTML; | ||
this.atemplate.push({id:template,html:html}); | ||
this.atemplate.push({id:template,html:html,binded:false}); | ||
} | ||
this.setId(); | ||
} | ||
addDataBind(ele) { | ||
on(ele,'[data-bind]', bindType,(e) => { | ||
const target = e.delegateTarget; | ||
const data = target.getAttribute('data-bind'); | ||
const attr = target.getAttribute('href'); | ||
let value = target.value; | ||
if (attr) { | ||
value = value.replace('#',''); | ||
} | ||
if (target.getAttribute('type') === 'checkbox') { | ||
const arr = []; | ||
const items = document.querySelectorAll(`[data-bind="${data}"]`); | ||
[].forEach.call(items, (item) => { | ||
if(item.checked) { | ||
arr.push(item.value); | ||
} | ||
}); | ||
} else if (target.getAttribute('type') !== 'radio') { | ||
this.updateDataByString(data, value); | ||
} | ||
}); | ||
} | ||
addActionBind(ele) { | ||
on(ele, dataAction, eventType,(e) => { | ||
const target = e.delegateTarget; | ||
let events = eventType.split(" "); | ||
let action = "action"; | ||
events.forEach((event) => { | ||
if (target.getAttribute("data-action-"+event)) { | ||
if(e.type === event){ | ||
action += "-"+event; | ||
} | ||
} | ||
}); | ||
const string = target.getAttribute(`data-${action}`); | ||
if(!string){ | ||
return; | ||
} | ||
let method = string.replace(/\(.*?\);?/,""); | ||
let parameter = string.replace(/(.*?)\((.*?)\);?/,"$2"); | ||
let pts = parameter.split(",");//引き数 | ||
this.e = e; | ||
if(this.method && this.method[method]){ | ||
this.method[method].apply(this,pts); | ||
}else if(this[method]){ | ||
this[method].apply(this,pts); | ||
} | ||
}); | ||
} | ||
addTemplate(id,html) { | ||
this.atemplate.push({id:id,html:html}) | ||
this.atemplate.push({id:id,html:html,binded:false}) | ||
this.templates.push(id); | ||
@@ -245,20 +149,2 @@ } | ||
setId () { | ||
let text; | ||
let ids = aTemplate.ids; | ||
let flag = false; | ||
while (1) { | ||
text = this.getRandText(10); | ||
for (let i = 0, n = aTemplate.ids; i < n; i++) { | ||
if (aTemplate.ids[i] === text) { | ||
flag = true; | ||
} | ||
} | ||
if (flag === false) { | ||
break; | ||
} | ||
} | ||
this.data.aTemplate_id = text; | ||
} | ||
getDataFromObj(s,o){ | ||
@@ -491,3 +377,3 @@ s = s.replace(/\[([a-zA-Z0-9._-]+)\]/g, '.$1'); // convert indexes to properties | ||
getHtml(selector,row){ | ||
let template = this.atemplate.find((item) => item.id === selector); | ||
let template = find(this.atemplate, (item) => item.id === selector); | ||
let html = ""; | ||
@@ -522,10 +408,9 @@ if(template && template.html){ | ||
update(txt,part){ | ||
update(renderWay = 'html', part){ | ||
let html = this.getHtml(); | ||
let templates = this.templates; | ||
let renderWay = txt || "html"; | ||
if(this.beforeUpdated){ | ||
this.beforeUpdated(); | ||
} | ||
for(let i = 0,n = templates.length; i < n; i++){ | ||
for(let i = 0, n = templates.length; i < n; i++){ | ||
let tem = templates[i]; | ||
@@ -550,2 +435,10 @@ let query = "#"+tem; | ||
} | ||
const template = find(this.atemplate, (item) => { | ||
return item.id === tem; | ||
}); | ||
if (!template.binded) { | ||
template.binded = true; | ||
this.addDataBind(selector(`[data-id='${tem}']`)); | ||
this.addActionBind(selector(`[data-id='${tem}']`)); | ||
} | ||
if(part){ | ||
@@ -577,3 +470,5 @@ break; | ||
}else{ | ||
item.value = data; | ||
// if(item !== document.activeElement) { | ||
item.value = data; | ||
// } | ||
} | ||
@@ -613,4 +508,2 @@ }); | ||
} | ||
} | ||
module.exports = aTemplate; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
279450
21
3539
3
16
2
+ Addedarray.prototype.find@^2.0.4
+ Addedarray-buffer-byte-length@1.0.2(transitive)
+ Addedarray.prototype.find@2.2.3(transitive)
+ Addedarraybuffer.prototype.slice@1.0.4(transitive)
+ Addedasync-function@1.0.0(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddata-view-buffer@1.0.2(transitive)
+ Addeddata-view-byte-length@1.0.2(transitive)
+ Addeddata-view-byte-offset@1.0.1(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-abstract@1.23.9(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedes-shim-unscopables@1.0.2(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedfor-each@0.3.4(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.8(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedget-symbol-description@1.1.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.1.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-array-buffer@3.0.5(transitive)
+ Addedis-async-function@2.1.1(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-finalizationregistry@1.1.1(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.1.1(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.4(transitive)
+ Addedis-string@1.1.1(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedown-keys@1.0.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedreflect.getprototypeof@1.0.10(transitive)
+ Addedregexp.prototype.flags@1.5.4(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-push-apply@1.0.0(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedset-proto@1.0.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtyped-array-buffer@1.0.3(transitive)
+ Addedtyped-array-byte-length@1.0.3(transitive)
+ Addedtyped-array-byte-offset@1.0.4(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedunbox-primitive@1.1.0(transitive)
+ Addedwhich-boxed-primitive@1.1.1(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)