Comparing version 0.0.4 to 0.0.5
@@ -0,1 +1,2 @@ | ||
/* eslint-disable */ | ||
window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V<U;++V){var ae=Z[V];if(ae.ignoreCase){ac=true}else{if(/[a-z]/i.test(ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){S=true;ac=false;break}}}var Y={b:8,t:9,n:10,v:11,f:12,r:13};function ab(ah){var ag=ah.charCodeAt(0);if(ag!==92){return ag}var af=ah.charAt(1);ag=Y[af];if(ag){return ag}else{if("0"<=af&&af<="7"){return parseInt(ah.substring(1),8)}else{if(af==="u"||af==="x"){return parseInt(ah.substring(2),16)}else{return ah.charCodeAt(1)}}}}function T(af){if(af<32){return(af<16?"\\x0":"\\x")+af.toString(16)}var ag=String.fromCharCode(af);if(ag==="\\"||ag==="-"||ag==="["||ag==="]"){ag="\\"+ag}return ag}function X(am){var aq=am.substring(1,am.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));var ak=[];var af=[];var ao=aq[0]==="^";for(var ar=ao?1:0,aj=aq.length;ar<aj;++ar){var ah=aq[ar];if(/\\[bdsw]/i.test(ah)){ak.push(ah)}else{var ag=ab(ah);var al;if(ar+2<aj&&"-"===aq[ar+1]){al=ab(aq[ar+2]);ar+=2}else{al=ag}af.push([ag,al]);if(!(al<65||ag>122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;ar<af.length;++ar){var at=af[ar];if(at[0]<=ap[1]+1){ap[1]=Math.max(ap[1],at[1])}else{ai.push(ap=at)}}var an=["["];if(ao){an.push("^")}an.push.apply(an,ak);for(var ar=0;ar<ai.length;++ar){var at=ai[ar];an.push(T(at[0]));if(at[1]>at[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak<ah;++ak){var ag=aj[ak];if(ag==="("){++am}else{if("\\"===ag.charAt(0)){var af=+ag.substring(1);if(af&&af<=am){an[af]=-1}}}}for(var ak=1;ak<an.length;++ak){if(-1===an[ak]){an[ak]=++ad}}for(var ak=0,am=0;ak<ah;++ak){var ag=aj[ak];if(ag==="("){++am;if(an[am]===undefined){aj[ak]="(?:"}}else{if("\\"===ag.charAt(0)){var af=+ag.substring(1);if(af&&af<=am){aj[ak]="\\"+an[am]}}}}for(var ak=0,am=0;ak<ah;++ak){if("^"===aj[ak]&&"^"!==aj[ak+1]){aj[ak]=""}}if(al.ignoreCase&&S){for(var ak=0;ak<ah;++ak){var ag=aj[ak];var ai=ag.charAt(0);if(ag.length>=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V<U;++V){var ae=Z[V];if(ae.global||ae.multiline){throw new Error(""+ae)}aa.push("(?:"+W(ae)+")")}return new RegExp(aa.join("|"),ac?"gi":"g")}function a(V){var U=/(?:^|\s)nocode(?:\s|$)/;var X=[];var T=0;var Z=[];var W=0;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=document.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Y=S&&"pre"===S.substring(0,3);function aa(ab){switch(ab.nodeType){case 1:if(U.test(ab.className)){return}for(var ae=ab.firstChild;ae;ae=ae.nextSibling){aa(ae)}var ad=ab.nodeName;if("BR"===ad||"LI"===ad){X[W]="\n";Z[W<<1]=T++;Z[(W++<<1)|1]=ab}break;case 3:case 4:var ac=ab.nodeValue;if(ac.length){if(!Y){ac=ac.replace(/[ \t\r\n]+/g," ")}else{ac=ac.replace(/\r\n?/g,"\n")}X[W]=ac;Z[W<<1]=T;T+=ac.length;Z[(W++<<1)|1]=ab}break}}aa(V);return{sourceCode:X.join("").replace(/\n$/,""),spans:Z}}function B(S,U,W,T){if(!U){return}var V={sourceCode:U,basePos:S};W(V);T.push.apply(T,V.decorations)}var v=/\S/;function o(S){var V=undefined;for(var U=S.firstChild;U;U=U.nextSibling){var T=U.nodeType;V=(T===1)?(V?S:U):(T===3)?(v.test(U.nodeValue)?S:V):V}return V===S?undefined:V}function g(U,T){var S={};var V;(function(){var ad=U.concat(T);var ah=[];var ag={};for(var ab=0,Z=ad.length;ab<Z;++ab){var Y=ad[ab];var ac=Y[3];if(ac){for(var ae=ac.length;--ae>=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae<aq;++ae){var ag=an[ae];var ap=aj[ag];var ai=void 0;var am;if(typeof ap==="string"){am=false}else{var aa=S[ag.charAt(0)];if(aa){ai=ag.match(aa[1]);ap=aa[0]}else{for(var ao=0;ao<X;++ao){aa=T[ao];ai=ag.match(aa[1]);if(ai){ap=aa[0];break}}if(!ai){ap=F}}am=ap.length>=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y<W.length;++Y){ae(W[Y])}if(ag===(ag|0)){W[0].setAttribute("value",ag)}var aa=ac.createElement("OL");aa.className="linenums";var X=Math.max(0,((ag-1))|0)||0;for(var Y=0,T=W.length;Y<T;++Y){af=W[Y];af.className="L"+((Y+X)%10);if(!af.firstChild){af.appendChild(ac.createTextNode("\xA0"))}aa.appendChild(af)}V.appendChild(aa)}function D(ac){var aj=/\bMSIE\b/.test(navigator.userAgent);var am=/\n/g;var al=ac.sourceCode;var an=al.length;var V=0;var aa=ac.spans;var T=aa.length;var ah=0;var X=ac.decorations;var Y=X.length;var Z=0;X[Y]=an;var ar,aq;for(aq=ar=0;aq<Y;){if(X[aq]!==X[aq+2]){X[ar++]=X[aq++];X[ar++]=X[aq++]}else{aq+=2}}Y=ar;for(aq=ar=0;aq<Y;){var at=X[aq];var ab=X[aq+1];var W=aq+2;while(W+2<=Y&&X[W+1]===ab){W+=2}X[ar++]=at;X[ar++]=ab;aq=W}Y=X.length=ar;var ae=null;while(ah<T){var af=aa[ah];var S=aa[ah+2]||an;var ag=X[Z];var ap=X[Z+2]||an;var W=Math.min(S,ap);var ak=aa[ah+1];var U;if(ak.nodeType!==1&&(U=al.substring(V,W))){if(aj){U=U.replace(am,"\r")}ak.nodeValue=U;var ai=ak.ownerDocument;var ao=ai.createElement("SPAN");ao.className=X[Z+1];var ad=ak.parentNode;ad.replaceChild(ao,ak);ao.appendChild(ak);if(V<S){aa[ah+1]=ak=ai.createTextNode(al.substring(W,S));ad.insertBefore(ak,ao.nextSibling)}}V=W;if(V>=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*</.test(S)?"default-markup":"default-code"}return t[T]}c(K,["default-code"]);c(g([],[[F,/^[^<?]+/],[E,/^<!\w[^>]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa<ac.length;++aa){for(var Z=0,V=ac[aa].length;Z<V;++Z){T.push(ac[aa][Z])}}ac=null;var W=Date;if(!W.now){W={now:function(){return +(new Date)}}}var X=0;var S;var ab=/\blang(?:uage)?-([\w.]+)(?!\S)/;var ae=/\bprettyprint\b/;function U(){var ag=(window.PR_SHOULD_USE_CONTINUATION?W.now()+250:Infinity);for(;X<T.length&&W.now()<ag;X++){var aj=T[X];var ai=aj.className;if(ai.indexOf("prettyprint")>=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X<T.length){setTimeout(U,250)}else{if(ad){ad()}}}U()}window.prettyPrintOne=y;window.prettyPrint=b;window.PR={createSimpleLexer:g,registerLangHandler:c,sourceDecorator:i,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:n,PR_COMMENT:j,PR_DECLARATION:E,PR_KEYWORD:z,PR_LITERAL:G,PR_NOCODE:N,PR_PLAIN:F,PR_PUNCTUATION:L,PR_SOURCE:J,PR_STRING:C,PR_TAG:m,PR_TYPE:O}})();PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_DECLARATION,/^<!\w[^>]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^<script\b[^>]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:<!--|-->)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); |
@@ -1,3 +0,4 @@ | ||
var addSorting = (function () { | ||
"use strict"; | ||
/* eslint-disable */ | ||
var addSorting = (function() { | ||
'use strict'; | ||
var cols, | ||
@@ -10,9 +11,17 @@ currentSort = { | ||
// returns the summary table element | ||
function getTable() { return document.querySelector('.coverage-summary'); } | ||
function getTable() { | ||
return document.querySelector('.coverage-summary'); | ||
} | ||
// returns the thead element of the summary table | ||
function getTableHeader() { return getTable().querySelector('thead tr'); } | ||
function getTableHeader() { | ||
return getTable().querySelector('thead tr'); | ||
} | ||
// returns the tbody element of the summary table | ||
function getTableBody() { return getTable().querySelector('tbody'); } | ||
function getTableBody() { | ||
return getTable().querySelector('tbody'); | ||
} | ||
// returns the th element for nth column | ||
function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } | ||
function getNthColumn(n) { | ||
return getTableHeader().querySelectorAll('th')[n]; | ||
} | ||
@@ -37,3 +46,4 @@ // loads all columns | ||
col.defaultDescSort = col.type === 'number'; | ||
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>'; | ||
colNode.innerHTML = | ||
colNode.innerHTML + '<span class="sorter"></span>'; | ||
} | ||
@@ -75,3 +85,3 @@ } | ||
var key = cols[index].key, | ||
sorter = function (a, b) { | ||
sorter = function(a, b) { | ||
a = a.data[key]; | ||
@@ -88,3 +98,3 @@ b = b.data[key]; | ||
if (desc) { | ||
finalSorter = function (a, b) { | ||
finalSorter = function(a, b) { | ||
return -1 * sorter(a, b); | ||
@@ -115,3 +125,5 @@ }; | ||
function addSortIndicators() { | ||
getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; | ||
getNthColumn(currentSort.index).className += currentSort.desc | ||
? ' sorted-desc' | ||
: ' sorted'; | ||
} | ||
@@ -125,3 +137,3 @@ // adds event listeners for all sorter widgets | ||
return function () { | ||
return function() { | ||
var desc = col.defaultDescSort; | ||
@@ -139,3 +151,3 @@ | ||
}; | ||
for (i =0 ; i < cols.length; i += 1) { | ||
for (i = 0; i < cols.length; i += 1) { | ||
if (cols[i].sortable) { | ||
@@ -154,3 +166,3 @@ // add the click event handler on the th so users | ||
// adds sorting functionality to the UI | ||
return function () { | ||
return function() { | ||
if (!getTable()) { | ||
@@ -160,3 +172,3 @@ return; | ||
cols = loadColumns(); | ||
loadData(cols); | ||
loadData(); | ||
addSortIndicators(); | ||
@@ -163,0 +175,0 @@ enableUI(); |
@@ -265,4 +265,4 @@ /*! | ||
var hasLeftAnchor = | ||
el.firstChild && | ||
(' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1, | ||
el.firstChild && | ||
(' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1, | ||
hasRightAnchor = | ||
@@ -269,0 +269,0 @@ el.lastChild && |
@@ -1,586 +0,782 @@ | ||
/*! Split.js - v1.3.5 */ | ||
// https://github.com/nathancahill/Split.js | ||
// Copyright (c) 2017 Nathan Cahill; Licensed MIT | ||
/*! Split.js - v1.5.11 */ | ||
(function(global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' | ||
? (module.exports = factory()) | ||
: typeof define === 'function' && define.amd | ||
? define(factory) | ||
: (global.Split = factory()); | ||
})(this, function() { | ||
'use strict'; | ||
// The programming goals of Split.js are to deliver readable, understandable and | ||
// maintainable code, while at the same time manually optimizing for tiny minified file size, | ||
// browser compatibility without additional requirements, graceful fallback (IE8 is supported) | ||
// and very few assumptions about the user's page layout. | ||
var global = window; | ||
var document = global.document; | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.Split = factory()); | ||
}(this, (function () { 'use strict'; | ||
// Save a couple long function names that are used frequently. | ||
// This optimization saves around 400 bytes. | ||
var addEventListener = 'addEventListener'; | ||
var removeEventListener = 'removeEventListener'; | ||
var getBoundingClientRect = 'getBoundingClientRect'; | ||
var NOOP = function() { | ||
return false; | ||
}; | ||
// The programming goals of Split.js are to deliver readable, understandable and | ||
// maintainable code, while at the same time manually optimizing for tiny minified file size, | ||
// browser compatibility without additional requirements, graceful fallback (IE8 is supported) | ||
// and very few assumptions about the user's page layout. | ||
var global = window; | ||
var document = global.document; | ||
// Figure out if we're in IE8 or not. IE8 will still render correctly, | ||
// but will be static instead of draggable. | ||
var isIE8 = global.attachEvent && !global[addEventListener]; | ||
// Save a couple long function names that are used frequently. | ||
// This optimization saves around 400 bytes. | ||
var addEventListener = 'addEventListener'; | ||
var removeEventListener = 'removeEventListener'; | ||
var getBoundingClientRect = 'getBoundingClientRect'; | ||
var gutterStartDragging = '_a'; | ||
var aGutterSize = '_b'; | ||
var bGutterSize = '_c'; | ||
var HORIZONTAL = 'horizontal'; | ||
var NOOP = function () { return false; }; | ||
// This library only needs two helper functions: | ||
// | ||
// The first determines which prefixes of CSS calc we need. | ||
// We only need to do this once on startup, when this anonymous function is called. | ||
// | ||
// Tests -webkit, -moz and -o prefixes. Modified from StackOverflow: | ||
// http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167 | ||
var calc = | ||
['', '-webkit-', '-moz-', '-o-'] | ||
.filter(function(prefix) { | ||
var el = document.createElement('div'); | ||
el.style.cssText = 'width:' + prefix + 'calc(9px)'; | ||
// Figure out if we're in IE8 or not. IE8 will still render correctly, | ||
// but will be static instead of draggable. | ||
var isIE8 = global.attachEvent && !global[addEventListener]; | ||
return !!el.style.length; | ||
}) | ||
.shift() + 'calc'; | ||
// Helper function determines which prefixes of CSS calc we need. | ||
// We only need to do this once on startup, when this anonymous function is called. | ||
// | ||
// Tests -webkit, -moz and -o prefixes. Modified from StackOverflow: | ||
// http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167 | ||
var calc = (['', '-webkit-', '-moz-', '-o-'] | ||
.filter(function (prefix) { | ||
var el = document.createElement('div'); | ||
el.style.cssText = "width:" + prefix + "calc(9px)"; | ||
// The second helper function allows elements and string selectors to be used | ||
// interchangeably. In either case an element is returned. This allows us to | ||
// do `Split([elem1, elem2])` as well as `Split(['#id1', '#id2'])`. | ||
var elementOrSelector = function(el) { | ||
if (typeof el === 'string' || el instanceof String) { | ||
return document.querySelector(el); | ||
} | ||
return !!el.style.length | ||
}) | ||
.shift()) + "calc"; | ||
return el; | ||
}; | ||
// Helper function checks if its argument is a string-like type | ||
var isString = function (v) { return typeof v === 'string' || v instanceof String; }; | ||
// The main function to initialize a split. Split.js thinks about each pair | ||
// of elements as an independant pair. Dragging the gutter between two elements | ||
// only changes the dimensions of elements in that pair. This is key to understanding | ||
// how the following functions operate, since each function is bound to a pair. | ||
// | ||
// A pair object is shaped like this: | ||
// | ||
// { | ||
// a: DOM element, | ||
// b: DOM element, | ||
// aMin: Number, | ||
// bMin: Number, | ||
// dragging: Boolean, | ||
// parent: DOM element, | ||
// isFirst: Boolean, | ||
// isLast: Boolean, | ||
// direction: 'horizontal' | 'vertical' | ||
// } | ||
// | ||
// The basic sequence: | ||
// | ||
// 1. Set defaults to something sane. `options` doesn't have to be passed at all. | ||
// 2. Initialize a bunch of strings based on the direction we're splitting. | ||
// A lot of the behavior in the rest of the library is paramatized down to | ||
// rely on CSS strings and classes. | ||
// 3. Define the dragging helper functions, and a few helpers to go with them. | ||
// 4. Loop through the elements while pairing them off. Every pair gets an | ||
// `pair` object, a gutter, and special isFirst/isLast properties. | ||
// 5. Actually size the pair elements, insert gutters and attach event listeners. | ||
var Split = function(ids, options) { | ||
if (options === void 0) options = {}; | ||
// Helper function allows elements and string selectors to be used | ||
// interchangeably. In either case an element is returned. This allows us to | ||
// do `Split([elem1, elem2])` as well as `Split(['#id1', '#id2'])`. | ||
var elementOrSelector = function (el) { | ||
if (isString(el)) { | ||
var ele = document.querySelector(el); | ||
if (!ele) { | ||
throw new Error(("Selector " + el + " did not match a DOM element")) | ||
} | ||
return ele | ||
} | ||
var dimension; | ||
var clientDimension; | ||
var clientAxis; | ||
var position; | ||
var paddingA; | ||
var paddingB; | ||
var elements; | ||
return el | ||
}; | ||
// All DOM elements in the split should have a common parent. We can grab | ||
// the first elements parent and hope users read the docs because the | ||
// behavior will be whacky otherwise. | ||
var parent = elementOrSelector(ids[0]).parentNode; | ||
var parentFlexDirection = global.getComputedStyle(parent).flexDirection; | ||
// Helper function gets a property from the properties object, with a default fallback | ||
var getOption = function (options, propName, def) { | ||
var value = options[propName]; | ||
if (value !== undefined) { | ||
return value | ||
} | ||
return def | ||
}; | ||
// Set default options.sizes to equal percentages of the parent element. | ||
var sizes = | ||
options.sizes || | ||
ids.map(function() { | ||
return 100 / ids.length; | ||
}); | ||
var getGutterSize = function (gutterSize, isFirst, isLast, gutterAlign) { | ||
if (isFirst) { | ||
if (gutterAlign === 'end') { | ||
return 0 | ||
} | ||
if (gutterAlign === 'center') { | ||
return gutterSize / 2 | ||
} | ||
} else if (isLast) { | ||
if (gutterAlign === 'start') { | ||
return 0 | ||
} | ||
if (gutterAlign === 'center') { | ||
return gutterSize / 2 | ||
} | ||
} | ||
// Standardize minSize to an array if it isn't already. This allows minSize | ||
// to be passed as a number. | ||
var minSize = options.minSize !== undefined ? options.minSize : 100; | ||
var minSizes = Array.isArray(minSize) | ||
? minSize | ||
: ids.map(function() { | ||
return minSize; | ||
}); | ||
var gutterSize = options.gutterSize !== undefined ? options.gutterSize : 10; | ||
var snapOffset = options.snapOffset !== undefined ? options.snapOffset : 30; | ||
var direction = options.direction || 'horizontal'; | ||
var cursor = | ||
options.cursor || | ||
(direction === 'horizontal' ? 'ew-resize' : 'ns-resize'); | ||
var gutter = | ||
options.gutter || | ||
function(i, gutterDirection) { | ||
return gutterSize | ||
}; | ||
// Default options | ||
var defaultGutterFn = function (i, gutterDirection) { | ||
var gut = document.createElement('div'); | ||
gut.className = 'gutter gutter-' + gutterDirection; | ||
return gut; | ||
}; | ||
var elementStyle = | ||
options.elementStyle || | ||
function(dim, size, gutSize) { | ||
gut.className = "gutter gutter-" + gutterDirection; | ||
return gut | ||
}; | ||
var defaultElementStyleFn = function (dim, size, gutSize) { | ||
var style = {}; | ||
if (typeof size !== 'string' && !(size instanceof String)) { | ||
if (!isIE8) { | ||
style[dim] = calc + '(' + size + '% - ' + gutSize + 'px)'; | ||
} else { | ||
style[dim] = size + '%'; | ||
} | ||
if (!isString(size)) { | ||
if (!isIE8) { | ||
style[dim] = calc + "(" + size + "% - " + gutSize + "px)"; | ||
} else { | ||
style[dim] = size + "%"; | ||
} | ||
} else { | ||
style[dim] = size; | ||
style[dim] = size; | ||
} | ||
return style; | ||
}; | ||
var gutterStyle = | ||
options.gutterStyle || | ||
function(dim, gutSize) { | ||
return (obj = {}), (obj[dim] = gutSize + 'px'), obj; | ||
return style | ||
}; | ||
var defaultGutterStyleFn = function (dim, gutSize) { | ||
var obj; | ||
}; | ||
// 2. Initialize a bunch of strings based on the direction we're splitting. | ||
// A lot of the behavior in the rest of the library is paramatized down to | ||
// rely on CSS strings and classes. | ||
if (direction === 'horizontal') { | ||
dimension = 'width'; | ||
clientDimension = 'clientWidth'; | ||
clientAxis = 'clientX'; | ||
position = 'left'; | ||
paddingA = 'paddingLeft'; | ||
paddingB = 'paddingRight'; | ||
} else if (direction === 'vertical') { | ||
dimension = 'height'; | ||
clientDimension = 'clientHeight'; | ||
clientAxis = 'clientY'; | ||
position = 'top'; | ||
paddingA = 'paddingTop'; | ||
paddingB = 'paddingBottom'; | ||
} | ||
return (( obj = {}, obj[dim] = (gutSize + "px"), obj )); | ||
}; | ||
// 3. Define the dragging helper functions, and a few helpers to go with them. | ||
// Each helper is bound to a pair object that contains it's metadata. This | ||
// also makes it easy to store references to listeners that that will be | ||
// added and removed. | ||
// The main function to initialize a split. Split.js thinks about each pair | ||
// of elements as an independant pair. Dragging the gutter between two elements | ||
// only changes the dimensions of elements in that pair. This is key to understanding | ||
// how the following functions operate, since each function is bound to a pair. | ||
// | ||
// Even though there are no other functions contained in them, aliasing | ||
// this to self saves 50 bytes or so since it's used so frequently. | ||
// A pair object is shaped like this: | ||
// | ||
// The pair object saves metadata like dragging state, position and | ||
// event listener references. | ||
// { | ||
// a: DOM element, | ||
// b: DOM element, | ||
// aMin: Number, | ||
// bMin: Number, | ||
// dragging: Boolean, | ||
// parent: DOM element, | ||
// direction: 'horizontal' | 'vertical' | ||
// } | ||
// | ||
// The basic sequence: | ||
// | ||
// 1. Set defaults to something sane. `options` doesn't have to be passed at all. | ||
// 2. Initialize a bunch of strings based on the direction we're splitting. | ||
// A lot of the behavior in the rest of the library is paramatized down to | ||
// rely on CSS strings and classes. | ||
// 3. Define the dragging helper functions, and a few helpers to go with them. | ||
// 4. Loop through the elements while pairing them off. Every pair gets an | ||
// `pair` object and a gutter. | ||
// 5. Actually size the pair elements, insert gutters and attach event listeners. | ||
var Split = function (idsOption, options) { | ||
if ( options === void 0 ) options = {}; | ||
function setElementSize(el, size, gutSize) { | ||
// Split.js allows setting sizes via numbers (ideally), or if you must, | ||
// by string, like '300px'. This is less than ideal, because it breaks | ||
// the fluid layout that `calc(% - px)` provides. You're on your own if you do that, | ||
// make sure you calculate the gutter size by hand. | ||
var style = elementStyle(dimension, size, gutSize); | ||
var ids = idsOption; | ||
var dimension; | ||
var clientAxis; | ||
var position; | ||
var positionEnd; | ||
var clientSize; | ||
var elements; | ||
// eslint-disable-next-line no-param-reassign | ||
Object.keys(style).forEach(function(prop) { | ||
return (el.style[prop] = style[prop]); | ||
}); | ||
} | ||
// Allow HTMLCollection to be used as an argument when supported | ||
if (Array.from) { | ||
ids = Array.from(ids); | ||
} | ||
function setGutterSize(gutterElement, gutSize) { | ||
var style = gutterStyle(dimension, gutSize); | ||
// All DOM elements in the split should have a common parent. We can grab | ||
// the first elements parent and hope users read the docs because the | ||
// behavior will be whacky otherwise. | ||
var firstElement = elementOrSelector(ids[0]); | ||
var parent = firstElement.parentNode; | ||
var parentStyle = getComputedStyle ? getComputedStyle(parent) : null; | ||
var parentFlexDirection = parentStyle ? parentStyle.flexDirection : null; | ||
// eslint-disable-next-line no-param-reassign | ||
Object.keys(style).forEach(function(prop) { | ||
return (gutterElement.style[prop] = style[prop]); | ||
}); | ||
} | ||
// Set default options.sizes to equal percentages of the parent element. | ||
var sizes = getOption(options, 'sizes') || ids.map(function () { return 100 / ids.length; }); | ||
// Actually adjust the size of elements `a` and `b` to `offset` while dragging. | ||
// calc is used to allow calc(percentage + gutterpx) on the whole split instance, | ||
// which allows the viewport to be resized without additional logic. | ||
// Element a's size is the same as offset. b's size is total size - a size. | ||
// Both sizes are calculated from the initial parent percentage, | ||
// then the gutter size is subtracted. | ||
function adjust(offset) { | ||
var a = elements[this.a]; | ||
var b = elements[this.b]; | ||
var percentage = a.size + b.size; | ||
// Standardize minSize to an array if it isn't already. This allows minSize | ||
// to be passed as a number. | ||
var minSize = getOption(options, 'minSize', 100); | ||
var minSizes = Array.isArray(minSize) ? minSize : ids.map(function () { return minSize; }); | ||
a.size = offset / this.size * percentage; | ||
b.size = percentage - offset / this.size * percentage; | ||
// Get other options | ||
var expandToMin = getOption(options, 'expandToMin', false); | ||
var gutterSize = getOption(options, 'gutterSize', 10); | ||
var gutterAlign = getOption(options, 'gutterAlign', 'center'); | ||
var snapOffset = getOption(options, 'snapOffset', 30); | ||
var dragInterval = getOption(options, 'dragInterval', 1); | ||
var direction = getOption(options, 'direction', HORIZONTAL); | ||
var cursor = getOption( | ||
options, | ||
'cursor', | ||
direction === HORIZONTAL ? 'col-resize' : 'row-resize' | ||
); | ||
var gutter = getOption(options, 'gutter', defaultGutterFn); | ||
var elementStyle = getOption( | ||
options, | ||
'elementStyle', | ||
defaultElementStyleFn | ||
); | ||
var gutterStyle = getOption(options, 'gutterStyle', defaultGutterStyleFn); | ||
setElementSize(a.element, a.size, this.aGutterSize); | ||
setElementSize(b.element, b.size, this.bGutterSize); | ||
} | ||
// 2. Initialize a bunch of strings based on the direction we're splitting. | ||
// A lot of the behavior in the rest of the library is paramatized down to | ||
// rely on CSS strings and classes. | ||
if (direction === HORIZONTAL) { | ||
dimension = 'width'; | ||
clientAxis = 'clientX'; | ||
position = 'left'; | ||
positionEnd = 'right'; | ||
clientSize = 'clientWidth'; | ||
} else if (direction === 'vertical') { | ||
dimension = 'height'; | ||
clientAxis = 'clientY'; | ||
position = 'top'; | ||
positionEnd = 'bottom'; | ||
clientSize = 'clientHeight'; | ||
} | ||
// drag, where all the magic happens. The logic is really quite simple: | ||
// | ||
// 1. Ignore if the pair is not dragging. | ||
// 2. Get the offset of the event. | ||
// 3. Snap offset to min if within snappable range (within min + snapOffset). | ||
// 4. Actually adjust each element in the pair to offset. | ||
// | ||
// --------------------------------------------------------------------- | ||
// | | <- a.minSize || b.minSize -> | | | ||
// | | | <- this.snapOffset || this.snapOffset -> | | | | ||
// | | | || | | | | ||
// | | | || | | | | ||
// --------------------------------------------------------------------- | ||
// | <- this.start this.size -> | | ||
function drag(e) { | ||
var offset; | ||
// 3. Define the dragging helper functions, and a few helpers to go with them. | ||
// Each helper is bound to a pair object that contains its metadata. This | ||
// also makes it easy to store references to listeners that that will be | ||
// added and removed. | ||
// | ||
// Even though there are no other functions contained in them, aliasing | ||
// this to self saves 50 bytes or so since it's used so frequently. | ||
// | ||
// The pair object saves metadata like dragging state, position and | ||
// event listener references. | ||
if (!this.dragging) { | ||
return; | ||
} | ||
function setElementSize(el, size, gutSize, i) { | ||
// Split.js allows setting sizes via numbers (ideally), or if you must, | ||
// by string, like '300px'. This is less than ideal, because it breaks | ||
// the fluid layout that `calc(% - px)` provides. You're on your own if you do that, | ||
// make sure you calculate the gutter size by hand. | ||
var style = elementStyle(dimension, size, gutSize, i); | ||
// Get the offset of the event from the first side of the | ||
// pair `this.start`. Supports touch events, but not multitouch, so only the first | ||
// finger `touches[0]` is counted. | ||
if ('touches' in e) { | ||
offset = e.touches[0][clientAxis] - this.start; | ||
} else { | ||
offset = e[clientAxis] - this.start; | ||
} | ||
Object.keys(style).forEach(function (prop) { | ||
// eslint-disable-next-line no-param-reassign | ||
el.style[prop] = style[prop]; | ||
}); | ||
} | ||
// If within snapOffset of min or max, set offset to min or max. | ||
// snapOffset buffers a.minSize and b.minSize, so logic is opposite for both. | ||
// Include the appropriate gutter sizes to prevent overflows. | ||
if (offset <= elements[this.a].minSize + snapOffset + this.aGutterSize) { | ||
offset = elements[this.a].minSize + this.aGutterSize; | ||
} else if ( | ||
offset >= | ||
this.size - (elements[this.b].minSize + snapOffset + this.bGutterSize) | ||
) { | ||
offset = this.size - (elements[this.b].minSize + this.bGutterSize); | ||
} | ||
function setGutterSize(gutterElement, gutSize, i) { | ||
var style = gutterStyle(dimension, gutSize, i); | ||
// Actually adjust the size. | ||
adjust.call(this, offset); | ||
Object.keys(style).forEach(function (prop) { | ||
// eslint-disable-next-line no-param-reassign | ||
gutterElement.style[prop] = style[prop]; | ||
}); | ||
} | ||
// Call the drag callback continously. Don't do anything too intensive | ||
// in this callback. | ||
if (options.onDrag) { | ||
options.onDrag(); | ||
} | ||
} | ||
function getSizes() { | ||
return elements.map(function (element) { return element.size; }) | ||
} | ||
// Cache some important sizes when drag starts, so we don't have to do that | ||
// continously: | ||
// | ||
// `size`: The total size of the pair. First + second + first gutter + second gutter. | ||
// `start`: The leading side of the first element. | ||
// | ||
// ------------------------------------------------ | ||
// | aGutterSize -> ||| | | ||
// | ||| | | ||
// | ||| | | ||
// | ||| <- bGutterSize | | ||
// ------------------------------------------------ | ||
// | <- start size -> | | ||
function calculateSizes() { | ||
// Figure out the parent size minus padding. | ||
var a = elements[this.a].element; | ||
var b = elements[this.b].element; | ||
// Supports touch events, but not multitouch, so only the first | ||
// finger `touches[0]` is counted. | ||
function getMousePosition(e) { | ||
if ('touches' in e) { return e.touches[0][clientAxis] } | ||
return e[clientAxis] | ||
} | ||
this.size = | ||
a[getBoundingClientRect]()[dimension] + | ||
b[getBoundingClientRect]()[dimension] + | ||
this.aGutterSize + | ||
this.bGutterSize; | ||
this.start = a[getBoundingClientRect]()[position]; | ||
} | ||
// Actually adjust the size of elements `a` and `b` to `offset` while dragging. | ||
// calc is used to allow calc(percentage + gutterpx) on the whole split instance, | ||
// which allows the viewport to be resized without additional logic. | ||
// Element a's size is the same as offset. b's size is total size - a size. | ||
// Both sizes are calculated from the initial parent percentage, | ||
// then the gutter size is subtracted. | ||
function adjust(offset) { | ||
var a = elements[this.a]; | ||
var b = elements[this.b]; | ||
var percentage = a.size + b.size; | ||
// stopDragging is very similar to startDragging in reverse. | ||
function stopDragging() { | ||
var self = this; | ||
var a = elements[self.a].element; | ||
var b = elements[self.b].element; | ||
a.size = (offset / this.size) * percentage; | ||
b.size = percentage - (offset / this.size) * percentage; | ||
if (self.dragging && options.onDragEnd) { | ||
options.onDragEnd(); | ||
} | ||
setElementSize(a.element, a.size, this[aGutterSize], a.i); | ||
setElementSize(b.element, b.size, this[bGutterSize], b.i); | ||
} | ||
self.dragging = false; | ||
// drag, where all the magic happens. The logic is really quite simple: | ||
// | ||
// 1. Ignore if the pair is not dragging. | ||
// 2. Get the offset of the event. | ||
// 3. Snap offset to min if within snappable range (within min + snapOffset). | ||
// 4. Actually adjust each element in the pair to offset. | ||
// | ||
// --------------------------------------------------------------------- | ||
// | | <- a.minSize || b.minSize -> | | | ||
// | | | <- this.snapOffset || this.snapOffset -> | | | | ||
// | | | || | | | | ||
// | | | || | | | | ||
// --------------------------------------------------------------------- | ||
// | <- this.start this.size -> | | ||
function drag(e) { | ||
var offset; | ||
var a = elements[this.a]; | ||
var b = elements[this.b]; | ||
// Remove the stored event listeners. This is why we store them. | ||
global[removeEventListener]('mouseup', self.stop); | ||
global[removeEventListener]('touchend', self.stop); | ||
global[removeEventListener]('touchcancel', self.stop); | ||
if (!this.dragging) { return } | ||
self.parent[removeEventListener]('mousemove', self.move); | ||
self.parent[removeEventListener]('touchmove', self.move); | ||
// Get the offset of the event from the first side of the | ||
// pair `this.start`. Then offset by the initial position of the | ||
// mouse compared to the gutter size. | ||
offset = | ||
getMousePosition(e) - | ||
this.start + | ||
(this[aGutterSize] - this.dragOffset); | ||
// Delete them once they are removed. I think this makes a difference | ||
// in memory usage with a lot of splits on one page. But I don't know for sure. | ||
delete self.stop; | ||
delete self.move; | ||
if (dragInterval > 1) { | ||
offset = Math.round(offset / dragInterval) * dragInterval; | ||
} | ||
a[removeEventListener]('selectstart', NOOP); | ||
a[removeEventListener]('dragstart', NOOP); | ||
b[removeEventListener]('selectstart', NOOP); | ||
b[removeEventListener]('dragstart', NOOP); | ||
// If within snapOffset of min or max, set offset to min or max. | ||
// snapOffset buffers a.minSize and b.minSize, so logic is opposite for both. | ||
// Include the appropriate gutter sizes to prevent overflows. | ||
if (offset <= a.minSize + snapOffset + this[aGutterSize]) { | ||
offset = a.minSize + this[aGutterSize]; | ||
} else if ( | ||
offset >= | ||
this.size - (b.minSize + snapOffset + this[bGutterSize]) | ||
) { | ||
offset = this.size - (b.minSize + this[bGutterSize]); | ||
} | ||
a.style.userSelect = ''; | ||
a.style.webkitUserSelect = ''; | ||
a.style.MozUserSelect = ''; | ||
a.style.pointerEvents = ''; | ||
// Actually adjust the size. | ||
adjust.call(this, offset); | ||
b.style.userSelect = ''; | ||
b.style.webkitUserSelect = ''; | ||
b.style.MozUserSelect = ''; | ||
b.style.pointerEvents = ''; | ||
// Call the drag callback continously. Don't do anything too intensive | ||
// in this callback. | ||
getOption(options, 'onDrag', NOOP)(); | ||
} | ||
self.gutter.style.cursor = ''; | ||
self.parent.style.cursor = ''; | ||
} | ||
// Cache some important sizes when drag starts, so we don't have to do that | ||
// continously: | ||
// | ||
// `size`: The total size of the pair. First + second + first gutter + second gutter. | ||
// `start`: The leading side of the first element. | ||
// | ||
// ------------------------------------------------ | ||
// | aGutterSize -> ||| | | ||
// | ||| | | ||
// | ||| | | ||
// | ||| <- bGutterSize | | ||
// ------------------------------------------------ | ||
// | <- start size -> | | ||
function calculateSizes() { | ||
// Figure out the parent size minus padding. | ||
var a = elements[this.a].element; | ||
var b = elements[this.b].element; | ||
// startDragging calls `calculateSizes` to store the inital size in the pair object. | ||
// It also adds event listeners for mouse/touch events, | ||
// and prevents selection while dragging so avoid the selecting text. | ||
function startDragging(e) { | ||
// Alias frequently used variables to save space. 200 bytes. | ||
var self = this; | ||
var a = elements[self.a].element; | ||
var b = elements[self.b].element; | ||
var aBounds = a[getBoundingClientRect](); | ||
var bBounds = b[getBoundingClientRect](); | ||
// Call the onDragStart callback. | ||
if (!self.dragging && options.onDragStart) { | ||
options.onDragStart(); | ||
} | ||
this.size = | ||
aBounds[dimension] + | ||
bBounds[dimension] + | ||
this[aGutterSize] + | ||
this[bGutterSize]; | ||
this.start = aBounds[position]; | ||
this.end = aBounds[positionEnd]; | ||
} | ||
// Don't actually drag the element. We emulate that in the drag function. | ||
e.preventDefault(); | ||
function innerSize(element) { | ||
// Return nothing if getComputedStyle is not supported (< IE9) | ||
// Or if parent element has no layout yet | ||
if (!getComputedStyle) { return null } | ||
// Set the dragging property of the pair object. | ||
self.dragging = true; | ||
var computedStyle = getComputedStyle(element); | ||
// Create two event listeners bound to the same pair object and store | ||
// them in the pair object. | ||
self.move = drag.bind(self); | ||
self.stop = stopDragging.bind(self); | ||
if (!computedStyle) { return null } | ||
// All the binding. `window` gets the stop events in case we drag out of the elements. | ||
global[addEventListener]('mouseup', self.stop); | ||
global[addEventListener]('touchend', self.stop); | ||
global[addEventListener]('touchcancel', self.stop); | ||
var size = element[clientSize]; | ||
self.parent[addEventListener]('mousemove', self.move); | ||
self.parent[addEventListener]('touchmove', self.move); | ||
if (size === 0) { return null } | ||
// Disable selection. Disable! | ||
a[addEventListener]('selectstart', NOOP); | ||
a[addEventListener]('dragstart', NOOP); | ||
b[addEventListener]('selectstart', NOOP); | ||
b[addEventListener]('dragstart', NOOP); | ||
if (direction === HORIZONTAL) { | ||
size -= | ||
parseFloat(computedStyle.paddingLeft) + | ||
parseFloat(computedStyle.paddingRight); | ||
} else { | ||
size -= | ||
parseFloat(computedStyle.paddingTop) + | ||
parseFloat(computedStyle.paddingBottom); | ||
} | ||
a.style.userSelect = 'none'; | ||
a.style.webkitUserSelect = 'none'; | ||
a.style.MozUserSelect = 'none'; | ||
a.style.pointerEvents = 'none'; | ||
return size | ||
} | ||
b.style.userSelect = 'none'; | ||
b.style.webkitUserSelect = 'none'; | ||
b.style.MozUserSelect = 'none'; | ||
b.style.pointerEvents = 'none'; | ||
// When specifying percentage sizes that are less than the computed | ||
// size of the element minus the gutter, the lesser percentages must be increased | ||
// (and decreased from the other elements) to make space for the pixels | ||
// subtracted by the gutters. | ||
function trimToMin(sizesToTrim) { | ||
// Try to get inner size of parent element. | ||
// If it's no supported, return original sizes. | ||
var parentSize = innerSize(parent); | ||
if (parentSize === null) { | ||
return sizesToTrim | ||
} | ||
// Set the cursor, both on the gutter and the parent element. | ||
// Doing only a, b and gutter causes flickering. | ||
self.gutter.style.cursor = cursor; | ||
self.parent.style.cursor = cursor; | ||
if (minSizes.reduce(function (a, b) { return a + b; }, 0) > parentSize) { | ||
return sizesToTrim | ||
} | ||
// Cache the initial sizes of the pair. | ||
calculateSizes.call(self); | ||
} | ||
// Keep track of the excess pixels, the amount of pixels over the desired percentage | ||
// Also keep track of the elements with pixels to spare, to decrease after if needed | ||
var excessPixels = 0; | ||
var toSpare = []; | ||
// 5. Create pair and element objects. Each pair has an index reference to | ||
// elements `a` and `b` of the pair (first and second elements). | ||
// Loop through the elements while pairing them off. Every pair gets a | ||
// `pair` object, a gutter, and isFirst/isLast properties. | ||
// | ||
// Basic logic: | ||
// | ||
// - Starting with the second element `i > 0`, create `pair` objects with | ||
// `a = i - 1` and `b = i` | ||
// - Set gutter sizes based on the _pair_ being first/last. The first and last | ||
// pair have gutterSize / 2, since they only have one half gutter, and not two. | ||
// - Create gutter elements and add event listeners. | ||
// - Set the size of the elements, minus the gutter sizes. | ||
// | ||
// ----------------------------------------------------------------------- | ||
// | i=0 | i=1 | i=2 | i=3 | | ||
// | | isFirst | | isLast | | ||
// | pair 0 pair 1 pair 2 | | ||
// | | | | | | ||
// ----------------------------------------------------------------------- | ||
var pairs = []; | ||
elements = ids.map(function(id, i) { | ||
// Create the element object. | ||
var element = { | ||
element: elementOrSelector(id), | ||
size: sizes[i], | ||
minSize: minSizes[i] | ||
}; | ||
var pixelSizes = sizesToTrim.map(function (size, i) { | ||
// Convert requested percentages to pixel sizes | ||
var pixelSize = (parentSize * size) / 100; | ||
var elementGutterSize = getGutterSize( | ||
gutterSize, | ||
i === 0, | ||
i === sizesToTrim.length - 1, | ||
gutterAlign | ||
); | ||
var elementMinSize = minSizes[i] + elementGutterSize; | ||
var pair; | ||
// If element is too smal, increase excess pixels by the difference | ||
// and mark that it has no pixels to spare | ||
if (pixelSize < elementMinSize) { | ||
excessPixels += elementMinSize - pixelSize; | ||
toSpare.push(0); | ||
return elementMinSize | ||
} | ||
if (i > 0) { | ||
// Create the pair object with it's metadata. | ||
pair = { | ||
a: i - 1, | ||
b: i, | ||
dragging: false, | ||
isFirst: i === 1, | ||
isLast: i === ids.length - 1, | ||
direction: direction, | ||
parent: parent | ||
}; | ||
// Otherwise, mark the pixels it has to spare and return it's original size | ||
toSpare.push(pixelSize - elementMinSize); | ||
return pixelSize | ||
}); | ||
// For first and last pairs, first and last gutter width is half. | ||
pair.aGutterSize = gutterSize; | ||
pair.bGutterSize = gutterSize; | ||
// If nothing was adjusted, return the original sizes | ||
if (excessPixels === 0) { | ||
return sizesToTrim | ||
} | ||
if (pair.isFirst) { | ||
pair.aGutterSize = gutterSize / 2; | ||
} | ||
return pixelSizes.map(function (pixelSize, i) { | ||
var newPixelSize = pixelSize; | ||
if (pair.isLast) { | ||
pair.bGutterSize = gutterSize / 2; | ||
} | ||
// While there's still pixels to take, and there's enough pixels to spare, | ||
// take as many as possible up to the total excess pixels | ||
if (excessPixels > 0 && toSpare[i] - excessPixels > 0) { | ||
var takenPixels = Math.min( | ||
excessPixels, | ||
toSpare[i] - excessPixels | ||
); | ||
// if the parent has a reverse flex-direction, switch the pair elements. | ||
if ( | ||
parentFlexDirection === 'row-reverse' || | ||
parentFlexDirection === 'column-reverse' | ||
) { | ||
var temp = pair.a; | ||
pair.a = pair.b; | ||
pair.b = temp; | ||
// Subtract the amount taken for the next iteration | ||
excessPixels -= takenPixels; | ||
newPixelSize = pixelSize - takenPixels; | ||
} | ||
// Return the pixel size adjusted as a percentage | ||
return (newPixelSize / parentSize) * 100 | ||
}) | ||
} | ||
} | ||
// Determine the size of the current element. IE8 is supported by | ||
// staticly assigning sizes without draggable gutters. Assigns a string | ||
// to `size`. | ||
// | ||
// IE9 and above | ||
if (!isIE8) { | ||
// Create gutter elements for each pair. | ||
if (i > 0) { | ||
var gutterElement = gutter(i, direction); | ||
setGutterSize(gutterElement, gutterSize); | ||
// stopDragging is very similar to startDragging in reverse. | ||
function stopDragging() { | ||
var self = this; | ||
var a = elements[self.a].element; | ||
var b = elements[self.b].element; | ||
gutterElement[addEventListener]( | ||
'mousedown', | ||
startDragging.bind(pair) | ||
); | ||
gutterElement[addEventListener]( | ||
'touchstart', | ||
startDragging.bind(pair) | ||
); | ||
if (self.dragging) { | ||
getOption(options, 'onDragEnd', NOOP)(getSizes()); | ||
} | ||
parent.insertBefore(gutterElement, element.element); | ||
self.dragging = false; | ||
pair.gutter = gutterElement; | ||
// Remove the stored event listeners. This is why we store them. | ||
global[removeEventListener]('mouseup', self.stop); | ||
global[removeEventListener]('touchend', self.stop); | ||
global[removeEventListener]('touchcancel', self.stop); | ||
global[removeEventListener]('mousemove', self.move); | ||
global[removeEventListener]('touchmove', self.move); | ||
// Clear bound function references | ||
self.stop = null; | ||
self.move = null; | ||
a[removeEventListener]('selectstart', NOOP); | ||
a[removeEventListener]('dragstart', NOOP); | ||
b[removeEventListener]('selectstart', NOOP); | ||
b[removeEventListener]('dragstart', NOOP); | ||
a.style.userSelect = ''; | ||
a.style.webkitUserSelect = ''; | ||
a.style.MozUserSelect = ''; | ||
a.style.pointerEvents = ''; | ||
b.style.userSelect = ''; | ||
b.style.webkitUserSelect = ''; | ||
b.style.MozUserSelect = ''; | ||
b.style.pointerEvents = ''; | ||
self.gutter.style.cursor = ''; | ||
self.parent.style.cursor = ''; | ||
document.body.style.cursor = ''; | ||
} | ||
} | ||
// Set the element size to our determined size. | ||
// Half-size gutters for first and last elements. | ||
if (i === 0 || i === ids.length - 1) { | ||
setElementSize(element.element, element.size, gutterSize / 2); | ||
} else { | ||
setElementSize(element.element, element.size, gutterSize); | ||
} | ||
// startDragging calls `calculateSizes` to store the inital size in the pair object. | ||
// It also adds event listeners for mouse/touch events, | ||
// and prevents selection while dragging so avoid the selecting text. | ||
function startDragging(e) { | ||
// Right-clicking can't start dragging. | ||
if ('button' in e && e.button !== 0) { | ||
return | ||
} | ||
var computedSize = element.element[getBoundingClientRect]()[dimension]; | ||
// Alias frequently used variables to save space. 200 bytes. | ||
var self = this; | ||
var a = elements[self.a].element; | ||
var b = elements[self.b].element; | ||
if (computedSize < element.minSize) { | ||
element.minSize = computedSize; | ||
} | ||
// Call the onDragStart callback. | ||
if (!self.dragging) { | ||
getOption(options, 'onDragStart', NOOP)(getSizes()); | ||
} | ||
// After the first iteration, and we have a pair object, append it to the | ||
// list of pairs. | ||
if (i > 0) { | ||
pairs.push(pair); | ||
} | ||
// Don't actually drag the element. We emulate that in the drag function. | ||
e.preventDefault(); | ||
return element; | ||
}); | ||
// Set the dragging property of the pair object. | ||
self.dragging = true; | ||
function setSizes(newSizes) { | ||
newSizes.forEach(function(newSize, i) { | ||
if (i > 0) { | ||
var pair = pairs[i - 1]; | ||
var a = elements[pair.a]; | ||
var b = elements[pair.b]; | ||
// Create two event listeners bound to the same pair object and store | ||
// them in the pair object. | ||
self.move = drag.bind(self); | ||
self.stop = stopDragging.bind(self); | ||
a.size = newSizes[i - 1]; | ||
b.size = newSize; | ||
// All the binding. `window` gets the stop events in case we drag out of the elements. | ||
global[addEventListener]('mouseup', self.stop); | ||
global[addEventListener]('touchend', self.stop); | ||
global[addEventListener]('touchcancel', self.stop); | ||
global[addEventListener]('mousemove', self.move); | ||
global[addEventListener]('touchmove', self.move); | ||
setElementSize(a.element, a.size, pair.aGutterSize); | ||
setElementSize(b.element, b.size, pair.bGutterSize); | ||
// Disable selection. Disable! | ||
a[addEventListener]('selectstart', NOOP); | ||
a[addEventListener]('dragstart', NOOP); | ||
b[addEventListener]('selectstart', NOOP); | ||
b[addEventListener]('dragstart', NOOP); | ||
a.style.userSelect = 'none'; | ||
a.style.webkitUserSelect = 'none'; | ||
a.style.MozUserSelect = 'none'; | ||
a.style.pointerEvents = 'none'; | ||
b.style.userSelect = 'none'; | ||
b.style.webkitUserSelect = 'none'; | ||
b.style.MozUserSelect = 'none'; | ||
b.style.pointerEvents = 'none'; | ||
// Set the cursor at multiple levels | ||
self.gutter.style.cursor = cursor; | ||
self.parent.style.cursor = cursor; | ||
document.body.style.cursor = cursor; | ||
// Cache the initial sizes of the pair. | ||
calculateSizes.call(self); | ||
// Determine the position of the mouse compared to the gutter | ||
self.dragOffset = getMousePosition(e) - self.end; | ||
} | ||
}); | ||
} | ||
function destroy() { | ||
pairs.forEach(function(pair) { | ||
pair.parent.removeChild(pair.gutter); | ||
elements[pair.a].element.style[dimension] = ''; | ||
elements[pair.b].element.style[dimension] = ''; | ||
}); | ||
} | ||
// adjust sizes to ensure percentage is within min size and gutter. | ||
sizes = trimToMin(sizes); | ||
if (isIE8) { | ||
return { | ||
setSizes: setSizes, | ||
destroy: destroy | ||
}; | ||
} | ||
// 5. Create pair and element objects. Each pair has an index reference to | ||
// elements `a` and `b` of the pair (first and second elements). | ||
// Loop through the elements while pairing them off. Every pair gets a | ||
// `pair` object and a gutter. | ||
// | ||
// Basic logic: | ||
// | ||
// - Starting with the second element `i > 0`, create `pair` objects with | ||
// `a = i - 1` and `b = i` | ||
// - Set gutter sizes based on the _pair_ being first/last. The first and last | ||
// pair have gutterSize / 2, since they only have one half gutter, and not two. | ||
// - Create gutter elements and add event listeners. | ||
// - Set the size of the elements, minus the gutter sizes. | ||
// | ||
// ----------------------------------------------------------------------- | ||
// | i=0 | i=1 | i=2 | i=3 | | ||
// | | | | | | ||
// | pair 0 pair 1 pair 2 | | ||
// | | | | | | ||
// ----------------------------------------------------------------------- | ||
var pairs = []; | ||
elements = ids.map(function (id, i) { | ||
// Create the element object. | ||
var element = { | ||
element: elementOrSelector(id), | ||
size: sizes[i], | ||
minSize: minSizes[i], | ||
i: i, | ||
}; | ||
return { | ||
setSizes: setSizes, | ||
getSizes: function getSizes() { | ||
return elements.map(function(element) { | ||
return element.size; | ||
var pair; | ||
if (i > 0) { | ||
// Create the pair object with its metadata. | ||
pair = { | ||
a: i - 1, | ||
b: i, | ||
dragging: false, | ||
direction: direction, | ||
parent: parent, | ||
}; | ||
pair[aGutterSize] = getGutterSize( | ||
gutterSize, | ||
i - 1 === 0, | ||
false, | ||
gutterAlign | ||
); | ||
pair[bGutterSize] = getGutterSize( | ||
gutterSize, | ||
false, | ||
i === ids.length - 1, | ||
gutterAlign | ||
); | ||
// if the parent has a reverse flex-direction, switch the pair elements. | ||
if ( | ||
parentFlexDirection === 'row-reverse' || | ||
parentFlexDirection === 'column-reverse' | ||
) { | ||
var temp = pair.a; | ||
pair.a = pair.b; | ||
pair.b = temp; | ||
} | ||
} | ||
// Determine the size of the current element. IE8 is supported by | ||
// staticly assigning sizes without draggable gutters. Assigns a string | ||
// to `size`. | ||
// | ||
// IE9 and above | ||
if (!isIE8) { | ||
// Create gutter elements for each pair. | ||
if (i > 0) { | ||
var gutterElement = gutter(i, direction, element.element); | ||
setGutterSize(gutterElement, gutterSize, i); | ||
// Save bound event listener for removal later | ||
pair[gutterStartDragging] = startDragging.bind(pair); | ||
// Attach bound event listener | ||
gutterElement[addEventListener]( | ||
'mousedown', | ||
pair[gutterStartDragging] | ||
); | ||
gutterElement[addEventListener]( | ||
'touchstart', | ||
pair[gutterStartDragging] | ||
); | ||
parent.insertBefore(gutterElement, element.element); | ||
pair.gutter = gutterElement; | ||
} | ||
} | ||
setElementSize( | ||
element.element, | ||
element.size, | ||
getGutterSize( | ||
gutterSize, | ||
i === 0, | ||
i === ids.length - 1, | ||
gutterAlign | ||
), | ||
i | ||
); | ||
// After the first iteration, and we have a pair object, append it to the | ||
// list of pairs. | ||
if (i > 0) { | ||
pairs.push(pair); | ||
} | ||
return element | ||
}); | ||
}, | ||
collapse: function collapse(i) { | ||
if (i === pairs.length) { | ||
var pair = pairs[i - 1]; | ||
calculateSizes.call(pair); | ||
function adjustToMin(element) { | ||
var isLast = element.i === pairs.length; | ||
var pair = isLast ? pairs[element.i - 1] : pairs[element.i]; | ||
if (!isIE8) { | ||
adjust.call(pair, pair.size - pair.bGutterSize); | ||
} | ||
} else { | ||
var pair$1 = pairs[i]; | ||
calculateSizes.call(pair); | ||
calculateSizes.call(pair$1); | ||
var size = isLast | ||
? pair.size - element.minSize - pair[bGutterSize] | ||
: element.minSize + pair[aGutterSize]; | ||
if (!isIE8) { | ||
adjust.call(pair$1, pair$1.aGutterSize); | ||
} | ||
adjust.call(pair, size); | ||
} | ||
}, | ||
destroy: destroy | ||
elements.forEach(function (element) { | ||
var computedSize = element.element[getBoundingClientRect]()[dimension]; | ||
if (computedSize < element.minSize) { | ||
if (expandToMin) { | ||
adjustToMin(element); | ||
} else { | ||
// eslint-disable-next-line no-param-reassign | ||
element.minSize = computedSize; | ||
} | ||
} | ||
}); | ||
function setSizes(newSizes) { | ||
var trimmed = trimToMin(newSizes); | ||
trimmed.forEach(function (newSize, i) { | ||
if (i > 0) { | ||
var pair = pairs[i - 1]; | ||
var a = elements[pair.a]; | ||
var b = elements[pair.b]; | ||
a.size = trimmed[i - 1]; | ||
b.size = newSize; | ||
setElementSize(a.element, a.size, pair[aGutterSize], a.i); | ||
setElementSize(b.element, b.size, pair[bGutterSize], b.i); | ||
} | ||
}); | ||
} | ||
function destroy(preserveStyles, preserveGutter) { | ||
pairs.forEach(function (pair) { | ||
if (preserveGutter !== true) { | ||
pair.parent.removeChild(pair.gutter); | ||
} else { | ||
pair.gutter[removeEventListener]( | ||
'mousedown', | ||
pair[gutterStartDragging] | ||
); | ||
pair.gutter[removeEventListener]( | ||
'touchstart', | ||
pair[gutterStartDragging] | ||
); | ||
} | ||
if (preserveStyles !== true) { | ||
var style = elementStyle( | ||
dimension, | ||
pair.a.size, | ||
pair[aGutterSize] | ||
); | ||
Object.keys(style).forEach(function (prop) { | ||
elements[pair.a].element.style[prop] = ''; | ||
elements[pair.b].element.style[prop] = ''; | ||
}); | ||
} | ||
}); | ||
} | ||
if (isIE8) { | ||
return { | ||
setSizes: setSizes, | ||
destroy: destroy, | ||
} | ||
} | ||
return { | ||
setSizes: setSizes, | ||
getSizes: getSizes, | ||
collapse: function collapse(i) { | ||
adjustToMin(elements[i]); | ||
}, | ||
destroy: destroy, | ||
parent: parent, | ||
pairs: pairs, | ||
} | ||
}; | ||
}; | ||
return Split; | ||
}); | ||
return Split; | ||
}))); |
{ | ||
"name": "atributo", | ||
"description": "Allocate jobs across a variable number of instances", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "https://github.com/davedoesdev/atributo", | ||
@@ -29,20 +29,20 @@ "author": { | ||
"dependencies": { | ||
"sqlite3": "~4.0.0", | ||
"async": "~2.6.0", | ||
"iferr": "~1.0.0" | ||
"sqlite3": "^4.1.0", | ||
"async": "^2.6.3", | ||
"iferr": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~1.0.1", | ||
"grunt-eslint": "~20.1.0", | ||
"grunt-mocha-test": "~0.13.3", | ||
"grunt-contrib-copy": "~1.0.0", | ||
"grunt-exec": "~3.0.0", | ||
"mocha": "~4.0.1", | ||
"chai": "~4.1.2", | ||
"nyc": "~11.3.0", | ||
"migrate": "~1.0.0", | ||
"babel-eslint": "~8.0.3", | ||
"documentation": "~5.3.5", | ||
"coveralls": "~3.0.0" | ||
"grunt": "^1.0.4", | ||
"grunt-eslint": "^22.0.0", | ||
"grunt-mocha-test": "^0.13.3", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-exec": "^3.0.0", | ||
"mocha": "^6.2.0", | ||
"chai": "^4.2.0", | ||
"nyc": "^14.1.1", | ||
"migrate": "^1.6.2", | ||
"babel-eslint": "^10.0.2", | ||
"documentation": "^12.1.1", | ||
"coveralls": "^3.0.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1787103
60
3961
+ Addedsqlite3@4.2.0(transitive)
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsqlite3@4.0.9(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
Updatedasync@^2.6.3
Updatediferr@^1.0.2
Updatedsqlite3@^4.1.0