(dist) make less
This commit is contained in:
parent
22fea4d8cf
commit
57553e7378
87
dist/less-1.0.13.js → dist/less-1.0.14.js
vendored
87
dist/less-1.0.13.js → dist/less-1.0.14.js
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// LESS - Leaner CSS v1.0.13
|
||||
// LESS - Leaner CSS v1.0.14
|
||||
// http://lesscss.org
|
||||
//
|
||||
// Copyright (c) 2010, Alexis Sellier
|
||||
@ -340,20 +340,30 @@ less.Parser = function Parser(env) {
|
||||
root.toCSS = (function (toCSS) {
|
||||
var line, lines, column;
|
||||
|
||||
return function () {
|
||||
return function (options) {
|
||||
options = options || {};
|
||||
try {
|
||||
return toCSS.call(this);
|
||||
var css = toCSS.call(this, [], {
|
||||
frames: [],
|
||||
compress: options.compress || false
|
||||
});
|
||||
if (options.compress) {
|
||||
return css.replace(/(\s)+/g, "$1");
|
||||
} else {
|
||||
return css;
|
||||
}
|
||||
} catch (e) {
|
||||
lines = input.split('\n');
|
||||
line = (input.slice(0, e.index).match(/\n/g) || "").length + 1;
|
||||
|
||||
for (var n = e.index, column = -1;
|
||||
n >= 0 && input.charAt(n) !== '\n';
|
||||
n--) { column++ }
|
||||
|
||||
throw {
|
||||
name: "NameError",
|
||||
message: e.message,
|
||||
line: line,
|
||||
stack: e.stack,
|
||||
column: column,
|
||||
extract: [
|
||||
lines[line - 2],
|
||||
@ -1286,8 +1296,8 @@ tree.Comment = function Comment(value) {
|
||||
this.value = value;
|
||||
};
|
||||
tree.Comment.prototype = {
|
||||
toCSS: function () {
|
||||
return this.value;
|
||||
toCSS: function (env) {
|
||||
return env.compress ? '' : this.value;
|
||||
}
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
@ -1337,8 +1347,9 @@ tree.Directive.prototype = {
|
||||
toCSS: function (ctx, env) {
|
||||
if (this.ruleset) {
|
||||
this.ruleset.root = true;
|
||||
return this.name + ' {\n ' +
|
||||
this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n ') + '\n}\n';
|
||||
return this.name + (env.compress ? '{' : ' {\n ') +
|
||||
this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n ') +
|
||||
(env.compress ? '}': '\n}\n');
|
||||
} else {
|
||||
return this.name + ' ' + this.value.toCSS() + ';\n';
|
||||
}
|
||||
@ -1360,8 +1371,8 @@ tree.Element = function Element(combinator, value) {
|
||||
combinator : new(tree.Combinator)(combinator);
|
||||
this.value = value.trim();
|
||||
};
|
||||
tree.Element.prototype.toCSS = function () {
|
||||
return this.combinator.toCSS() + this.value;
|
||||
tree.Element.prototype.toCSS = function (env) {
|
||||
return this.combinator.toCSS(env || {}) + this.value;
|
||||
};
|
||||
|
||||
tree.Combinator = function Combinator(value) {
|
||||
@ -1371,17 +1382,17 @@ tree.Combinator = function Combinator(value) {
|
||||
this.value = value ? value.trim() : "";
|
||||
}
|
||||
};
|
||||
tree.Combinator.prototype.toCSS = function () {
|
||||
switch (this.value) {
|
||||
case '' : return '';
|
||||
case ' ' : return ' ';
|
||||
case '&' : return '';
|
||||
case ':' : return ' :';
|
||||
case '::': return '::';
|
||||
case '+' : return ' + ';
|
||||
case '~' : return ' ~ ';
|
||||
case '>' : return ' > ';
|
||||
}
|
||||
tree.Combinator.prototype.toCSS = function (env) {
|
||||
return {
|
||||
'' : '',
|
||||
' ' : ' ',
|
||||
'&' : '',
|
||||
':' : ' :',
|
||||
'::': '::',
|
||||
'+' : env.compress ? '+' : ' + ',
|
||||
'~' : env.compress ? '~' : ' ~ ',
|
||||
'>' : env.compress ? '>' : ' > '
|
||||
}[this.value];
|
||||
};
|
||||
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
||||
|
||||
@ -1628,10 +1639,10 @@ tree.Rule = function Rule(name, value, index) {
|
||||
this.variable = true;
|
||||
} else { this.variable = false }
|
||||
};
|
||||
tree.Rule.prototype.toCSS = function () {
|
||||
tree.Rule.prototype.toCSS = function (env) {
|
||||
if (this.variable) { return "" }
|
||||
else {
|
||||
return this.name + ": " + this.value.toCSS() + ";";
|
||||
return this.name + (env.compress ? ':' : ': ') + this.value.toCSS(env) + ";";
|
||||
}
|
||||
};
|
||||
|
||||
@ -1653,10 +1664,10 @@ tree.Value.prototype = {
|
||||
}));
|
||||
}
|
||||
},
|
||||
toCSS: function () {
|
||||
toCSS: function (env) {
|
||||
return this.value.map(function (e) {
|
||||
return e.toCSS();
|
||||
}).join(', ');
|
||||
return e.toCSS(env);
|
||||
}).join(env.compress ? ',' : ', ');
|
||||
}
|
||||
};
|
||||
|
||||
@ -1765,7 +1776,6 @@ tree.Ruleset.prototype = {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
context = [], env = { frames: [] }
|
||||
for (var i = 0; i < this.rules.length; i++) {
|
||||
if (this.rules[i] instanceof tree.Import) {
|
||||
Array.prototype.splice
|
||||
@ -1795,13 +1805,13 @@ tree.Ruleset.prototype = {
|
||||
rulesets.push(rule.toCSS(paths, env));
|
||||
} else if (rule instanceof tree.Comment) {
|
||||
if (this.root) {
|
||||
rulesets.push(rule.toCSS());
|
||||
rulesets.push(rule.toCSS(env));
|
||||
} else {
|
||||
rules.push(rule.toCSS());
|
||||
rules.push(rule.toCSS(env));
|
||||
}
|
||||
} else {
|
||||
if (rule.toCSS && !rule.variable) {
|
||||
rules.push(rule.eval(env).toCSS());
|
||||
rules.push(rule.eval(env).toCSS(env));
|
||||
} else if (rule.value && !rule.variable) {
|
||||
rules.push(rule.value.toString());
|
||||
}
|
||||
@ -1814,15 +1824,18 @@ tree.Ruleset.prototype = {
|
||||
// a selector, or {}.
|
||||
// Otherwise, only output if this ruleset has rules.
|
||||
if (this.root) {
|
||||
css.push(rules.join('\n'));
|
||||
css.push(rules.join(env.compress ? '' : '\n'));
|
||||
} else {
|
||||
if (rules.length > 0) {
|
||||
selector = paths.map(function (p) {
|
||||
return p.map(function (s) {
|
||||
return s.toCSS();
|
||||
return s.toCSS(env);
|
||||
}).join('').trim();
|
||||
}).join(paths.length > 3 ? ',\n' : ', ');
|
||||
css.push(selector, " {\n " + rules.join('\n ') + "\n}\n");
|
||||
}).join(env.compress ? ',' : (paths.length > 3 ? ',\n' : ', '));
|
||||
css.push(selector,
|
||||
(env.compress ? '{' : ' {\n ') +
|
||||
rules.join(env.compress ? '' : '\n ') +
|
||||
(env.compress ? '}' : '\n}\n'));
|
||||
}
|
||||
}
|
||||
css.push(rulesets);
|
||||
@ -1830,7 +1843,7 @@ tree.Ruleset.prototype = {
|
||||
// Pop the stack
|
||||
env.frames.shift();
|
||||
|
||||
return css.join('');
|
||||
return css.join('') + (env.compress ? '\n' : '');
|
||||
}
|
||||
};
|
||||
|
||||
@ -1849,14 +1862,14 @@ tree.Selector.prototype.match = function (other) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
tree.Selector.prototype.toCSS = function () {
|
||||
tree.Selector.prototype.toCSS = function (env) {
|
||||
if (this._css) { return this._css }
|
||||
|
||||
return this._css = this.elements.map(function (e) {
|
||||
if (typeof(e) === 'string') {
|
||||
return ' ' + e.trim();
|
||||
} else {
|
||||
return e.toCSS();
|
||||
return e.toCSS(env);
|
||||
}
|
||||
}).join('');
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// LESS - Leaner CSS v1.0.13
|
||||
// LESS - Leaner CSS v1.0.14
|
||||
// http://lesscss.org
|
||||
//
|
||||
// Copyright (c) 2010, Alexis Sellier
|
||||
@ -9,22 +9,22 @@ if(!Array.isArray)Array.isArray=function(b){return Object.prototype.toString.cal
|
||||
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,m;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+n[l].length&&l<n.length-1)q+=n[l++].length;d.lastIndex=m=h-q;if(g=d.exec(n[l])){i=g[0].length;if(d.lastIndex-i!==m)return}}if(g){h+=i;for(i=q+n[l].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,l,k,n,q,s,j=this,o=function(){},p=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(m){i.queue.splice(i.queue.indexOf(d),1);i.files[d]=m;g(m);i.queue.length===0&&o()})}};this.env=b||{};this.optimization="optimization"in this.env?this.env.optimization:1;return s={imports:p,parse:function(d,g){var i,m,r=null;h=l=q=k=0;n=[];
|
||||
f=d.replace(/\r\n/g,"\n");if(j.optimization>0){f=f.replace(/\/\*(?:[^*]|\*+[^\/*])*\*+\//g,function(w){return j.optimization>1?"":w.replace(/\n(\s*\n)+/g,"\n")});n=f.split(/^(?=\n)/mg)}else n=[f];i=new tree.Ruleset([],a(this.parsers.primary));i.root=true;i.toCSS=function(w){var t,v;return function(){try{return w.call(this)}catch(x){v=f.split("\n");t=(f.slice(0,x.index).match(/\n/g)||"").length+1;for(var y=x.index,z=-1;y>=0&&f.charAt(y)!=="\n";y--)z++;throw{name:"NameError",message:x.message,line:t,
|
||||
column:z,extract:[v[t-2],v[t-1],v[t]]};}}}(i.toCSS);if(h<f.length-1){h=k;m=f.split("\n");d=(f.slice(0,h).match(/\n/g)||"").length+1;for(var u=h,A=-1;u>=0&&f.charAt(u)!=="\n";u--)A++;r={name:"ParseError",message:"Syntax Error on line "+d,filename:b.filename,line:d,column:A,extract:[m[d-2],m[d-1],m[d]]}}if(this.imports.queue.length>0)o=function(){g(r,i)};else g(r,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,m,r=h;g=a(/[#.][a-zA-Z0-9_-]+/g);){d.push(new tree.Element(i,g));i=a(">")}a("(")&&(m=a(this.entities.arguments))&&a(")");if(d.length>0&&(a(";")||e("}")))return new tree.mixin.Call(d,m,r)},definition:function(){var d,g=[],i,m;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(m=a(this.expression))g.push({name:i,value:m});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,m;if(a("[")){if(g=a(/[a-z-]+/g)||a(this.entities.quoted))d=(m=a(/[|~*$^]?=/g))&&(i=a(this.entities.quoted)||a(/[\w-]+/g))?[g,m,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,m=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{k=h;h=m}},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{k=
|
||||
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,p)},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,m;
|
||||
if(d=a(this.operand)){for(;(i=a(/[\/*]/g))&&(g=a(this.operand));)m=new tree.Operation(i,[m||d,g]);return m||d}},addition:function(){var d,g,i,m;if(d=a(this.multiplication)){for(;(i=a(/[-+]\s+/g)||f.charAt(h-1)!=" "&&a(/[-+]/g))&&(g=a(this.multiplication));)m=new tree.Operation(i,[m||d,g]);return m||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");
|
||||
less.Parser=function(b){function a(d){var g,i,m;if(d instanceof Function)return d.call(t.parsers);else if(typeof d==="string"){g=f.charAt(h)===d?d:null;i=1}else{if(h>=q+n[l].length&&l<n.length-1)q+=n[l++].length;d.lastIndex=m=h-q;if(g=d.exec(n[l])){i=g[0].length;if(d.lastIndex-i!==m)return}}if(g){h+=i;for(i=q+n[l].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,l,k,n,q,t,j=this,o=function(){},p=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(m){i.queue.splice(i.queue.indexOf(d),1);i.files[d]=m;g(m);i.queue.length===0&&o()})}};this.env=b||{};this.optimization="optimization"in this.env?this.env.optimization:1;return t={imports:p,parse:function(d,g){var i,m,s=null;h=l=q=k=0;n=[];
|
||||
f=d.replace(/\r\n/g,"\n");if(j.optimization>0){f=f.replace(/\/\*(?:[^*]|\*+[^\/*])*\*+\//g,function(z){return j.optimization>1?"":z.replace(/\n(\s*\n)+/g,"\n")});n=f.split(/^(?=\n)/mg)}else n=[f];i=new tree.Ruleset([],a(this.parsers.primary));i.root=true;i.toCSS=function(z){var u,x;return function(r){r=r||{};try{var v=z.call(this,[],{frames:[],compress:r.compress||false});return r.compress?v.replace(/(\s)+/g,"$1"):v}catch(y){x=f.split("\n");u=(f.slice(0,y.index).match(/\n/g)||"").length+1;r=y.index;
|
||||
for(v=-1;r>=0&&f.charAt(r)!=="\n";r--)v++;throw{name:"NameError",message:y.message,line:u,stack:y.stack,column:v,extract:[x[u-2],x[u-1],x[u]]};}}}(i.toCSS);if(h<f.length-1){h=k;m=f.split("\n");d=(f.slice(0,h).match(/\n/g)||"").length+1;for(var w=h,A=-1;w>=0&&f.charAt(w)!=="\n";w--)A++;s={name:"ParseError",message:"Syntax Error on line "+d,filename:b.filename,line:d,column:A,extract:[m[d-2],m[d-1],m[d]]}}if(this.imports.queue.length>0)o=function(){g(s,i)};else g(s,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,m,s=h;g=a(/[#.][a-zA-Z0-9_-]+/g);){d.push(new tree.Element(i,g));i=a(">")}a("(")&&(m=a(this.entities.arguments))&&a(")");if(d.length>0&&(a(";")||e("}")))return new tree.mixin.Call(d,m,s)},definition:function(){var d,g=[],
|
||||
i,m;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(m=a(this.expression))g.push({name:i,value:m});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,m;if(a("[")){if(g=a(/[a-z-]+/g)||a(this.entities.quoted))d=(m=a(/[|~*$^]?=/g))&&(i=a(this.entities.quoted)||a(/[\w-]+/g))?[g,m,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,m=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{k=h;h=m}},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{k=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,p)},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,m;if(d=a(this.operand)){for(;(i=a(/[\/*]/g))&&(g=a(this.operand));)m=new tree.Operation(i,[m||d,g]);return m||d}},addition:function(){var d,g,i,m;if(d=a(this.multiplication)){for(;(i=a(/[-+]\s+/g)||f.charAt(h-1)!=" "&&a(/[-+]/g))&&(g=a(this.multiplication));)m=new tree.Operation(i,[m||d,g]);return m||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(n){n=n<0?n+1:n>1?n-1:n;return n*6<1?k+(l-k)*n*6:n*2<1?l:n*3<2?k+(l-k)*(2/3-n)*6:k}b=(number(b)%360+360)%360/360;a=number(a);e=number(e);f=number(f);var l=e<=0.5?e*(a+1):e+a-e*a,k=e*2-l;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))}
|
||||
@ -32,12 +32,12 @@ if(typeof require!=="undefined")tree=require("less/tree");tree.Alpha=function(b)
|
||||
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),l,k=(f+h)/2,n=f-h;if(f===h)l=h=0;else{h=k>0.5?n/(2-f-h):n/(f+h);switch(f){case b:l=(a-e)/n+(a<e?6:0);break;case a:l=(e-b)/n+2;break;case e:l=(b-a)/n+4;break}l/=6}return{h:l*360,s:h,l:k}}};if(typeof require!=="undefined")tree=require("less/tree");tree.Comment=function(b){this.value=b};tree.Comment.prototype={toCSS:function(){return this.value}};if(typeof require!=="undefined")tree=require("less/tree");
|
||||
255,f=Math.max(b,a,e),h=Math.min(b,a,e),l,k=(f+h)/2,n=f-h;if(f===h)l=h=0;else{h=k>0.5?n/(2-f-h):n/(f+h);switch(f){case b:l=(a-e)/n+(a<e?6:0);break;case a:l=(e-b)/n+2;break;case e:l=(b-a)/n+4;break}l/=6}return{h:l*360,s:h,l:k}}};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+" {\n "+this.ruleset.toCSS(b,a).trim().replace(/\n/g,"\n ")+"\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(){return this.combinator.toCSS()+this.value};tree.Combinator=function(b){this.value=b===" "?" ":b?b.trim():""};
|
||||
tree.Combinator.prototype.toCSS=function(){switch(this.value){case "":return"";case " ":return" ";case "&":return"";case ":":return" :";case "::":return"::";case "+":return" + ";case "~":return" ~ ";case ">":return" > "}};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(" ")}};
|
||||
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};
|
||||
@ -46,21 +46,21 @@ tree.mixin.Call.prototype={eval:function(b){for(var a,e=[],f=false,h=0;h<b.frame
|
||||
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(){return this.variable?"":this.name+": "+this.value.toCSS()+";"};
|
||||
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(){return this.value.map(function(b){return b.toCSS()}).join(", ")}};tree.Shorthand=function(b,a){this.a=b;this.b=a};
|
||||
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 l=0;l<h.selectors.length;l++)if(b.match(h.selectors[l])){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=[],l=[];if(this.root){b=[];a={frames:[]};for(var k=0;k<this.rules.length;k++)this.rules[k]instanceof tree.Import&&Array.prototype.splice.apply(this.rules,[k,1].concat(this.rules[k].eval(a)))}else if(b.length===0)l=this.selectors.map(function(q){return[q]});else for(k=0;k<this.selectors.length;k++)for(var n=0;n<b.length;n++)l.push(b[n].concat([this.selectors[k]]));a.frames.unshift(this);for(k=0;k<this.rules.length;k++)this.rules[k]instanceof
|
||||
tree.mixin.Call&&Array.prototype.splice.apply(this.rules,[k,1].concat(this.rules[k].eval(a)));for(k=0;k<this.rules.length;k++){b=this.rules[k];if(b instanceof tree.Directive)h.push(b.eval(a).toCSS(l,a));else if(b.rules)h.push(b.toCSS(l,a));else if(b instanceof tree.Comment)this.root?h.push(b.toCSS()):f.push(b.toCSS());else if(b.toCSS&&!b.variable)f.push(b.eval(a).toCSS());else b.value&&!b.variable&&f.push(b.value.toString())}h=h.join("");if(this.root)e.push(f.join("\n"));else if(f.length>0){l=l.map(function(q){return q.map(function(s){return s.toCSS()}).join("").trim()}).join(l.length>
|
||||
3?",\n":", ");e.push(l," {\n "+f.join("\n ")+"\n}\n")}e.push(h);a.frames.shift();return e.join("")}};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(){if(this._css)return this._css;return this._css=this.elements.map(function(b){return typeof b==="string"?" "+b.trim():b.toCSS()}).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};
|
||||
return this._lookups[f]=e},toCSS:function(b,a){var e=[],f=[],h=[],l=[];if(this.root)for(var k=0;k<this.rules.length;k++)this.rules[k]instanceof tree.Import&&Array.prototype.splice.apply(this.rules,[k,1].concat(this.rules[k].eval(a)));else if(b.length===0)l=this.selectors.map(function(q){return[q]});else for(k=0;k<this.selectors.length;k++)for(var n=0;n<b.length;n++)l.push(b[n].concat([this.selectors[k]]));a.frames.unshift(this);for(k=0;k<this.rules.length;k++)this.rules[k]instanceof tree.mixin.Call&&
|
||||
Array.prototype.splice.apply(this.rules,[k,1].concat(this.rules[k].eval(a)));for(k=0;k<this.rules.length;k++){b=this.rules[k];if(b instanceof tree.Directive)h.push(b.eval(a).toCSS(l,a));else if(b.rules)h.push(b.toCSS(l,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){l=l.map(function(q){return q.map(function(t){return t.toCSS(a)}).join("").trim()}).join(a.compress?
|
||||
",":l.length>3?",\n":", ");e.push(l,(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")k("No selector method found");else return(document.querySelectorAll||jQuery).call(document,j)}function a(j){for(var o=0;o<q.length;o++)e(q[o],j)}function e(j,o){var p=typeof localStorage!=="undefined"&&localStorage.getItem(j.href),d=p&&JSON.parse(p);h(j.href,function(g,i){if(d&&(new Date(i)).valueOf()===(new Date(d.timestamp)).valueOf()){f(d.css,j);o(null,j,{local:true})}else(new less.Parser({optimization:3})).parse(g,
|
||||
function(m,r){if(m)return n(m,j.href);try{o(r,j,{local:false,lastModified:i})}catch(u){n(u,j.href)}})},function(g){throw new Error("Couldn't load "+j.href+" ("+g+")");})}function f(j,o,p){var d,g,i;g=o.title||o.href.match(/(?:^|\/)([-\w]+)\.[a-z]+$/i)[1];i="-less-"+g;if((d=document.getElementById(i))===null){d=document.createElement("style");d.type="text/css";d.media="screen";d.title=g;d.id=i;document.getElementsByTagName("head")[0].appendChild(d)}if(d.styleSheet)try{d.styleSheet.cssText=j}catch(m){throw new Error("Couldn't reassign styleSheet.cssText.");
|
||||
function(m,s){if(m)return n(m,j.href);try{o(s,j,{local:false,lastModified:i})}catch(w){n(w,j.href)}})},function(g){throw new Error("Couldn't load "+j.href+" ("+g+")");})}function f(j,o,p){var d,g,i;g=o.title||o.href.match(/(?:^|\/)([-\w]+)\.[a-z]+$/i)[1];i="-less-"+g;if((d=document.getElementById(i))===null){d=document.createElement("style");d.type="text/css";d.media="screen";d.title=g;d.id=i;document.getElementsByTagName("head")[0].appendChild(d)}if(d.styleSheet)try{d.styleSheet.cssText=j}catch(m){throw new Error("Couldn't reassign styleSheet.cssText.");
|
||||
}else{d.childNodes.length>0&&d.removeChild(d.childNodes[0]);d.appendChild(document.createTextNode(j))}p&&typeof localStorage!=="undefined"&&localStorage.setItem(o.href,JSON.stringify({timestamp:p,css:j}))}function h(j,o,p){var d=l();if(window.location.protocol==="file:"){d.open("GET",j,false);d.send(null);d.status===0?o(d.responseText):p(d.status)}else{d.open("GET",j,true);d.onreadystatechange=function(){if(d.readyState==4)if(d.status>=200&&d.status<300)o(d.responseText,d.getResponseHeader("Last-Modified"));
|
||||
else typeof p==="function"&&p(d.status)};d.send(null)}}function l(){if(window.XMLHttpRequest)return new XMLHttpRequest;else try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(j){k("less: browser doesn't support AJAX.");return null}}function k(j){less.env=="development"&&typeof console!=="undefined"&&console.log(j)}function n(j,o){if(!document.getElementById("less-error-message")){var p=document.createElement("div"),d;p.id="less-error-message";p.innerHTML="<h3>"+(j.message||"There is an error in your .less file")+
|
||||
'</h3><p><a href="'+o+'">'+o+"</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(g,i){return j.line+parseInt(i)}).replace(/\{(\d)\}/g,function(g,i){return j.extract[parseInt(i)]}).replace(/\{current\}/,j.extract[1].slice(0,j.column)+'<span class="error">'+j.extract[1].slice(j.column)+"</span>");f("#less-error-message span {margin-right: 15px;}#less-error-message pre {color: #ee4444;padding: 4px 0;margin: 0;}#less-error-message pre.ctx {color: #dd7777;}#less-error-message h3 {padding: 15px 0 5px 0;margin: 0;}#less-error-message a {color: #10a}#less-error-message .error {color: red;font-weight: bold;padding-bottom: 2px;border-bottom: 1px dashed red;}",
|
||||
{title:"error-message"});p.style.cssText="font-family: Arial, sans-serif;border: 1px solid #e00;background-color: #eee;border-radius: 5px;color: #e00;padding: 15px;margin-bottom: 15px";if(less.env=="development")d=setInterval(function(){if(document.body){document.body.insertBefore(p,document.body.childNodes[0]);clearInterval(d)}},10)}}var q=[];less.env=location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.protocol=="file:"?"development":"production";
|
||||
less.watch=function(){return this.watchMode=true};less.unwatch=function(){return this.watchMode=false};var s=setInterval(function(){if(document.body){q=b('link[rel="stylesheet/less"]');clearInterval(s);a(function(j,o,p){if(p.local)k("less: loading "+o.href+" from local storage.");else{f(j.toCSS(),o,p.lastModified);k("less: parsed "+o.href+" successfully.")}})}},10);if(less.env==="development"&&/!refresh/.test(location.hash))less.watchMode=true;if(less.env==="development")refreshTimer=setInterval(function(){less.watchMode&&
|
||||
less.watch=function(){return this.watchMode=true};less.unwatch=function(){return this.watchMode=false};var t=setInterval(function(){if(document.body){q=b('link[rel="stylesheet/less"]');clearInterval(t);a(function(j,o,p){if(p.local)k("less: loading "+o.href+" from local storage.");else{f(j.toCSS(),o,p.lastModified);k("less: parsed "+o.href+" successfully.")}})}},10);if(less.env==="development"&&/!refresh/.test(location.hash))less.watchMode=true;if(less.env==="development")refreshTimer=setInterval(function(){less.watchMode&&
|
||||
a(function(j,o,p){j&&f(j.toCSS(),o,p)})},1E3);less.Parser.importer=function(j,o,p){e({href:j,title:j},function(d){p(d)})}})();
|
Loading…
Reference in New Issue
Block a user