less 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/lib/less/functions.js +5 -0
- package/lib/less/index.js +1 -1
- package/lib/less/parser.js +2 -1
- package/lib/less/tree/call.js +12 -6
- package/package.json +1 -1
- package/test/css/functions.css +1 -0
- package/test/css/mixins.css +6 -0
- package/test/less/functions.less +1 -0
- package/test/less/mixins.less +7 -0
package/CHANGELOG.md
CHANGED
package/lib/less/functions.js
CHANGED
|
@@ -173,6 +173,11 @@ tree.functions = {
|
|
|
173
173
|
return this.desaturate(color, new(tree.Dimension)(100));
|
|
174
174
|
},
|
|
175
175
|
contrast: function (color, dark, light, threshold) {
|
|
176
|
+
// filter: contrast(3.2);
|
|
177
|
+
// should be kept as is, so check for color
|
|
178
|
+
if (!color.rgb) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
176
181
|
if (typeof light === 'undefined') {
|
|
177
182
|
light = this.rgba(255, 255, 255, 1.0);
|
|
178
183
|
}
|
package/lib/less/index.js
CHANGED
package/lib/less/parser.js
CHANGED
|
@@ -1085,7 +1085,7 @@ less.Parser = function Parser(env) {
|
|
|
1085
1085
|
// depreciated, will be removed soon
|
|
1086
1086
|
if ($('(')) {
|
|
1087
1087
|
sel = $(this.entity);
|
|
1088
|
-
|
|
1088
|
+
if (!$(')')) { return null; }
|
|
1089
1089
|
return new(tree.Selector)([new(tree.Element)('', sel, i)]);
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
@@ -1130,6 +1130,7 @@ less.Parser = function Parser(env) {
|
|
|
1130
1130
|
//
|
|
1131
1131
|
ruleset: function () {
|
|
1132
1132
|
var selectors = [], s, rules, match, debugInfo;
|
|
1133
|
+
|
|
1133
1134
|
save();
|
|
1134
1135
|
|
|
1135
1136
|
if (env.dumpLineNumbers)
|
package/lib/less/tree/call.js
CHANGED
|
@@ -14,7 +14,8 @@ tree.Call.prototype = {
|
|
|
14
14
|
// When evaluating a function call,
|
|
15
15
|
// we either find the function in `tree.functions` [1],
|
|
16
16
|
// in which case we call it, passing the evaluated arguments,
|
|
17
|
-
//
|
|
17
|
+
// if this returns null or we cannot find the function, we
|
|
18
|
+
// simply print it out as it appeared originally [2].
|
|
18
19
|
//
|
|
19
20
|
// The *functions.js* file contains the built-in functions.
|
|
20
21
|
//
|
|
@@ -23,21 +24,26 @@ tree.Call.prototype = {
|
|
|
23
24
|
// The function should receive the value, not the variable.
|
|
24
25
|
//
|
|
25
26
|
eval: function (env) {
|
|
26
|
-
var args = this.args.map(function (a) { return a.eval(env) })
|
|
27
|
+
var args = this.args.map(function (a) { return a.eval(env) }),
|
|
28
|
+
result;
|
|
27
29
|
|
|
28
30
|
if (this.name in tree.functions) { // 1.
|
|
29
31
|
try {
|
|
30
|
-
|
|
32
|
+
result = tree.functions[this.name].apply(tree.functions, args);
|
|
33
|
+
if (result != null) {
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
31
36
|
} catch (e) {
|
|
32
37
|
throw { type: e.type || "Runtime",
|
|
33
38
|
message: "error evaluating function `" + this.name + "`" +
|
|
34
39
|
(e.message ? ': ' + e.message : ''),
|
|
35
40
|
index: this.index, filename: this.filename };
|
|
36
41
|
}
|
|
37
|
-
} else { // 2.
|
|
38
|
-
return new(tree.Anonymous)(this.name +
|
|
39
|
-
"(" + args.map(function (a) { return a.toCSS(env) }).join(', ') + ")");
|
|
40
42
|
}
|
|
43
|
+
|
|
44
|
+
// 2.
|
|
45
|
+
return new(tree.Anonymous)(this.name +
|
|
46
|
+
"(" + args.map(function (a) { return a.toCSS(env) }).join(', ') + ")");
|
|
41
47
|
},
|
|
42
48
|
|
|
43
49
|
toCSS: function (env) {
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"keywords" : ["css", "parser", "lesscss", "browser"],
|
|
6
6
|
"author" : "Alexis Sellier <self@cloudhead.net>",
|
|
7
7
|
"contributors" : [],
|
|
8
|
-
"version" : "1.3.
|
|
8
|
+
"version" : "1.3.3",
|
|
9
9
|
"bin" : { "lessc": "./bin/lessc" },
|
|
10
10
|
"main" : "./lib/less/index",
|
|
11
11
|
"directories" : { "test": "./test" },
|
package/test/css/functions.css
CHANGED
package/test/css/mixins.css
CHANGED
package/test/less/functions.less
CHANGED
package/test/less/mixins.less
CHANGED