(dist) build 1.0.17
This commit is contained in:
parent
87ad66d6eb
commit
059e88c30e
67
dist/less-1.0.16.min.js
vendored
67
dist/less-1.0.16.min.js
vendored
@ -1,67 +0,0 @@
|
||||
//
|
||||
// LESS - Leaner CSS v1.0.16
|
||||
// http://lesscss.org
|
||||
//
|
||||
// Copyright (c) 2010, Alexis Sellier
|
||||
// Licensed under the Apache 2.0 License.
|
||||
//
|
||||
if(!Array.isArray)Array.isArray=function(b){return Object.prototype.toString.call(b)==="[object Array]"||b instanceof Array};if(!Array.prototype.forEach)Array.prototype.forEach=function(b,a){for(var e=this.length>>>0,f=0;f<e;f++)f in this&&b.call(a,this[f],f,this)};if(!Array.prototype.map)Array.prototype.map=function(b,a){for(var e=this.length>>>0,f=new Array(e),h=0;h<e;h++)if(h in this)f[h]=b.call(a,this[h],h,this);return f};
|
||||
if(!Array.prototype.filter)Array.prototype.filter=function(b,a){for(var e=[],f=0;f<this.length;f++)b.call(a,this[f])&&e.push(this[f]);return e};if(!Array.prototype.reduce)Array.prototype.reduce=function(b){var a=this.length>>>0,e=0;if(a===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2)var f=arguments[1];else{do{if(e in this){f=this[e++];break}if(++e>=a)throw new TypeError;}while(1)}for(;e<a;e++)if(e in this)f=b.call(null,f,this[e],e,this);return f};
|
||||
if(!Array.prototype.indexOf)Array.prototype.indexOf=function(b,a){var e=this.length;a=a||0;if(!e)return-1;if(a>=e)return-1;if(a<0)a+=e;for(;a<e;a++)if(Object.prototype.hasOwnProperty.call(this,a))if(b===this[a])return a;return-1};if(!Object.keys)Object.keys=function(b){var a=[];for(var e in b)Object.prototype.hasOwnProperty.call(b,e)&&a.push(e);return a};if(!String.prototype.trim)String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")};
|
||||
if(typeof require!=="undefined")var less=exports,tree=require("less/tree");else less=tree={};
|
||||
less.Parser=function(b){function a(d){var g,i,k;if(d instanceof Function)return d.call(s.parsers);else if(typeof d==="string"){g=f.charAt(h)===d?d:null;i=1}else{if(h>=q+m[n].length&&n<m.length-1)q+=m[n++].length;d.lastIndex=k=h-q;if(g=d.exec(m[n])){i=g[0].length;if(d.lastIndex-i!==k)return}}if(g){h+=i;for(i=q+m[n].length;h<=i;){d=f.charCodeAt(h);if(!(d===32||d===10||d===9))break;h++}return typeof g==="string"?g:g.length===1?g[0]:g}}function e(d){var g;if(typeof d==="string")return f.charAt(h)===d;
|
||||
else{d.lastIndex=h;if((g=d.exec(f))&&d.lastIndex-g[0].length===h)return g}}var f,h,n,l,m,q,s,r=this,y=function(){},j=this.imports={paths:b&&b.paths||[],queue:[],files:{},push:function(d,g){var i=this;this.queue.push(d);less.Parser.importer(d,this.paths,function(k){i.queue.splice(i.queue.indexOf(d),1);i.files[d]=k;g(k);i.queue.length===0&&y()})}};this.env=b||{};this.optimization="optimization"in this.env?this.env.optimization:1;return s={imports:j,parse:function(d,g){var i,k,o=null;h=n=q=l=0;m=[];
|
||||
f=d.replace(/\r\n/g,"\n");if(r.optimization>0){f=f.replace(/\/\*(?:[^*]|\*+[^\/*])*\*+\//g,function(t){return r.optimization>1?"":t.replace(/\n(\s*\n)+/g,"\n")});m=f.split(/^(?=\n)/mg)}else m=[f];i=new tree.Ruleset([],a(this.parsers.primary));i.root=true;i.toCSS=function(t){var v,x;return function(u){u=u||{};try{var z=t.call(this,[],{frames:[],compress:u.compress||false});return u.compress?z.replace(/(\s)+/g,"$1"):z}catch(A){x=f.split("\n");v=(f.slice(0,A.index).match(/\n/g)||"").length+1;u=A.index;
|
||||
for(z=-1;u>=0&&f.charAt(u)!=="\n";u--)z++;throw{name:"NameError",message:A.message,line:v,stack:A.stack,column:z,extract:[x[v-2],x[v-1],x[v]]};}}}(i.toCSS);if(h<f.length-1){h=l;k=f.split("\n");d=(f.slice(0,h).match(/\n/g)||"").length+1;for(var p=h,w=-1;p>=0&&f.charAt(p)!=="\n";p--)w++;o={name:"ParseError",message:"Syntax Error on line "+d,filename:b.filename,line:d,column:w,extract:[k[d-2],k[d-1],k[d]]}}if(this.imports.queue.length>0)y=function(){g(o,i)};else g(o,i)},parsers:{primary:function(){for(var d,
|
||||
g=[];d=a(this.mixin.definition)||a(this.rule)||a(this.ruleset)||a(this.mixin.call)||a(this.comment)||a(/[\n\s]+/g)||a(this.directive);)g.push(d);return g},comment:function(){var d;if(f.charAt(h)==="/")return(d=a(/\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/g))?new tree.Comment(d):a(/\/\/.*/g)},entities:{quoted:function(){var d;if(!(f.charAt(h)!=='"'&&f.charAt(h)!=="'"))if(d=a(/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/g))return new tree.Quoted(d[0],d[1]||d[2])},keyword:function(){var d;if(d=a(/[A-Za-z-]+/g))return new tree.Keyword(d)},
|
||||
call:function(){var d,g;if(d=a(/([a-zA-Z0-9_-]+|%)\(/g)){if(d[1].toLowerCase()==="alpha")return a(this.alpha);g=a(this.entities.arguments);if(a(")"))if(d)return new tree.Call(d[1],g)}},arguments:function(){for(var d=[],g;g=a(this.expression);){d.push(g);if(!a(","))break}return d},literal:function(){return a(this.entities.dimension)||a(this.entities.color)||a(this.entities.quoted)},url:function(){var d;if(!(f.charAt(h)!=="u"||!a(/url\(/g))){d=a(this.entities.quoted)||a(/[-a-zA-Z0-9_%@$\/.&=:;#+?]+/g);
|
||||
if(!a(")"))throw new Error("missing closing ) for url()");return new tree.URL(d.value?d:new tree.Anonymous(d))}},variable:function(){var d,g=h;if(f.charAt(h)==="@"&&(d=a(/@[a-zA-Z0-9_-]+/g)))return new tree.Variable(d,g)},color:function(){var d;if(f.charAt(h)==="#"&&(d=a(/#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/g)))return new tree.Color(d[1])},dimension:function(){var d;d=f.charCodeAt(h);if(!(d>57||d<45||d===47))if(d=a(/(-?[0-9]*\.?[0-9]+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm)?/g))return new tree.Dimension(d[1],
|
||||
d[2])}},variable:function(){var d;if(f.charAt(h)==="@"&&(d=a(/(@[a-zA-Z0-9_-]+)\s*:/g)))return d[1]},shorthand:function(){var d,g;if(e(/[@\w.-]+\/[@\w.-]+/g))if((d=a(this.entity))&&a("/")&&(g=a(this.entity)))return new tree.Shorthand(d,g)},mixin:{call:function(){for(var d=[],g,i,k,o=h;g=a(/[#.][a-zA-Z0-9_-]+/g);){d.push(new tree.Element(i,g));i=a(">")}a("(")&&(k=a(this.entities.arguments))&&a(")");if(d.length>0&&(a(";")||e("}")))return new tree.mixin.Call(d,k,o)},definition:function(){var d,g=[],
|
||||
i,k;if(!(f.charAt(h)!=="."||e(/[^{]*(;|})/g)))if(d=a(/([#.][a-zA-Z0-9_-]+)\s*\(/g)){for(d=d[1];i=a(/@[\w-]+/g)||a(this.entities.literal)||a(this.entities.keyword);){if(i[0]==="@")if(a(":"))if(k=a(this.expression))g.push({name:i,value:k});else throw new Error("Expected value");else g.push({name:i});else g.push({value:i});if(!a(","))break}if(!a(")"))throw new Error("Expected )");if(i=a(this.block))return new tree.mixin.Definition(d,g,i)}}},entity:function(){return a(this.entities.literal)||a(this.entities.variable)||
|
||||
a(this.entities.url)||a(this.entities.call)||a(this.entities.keyword)},end:function(){return a(";")||e("}")},alpha:function(){var d;if(a(/opacity=/gi))if(d=a(/[0-9]+/g)||a(this.entities.variable)){if(!a(")"))throw new Error("missing closing ) for alpha()");return new tree.Alpha(d)}},element:function(){var d;c=a(this.combinator);if(d=a(/[.#:]?[a-zA-Z0-9_-]+/g)||a("*")||a(this.attribute)||a(/\([^)@]+\)/g))return new tree.Element(c,d)},combinator:function(){var d;return(d=a(/[+>~]/g)||a("&")||a(/::/g))?
|
||||
new tree.Combinator(d):new tree.Combinator(f.charAt(h-1)===" "?" ":null)},selector:function(){for(var d,g=[];d=a(this.element);)g.push(d);if(g.length>0)return new tree.Selector(g)},tag:function(){return a(/[a-zA-Z][a-zA-Z-]*[0-9]?/g)||a("*")},attribute:function(){var d="",g,i,k;if(a("[")){if(g=a(/[a-z-]+/g)||a(this.entities.quoted))d=(k=a(/[|~*$^]?=/g))&&(i=a(this.entities.quoted)||a(/[\w-]+/g))?[g,k,i.toCSS?i.toCSS():i].join(""):g;if(a("]"))if(d)return"["+d+"]"}},block:function(){var d;if(a("{")&&
|
||||
(d=a(this.primary))&&a("}"))return d},ruleset:function(){var d=[],g,i,k=h;if(g=e(/([a-z.#: _-]+)[\s\n]*\{/g)){h+=g[0].length-1;d=[new tree.Selector([new tree.Element(null,g[1])])]}else{for(;g=a(this.selector);){d.push(g);if(!a(","))break}g&&a(this.comment)}if(d.length>0&&(i=a(this.block)))return new tree.Ruleset(d,i);else{l=h;h=k}},rule:function(){var d,g=h;if(name=a(this.property)||a(this.variable)){if(name.charAt(0)!="@"&&(match=e(/([^@+\/*(;{}-]*);/g))){h+=match[0].length-1;d=new tree.Anonymous(match[1])}else d=
|
||||
name==="font"?a(this.font):a(this.value);if(a(this.end))return new tree.Rule(name,d,g);else{l=h;h=g}}},"import":function(){var d;if(a(/@import\s+/g)&&(d=a(this.entities.quoted)||a(this.entities.url))&&a(";"))return new tree.Import(d,j)},directive:function(){var d,g,i;if(f.charAt(h)==="@")if(g=a(this["import"]))return g;else if(d=a(/@media|@page/g)){i=a(/[^{]+/g).trim();if(g=a(this.block))return new tree.Directive(d+" "+i,g)}else if(d=a(/@[-a-z]+/g))if(d==="@font-face"){if(g=a(this.block))return new tree.Directive(d,
|
||||
g)}else if((g=a(this.entity))&&a(";"))return new tree.Directive(d,g)},font:function(){for(var d=[],g=[],i;i=a(this.shorthand)||a(this.entity);)g.push(i);d.push(new tree.Expression(g));if(a(","))for(;i=a(this.expression);){d.push(i);if(!a(","))break}return new tree.Value(d,a(this.important))},value:function(){for(var d,g=[];d=a(this.expression);){g.push(d);if(!a(","))break}d=a(this.important);if(g.length>0)return new tree.Value(g,d)},important:function(){return a(/!\s*important/g)},sub:function(){var d;
|
||||
if(a("(")&&(d=a(this.expression))&&a(")"))return d},multiplication:function(){var d,g,i,k;if(d=a(this.operand)){for(;(i=a(/[\/*]/g))&&(g=a(this.operand));)k=new tree.Operation(i,[k||d,g]);return k||d}},addition:function(){var d,g,i,k;if(d=a(this.multiplication)){for(;(i=a(/[-+]\s+/g)||f.charAt(h-1)!=" "&&a(/[-+]/g))&&(g=a(this.multiplication));)k=new tree.Operation(i,[k||d,g]);return k||d}},operand:function(){return a(this.sub)||a(this.entities.dimension)||a(this.entities.color)||a(this.entities.variable)},
|
||||
expression:function(){for(var d,g=[];d=a(this.addition)||a(this.entity);)g.push(d);if(g.length>0)return new tree.Expression(g)},property:function(){var d;if(d=a(/(\*?-?[-a-z_0-9]+)\s*:/g))return d[1]}}}};less.Parser.importer=null;if(typeof require!=="undefined")tree=require("less/tree");
|
||||
tree.functions={rgb:function(b,a,e){return this.rgba(b,a,e,1)},rgba:function(b,a,e,f){b=[b,a,e].map(function(h){return number(h)});f=number(f);return new tree.Color(b,f)},hsl:function(b,a,e){return this.hsla(b,a,e,1)},hsla:function(b,a,e,f){function h(m){m=m<0?m+1:m>1?m-1:m;return m*6<1?l+(n-l)*m*6:m*2<1?n:m*3<2?l+(n-l)*(2/3-m)*6:l}b=(number(b)%360+360)%360/360;a=number(a);e=number(e);f=number(f);var n=e<=0.5?e*(a+1):e+a-e*a,l=e*2-n;return this.rgba(h(b+1/3)*255,h(b)*255,h(b-1/3)*255,f)},saturate:function(b,
|
||||
a){b=b.toHSL();b.s+=a.value/100;b.s=clamp(b.s);return this.hsl(b.h,b.s,b.l)},desaturate:function(b,a){b=b.toHSL();b.s-=a.value/100;b.s=clamp(b.s);return this.hsl(b.h,b.s,b.l)},lighten:function(b,a){b=b.toHSL();b.l*=1+a.value/100;b.l=clamp(b.l);return this.hsl(b.h,b.s,b.l)},darken:function(b,a){b=b.toHSL();b.l*=1-a.value/100;b.l=clamp(b.l);return this.hsl(b.h,b.s,b.l)},greyscale:function(b){return this.desaturate(b,new tree.Dimension(100))},e:function(b){return new tree.Anonymous(b)},"%":function(b){for(var a=
|
||||
Array.prototype.slice.call(arguments,1),e=b.content,f=0;f<a.length;f++)e=e.replace(/%s/,a[f].content).replace(/%[da]/,a[f].toCSS());e=e.replace(/%%/g,"%");return new tree.Quoted('"'+e+'"',e)}};function number(b){if(b instanceof tree.Dimension)return parseFloat(b.unit=="%"?b.value/100:b.value);else if(typeof b==="number")return b;else throw{error:"RuntimeError",message:"color functions take numbers as parameters"};}function clamp(b){return Math.min(1,Math.max(0,b))}
|
||||
if(typeof require!=="undefined")tree=require("less/tree");tree.Alpha=function(b){this.value=b};tree.Alpha.prototype={toCSS:function(){return"alpha(opacity="+this.value.toCSS()+")"},eval:function(){return this}};if(typeof require!=="undefined")tree=require("less/tree");tree.Anonymous=function(b){this.value=b.content||b};tree.Anonymous.prototype={toCSS:function(){return this.value},eval:function(){return this}};if(typeof require!=="undefined")tree=require("less/tree");
|
||||
tree.Call=function(b,a){this.name=b;this.args=a};tree.Call.prototype={eval:function(b){var a=this.args.map(function(e){return e.eval(b)});return this.name in tree.functions?tree.functions[this.name].apply(tree.functions,a):new tree.Anonymous(this.name+"("+a.map(function(e){return e.toCSS()}).join(", ")+")")},toCSS:function(b){return this.eval(b).toCSS()}};if(typeof require!=="undefined")tree=require("less/tree");
|
||||
tree.Color=function(b,a){if(Array.isArray(b)){this.rgb=b;this.alpha=a}else this.rgb=b.length==6?b.match(/.{2}/g).map(function(e){return parseInt(e,16)}):b.split("").map(function(e){return parseInt(e+e,16)})};
|
||||
tree.Color.prototype={eval:function(){return this},toCSS:function(){return this.alpha&&this.alpha<1?"rgba("+this.rgb.concat(this.alpha).join(", ")+")":"#"+this.rgb.map(function(b){b=Math.round(b);b=(b>255?255:b<0?0:b).toString(16);return b.length===1?"0"+b:b}).join("")},operate:function(b,a){var e=[];a instanceof tree.Color||(a=a.toColor());for(var f=0;f<3;f++)e[f]=tree.operate(b,this.rgb[f],a.rgb[f]);return new tree.Color(e)},toHSL:function(){var b=this.rgb[0]/255,a=this.rgb[1]/255,e=this.rgb[2]/
|
||||
255,f=Math.max(b,a,e),h=Math.min(b,a,e),n,l=(f+h)/2,m=f-h;if(f===h)n=h=0;else{h=l>0.5?m/(2-f-h):m/(f+h);switch(f){case b:n=(a-e)/m+(a<e?6:0);break;case a:n=(e-b)/m+2;break;case e:n=(b-a)/m+4;break}n/=6}return{h:n*360,s:h,l:l}}};if(typeof require!=="undefined")tree=require("less/tree");tree.Comment=function(b){this.value=b};tree.Comment.prototype={toCSS:function(b){return b.compress?"":this.value}};if(typeof require!=="undefined")tree=require("less/tree");
|
||||
tree.Dimension=function(b,a){this.value=parseFloat(b);this.unit=a||null};tree.Dimension.prototype={eval:function(){return this},toColor:function(){return new tree.Color([this.value,this.value,this.value])},toCSS:function(){return this.value+this.unit},operate:function(b,a){return new tree.Dimension(tree.operate(b,this.value,a.value),this.unit||a.unit)}};if(typeof require!=="undefined")tree=require("less/tree");
|
||||
tree.Directive=function(b,a){this.name=b;if(Array.isArray(a))this.ruleset=new tree.Ruleset([],a);else this.value=a};
|
||||
tree.Directive.prototype={toCSS:function(b,a){if(this.ruleset){this.ruleset.root=true;return this.name+(a.compress?"{":" {\n ")+this.ruleset.toCSS(b,a).trim().replace(/\n/g,"\n ")+(a.compress?"}":"\n}\n")}else return this.name+" "+this.value.toCSS()+";\n"},eval:function(b){b.frames.unshift(this);this.ruleset&&this.ruleset.evalRules(b);b.frames.shift();return this},variable:function(b){return tree.Ruleset.prototype.variable.call(this.ruleset,b)},find:function(){return tree.Ruleset.prototype.find.apply(this.ruleset,
|
||||
arguments)},rulesets:function(){return tree.Ruleset.prototype.rulesets.apply(this.ruleset)}};if(typeof require!=="undefined")tree=require("less/tree");tree.Element=function(b,a){this.combinator=b instanceof tree.Combinator?b:new tree.Combinator(b);this.value=a.trim()};tree.Element.prototype.toCSS=function(b){return this.combinator.toCSS(b||{})+this.value};tree.Combinator=function(b){this.value=b===" "?" ":b?b.trim():""};
|
||||
tree.Combinator.prototype.toCSS=function(b){return{"":""," ":" ","&":"",":":" :","::":"::","+":b.compress?"+":" + ","~":b.compress?"~":" ~ ",">":b.compress?">":" > "}[this.value]};if(typeof require!=="undefined")tree=require("less/tree");tree.Expression=function(b){this.value=b};tree.Expression.prototype={eval:function(b){return this.value.length>1?new tree.Expression(this.value.map(function(a){return a.eval(b)})):this.value[0].eval(b)},toCSS:function(){return this.value.map(function(b){return b.toCSS()}).join(" ")}};
|
||||
if(typeof require!=="undefined")tree=require("less/tree");tree.Import=function(b,a){var e=this;this._path=b;this.path=b instanceof tree.Quoted?/\.(le?|c)ss$/.test(b.content)?b.content:b.content+".less":b.value.content||b.value;(this.css=/css$/.test(this.path))||a.push(this.path,function(f){e.root=f})};
|
||||
tree.Import.prototype={toCSS:function(){return this.css?"@import "+this._path.toCSS()+";\n":""},eval:function(){if(this.css)return this;else{for(var b=0;b<this.root.rules.length;b++)this.root.rules[b]instanceof tree.Import&&Array.prototype.splice.apply(this.root.rules,[b,1].concat(this.root.rules[b].eval()));return this.root.rules}}};if(typeof require!=="undefined")tree=require("less/tree");tree.Keyword=function(b){this.value=b};tree.Keyword.prototype={eval:function(){return this},toCSS:function(){return this.value}};
|
||||
if(typeof require!=="undefined")tree=require("less/tree");tree.mixin={};tree.mixin.Call=function(b,a,e){this.selector=new tree.Selector(b);this.arguments=a;this.index=e};
|
||||
tree.mixin.Call.prototype={eval:function(b){for(var a,e=[],f=false,h=0;h<b.frames.length;h++)if((a=b.frames[h].find(this.selector)).length>0){for(h=0;h<a.length;h++)if(a[h].match(this.arguments,b))try{Array.prototype.push.apply(e,a[h].eval(this.arguments,b).rules);f=true}catch(n){throw{message:n.message,index:this.index};}if(f)return e;else throw{message:"No matching definition was found for `"+this.selector.toCSS().trim()+"("+this.arguments.map(function(l){return l.toCSS()}).join(", ")+")`",index:this.index};
|
||||
}throw{message:this.selector.toCSS().trim()+" is undefined",index:this.index};}};tree.mixin.Definition=function(b,a,e){this.name=b;this.selectors=[new tree.Selector([new tree.Element(null,b)])];this.params=a;this.arity=a.length;this.rules=e;this._lookups={};this.required=a.reduce(function(f,h){return h.name&&!h.value?f+1:f},0)};
|
||||
tree.mixin.Definition.prototype={toCSS:function(){return""},variable:function(b){return tree.Ruleset.prototype.variable.call(this,b)},find:function(){return tree.Ruleset.prototype.find.apply(this,arguments)},rulesets:function(){return tree.Ruleset.prototype.rulesets.apply(this)},eval:function(b,a){for(var e=new tree.Ruleset(null,[]),f=0,h;f<this.params.length;f++)if(this.params[f].name)if(h=b&&b[f]||this.params[f].value)e.rules.unshift(new tree.Rule(this.params[f].name,h.eval(a)));else throw{message:"wrong number of arguments for "+
|
||||
this.name+" ("+b.length+" for "+this.arity+")"};return(new tree.Ruleset(null,this.rules)).evalRules({frames:[this,e].concat(a.frames)})},match:function(b,a){var e=b&&b.length||0;if(e<this.required)return false;for(var f=0;f<Math.min(e,this.arity);f++)if(!this.params[f].name)if(!b[f].wildcard)if(b[f].eval(a).toCSS()!=this.params[f].value.eval(a).toCSS())return false;return true}};if(typeof require!=="undefined")tree=require("less/tree");tree.Operation=function(b,a){this.op=b.trim();this.operands=a};
|
||||
tree.Operation.prototype.eval=function(b){var a=this.operands[0].eval(b);b=this.operands[1].eval(b);var e;if(a instanceof tree.Dimension&&b instanceof tree.Color)if(this.op==="*"||this.op==="+"){e=b;b=a;a=e}else throw{name:"OperationError",message:"Can't substract or divide a color from a number"};return a.operate(this.op,b)};tree.operate=function(b,a,e){switch(b){case "+":return a+e;case "-":return a-e;case "*":return a*e;case "/":return a/e}};if(typeof require!=="undefined")tree=require("less/tree");
|
||||
tree.Quoted=function(b,a){this.value=b;this.content=a};tree.Quoted.prototype={toCSS:function(){return this.value},eval:function(){return this}};if(typeof require!=="undefined")tree=require("less/tree");tree.Rule=function(b,a,e){this.name=b;this.value=a instanceof tree.Value?a:new tree.Value([a]);this.index=e;this.variable=b.charAt(0)==="@"?true:false};tree.Rule.prototype.toCSS=function(b){return this.variable?"":this.name+(b.compress?":":": ")+this.value.toCSS(b)+";"};
|
||||
tree.Rule.prototype.eval=function(b){return new tree.Rule(this.name,this.value.eval(b))};tree.Value=function(b){this.value=b;this.is="value"};tree.Value.prototype={eval:function(b){return this.value.length===1?this.value[0].eval(b):new tree.Value(this.value.map(function(a){return a.eval(b)}))},toCSS:function(b){return this.value.map(function(a){return a.toCSS(b)}).join(b.compress?",":", ")}};tree.Shorthand=function(b,a){this.a=b;this.b=a};
|
||||
tree.Shorthand.prototype={toCSS:function(b){return this.a.toCSS(b)+"/"+this.b.toCSS(b)},eval:function(){return this}};if(typeof require!=="undefined")tree=require("less/tree");tree.Ruleset=function(b,a){this.selectors=b;this.rules=a;this._lookups={}};
|
||||
tree.Ruleset.prototype={eval:function(){return this},evalRules:function(b){var a=[];this.rules.forEach(function(e){if(e.evalRules)a.push(e.evalRules(b));else e instanceof tree.mixin.Call?Array.prototype.push.apply(a,e.eval(b)):a.push(e.eval(b))});this.rules=a;return this},match:function(b){return!b||b.length===0},variable:function(b){return this._variables?this._variables[b]:(this._variables=this.rules.reduce(function(a,e){if(e instanceof tree.Rule&&e.variable===true)a[e.name]=e;return a},{}))[b]},
|
||||
rulesets:function(){return this._rulesets?this._rulesets:(this._rulesets=this.rules.filter(function(b){if(b instanceof tree.Ruleset||b instanceof tree.mixin.Definition)return b}))},find:function(b,a){a=a||this;var e=[],f=b.toCSS();if(f in this._lookups)return this._lookups[f];this.rulesets().forEach(function(h){if(h!==a)for(var n=0;n<h.selectors.length;n++)if(b.match(h.selectors[n])){b.elements.length>1?Array.prototype.push.apply(e,h.find(new tree.Selector(b.elements.slice(1)),a)):e.push(h);break}});
|
||||
return this._lookups[f]=e},toCSS:function(b,a){var e=[],f=[],h=[],n=[];if(this.root)for(var l=0;l<this.rules.length;l++)this.rules[l]instanceof tree.Import&&Array.prototype.splice.apply(this.rules,[l,1].concat(this.rules[l].eval(a)));else if(b.length===0)n=this.selectors.map(function(q){return[q]});else for(l=0;l<this.selectors.length;l++)for(var m=0;m<b.length;m++)n.push(b[m].concat([this.selectors[l]]));a.frames.unshift(this);for(l=0;l<this.rules.length;l++)this.rules[l]instanceof tree.mixin.Call&&
|
||||
Array.prototype.splice.apply(this.rules,[l,1].concat(this.rules[l].eval(a)));for(l=0;l<this.rules.length;l++){b=this.rules[l];if(b instanceof tree.Directive)h.push(b.eval(a).toCSS(n,a));else if(b.rules)h.push(b.toCSS(n,a));else if(b instanceof tree.Comment)this.root?h.push(b.toCSS(a)):f.push(b.toCSS(a));else if(b.toCSS&&!b.variable)f.push(b.eval(a).toCSS(a));else b.value&&!b.variable&&f.push(b.value.toString())}h=h.join("");if(this.root)e.push(f.join(a.compress?"":"\n"));else if(f.length>0){n=n.map(function(q){return q.map(function(s){return s.toCSS(a)}).join("").trim()}).join(a.compress?
|
||||
",":n.length>3?",\n":", ");e.push(n,(a.compress?"{":" {\n ")+f.join(a.compress?"":"\n ")+(a.compress?"}":"\n}\n"))}e.push(h);a.frames.shift();return e.join("")+(a.compress?"\n":"")}};if(typeof require!=="undefined")tree=require("less/tree");tree.Selector=function(b){this.elements=b;if(this.elements[0].combinator.value==="")this.elements[0].combinator.value=" "};tree.Selector.prototype.match=function(b){return this.elements[0].value===b.elements[0].value?true:false};
|
||||
tree.Selector.prototype.toCSS=function(b){if(this._css)return this._css;return this._css=this.elements.map(function(a){return typeof a==="string"?" "+a.trim():a.toCSS(b)}).join("")};if(typeof require!=="undefined")tree=require("less/tree");tree.URL=function(b){this.value=b};tree.URL.prototype={toCSS:function(){return"url("+this.value.toCSS()+")"},eval:function(){return this}};if(typeof require!=="undefined")tree=require("less/tree");tree.Variable=function(b,a){this.name=b;this.index=a};
|
||||
tree.Variable.prototype={eval:function(b){var a,e,f=this.name;if(a=tree.find(b.frames,function(h){if(e=h.variable(f))return e.value.eval(b)}))return a;else throw{message:"variable "+this.name+" is undefined",index:this.index};}};if(typeof require!=="undefined")tree=exports;tree.find=function(b,a){for(var e=0,f;e<b.length;e++)if(f=a.call(b,b[e]))return f;return null};
|
||||
(function(){function b(j){if(!document.querySelectorAll&&typeof jQuery==="undefined")m("No selector method found");else return(document.querySelectorAll||jQuery).call(document,j)}function a(j,d){for(var g=0;g<y.length;g++)e(y[g],j,d)}function e(j,d,g){var i=r&&r.getItem(j.href),k=r&&r.getItem(j.href+":timestamp"),o={css:i,timestamp:k};h(j.href,g,function(p,w){if(o&&(new Date(w)).valueOf()===(new Date(o.timestamp)).valueOf()){f(o.css,j);d(null,j,{local:true})}else(new less.Parser({optimization:less.optimization})).parse(p,
|
||||
function(t,v){if(t)return q(t,j.href);try{d(v,j,{local:false,lastModified:w});l(document.getElementById("less-error-message:"+j.href.replace(/[^a-z]+/gi,"-")))}catch(x){q(x,j.href)}})},function(p){throw new Error("Couldn't load "+j.href+" ("+p+")");})}function f(j,d,g){var i,k="less:"+(d.title||d.href.match(/(?:^|\/)([-\w]+)\.[a-z]+$/i)[1]);if((i=document.getElementById(k))===null){i=document.createElement("style");i.type="text/css";i.media="screen";i.id=k;document.getElementsByTagName("head")[0].appendChild(i)}if(i.styleSheet)try{i.styleSheet.cssText=
|
||||
j}catch(o){throw new Error("Couldn't reassign styleSheet.cssText.");}else(function(p){if(i.childNodes.length>0)i.firstChild.nodeValue!==p.nodeValue&&i.replaceChild(p,i.firstChild);else i.appendChild(p)})(document.createTextNode(j));if(g&&r){r.setItem(d.href,j);r.setItem(d.href+":timestamp",g)}}function h(j,d,g,i){function k(p,w,t){if(p.status>=200&&p.status<300)w(p.responseText,p.getResponseHeader("Last-Modified"));else typeof t==="function"&&t(p.status)}var o=n();d=s?false:d||less.async;o.open("GET",
|
||||
j,d);o.send(null);if(s)o.status===0?g(o.responseText):i(o.status);else if(d)o.onreadystatechange=function(){o.readyState==4&&k(o,g,i)};else k(o,g,i)}function n(){if(window.XMLHttpRequest)return new XMLHttpRequest;else try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(j){m("less: browser doesn't support AJAX.");return null}}function l(j){return j&&j.parentNode.removeChild(j)}function m(j){less.env=="development"&&typeof console!=="undefined"&&console.log(j)}function q(j,d){var g="less-error-message:"+
|
||||
d.replace(/[^a-z]+/ig,"-");if(!j.extract)throw j;var i=document.createElement("div"),k;i.id=g;i.className="less-error-message";i.innerHTML="<h3>"+(j.message||"There is an error in your .less file")+'</h3><p><a href="'+d+'">'+d+"</a> on line "+j.line+", column "+(j.column+1)+":</p>"+'<div>\n<pre class="ctx"><span>[-1]</span>{0}</pre>\n<pre><span>[0]</span>{current}</pre>\n<pre class="ctx"><span>[1]</span>{2}</pre>\n</div>'.replace(/\[(-?\d)\]/g,function(o,p){return parseInt(j.line)+parseInt(p)||""}).replace(/\{(\d)\}/g,
|
||||
function(o,p){return j.extract[parseInt(p)]||""}).replace(/\{current\}/,j.extract[1].slice(0,j.column)+'<span class="error">'+j.extract[1].slice(j.column)+"</span>");f(".less-error-message span {\nmargin-right: 15px;\n}\n.less-error-message pre {\ncolor: #ee4444;\npadding: 4px 0;\nmargin: 0;\n}\n.less-error-message pre.ctx {\ncolor: #dd7777;\n}\n.less-error-message h3 {\npadding: 15px 0 5px 0;\nmargin: 0;\n}\n.less-error-message a {\ncolor: #10a\n}\n.less-error-message .error {\ncolor: red;\nfont-weight: bold;\npadding-bottom: 2px;\nborder-bottom: 1px dashed red;\n}",
|
||||
{title:"error-message"});i.style.cssText="font-family: Arial, sans-serif;border: 1px solid #e00;background-color: #eee;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px;color: #e00;padding: 15px;margin-bottom: 15px";if(less.env=="development")k=setInterval(function(){if(document.body){document.getElementById(g)?document.body.replaceChild(i,document.getElementById(g)):document.body.insertBefore(i,document.body.firstChild);clearInterval(k)}},10)}var s=location.protocol==="file:";
|
||||
less.env=location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||s?"development":"production";less.async=false;less.poll=s?1E3:1500;less.watch=function(){return this.watchMode=true};less.unwatch=function(){return this.watchMode=false};if(less.env==="development"){less.optimization=0;/!watch/.test(location.hash)&&less.watch();less.watchTimer=setInterval(function(){less.watchMode&&a(function(j,d,g){j&&f(j.toCSS(),d,g.lastModified)})},less.poll)}else less.optimization=
|
||||
3;var r=typeof window.localStorage==="undefined"?null:window.localStorage,y=b('link[rel="stylesheet/less"]');less.refresh=function(){a(function(j,d,g){if(g.local)m("less: loading "+d.href+" from local storage.");else{f(j.toCSS(),d,g.lastModified);m("less: parsed "+d.href+" successfully.")}})};less.refresh();less.Parser.importer=function(j,d,g){e({href:j,title:j},function(i){g(i)})}})();
|
183
dist/less-1.0.16.js → dist/less-1.0.17.js
vendored
183
dist/less-1.0.16.js → dist/less-1.0.17.js
vendored
@ -1,10 +1,18 @@
|
||||
//
|
||||
// LESS - Leaner CSS v1.0.16
|
||||
// LESS - Leaner CSS v1.0.17
|
||||
// http://lesscss.org
|
||||
//
|
||||
// Copyright (c) 2010, Alexis Sellier
|
||||
// Licensed under the Apache 2.0 License.
|
||||
//
|
||||
(function (window, undefined) {
|
||||
//
|
||||
// Stub out `require` in the browser
|
||||
//
|
||||
function require(arg) {
|
||||
return window.less[arg.split('/')[1]];
|
||||
};
|
||||
|
||||
|
||||
// ecma-5.js
|
||||
//
|
||||
@ -125,11 +133,14 @@ if (!String.prototype.trim) {
|
||||
return String(this).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
||||
};
|
||||
}
|
||||
if (typeof(require) !== 'undefined') {
|
||||
var less = exports;
|
||||
var tree = require('less/tree');
|
||||
var less, tree;
|
||||
|
||||
if (typeof(window) === 'undefined') {
|
||||
less = exports,
|
||||
tree = require('less/tree');
|
||||
} else {
|
||||
var less = tree = {};
|
||||
less = window.less = {},
|
||||
tree = window.less.tree = {};
|
||||
}
|
||||
//
|
||||
// less.js - parser
|
||||
@ -1044,7 +1055,7 @@ less.Parser = function Parser(env) {
|
||||
|
||||
less.Parser.importer = null;
|
||||
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
(function (tree) {
|
||||
|
||||
tree.functions = {
|
||||
rgb: function (r, g, b) {
|
||||
@ -1059,11 +1070,9 @@ tree.functions = {
|
||||
return this.hsla(h, s, l, 1.0);
|
||||
},
|
||||
hsla: function (h, s, l, a) {
|
||||
h = (((number(h) % 360) + 360) % 360) / 360;
|
||||
h = (number(h) % 360) / 360;
|
||||
s = number(s); l = number(l); a = number(a);
|
||||
|
||||
//require('sys').puts(h, s, l)
|
||||
|
||||
var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
|
||||
var m1 = l * 2 - m2;
|
||||
|
||||
@ -1080,6 +1089,18 @@ tree.functions = {
|
||||
else return m1;
|
||||
}
|
||||
},
|
||||
hue: function (color) {
|
||||
return new(tree.Dimension)(Math.round(color.toHSL().h));
|
||||
},
|
||||
saturation: function (color) {
|
||||
return new(tree.Dimension)(Math.round(color.toHSL().s * 100), '%');
|
||||
},
|
||||
lightness: function (color) {
|
||||
return new(tree.Dimension)(Math.round(color.toHSL().l * 100), '%');
|
||||
},
|
||||
alpha: function (color) {
|
||||
return new(tree.Dimension)(color.toHSL().a);
|
||||
},
|
||||
saturate: function (color, amount) {
|
||||
var hsl = color.toHSL();
|
||||
|
||||
@ -1097,18 +1118,26 @@ tree.functions = {
|
||||
lighten: function (color, amount) {
|
||||
var hsl = color.toHSL();
|
||||
|
||||
hsl.l *= (1 + amount.value / 100);
|
||||
hsl.l += amount.value / 100;
|
||||
hsl.l = clamp(hsl.l);
|
||||
return this.hsl(hsl.h, hsl.s, hsl.l);
|
||||
},
|
||||
darken: function (color, amount) {
|
||||
var hsl = color.toHSL();
|
||||
|
||||
hsl.l *= (1 - amount.value / 100);
|
||||
hsl.l -= amount.value / 100;
|
||||
hsl.l = clamp(hsl.l);
|
||||
return this.hsl(hsl.h, hsl.s, hsl.l);
|
||||
},
|
||||
greyscale: function (color, amount) {
|
||||
spin: function (color, amount) {
|
||||
var hsl = color.toHSL();
|
||||
var hue = (hsl.h + amount.value) % 360;
|
||||
|
||||
hsl.h = hue < 0 ? 360 + hue : hue;
|
||||
|
||||
return this.hsl(hsl.h, hsl.s, hsl.l);
|
||||
},
|
||||
greyscale: function (color) {
|
||||
return this.desaturate(color, new(tree.Dimension)(100));
|
||||
},
|
||||
e: function (str) {
|
||||
@ -1143,7 +1172,9 @@ function number(n) {
|
||||
function clamp(val) {
|
||||
return Math.min(1, Math.max(0, val));
|
||||
}
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Alpha = function Alpha(val) {
|
||||
this.value = val;
|
||||
@ -1154,7 +1185,9 @@ tree.Alpha.prototype = {
|
||||
},
|
||||
eval: function () { return this }
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Anonymous = function Anonymous(string) {
|
||||
this.value = string.content || string;
|
||||
@ -1165,7 +1198,9 @@ tree.Anonymous.prototype = {
|
||||
},
|
||||
eval: function () { return this }
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
//
|
||||
// A function call node.
|
||||
@ -1202,7 +1237,9 @@ tree.Call.prototype = {
|
||||
return this.eval(env).toCSS();
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
//
|
||||
// RGB Colors - #ff0014, #eee
|
||||
//
|
||||
@ -1290,7 +1327,9 @@ tree.Color.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Comment = function Comment(value) {
|
||||
this.value = value;
|
||||
@ -1300,7 +1339,9 @@ tree.Comment.prototype = {
|
||||
return env.compress ? '' : this.value;
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
//
|
||||
// A number with a unit
|
||||
@ -1333,7 +1374,8 @@ tree.Dimension.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Directive = function Directive(name, value) {
|
||||
this.name = name;
|
||||
@ -1364,7 +1406,9 @@ tree.Directive.prototype = {
|
||||
find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) },
|
||||
rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) }
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Element = function Element(combinator, value) {
|
||||
this.combinator = combinator instanceof tree.Combinator ?
|
||||
@ -1394,7 +1438,9 @@ tree.Combinator.prototype.toCSS = function (env) {
|
||||
'>' : env.compress ? '>' : ' > '
|
||||
}[this.value];
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Expression = function Expression(value) { this.value = value };
|
||||
tree.Expression.prototype = {
|
||||
@ -1413,7 +1459,9 @@ tree.Expression.prototype = {
|
||||
}).join(' ');
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
//
|
||||
// CSS @import node
|
||||
//
|
||||
@ -1481,14 +1529,18 @@ tree.Import.prototype = {
|
||||
}
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Keyword = function Keyword(value) { this.value = value };
|
||||
tree.Keyword.prototype = {
|
||||
eval: function () { return this },
|
||||
toCSS: function () { return this.value }
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.mixin = {};
|
||||
tree.mixin.Call = function MixinCall(elements, args, index) {
|
||||
@ -1583,7 +1635,9 @@ tree.mixin.Definition.prototype = {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Operation = function Operation(op, operands) {
|
||||
this.op = op.trim();
|
||||
@ -1613,7 +1667,9 @@ tree.operate = function (op, a, b) {
|
||||
case '/': return a / b;
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Quoted = function Quoted(value, content) {
|
||||
this.value = value;
|
||||
@ -1628,7 +1684,9 @@ tree.Quoted.prototype = {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Rule = function Rule(name, value, index) {
|
||||
this.name = name;
|
||||
@ -1650,27 +1708,6 @@ tree.Rule.prototype.eval = function (context) {
|
||||
return new(tree.Rule)(this.name, this.value.eval(context));
|
||||
};
|
||||
|
||||
tree.Value = function Value(value) {
|
||||
this.value = value;
|
||||
this.is = 'value';
|
||||
};
|
||||
tree.Value.prototype = {
|
||||
eval: function (env) {
|
||||
if (this.value.length === 1) {
|
||||
return this.value[0].eval(env);
|
||||
} else {
|
||||
return new(tree.Value)(this.value.map(function (v) {
|
||||
return v.eval(env);
|
||||
}));
|
||||
}
|
||||
},
|
||||
toCSS: function (env) {
|
||||
return this.value.map(function (e) {
|
||||
return e.toCSS(env);
|
||||
}).join(env.compress ? ',' : ', ');
|
||||
}
|
||||
};
|
||||
|
||||
tree.Shorthand = function Shorthand(a, b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
@ -1682,7 +1719,9 @@ tree.Shorthand.prototype = {
|
||||
},
|
||||
eval: function () { return this }
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Ruleset = function Ruleset(selectors, rules) {
|
||||
this.selectors = selectors;
|
||||
@ -1846,8 +1885,8 @@ tree.Ruleset.prototype = {
|
||||
return css.join('') + (env.compress ? '\n' : '');
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Selector = function Selector(elements) {
|
||||
this.elements = elements;
|
||||
@ -1874,7 +1913,8 @@ tree.Selector.prototype.toCSS = function (env) {
|
||||
}).join('');
|
||||
};
|
||||
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.URL = function URL(val) {
|
||||
this.value = val;
|
||||
@ -1885,7 +1925,33 @@ tree.URL.prototype = {
|
||||
},
|
||||
eval: function () { return this }
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Value = function Value(value) {
|
||||
this.value = value;
|
||||
this.is = 'value';
|
||||
};
|
||||
tree.Value.prototype = {
|
||||
eval: function (env) {
|
||||
if (this.value.length === 1) {
|
||||
return this.value[0].eval(env);
|
||||
} else {
|
||||
return new(tree.Value)(this.value.map(function (v) {
|
||||
return v.eval(env);
|
||||
}));
|
||||
}
|
||||
},
|
||||
toCSS: function (env) {
|
||||
return this.value.map(function (e) {
|
||||
return e.toCSS(env);
|
||||
}).join(env.compress ? ',' : ', ');
|
||||
}
|
||||
};
|
||||
|
||||
})(require('less/tree'));
|
||||
(function (tree) {
|
||||
|
||||
tree.Variable = function Variable(name, index) { this.name = name, this.index = index };
|
||||
tree.Variable.prototype = {
|
||||
@ -1904,15 +1970,16 @@ tree.Variable.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof(require) !== 'undefined') { var tree = exports }
|
||||
|
||||
tree.find = function (obj, fun) {
|
||||
})(require('less/tree'));
|
||||
require('less/tree').find = function (obj, fun) {
|
||||
for (var i = 0, r; i < obj.length; i++) {
|
||||
if (r = fun.call(obj, obj[i])) { return r }
|
||||
}
|
||||
return null;
|
||||
};
|
||||
(function () {
|
||||
//
|
||||
// browser.js - client-side engine
|
||||
//
|
||||
|
||||
var isFileProtocol = location.protocol === 'file:';
|
||||
|
||||
@ -2206,4 +2273,4 @@ less.Parser.importer = function (path, paths, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
})();
|
||||
})(window);
|
59
dist/less-1.0.17.min.js
vendored
Normal file
59
dist/less-1.0.17.min.js
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// LESS - Leaner CSS v1.0.17
|
||||
// http://lesscss.org
|
||||
//
|
||||
// Copyright (c) 2010, Alexis Sellier
|
||||
// Licensed under the Apache 2.0 License.
|
||||
//
|
||||
(function(u){function q(d){return u.less[d.split("/")[1]]}function N(d){if(!document.querySelectorAll&&typeof jQuery==="undefined")z("No selector method found");else return(document.querySelectorAll||jQuery).call(document,d)}function G(d,a){for(var e=0;e<H.length;e++)I(H[e],d,a)}function I(d,a,e){var b=v&&v.getItem(d.href),g=v&&v.getItem(d.href+":timestamp"),i={css:b,timestamp:g};O(d.href,e,function(j,l){if(i&&(new Date(l)).valueOf()===(new Date(i.timestamp)).valueOf()){A(i.css,d);a(null,d,{local:true})}else(new p.Parser({optimization:p.optimization})).parse(j,
|
||||
function(o,s){if(o)return J(o,d.href);try{a(s,d,{local:false,lastModified:l});P(document.getElementById("less-error-message:"+d.href.replace(/[^a-z]+/gi,"-")))}catch(r){J(r,d.href)}})},function(j){throw new Error("Couldn't load "+d.href+" ("+j+")");})}function A(d,a,e){var b,g="less:"+(a.title||a.href.match(/(?:^|\/)([-\w]+)\.[a-z]+$/i)[1]);if((b=document.getElementById(g))===null){b=document.createElement("style");b.type="text/css";b.media="screen";b.id=g;document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet)try{b.styleSheet.cssText=
|
||||
d}catch(i){throw new Error("Couldn't reassign styleSheet.cssText.");}else(function(j){if(b.childNodes.length>0)b.firstChild.nodeValue!==j.nodeValue&&b.replaceChild(j,b.firstChild);else b.appendChild(j)})(document.createTextNode(d));if(e&&v){v.setItem(a.href,d);v.setItem(a.href+":timestamp",e)}}function O(d,a,e,b){function g(j,l,o){if(j.status>=200&&j.status<300)l(j.responseText,j.getResponseHeader("Last-Modified"));else typeof o==="function"&&o(j.status)}var i=Q();a=B?false:a||p.async;i.open("GET",
|
||||
d,a);i.send(null);if(B)i.status===0?e(i.responseText):b(i.status);else if(a)i.onreadystatechange=function(){i.readyState==4&&g(i,e,b)};else g(i,e,b)}function Q(){if(u.XMLHttpRequest)return new XMLHttpRequest;else try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(d){z("less: browser doesn't support AJAX.");return null}}function P(d){return d&&d.parentNode.removeChild(d)}function z(d){p.env=="development"&&typeof console!=="undefined"&&console.log(d)}function J(d,a){var e="less-error-message:"+
|
||||
a.replace(/[^a-z]+/ig,"-");if(!d.extract)throw d;var b=document.createElement("div"),g;b.id=e;b.className="less-error-message";b.innerHTML="<h3>"+(d.message||"There is an error in your .less file")+'</h3><p><a href="'+a+'">'+a+"</a> on line "+d.line+", column "+(d.column+1)+":</p>"+'<div>\n<pre class="ctx"><span>[-1]</span>{0}</pre>\n<pre><span>[0]</span>{current}</pre>\n<pre class="ctx"><span>[1]</span>{2}</pre>\n</div>'.replace(/\[(-?\d)\]/g,function(i,j){return parseInt(d.line)+parseInt(j)||""}).replace(/\{(\d)\}/g,
|
||||
function(i,j){return d.extract[parseInt(j)]||""}).replace(/\{current\}/,d.extract[1].slice(0,d.column)+'<span class="error">'+d.extract[1].slice(d.column)+"</span>");A(".less-error-message span {\nmargin-right: 15px;\n}\n.less-error-message pre {\ncolor: #ee4444;\npadding: 4px 0;\nmargin: 0;\n}\n.less-error-message pre.ctx {\ncolor: #dd7777;\n}\n.less-error-message h3 {\npadding: 15px 0 5px 0;\nmargin: 0;\n}\n.less-error-message a {\ncolor: #10a\n}\n.less-error-message .error {\ncolor: red;\nfont-weight: bold;\npadding-bottom: 2px;\nborder-bottom: 1px dashed red;\n}",
|
||||
{title:"error-message"});b.style.cssText="font-family: Arial, sans-serif;border: 1px solid #e00;background-color: #eee;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px;color: #e00;padding: 15px;margin-bottom: 15px";if(p.env=="development")g=setInterval(function(){if(document.body){document.getElementById(e)?document.body.replaceChild(b,document.getElementById(e)):document.body.insertBefore(b,document.body.firstChild);clearInterval(g)}},10)}if(!Array.isArray)Array.isArray=function(d){return Object.prototype.toString.call(d)===
|
||||
"[object Array]"||d instanceof Array};if(!Array.prototype.forEach)Array.prototype.forEach=function(d,a){for(var e=this.length>>>0,b=0;b<e;b++)b in this&&d.call(a,this[b],b,this)};if(!Array.prototype.map)Array.prototype.map=function(d,a){for(var e=this.length>>>0,b=new Array(e),g=0;g<e;g++)if(g in this)b[g]=d.call(a,this[g],g,this);return b};if(!Array.prototype.filter)Array.prototype.filter=function(d,a){for(var e=[],b=0;b<this.length;b++)d.call(a,this[b])&&e.push(this[b]);return e};if(!Array.prototype.reduce)Array.prototype.reduce=
|
||||
function(d){var a=this.length>>>0,e=0;if(a===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2)var b=arguments[1];else{do{if(e in this){b=this[e++];break}if(++e>=a)throw new TypeError;}while(1)}for(;e<a;e++)if(e in this)b=d.call(null,b,this[e],e,this);return b};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(d,a){var e=this.length;a=a||0;if(!e)return-1;if(a>=e)return-1;if(a<0)a+=e;for(;a<e;a++)if(Object.prototype.hasOwnProperty.call(this,a))if(d===this[a])return a;return-1};
|
||||
if(!Object.keys)Object.keys=function(d){var a=[];for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&a.push(e);return a};if(!String.prototype.trim)String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")};var p,m;if(typeof u==="undefined"){p=exports;m=q("less/tree")}else{p=u.less={};m=u.less.tree={}}p.Parser=function(d){function a(f){var h,k,n;if(f instanceof Function)return f.call(s.parsers);else if(typeof f==="string"){h=b.charAt(g)===f?f:null;k=1}else{if(g>=
|
||||
o+l[i].length&&i<l.length-1)o+=l[i++].length;f.lastIndex=n=g-o;if(h=f.exec(l[i])){k=h[0].length;if(f.lastIndex-k!==n)return}}if(h){g+=k;for(k=o+l[i].length;g<=k;){f=b.charCodeAt(g);if(!(f===32||f===10||f===9))break;g++}return typeof h==="string"?h:h.length===1?h[0]:h}}function e(f){var h;if(typeof f==="string")return b.charAt(g)===f;else{f.lastIndex=g;if((h=f.exec(b))&&f.lastIndex-h[0].length===g)return h}}var b,g,i,j,l,o,s,r=this,K=function(){},L=this.imports={paths:d&&d.paths||[],queue:[],files:{},
|
||||
push:function(f,h){var k=this;this.queue.push(f);p.Parser.importer(f,this.paths,function(n){k.queue.splice(k.queue.indexOf(f),1);k.files[f]=n;h(n);k.queue.length===0&&K()})}};this.env=d||{};this.optimization="optimization"in this.env?this.env.optimization:1;return s={imports:L,parse:function(f,h){var k,n,w=null;g=i=o=j=0;l=[];b=f.replace(/\r\n/g,"\n");if(r.optimization>0){b=b.replace(/\/\*(?:[^*]|\*+[^\/*])*\*+\//g,function(E){return r.optimization>1?"":E.replace(/\n(\s*\n)+/g,"\n")});l=b.split(/^(?=\n)/mg)}else l=
|
||||
[b];k=new m.Ruleset([],a(this.parsers.primary));k.root=true;k.toCSS=function(E){var x,C;return function(t){t=t||{};try{var y=E.call(this,[],{frames:[],compress:t.compress||false});return t.compress?y.replace(/(\s)+/g,"$1"):y}catch(D){C=b.split("\n");x=(b.slice(0,D.index).match(/\n/g)||"").length+1;t=D.index;for(y=-1;t>=0&&b.charAt(t)!=="\n";t--)y++;throw{name:"NameError",message:D.message,line:x,stack:D.stack,column:y,extract:[C[x-2],C[x-1],C[x]]};}}}(k.toCSS);if(g<b.length-1){g=j;n=b.split("\n");
|
||||
f=(b.slice(0,g).match(/\n/g)||"").length+1;for(var F=g,M=-1;F>=0&&b.charAt(F)!=="\n";F--)M++;w={name:"ParseError",message:"Syntax Error on line "+f,filename:d.filename,line:f,column:M,extract:[n[f-2],n[f-1],n[f]]}}if(this.imports.queue.length>0)K=function(){h(w,k)};else h(w,k)},parsers:{primary:function(){for(var f,h=[];f=a(this.mixin.definition)||a(this.rule)||a(this.ruleset)||a(this.mixin.call)||a(this.comment)||a(/[\n\s]+/g)||a(this.directive);)h.push(f);return h},comment:function(){var f;if(b.charAt(g)===
|
||||
"/")return(f=a(/\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/g))?new m.Comment(f):a(/\/\/.*/g)},entities:{quoted:function(){var f;if(!(b.charAt(g)!=='"'&&b.charAt(g)!=="'"))if(f=a(/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/g))return new m.Quoted(f[0],f[1]||f[2])},keyword:function(){var f;if(f=a(/[A-Za-z-]+/g))return new m.Keyword(f)},call:function(){var f,h;if(f=a(/([a-zA-Z0-9_-]+|%)\(/g)){if(f[1].toLowerCase()==="alpha")return a(this.alpha);h=a(this.entities.arguments);if(a(")"))if(f)return new m.Call(f[1],
|
||||
h)}},arguments:function(){for(var f=[],h;h=a(this.expression);){f.push(h);if(!a(","))break}return f},literal:function(){return a(this.entities.dimension)||a(this.entities.color)||a(this.entities.quoted)},url:function(){var f;if(!(b.charAt(g)!=="u"||!a(/url\(/g))){f=a(this.entities.quoted)||a(/[-a-zA-Z0-9_%@$\/.&=:;#+?]+/g);if(!a(")"))throw new Error("missing closing ) for url()");return new m.URL(f.value?f:new m.Anonymous(f))}},variable:function(){var f,h=g;if(b.charAt(g)==="@"&&(f=a(/@[a-zA-Z0-9_-]+/g)))return new m.Variable(f,
|
||||
h)},color:function(){var f;if(b.charAt(g)==="#"&&(f=a(/#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/g)))return new m.Color(f[1])},dimension:function(){var f;f=b.charCodeAt(g);if(!(f>57||f<45||f===47))if(f=a(/(-?[0-9]*\.?[0-9]+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm)?/g))return new m.Dimension(f[1],f[2])}},variable:function(){var f;if(b.charAt(g)==="@"&&(f=a(/(@[a-zA-Z0-9_-]+)\s*:/g)))return f[1]},shorthand:function(){var f,h;if(e(/[@\w.-]+\/[@\w.-]+/g))if((f=a(this.entity))&&a("/")&&(h=a(this.entity)))return new m.Shorthand(f,
|
||||
h)},mixin:{call:function(){for(var f=[],h,k,n,w=g;h=a(/[#.][a-zA-Z0-9_-]+/g);){f.push(new m.Element(k,h));k=a(">")}a("(")&&(n=a(this.entities.arguments))&&a(")");if(f.length>0&&(a(";")||e("}")))return new m.mixin.Call(f,n,w)},definition:function(){var f,h=[],k,n;if(!(b.charAt(g)!=="."||e(/[^{]*(;|})/g)))if(f=a(/([#.][a-zA-Z0-9_-]+)\s*\(/g)){for(f=f[1];k=a(/@[\w-]+/g)||a(this.entities.literal)||a(this.entities.keyword);){if(k[0]==="@")if(a(":"))if(n=a(this.expression))h.push({name:k,value:n});else throw new Error("Expected value");
|
||||
else h.push({name:k});else h.push({value:k});if(!a(","))break}if(!a(")"))throw new Error("Expected )");if(k=a(this.block))return new m.mixin.Definition(f,h,k)}}},entity:function(){return a(this.entities.literal)||a(this.entities.variable)||a(this.entities.url)||a(this.entities.call)||a(this.entities.keyword)},end:function(){return a(";")||e("}")},alpha:function(){var f;if(a(/opacity=/gi))if(f=a(/[0-9]+/g)||a(this.entities.variable)){if(!a(")"))throw new Error("missing closing ) for alpha()");return new m.Alpha(f)}},
|
||||
element:function(){var f;c=a(this.combinator);if(f=a(/[.#:]?[a-zA-Z0-9_-]+/g)||a("*")||a(this.attribute)||a(/\([^)@]+\)/g))return new m.Element(c,f)},combinator:function(){var f;return(f=a(/[+>~]/g)||a("&")||a(/::/g))?new m.Combinator(f):new m.Combinator(b.charAt(g-1)===" "?" ":null)},selector:function(){for(var f,h=[];f=a(this.element);)h.push(f);if(h.length>0)return new m.Selector(h)},tag:function(){return a(/[a-zA-Z][a-zA-Z-]*[0-9]?/g)||a("*")},attribute:function(){var f="",h,k,n;if(a("[")){if(h=
|
||||
a(/[a-z-]+/g)||a(this.entities.quoted))f=(n=a(/[|~*$^]?=/g))&&(k=a(this.entities.quoted)||a(/[\w-]+/g))?[h,n,k.toCSS?k.toCSS():k].join(""):h;if(a("]"))if(f)return"["+f+"]"}},block:function(){var f;if(a("{")&&(f=a(this.primary))&&a("}"))return f},ruleset:function(){var f=[],h,k,n=g;if(h=e(/([a-z.#: _-]+)[\s\n]*\{/g)){g+=h[0].length-1;f=[new m.Selector([new m.Element(null,h[1])])]}else{for(;h=a(this.selector);){f.push(h);if(!a(","))break}h&&a(this.comment)}if(f.length>0&&(k=a(this.block)))return new m.Ruleset(f,
|
||||
k);else{j=g;g=n}},rule:function(){var f,h=g;if(name=a(this.property)||a(this.variable)){if(name.charAt(0)!="@"&&(match=e(/([^@+\/*(;{}-]*);/g))){g+=match[0].length-1;f=new m.Anonymous(match[1])}else f=name==="font"?a(this.font):a(this.value);if(a(this.end))return new m.Rule(name,f,h);else{j=g;g=h}}},"import":function(){var f;if(a(/@import\s+/g)&&(f=a(this.entities.quoted)||a(this.entities.url))&&a(";"))return new m.Import(f,L)},directive:function(){var f,h,k;if(b.charAt(g)==="@")if(h=a(this["import"]))return h;
|
||||
else if(f=a(/@media|@page/g)){k=a(/[^{]+/g).trim();if(h=a(this.block))return new m.Directive(f+" "+k,h)}else if(f=a(/@[-a-z]+/g))if(f==="@font-face"){if(h=a(this.block))return new m.Directive(f,h)}else if((h=a(this.entity))&&a(";"))return new m.Directive(f,h)},font:function(){for(var f=[],h=[],k;k=a(this.shorthand)||a(this.entity);)h.push(k);f.push(new m.Expression(h));if(a(","))for(;k=a(this.expression);){f.push(k);if(!a(","))break}return new m.Value(f,a(this.important))},value:function(){for(var f,
|
||||
h=[];f=a(this.expression);){h.push(f);if(!a(","))break}f=a(this.important);if(h.length>0)return new m.Value(h,f)},important:function(){return a(/!\s*important/g)},sub:function(){var f;if(a("(")&&(f=a(this.expression))&&a(")"))return f},multiplication:function(){var f,h,k,n;if(f=a(this.operand)){for(;(k=a(/[\/*]/g))&&(h=a(this.operand));)n=new m.Operation(k,[n||f,h]);return n||f}},addition:function(){var f,h,k,n;if(f=a(this.multiplication)){for(;(k=a(/[-+]\s+/g)||b.charAt(g-1)!=" "&&a(/[-+]/g))&&(h=
|
||||
a(this.multiplication));)n=new m.Operation(k,[n||f,h]);return n||f}},operand:function(){return a(this.sub)||a(this.entities.dimension)||a(this.entities.color)||a(this.entities.variable)},expression:function(){for(var f,h=[];f=a(this.addition)||a(this.entity);)h.push(f);if(h.length>0)return new m.Expression(h)},property:function(){var f;if(f=a(/(\*?-?[-a-z_0-9]+)\s*:/g))return f[1]}}}};p.Parser.importer=null;(function(d){function a(b){if(b instanceof d.Dimension)return parseFloat(b.unit=="%"?b.value/
|
||||
100:b.value);else if(typeof b==="number")return b;else throw{error:"RuntimeError",message:"color functions take numbers as parameters"};}function e(b){return Math.min(1,Math.max(0,b))}d.functions={rgb:function(b,g,i){return this.rgba(b,g,i,1)},rgba:function(b,g,i,j){b=[b,g,i].map(function(l){return a(l)});j=a(j);return new d.Color(b,j)},hsl:function(b,g,i){return this.hsla(b,g,i,1)},hsla:function(b,g,i,j){function l(r){r=r<0?r+1:r>1?r-1:r;return r*6<1?s+(o-s)*r*6:r*2<1?o:r*3<2?s+(o-s)*(2/3-r)*6:s}
|
||||
b=a(b)%360/360;g=a(g);i=a(i);j=a(j);var o=i<=0.5?i*(g+1):i+g-i*g,s=i*2-o;return this.rgba(l(b+1/3)*255,l(b)*255,l(b-1/3)*255,j)},hue:function(b){return new d.Dimension(Math.round(b.toHSL().h))},saturation:function(b){return new d.Dimension(Math.round(b.toHSL().s*100),"%")},lightness:function(b){return new d.Dimension(Math.round(b.toHSL().l*100),"%")},alpha:function(b){return new d.Dimension(b.toHSL().a)},saturate:function(b,g){b=b.toHSL();b.s+=g.value/100;b.s=e(b.s);return this.hsl(b.h,b.s,b.l)},
|
||||
desaturate:function(b,g){b=b.toHSL();b.s-=g.value/100;b.s=e(b.s);return this.hsl(b.h,b.s,b.l)},lighten:function(b,g){b=b.toHSL();b.l+=g.value/100;b.l=e(b.l);return this.hsl(b.h,b.s,b.l)},darken:function(b,g){b=b.toHSL();b.l-=g.value/100;b.l=e(b.l);return this.hsl(b.h,b.s,b.l)},spin:function(b,g){b=b.toHSL();g=(b.h+g.value)%360;b.h=g<0?360+g:g;return this.hsl(b.h,b.s,b.l)},greyscale:function(b){return this.desaturate(b,new d.Dimension(100))},e:function(b){return new d.Anonymous(b)},"%":function(b){for(var g=
|
||||
Array.prototype.slice.call(arguments,1),i=b.content,j=0;j<g.length;j++)i=i.replace(/%s/,g[j].content).replace(/%[da]/,g[j].toCSS());i=i.replace(/%%/g,"%");return new d.Quoted('"'+i+'"',i)}}})(q("less/tree"));(function(d){d.Alpha=function(a){this.value=a};d.Alpha.prototype={toCSS:function(){return"alpha(opacity="+this.value.toCSS()+")"},eval:function(){return this}}})(q("less/tree"));(function(d){d.Anonymous=function(a){this.value=a.content||a};d.Anonymous.prototype={toCSS:function(){return this.value},
|
||||
eval:function(){return this}}})(q("less/tree"));(function(d){d.Call=function(a,e){this.name=a;this.args=e};d.Call.prototype={eval:function(a){var e=this.args.map(function(b){return b.eval(a)});return this.name in d.functions?d.functions[this.name].apply(d.functions,e):new d.Anonymous(this.name+"("+e.map(function(b){return b.toCSS()}).join(", ")+")")},toCSS:function(a){return this.eval(a).toCSS()}}})(q("less/tree"));(function(d){d.Color=function(a,e){if(Array.isArray(a)){this.rgb=a;this.alpha=e}else this.rgb=
|
||||
a.length==6?a.match(/.{2}/g).map(function(b){return parseInt(b,16)}):a.split("").map(function(b){return parseInt(b+b,16)})};d.Color.prototype={eval:function(){return this},toCSS:function(){return this.alpha&&this.alpha<1?"rgba("+this.rgb.concat(this.alpha).join(", ")+")":"#"+this.rgb.map(function(a){a=Math.round(a);a=(a>255?255:a<0?0:a).toString(16);return a.length===1?"0"+a:a}).join("")},operate:function(a,e){var b=[];e instanceof d.Color||(e=e.toColor());for(var g=0;g<3;g++)b[g]=d.operate(a,this.rgb[g],
|
||||
e.rgb[g]);return new d.Color(b)},toHSL:function(){var a=this.rgb[0]/255,e=this.rgb[1]/255,b=this.rgb[2]/255,g=Math.max(a,e,b),i=Math.min(a,e,b),j,l=(g+i)/2,o=g-i;if(g===i)j=i=0;else{i=l>0.5?o/(2-g-i):o/(g+i);switch(g){case a:j=(e-b)/o+(e<b?6:0);break;case e:j=(b-a)/o+2;break;case b:j=(a-e)/o+4;break}j/=6}return{h:j*360,s:i,l:l}}}})(q("less/tree"));(function(d){d.Comment=function(a){this.value=a};d.Comment.prototype={toCSS:function(a){return a.compress?"":this.value}}})(q("less/tree"));(function(d){d.Dimension=
|
||||
function(a,e){this.value=parseFloat(a);this.unit=e||null};d.Dimension.prototype={eval:function(){return this},toColor:function(){return new d.Color([this.value,this.value,this.value])},toCSS:function(){return this.value+this.unit},operate:function(a,e){return new d.Dimension(d.operate(a,this.value,e.value),this.unit||e.unit)}}})(q("less/tree"));(function(d){d.Directive=function(a,e){this.name=a;if(Array.isArray(e))this.ruleset=new d.Ruleset([],e);else this.value=e};d.Directive.prototype={toCSS:function(a,
|
||||
e){if(this.ruleset){this.ruleset.root=true;return this.name+(e.compress?"{":" {\n ")+this.ruleset.toCSS(a,e).trim().replace(/\n/g,"\n ")+(e.compress?"}":"\n}\n")}else return this.name+" "+this.value.toCSS()+";\n"},eval:function(a){a.frames.unshift(this);this.ruleset&&this.ruleset.evalRules(a);a.frames.shift();return this},variable:function(a){return d.Ruleset.prototype.variable.call(this.ruleset,a)},find:function(){return d.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return d.Ruleset.prototype.rulesets.apply(this.ruleset)}}})(q("less/tree"));
|
||||
(function(d){d.Element=function(a,e){this.combinator=a instanceof d.Combinator?a:new d.Combinator(a);this.value=e.trim()};d.Element.prototype.toCSS=function(a){return this.combinator.toCSS(a||{})+this.value};d.Combinator=function(a){this.value=a===" "?" ":a?a.trim():""};d.Combinator.prototype.toCSS=function(a){return{"":""," ":" ","&":"",":":" :","::":"::","+":a.compress?"+":" + ","~":a.compress?"~":" ~ ",">":a.compress?">":" > "}[this.value]}})(q("less/tree"));(function(d){d.Expression=function(a){this.value=
|
||||
a};d.Expression.prototype={eval:function(a){return this.value.length>1?new d.Expression(this.value.map(function(e){return e.eval(a)})):this.value[0].eval(a)},toCSS:function(){return this.value.map(function(a){return a.toCSS()}).join(" ")}}})(q("less/tree"));(function(d){d.Import=function(a,e){var b=this;this._path=a;this.path=a instanceof d.Quoted?/\.(le?|c)ss$/.test(a.content)?a.content:a.content+".less":a.value.content||a.value;(this.css=/css$/.test(this.path))||e.push(this.path,function(g){b.root=
|
||||
g})};d.Import.prototype={toCSS:function(){return this.css?"@import "+this._path.toCSS()+";\n":""},eval:function(){if(this.css)return this;else{for(var a=0;a<this.root.rules.length;a++)this.root.rules[a]instanceof d.Import&&Array.prototype.splice.apply(this.root.rules,[a,1].concat(this.root.rules[a].eval()));return this.root.rules}}}})(q("less/tree"));(function(d){d.Keyword=function(a){this.value=a};d.Keyword.prototype={eval:function(){return this},toCSS:function(){return this.value}}})(q("less/tree"));
|
||||
(function(d){d.mixin={};d.mixin.Call=function(a,e,b){this.selector=new d.Selector(a);this.arguments=e;this.index=b};d.mixin.Call.prototype={eval:function(a){for(var e,b=[],g=false,i=0;i<a.frames.length;i++)if((e=a.frames[i].find(this.selector)).length>0){for(i=0;i<e.length;i++)if(e[i].match(this.arguments,a))try{Array.prototype.push.apply(b,e[i].eval(this.arguments,a).rules);g=true}catch(j){throw{message:j.message,index:this.index};}if(g)return b;else throw{message:"No matching definition was found for `"+
|
||||
this.selector.toCSS().trim()+"("+this.arguments.map(function(l){return l.toCSS()}).join(", ")+")`",index:this.index};}throw{message:this.selector.toCSS().trim()+" is undefined",index:this.index};}};d.mixin.Definition=function(a,e,b){this.name=a;this.selectors=[new d.Selector([new d.Element(null,a)])];this.params=e;this.arity=e.length;this.rules=b;this._lookups={};this.required=e.reduce(function(g,i){return i.name&&!i.value?g+1:g},0)};d.mixin.Definition.prototype={toCSS:function(){return""},variable:function(a){return d.Ruleset.prototype.variable.call(this,
|
||||
a)},find:function(){return d.Ruleset.prototype.find.apply(this,arguments)},rulesets:function(){return d.Ruleset.prototype.rulesets.apply(this)},eval:function(a,e){for(var b=new d.Ruleset(null,[]),g=0,i;g<this.params.length;g++)if(this.params[g].name)if(i=a&&a[g]||this.params[g].value)b.rules.unshift(new d.Rule(this.params[g].name,i.eval(e)));else throw{message:"wrong number of arguments for "+this.name+" ("+a.length+" for "+this.arity+")"};return(new d.Ruleset(null,this.rules)).evalRules({frames:[this,
|
||||
b].concat(e.frames)})},match:function(a,e){var b=a&&a.length||0;if(b<this.required)return false;for(var g=0;g<Math.min(b,this.arity);g++)if(!this.params[g].name)if(!a[g].wildcard)if(a[g].eval(e).toCSS()!=this.params[g].value.eval(e).toCSS())return false;return true}}})(q("less/tree"));(function(d){d.Operation=function(a,e){this.op=a.trim();this.operands=e};d.Operation.prototype.eval=function(a){var e=this.operands[0].eval(a);a=this.operands[1].eval(a);var b;if(e instanceof d.Dimension&&a instanceof
|
||||
d.Color)if(this.op==="*"||this.op==="+"){b=a;a=e;e=b}else throw{name:"OperationError",message:"Can't substract or divide a color from a number"};return e.operate(this.op,a)};d.operate=function(a,e,b){switch(a){case "+":return e+b;case "-":return e-b;case "*":return e*b;case "/":return e/b}}})(q("less/tree"));(function(d){d.Quoted=function(a,e){this.value=a;this.content=e};d.Quoted.prototype={toCSS:function(){return this.value},eval:function(){return this}}})(q("less/tree"));(function(d){d.Rule=function(a,
|
||||
e,b){this.name=a;this.value=e instanceof d.Value?e:new d.Value([e]);this.index=b;this.variable=a.charAt(0)==="@"?true:false};d.Rule.prototype.toCSS=function(a){return this.variable?"":this.name+(a.compress?":":": ")+this.value.toCSS(a)+";"};d.Rule.prototype.eval=function(a){return new d.Rule(this.name,this.value.eval(a))};d.Shorthand=function(a,e){this.a=a;this.b=e};d.Shorthand.prototype={toCSS:function(a){return this.a.toCSS(a)+"/"+this.b.toCSS(a)},eval:function(){return this}}})(q("less/tree"));
|
||||
(function(d){d.Ruleset=function(a,e){this.selectors=a;this.rules=e;this._lookups={}};d.Ruleset.prototype={eval:function(){return this},evalRules:function(a){var e=[];this.rules.forEach(function(b){if(b.evalRules)e.push(b.evalRules(a));else b instanceof d.mixin.Call?Array.prototype.push.apply(e,b.eval(a)):e.push(b.eval(a))});this.rules=e;return this},match:function(a){return!a||a.length===0},variable:function(a){return this._variables?this._variables[a]:(this._variables=this.rules.reduce(function(e,
|
||||
b){if(b instanceof d.Rule&&b.variable===true)e[b.name]=b;return e},{}))[a]},rulesets:function(){return this._rulesets?this._rulesets:(this._rulesets=this.rules.filter(function(a){if(a instanceof d.Ruleset||a instanceof d.mixin.Definition)return a}))},find:function(a,e){e=e||this;var b=[],g=a.toCSS();if(g in this._lookups)return this._lookups[g];this.rulesets().forEach(function(i){if(i!==e)for(var j=0;j<i.selectors.length;j++)if(a.match(i.selectors[j])){a.elements.length>1?Array.prototype.push.apply(b,
|
||||
i.find(new d.Selector(a.elements.slice(1)),e)):b.push(i);break}});return this._lookups[g]=b},toCSS:function(a,e){var b=[],g=[],i=[],j=[];if(this.root)for(var l=0;l<this.rules.length;l++)this.rules[l]instanceof d.Import&&Array.prototype.splice.apply(this.rules,[l,1].concat(this.rules[l].eval(e)));else if(a.length===0)j=this.selectors.map(function(s){return[s]});else for(l=0;l<this.selectors.length;l++)for(var o=0;o<a.length;o++)j.push(a[o].concat([this.selectors[l]]));e.frames.unshift(this);for(l=
|
||||
0;l<this.rules.length;l++)this.rules[l]instanceof d.mixin.Call&&Array.prototype.splice.apply(this.rules,[l,1].concat(this.rules[l].eval(e)));for(l=0;l<this.rules.length;l++){a=this.rules[l];if(a instanceof d.Directive)i.push(a.eval(e).toCSS(j,e));else if(a.rules)i.push(a.toCSS(j,e));else if(a instanceof d.Comment)this.root?i.push(a.toCSS(e)):g.push(a.toCSS(e));else if(a.toCSS&&!a.variable)g.push(a.eval(e).toCSS(e));else a.value&&!a.variable&&g.push(a.value.toString())}i=i.join("");if(this.root)b.push(g.join(e.compress?
|
||||
"":"\n"));else if(g.length>0){j=j.map(function(s){return s.map(function(r){return r.toCSS(e)}).join("").trim()}).join(e.compress?",":j.length>3?",\n":", ");b.push(j,(e.compress?"{":" {\n ")+g.join(e.compress?"":"\n ")+(e.compress?"}":"\n}\n"))}b.push(i);e.frames.shift();return b.join("")+(e.compress?"\n":"")}}})(q("less/tree"));(function(d){d.Selector=function(a){this.elements=a;if(this.elements[0].combinator.value==="")this.elements[0].combinator.value=" "};d.Selector.prototype.match=function(a){return this.elements[0].value===
|
||||
a.elements[0].value?true:false};d.Selector.prototype.toCSS=function(a){if(this._css)return this._css;return this._css=this.elements.map(function(e){return typeof e==="string"?" "+e.trim():e.toCSS(a)}).join("")}})(q("less/tree"));(function(d){d.URL=function(a){this.value=a};d.URL.prototype={toCSS:function(){return"url("+this.value.toCSS()+")"},eval:function(){return this}}})(q("less/tree"));(function(d){d.Value=function(a){this.value=a;this.is="value"};d.Value.prototype={eval:function(a){return this.value.length===
|
||||
1?this.value[0].eval(a):new d.Value(this.value.map(function(e){return e.eval(a)}))},toCSS:function(a){return this.value.map(function(e){return e.toCSS(a)}).join(a.compress?",":", ")}}})(q("less/tree"));(function(d){d.Variable=function(a,e){this.name=a;this.index=e};d.Variable.prototype={eval:function(a){var e,b,g=this.name;if(e=d.find(a.frames,function(i){if(b=i.variable(g))return b.value.eval(a)}))return e;else throw{message:"variable "+this.name+" is undefined",index:this.index};}}})(q("less/tree"));
|
||||
q("less/tree").find=function(d,a){for(var e=0,b;e<d.length;e++)if(b=a.call(d,d[e]))return b;return null};var B=location.protocol==="file:";p.env=location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||B?"development":"production";p.async=false;p.poll=B?1E3:1500;p.watch=function(){return this.watchMode=true};p.unwatch=function(){return this.watchMode=false};if(p.env==="development"){p.optimization=0;/!watch/.test(location.hash)&&p.watch();
|
||||
p.watchTimer=setInterval(function(){p.watchMode&&G(function(d,a,e){d&&A(d.toCSS(),a,e.lastModified)})},p.poll)}else p.optimization=3;var v=typeof u.localStorage==="undefined"?null:u.localStorage,H=N('link[rel="stylesheet/less"]');p.refresh=function(){G(function(d,a,e){if(e.local)z("less: loading "+a.href+" from local storage.");else{A(d.toCSS(),a,e.lastModified);z("less: parsed "+a.href+" successfully.")}})};p.refresh();p.Parser.importer=function(d,a,e){I({href:d,title:d},function(b){e(b)})}})(window);
|
Loading…
Reference in New Issue
Block a user