diff --git a/dist/less-1.0.17.min.js b/dist/less-1.0.17.min.js deleted file mode 100644 index f04bb3e3..00000000 --- a/dist/less-1.0.17.min.js +++ /dev/null @@ -1,59 +0,0 @@ -// -// 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;e0)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="

"+(d.message||"There is an error in your .less file")+'

'+a+" on line "+d.line+", column "+(d.column+1)+":

"+'
\n
[-1]{0}
\n
[0]{current}
\n
[1]{2}
\n
'.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)+''+d.extract[1].slice(d.column)+"");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>>0,b=new Array(e),g=0;g>>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=e)return-1;if(a<0)a+=e;for(;a= -o+l[i].length&&i0){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=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;j255?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":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;a0){for(i=0;i1?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;l0){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;e0||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); diff --git a/dist/less-1.0.17.js b/dist/less-1.0.18.js similarity index 98% rename from dist/less-1.0.17.js rename to dist/less-1.0.18.js index c1d41ef9..577db2a8 100644 --- a/dist/less-1.0.17.js +++ b/dist/less-1.0.18.js @@ -1,5 +1,5 @@ // -// LESS - Leaner CSS v1.0.17 +// LESS - Leaner CSS v1.0.18 // http://lesscss.org // // Copyright (c) 2010, Alexis Sellier @@ -486,10 +486,10 @@ less.Parser = function Parser(env) { if (input.charAt(i) !== '/') return; - if (comment = $(/\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/g)) { + if (input.charAt(i + 1) === '/') { + return new(tree.Comment)($(/\/\/.*/g), true); + } else if (comment = $(/\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/g)) { return new(tree.Comment)(comment); - } else { - return $(/\/\/.*/g); } }, @@ -1331,13 +1331,15 @@ tree.Color.prototype = { })(require('less/tree')); (function (tree) { -tree.Comment = function Comment(value) { +tree.Comment = function Comment(value, silent) { this.value = value; + this.silent = !!silent; }; tree.Comment.prototype = { toCSS: function (env) { return env.compress ? '' : this.value; - } + }, + eval: function () { return this } }; })(require('less/tree')); @@ -1739,7 +1741,7 @@ tree.Ruleset.prototype = { } else if (rule instanceof tree.mixin.Call) { Array.prototype.push.apply(rules, rule.eval(context)); } else { - rules.push(rule.eval(context)); + rules.push(rule.eval ? rule.eval(context) : ''); } }); this.rules = rules; @@ -1843,10 +1845,12 @@ tree.Ruleset.prototype = { } else if (rule.rules) { rulesets.push(rule.toCSS(paths, env)); } else if (rule instanceof tree.Comment) { - if (this.root) { - rulesets.push(rule.toCSS(env)); - } else { - rules.push(rule.toCSS(env)); + if (!rule.silent) { + if (this.root) { + rulesets.push(rule.toCSS(env)); + } else { + rules.push(rule.toCSS(env)); + } } } else { if (rule.toCSS && !rule.variable) { @@ -2033,41 +2037,42 @@ var cache = (typeof(window.localStorage) === 'undefined') ? null : window.localS // var sheets = select('link[rel="stylesheet/less"]'); -less.refresh = function () { +less.refresh = function (reload) { loadStyleSheets(function (root, sheet, env) { if (env.local) { - log("less: loading " + sheet.href + " from local storage."); + log("loading " + sheet.href + " from cache."); } else { + log("parsed " + sheet.href + " successfully."); createCSS(root.toCSS(), sheet, env.lastModified); - log("less: parsed " + sheet.href + " successfully."); } - }); + }, reload); }; less.refresh(); function select(str) { if (!document.querySelectorAll && typeof(jQuery) === "undefined") { - log("No selector method found"); + log("no selector method found."); } else { return (document.querySelectorAll || jQuery).call(document, str); } } -function loadStyleSheets(callback, async) { +function loadStyleSheets(callback, reload) { for (var i = 0; i < sheets.length; i++) { - loadStyleSheet(sheets[i], callback, async); + loadStyleSheet(sheets[i], callback, reload); } } -function loadStyleSheet(sheet, callback, async) { +function loadStyleSheet(sheet, callback, reload) { var css = cache && cache.getItem(sheet.href); var timestamp = cache && cache.getItem(sheet.href + ':timestamp'); - var styles = { css: css, timestamp: timestamp }; + var styles = { css: css, timestamp: timestamp }; - xhr(sheet.href, async, function (data, lastModified) { - if (styles && (new(Date)(lastModified).valueOf() === - new(Date)(styles.timestamp).valueOf())) { + xhr(sheet.href, function (data, lastModified) { + if (!reload && styles && + (new(Date)(lastModified).valueOf() === + new(Date)(styles.timestamp).valueOf())) { // Use local copy createCSS(styles.css, sheet); callback(null, sheet, { local: true }); @@ -2125,15 +2130,15 @@ function createCSS(styles, sheet, lastModified) { // Don't update the local store if the file wasn't modified if (lastModified && cache) { + log('saving ' + sheet.href + ' to cache.'); cache.setItem(sheet.href, styles); cache.setItem(sheet.href + ':timestamp', lastModified); } } -function xhr(url, async, callback, errback) { +function xhr(url, callback, errback) { var xhr = getXMLHttpRequest(); - - async = isFileProtocol ? false : (async || less.async); + var async = isFileProtocol ? false : less.async; xhr.open('GET', url, async); xhr.send(null); @@ -2171,7 +2176,7 @@ function getXMLHttpRequest() { try { return new(ActiveXObject)("MSXML2.XMLHTTP.3.0"); } catch (e) { - log("less: browser doesn't support AJAX."); + log("browser doesn't support AJAX."); return null; } } @@ -2182,7 +2187,7 @@ function removeNode(node) { } function log(str) { - if (less.env == 'development' && typeof(console) !== "undefined") { console.log(str) } + if (less.env == 'development' && typeof(console) !== "undefined") { console.log('less: ' + str) } } function error(e, href) { diff --git a/dist/less-1.0.18.min.js b/dist/less-1.0.18.min.js new file mode 100644 index 00000000..63fcffc1 --- /dev/null +++ b/dist/less-1.0.18.min.js @@ -0,0 +1,60 @@ +// +// LESS - Leaner CSS v1.0.18 +// 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")w("no selector method found.");else return(document.querySelectorAll||jQuery).call(document,d)}function G(d,a){for(var e=0;e0)b.firstChild.nodeValue!==j.nodeValue&&b.replaceChild(j,b.firstChild);else b.appendChild(j)})(document.createTextNode(d));if(e&&v){w("saving "+a.href+" to cache.");v.setItem(a.href,d);v.setItem(a.href+":timestamp",e)}}function O(d,a,e){function b(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 g=Q(),i= +B?false:p.async;g.open("GET",d,i);g.send(null);if(B)g.status===0?a(g.responseText):e(g.status);else if(i)g.onreadystatechange=function(){g.readyState==4&&b(g,a,e)};else b(g,a,e)}function Q(){if(u.XMLHttpRequest)return new XMLHttpRequest;else try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(d){w("browser doesn't support AJAX.");return null}}function P(d){return d&&d.parentNode.removeChild(d)}function w(d){p.env=="development"&&typeof console!=="undefined"&&console.log("less: "+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="

"+(d.message||"There is an error in your .less file")+'

'+a+" on line "+d.line+", column "+(d.column+1)+":

"+'
\n
[-1]{0}
\n
[0]{current}
\n
[1]{2}
\n
'.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)+''+d.extract[1].slice(d.column)+"");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>>0,b=new Array(e),g=0;g>>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=e)return-1;if(a<0)a+=e;for(;a= +o+l[i].length&&i0){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 y,C;return function(t){t=t||{};try{var z=E.call(this,[],{frames:[],compress:t.compress||false});return t.compress?z.replace(/(\s)+/g,"$1"):z}catch(D){C=b.split("\n");y=(b.slice(0,D.index).match(/\n/g)||"").length+1;t=D.index;for(z=-1;t>=0&&b.charAt(t)!=="\n";t--)z++;throw{name:"NameError",message:D.message,line:y,stack:D.stack,column:z,extract:[C[y-2],C[y-1],C[y]]};}}}(k.toCSS);if(g=0&&b.charAt(F)!=="\n";F--)M++;x={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(x,k)};else h(x,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)=== +"/")if(b.charAt(g+1)==="/")return new m.Comment(a(/\/\/.*/g),true);else if(f=a(/\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/g))return new m.Comment(f)},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,x=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,x)},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;j255?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":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;a0){for(i=0;i1?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;l0){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;e0||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(d){G(function(a,e,b){if(b.local)w("loading "+e.href+" from cache."); +else{w("parsed "+e.href+" successfully.");A(a.toCSS(),e,b.lastModified)}},d)};p.refresh();p.Parser.importer=function(d,a,e){I({href:d,title:d},function(b){e(b)})}})(window);