less 2.3.0 → 2.3.1
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/.idea/inspectionProfiles/Project_Default.xml +1 -0
- package/.idea/jsLinters/jscs.xml +4 -0
- package/.idea/jsLinters/jshint.xml +58 -4
- package/.idea/workspace.xml +427 -892
- package/.jscsrc +34 -2
- package/.jshintrc +0 -1
- package/CHANGELOG.md +7 -0
- package/bin/lessc +8 -3
- package/bower.json +1 -1
- package/dist/less.js +362 -245
- package/dist/less.min.js +5 -5
- package/lib/less/data/unit-conversions.js +3 -3
- package/lib/less/environment/abstract-file-manager.js +4 -4
- package/lib/less/functions/color-blending.js +3 -3
- package/lib/less/functions/color.js +7 -7
- package/lib/less/functions/data-uri.js +3 -2
- package/lib/less/functions/string.js +3 -1
- package/lib/less/functions/svg.js +6 -3
- package/lib/less/functions/types.js +3 -1
- package/lib/less/import-manager.js +4 -1
- package/lib/less/index.js +1 -1
- package/lib/less/parser/parser.js +12 -7
- package/lib/less/source-map-output.js +3 -3
- package/lib/less/transform-tree.js +1 -1
- package/lib/less/tree/condition.js +1 -1
- package/lib/less/tree/debug-info.js +6 -2
- package/lib/less/tree/dimension.js +1 -1
- package/lib/less/tree/directive.js +15 -3
- package/lib/less/tree/import.js +1 -1
- package/lib/less/tree/media.js +3 -2
- package/lib/less/tree/mixin-call.js +3 -4
- package/lib/less/tree/mixin-definition.js +4 -3
- package/lib/less/tree/quoted.js +1 -1
- package/lib/less/tree/rule.js +2 -3
- package/lib/less/tree/ruleset.js +223 -149
- package/lib/less/tree/selector.js +2 -1
- package/lib/less/tree/url.js +1 -1
- package/lib/less/tree/value.js +1 -1
- package/lib/less/tree/variable.js +1 -1
- package/lib/less/visitors/extend-visitor.js +30 -22
- package/lib/less/visitors/import-visitor.js +2 -1
- package/lib/less/visitors/to-css-visitor.js +5 -4
- package/lib/less-browser/utils.js +5 -5
- package/lib/less-node/file-manager.js +8 -4
- package/lib/less-node/url-file-manager.js +2 -2
- package/lib/less-rhino/index.js +2 -2
- package/package.json +3 -3
- package/test/browser/common.js +3 -3
- package/test/browser/jasmine-jsreporter.js +2 -2
- package/test/browser/less.js +29 -0
- package/test/copy-bom.js +14 -8
- package/test/css/selectors.css +9 -0
- package/test/index.js +1 -1
- package/test/less/selectors.less +18 -3
- package/test/less-bom/charsets.less +3 -0
- package/test/less-bom/colors.less +98 -0
- package/test/less-bom/comments.less +102 -0
- package/test/less-bom/comments2.less +20 -0
- package/test/less-bom/compression/compression.less +36 -0
- package/test/less-bom/css-3.less +154 -0
- package/test/less-bom/css-escapes.less +33 -0
- package/test/less-bom/css-guards.less +103 -0
- package/test/less-bom/css.less +108 -0
- package/test/less-bom/debug/import/test.less +25 -0
- package/test/less-bom/debug/linenumbers.less +33 -0
- package/test/less-bom/detached-rulesets.less +103 -0
- package/test/less-bom/empty.less +1 -0
- package/test/less-bom/errors/add-mixed-units.less +3 -0
- package/test/less-bom/errors/add-mixed-units.txt +4 -0
- package/test/less-bom/errors/add-mixed-units2.less +3 -0
- package/test/less-bom/errors/add-mixed-units2.txt +4 -0
- package/test/less-bom/errors/at-rules-undefined-var.less +4 -0
- package/test/less-bom/errors/at-rules-undefined-var.txt +4 -0
- package/test/less-bom/errors/bad-variable-declaration1.less +1 -0
- package/test/less-bom/errors/bad-variable-declaration1.txt +2 -0
- package/test/less-bom/errors/color-func-invalid-color.less +3 -0
- package/test/less-bom/errors/color-func-invalid-color.txt +4 -0
- package/test/less-bom/errors/color-invalid-hex-code.less +3 -0
- package/test/less-bom/errors/color-invalid-hex-code.txt +4 -0
- package/test/less-bom/errors/color-invalid-hex-code2.less +3 -0
- package/test/less-bom/errors/color-invalid-hex-code2.txt +4 -0
- package/test/less-bom/errors/css-guard-default-func.less +4 -0
- package/test/less-bom/errors/css-guard-default-func.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-1.less +6 -0
- package/test/less-bom/errors/detached-ruleset-1.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-2.less +6 -0
- package/test/less-bom/errors/detached-ruleset-2.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-3.less +4 -0
- package/test/less-bom/errors/detached-ruleset-3.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-4.less +5 -0
- package/test/less-bom/errors/detached-ruleset-4.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-5.less +4 -0
- package/test/less-bom/errors/detached-ruleset-5.txt +3 -0
- package/test/less-bom/errors/detached-ruleset-6.less +5 -0
- package/test/less-bom/errors/detached-ruleset-6.txt +4 -0
- package/test/less-bom/errors/divide-mixed-units.less +3 -0
- package/test/less-bom/errors/divide-mixed-units.txt +4 -0
- package/test/less-bom/errors/extend-no-selector.less +3 -0
- package/test/less-bom/errors/extend-no-selector.txt +3 -0
- package/test/less-bom/errors/extend-not-at-end.less +3 -0
- package/test/less-bom/errors/extend-not-at-end.txt +3 -0
- package/test/less-bom/errors/import-malformed.less +1 -0
- package/test/less-bom/errors/import-malformed.txt +3 -0
- package/test/less-bom/errors/import-missing.less +6 -0
- package/test/less-bom/errors/import-missing.txt +3 -0
- package/test/less-bom/errors/import-no-semi.less +1 -0
- package/test/less-bom/errors/import-no-semi.txt +2 -0
- package/test/less-bom/errors/import-subfolder1.less +1 -0
- package/test/less-bom/errors/import-subfolder1.txt +3 -0
- package/test/less-bom/errors/import-subfolder2.less +1 -0
- package/test/less-bom/errors/import-subfolder2.txt +4 -0
- package/test/less-bom/errors/imports/import-subfolder1.less +1 -0
- package/test/less-bom/errors/imports/import-subfolder2.less +1 -0
- package/test/less-bom/errors/imports/import-test.less +4 -0
- package/test/less-bom/errors/imports/subfolder/mixin-not-defined.less +1 -0
- package/test/less-bom/errors/imports/subfolder/parse-error-curly-bracket.less +1 -0
- package/test/less-bom/errors/javascript-error.less +3 -0
- package/test/less-bom/errors/javascript-error.txt +4 -0
- package/test/less-bom/errors/javascript-undefined-var.less +3 -0
- package/test/less-bom/errors/javascript-undefined-var.txt +4 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-1.less +6 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-1.txt +4 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-2.less +6 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-2.txt +4 -0
- package/test/less-bom/errors/mixin-not-defined.less +11 -0
- package/test/less-bom/errors/mixin-not-defined.txt +3 -0
- package/test/less-bom/errors/mixin-not-matched.less +6 -0
- package/test/less-bom/errors/mixin-not-matched.txt +3 -0
- package/test/less-bom/errors/mixin-not-matched2.less +6 -0
- package/test/less-bom/errors/mixin-not-matched2.txt +3 -0
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.less +9 -0
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.txt +4 -0
- package/test/less-bom/errors/mixins-guards-default-func-1.less +9 -0
- package/test/less-bom/errors/mixins-guards-default-func-1.txt +4 -0
- package/test/less-bom/errors/mixins-guards-default-func-2.less +9 -0
- package/test/less-bom/errors/mixins-guards-default-func-2.txt +4 -0
- package/test/less-bom/errors/mixins-guards-default-func-3.less +9 -0
- package/test/less-bom/errors/mixins-guards-default-func-3.txt +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors.less +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors.txt +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.less +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.txt +4 -0
- package/test/less-bom/errors/multiply-mixed-units.less +7 -0
- package/test/less-bom/errors/multiply-mixed-units.txt +4 -0
- package/test/less-bom/errors/parens-error-1.less +3 -0
- package/test/less-bom/errors/parens-error-1.txt +4 -0
- package/test/less-bom/errors/parens-error-2.less +3 -0
- package/test/less-bom/errors/parens-error-2.txt +4 -0
- package/test/less-bom/errors/parens-error-3.less +3 -0
- package/test/less-bom/errors/parens-error-3.txt +4 -0
- package/test/less-bom/errors/parse-error-curly-bracket.less +4 -0
- package/test/less-bom/errors/parse-error-curly-bracket.txt +4 -0
- package/test/less-bom/errors/parse-error-extra-parens.less +5 -0
- package/test/less-bom/errors/parse-error-extra-parens.txt +3 -0
- package/test/less-bom/errors/parse-error-missing-bracket.less +2 -0
- package/test/less-bom/errors/parse-error-missing-bracket.txt +3 -0
- package/test/less-bom/errors/parse-error-missing-parens.less +5 -0
- package/test/less-bom/errors/parse-error-missing-parens.txt +3 -0
- package/test/less-bom/errors/parse-error-with-import.less +13 -0
- package/test/less-bom/errors/parse-error-with-import.txt +4 -0
- package/test/less-bom/errors/percentage-missing-space.less +3 -0
- package/test/less-bom/errors/percentage-missing-space.txt +4 -0
- package/test/less-bom/errors/property-asterisk-only-name.less +3 -0
- package/test/less-bom/errors/property-asterisk-only-name.txt +4 -0
- package/test/less-bom/errors/property-ie5-hack.less +3 -0
- package/test/less-bom/errors/property-ie5-hack.txt +3 -0
- package/test/less-bom/errors/property-in-root.less +4 -0
- package/test/less-bom/errors/property-in-root.txt +4 -0
- package/test/less-bom/errors/property-in-root2.less +1 -0
- package/test/less-bom/errors/property-in-root2.txt +4 -0
- package/test/less-bom/errors/property-in-root3.less +4 -0
- package/test/less-bom/errors/property-in-root3.txt +3 -0
- package/test/less-bom/errors/property-interp-not-defined.less +1 -0
- package/test/less-bom/errors/property-interp-not-defined.txt +2 -0
- package/test/less-bom/errors/recursive-variable.less +1 -0
- package/test/less-bom/errors/recursive-variable.txt +2 -0
- package/test/less-bom/errors/single-character.less +1 -0
- package/test/less-bom/errors/single-character.txt +2 -0
- package/test/less-bom/errors/svg-gradient1.less +3 -0
- package/test/less-bom/errors/svg-gradient1.txt +4 -0
- package/test/less-bom/errors/svg-gradient2.less +3 -0
- package/test/less-bom/errors/svg-gradient2.txt +4 -0
- package/test/less-bom/errors/svg-gradient3.less +3 -0
- package/test/less-bom/errors/svg-gradient3.txt +4 -0
- package/test/less-bom/errors/unit-function.less +3 -0
- package/test/less-bom/errors/unit-function.txt +4 -0
- package/test/less-bom/extend-chaining.less +91 -0
- package/test/less-bom/extend-clearfix.less +19 -0
- package/test/less-bom/extend-exact.less +46 -0
- package/test/less-bom/extend-media.less +24 -0
- package/test/less-bom/extend-nest.less +65 -0
- package/test/less-bom/extend-selector.less +99 -0
- package/test/less-bom/extend.less +81 -0
- package/test/less-bom/extract-and-length.less +133 -0
- package/test/less-bom/functions.less +201 -0
- package/test/less-bom/globalVars/extended.json +5 -0
- package/test/less-bom/globalVars/extended.less +10 -0
- package/test/less-bom/globalVars/simple.json +3 -0
- package/test/less-bom/globalVars/simple.less +3 -0
- package/test/less-bom/ie-filters.less +15 -0
- package/test/less-bom/import/deeper/deeper-2/url-import-2.less +3 -0
- package/test/less-bom/import/deeper/deeper-2/url-import.less +1 -0
- package/test/less-bom/import/deeper/import-once-test-a.less +1 -0
- package/test/less-bom/import/deeper/url-import.less +1 -0
- package/test/less-bom/import/import-and-relative-paths-test.less +17 -0
- package/test/less-bom/import/import-charset-test.less +1 -0
- package/test/less-bom/import/import-interpolation.less +2 -0
- package/test/less-bom/import/import-interpolation2.less +5 -0
- package/test/less-bom/import/import-once-test-c.less +6 -0
- package/test/less-bom/import/import-reference.less +89 -0
- package/test/less-bom/import/import-test-a.less +4 -0
- package/test/less-bom/import/import-test-b.less +8 -0
- package/test/less-bom/import/import-test-c.less +6 -0
- package/test/less-bom/import/import-test-d.css +1 -0
- package/test/less-bom/import/import-test-e.less +2 -0
- package/test/less-bom/import/import-test-f.less +5 -0
- package/test/less-bom/import/imports/font.less +8 -0
- package/test/less-bom/import/imports/logo.less +5 -0
- package/test/less-bom/import/interpolation-vars.less +6 -0
- package/test/less-bom/import/invalid-css.less +1 -0
- package/test/less-bom/import/urls.less +1 -0
- package/test/less-bom/import-inline.less +3 -0
- package/test/less-bom/import-interpolation.less +8 -0
- package/test/less-bom/import-once.less +6 -0
- package/test/less-bom/import-reference.less +23 -0
- package/test/less-bom/import.less +30 -0
- package/test/less-bom/include-path/include-path.less +6 -0
- package/test/less-bom/javascript.less +38 -0
- package/test/less-bom/lazy-eval.less +6 -0
- package/test/less-bom/legacy/legacy.less +7 -0
- package/test/less-bom/media.less +234 -0
- package/test/less-bom/merge.less +78 -0
- package/test/less-bom/mixins-args.less +215 -0
- package/test/less-bom/mixins-closure.less +26 -0
- package/test/less-bom/mixins-guards-default-func.less +195 -0
- package/test/less-bom/mixins-guards.less +271 -0
- package/test/less-bom/mixins-important.less +37 -0
- package/test/less-bom/mixins-interpolated.less +75 -0
- package/test/less-bom/mixins-named-args.less +36 -0
- package/test/less-bom/mixins-nested.less +22 -0
- package/test/less-bom/mixins-pattern.less +102 -0
- package/test/less-bom/mixins.less +145 -0
- package/test/less-bom/modifyVars/extended.json +5 -0
- package/test/less-bom/modifyVars/extended.less +11 -0
- package/test/less-bom/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
- package/test/less-bom/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
- package/test/less-bom/no-js-errors/no-js-errors.less +3 -0
- package/test/less-bom/no-js-errors/no-js-errors.txt +4 -0
- package/test/less-bom/no-output.less +2 -0
- package/test/less-bom/operations.less +62 -0
- package/test/less-bom/parens.less +45 -0
- package/test/less-bom/property-name-interp.less +56 -0
- package/test/less-bom/rulesets.less +30 -0
- package/test/less-bom/scope.less +104 -0
- package/test/less-bom/selectors.less +174 -0
- package/test/less-bom/sourcemaps/basic.json +3 -0
- package/test/less-bom/sourcemaps/basic.less +27 -0
- package/test/less-bom/sourcemaps/imported.css +7 -0
- package/test/less-bom/static-urls/urls.less +33 -0
- package/test/less-bom/strict-units/strict-units.less +4 -0
- package/test/less-bom/strings.less +73 -0
- package/test/less-bom/url-args/urls.less +63 -0
- package/test/less-bom/urls.less +94 -0
- package/test/less-bom/variables-in-at-rules.less +20 -0
- package/test/less-bom/variables.less +119 -0
- package/test/less-bom/whitespace.less +44 -0
- package/test/less-test.js +2 -2
- package/test/modify-vars.js +6 -4
|
@@ -53,10 +53,10 @@ abstractFileManager.prototype.pathDiff = function pathDiff(url, baseUrl) {
|
|
|
53
53
|
}
|
|
54
54
|
baseUrlDirectories = baseUrlParts.directories.slice(i);
|
|
55
55
|
urlDirectories = urlParts.directories.slice(i);
|
|
56
|
-
for(i = 0; i < baseUrlDirectories.length-1; i++) {
|
|
56
|
+
for(i = 0; i < baseUrlDirectories.length - 1; i++) {
|
|
57
57
|
diff += "../";
|
|
58
58
|
}
|
|
59
|
-
for(i = 0; i < urlDirectories.length-1; i++) {
|
|
59
|
+
for(i = 0; i < urlDirectories.length - 1; i++) {
|
|
60
60
|
diff += urlDirectories[i] + "/";
|
|
61
61
|
}
|
|
62
62
|
return diff;
|
|
@@ -81,7 +81,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
|
|
|
81
81
|
if (baseUrl && (!urlParts[1] || urlParts[2])) {
|
|
82
82
|
baseUrlParts = baseUrl.match(urlPartsRegex);
|
|
83
83
|
if (!baseUrlParts) {
|
|
84
|
-
throw new Error("Could not parse page url - '"+baseUrl+"'");
|
|
84
|
+
throw new Error("Could not parse page url - '" + baseUrl + "'");
|
|
85
85
|
}
|
|
86
86
|
urlParts[1] = urlParts[1] || baseUrlParts[1] || "";
|
|
87
87
|
if (!urlParts[2]) {
|
|
@@ -102,7 +102,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
|
|
|
102
102
|
|
|
103
103
|
for(i = 0; i < directories.length; i++) {
|
|
104
104
|
if (directories[i] === ".." && i > 0) {
|
|
105
|
-
directories.splice(i-1, 2);
|
|
105
|
+
directories.splice(i - 1, 2);
|
|
106
106
|
i -= 2;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -33,9 +33,9 @@ var colorBlendModeFunctions = {
|
|
|
33
33
|
},
|
|
34
34
|
overlay: function(cb, cs) {
|
|
35
35
|
cb *= 2;
|
|
36
|
-
return (cb <= 1)
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
return (cb <= 1) ?
|
|
37
|
+
colorBlendModeFunctions.multiply(cb, cs) :
|
|
38
|
+
colorBlendModeFunctions.screen(cb - 1, cs);
|
|
39
39
|
},
|
|
40
40
|
softlight: function(cb, cs) {
|
|
41
41
|
var d = 1, e = cb;
|
|
@@ -47,7 +47,7 @@ colorFunctions = {
|
|
|
47
47
|
h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
|
|
48
48
|
if (h * 6 < 1) { return m1 + (m2 - m1) * h * 6; }
|
|
49
49
|
else if (h * 2 < 1) { return m2; }
|
|
50
|
-
else if (h * 3 < 2) { return m1 + (m2 - m1) * (2/3 - h) * 6; }
|
|
50
|
+
else if (h * 3 < 2) { return m1 + (m2 - m1) * (2 / 3 - h) * 6; }
|
|
51
51
|
else { return m1; }
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -57,9 +57,9 @@ colorFunctions = {
|
|
|
57
57
|
var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
|
|
58
58
|
var m1 = l * 2 - m2;
|
|
59
59
|
|
|
60
|
-
return colorFunctions.rgba(hue(h + 1/3) * 255,
|
|
60
|
+
return colorFunctions.rgba(hue(h + 1 / 3) * 255,
|
|
61
61
|
hue(h) * 255,
|
|
62
|
-
hue(h - 1/3) * 255,
|
|
62
|
+
hue(h - 1 / 3) * 255,
|
|
63
63
|
a);
|
|
64
64
|
},
|
|
65
65
|
|
|
@@ -127,9 +127,9 @@ colorFunctions = {
|
|
|
127
127
|
},
|
|
128
128
|
luminance: function (color) {
|
|
129
129
|
var luminance =
|
|
130
|
-
(0.2126 * color.rgb[0] / 255)
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
(0.2126 * color.rgb[0] / 255) +
|
|
131
|
+
(0.7152 * color.rgb[1] / 255) +
|
|
132
|
+
(0.0722 * color.rgb[2] / 255);
|
|
133
133
|
|
|
134
134
|
return new Dimension(luminance * color.alpha * 100, '%');
|
|
135
135
|
},
|
|
@@ -268,7 +268,7 @@ colorFunctions = {
|
|
|
268
268
|
};
|
|
269
269
|
},
|
|
270
270
|
tint: function(color, amount) {
|
|
271
|
-
return colorFunctions.mix(colorFunctions.rgb(255,255,255), color, amount);
|
|
271
|
+
return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount);
|
|
272
272
|
},
|
|
273
273
|
shade: function(color, amount) {
|
|
274
274
|
return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount);
|
|
@@ -22,7 +22,7 @@ module.exports = function(environment) {
|
|
|
22
22
|
|
|
23
23
|
var fragmentStart = filePath.indexOf('#');
|
|
24
24
|
var fragment = '';
|
|
25
|
-
if (fragmentStart
|
|
25
|
+
if (fragmentStart !== -1) {
|
|
26
26
|
fragment = filePath.slice(fragmentStart);
|
|
27
27
|
filePath = filePath.slice(0, fragmentStart);
|
|
28
28
|
}
|
|
@@ -73,7 +73,8 @@ module.exports = function(environment) {
|
|
|
73
73
|
if (uri.length >= DATA_URI_MAX) {
|
|
74
74
|
|
|
75
75
|
if (this.context.ieCompat !== false) {
|
|
76
|
-
logger.warn("Skipped data-uri embedding of " + filePath + " because its size (" + uri.length +
|
|
76
|
+
logger.warn("Skipped data-uri embedding of " + filePath + " because its size (" + uri.length +
|
|
77
|
+
" characters) exceeds IE8-safe " + DATA_URI_MAX + " characters!");
|
|
77
78
|
|
|
78
79
|
return fallback(this, filePathNode || mimetypeNode);
|
|
79
80
|
}
|
|
@@ -8,7 +8,9 @@ functionRegistry.addMultiple({
|
|
|
8
8
|
return new Anonymous(str instanceof JavaScript ? str.evaluated : str.value);
|
|
9
9
|
},
|
|
10
10
|
escape: function (str) {
|
|
11
|
-
return new Anonymous(
|
|
11
|
+
return new Anonymous(
|
|
12
|
+
encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B")
|
|
13
|
+
.replace(/\(/g, "%28").replace(/\)/g, "%29"));
|
|
12
14
|
},
|
|
13
15
|
replace: function (string, pattern, replacement, flags) {
|
|
14
16
|
var result = string.value;
|
|
@@ -9,7 +9,9 @@ module.exports = function(environment) {
|
|
|
9
9
|
functionRegistry.add("svg-gradient", function(direction) {
|
|
10
10
|
|
|
11
11
|
function throwArgumentDescriptor() {
|
|
12
|
-
throw { type: "Argument",
|
|
12
|
+
throw { type: "Argument",
|
|
13
|
+
message: "svg-gradient expects direction, start_color [start_position], [color position,]...," +
|
|
14
|
+
" end_color [end_position]" };
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
if (arguments.length < 3) {
|
|
@@ -44,7 +46,8 @@ module.exports = function(environment) {
|
|
|
44
46
|
rectangleDimension = 'x="-50" y="-50" width="101" height="101"';
|
|
45
47
|
break;
|
|
46
48
|
default:
|
|
47
|
-
throw { type: "Argument", message: "svg-gradient direction must be 'to bottom', 'to right',
|
|
49
|
+
throw { type: "Argument", message: "svg-gradient direction must be 'to bottom', 'to right'," +
|
|
50
|
+
" 'to bottom right', 'to top right' or 'ellipse at center'" };
|
|
48
51
|
}
|
|
49
52
|
returner = '<?xml version="1.0" ?>' +
|
|
50
53
|
'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">' +
|
|
@@ -59,7 +62,7 @@ module.exports = function(environment) {
|
|
|
59
62
|
position = undefined;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
if (!(color instanceof Color) || (!((i === 0 || i+1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {
|
|
65
|
+
if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {
|
|
63
66
|
throwArgumentDescriptor();
|
|
64
67
|
}
|
|
65
68
|
positionValue = position ? position.toCSS(renderEnv) : i === 0 ? "0%" : "100%";
|
|
@@ -52,7 +52,9 @@ functionRegistry.addMultiple({
|
|
|
52
52
|
isunit: isunit,
|
|
53
53
|
unit: function (val, unit) {
|
|
54
54
|
if(!(val instanceof Dimension)) {
|
|
55
|
-
throw { type: "Argument",
|
|
55
|
+
throw { type: "Argument",
|
|
56
|
+
message: "the first argument to unit must be a number" +
|
|
57
|
+
(val instanceof Operation ? ". Have you forgotten parenthesis?" : "") };
|
|
56
58
|
}
|
|
57
59
|
if (unit) {
|
|
58
60
|
if (unit instanceof Keyword) {
|
|
@@ -82,7 +82,10 @@ module.exports = function(environment) {
|
|
|
82
82
|
// then rootpath should become 'less/../'
|
|
83
83
|
newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);
|
|
84
84
|
if(newFileInfo.relativeUrls) {
|
|
85
|
-
newFileInfo.rootpath = fileManager.join(
|
|
85
|
+
newFileInfo.rootpath = fileManager.join(
|
|
86
|
+
(importManager.context.rootpath || ""),
|
|
87
|
+
fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
|
|
88
|
+
|
|
86
89
|
if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {
|
|
87
90
|
newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);
|
|
88
91
|
}
|
package/lib/less/index.js
CHANGED
|
@@ -2,7 +2,7 @@ module.exports = function(environment, fileManagers) {
|
|
|
2
2
|
var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
|
|
3
3
|
|
|
4
4
|
var less = {
|
|
5
|
-
version: [2, 3,
|
|
5
|
+
version: [2, 3, 1],
|
|
6
6
|
data: require('./data'),
|
|
7
7
|
tree: require('./tree'),
|
|
8
8
|
Environment: (Environment = require("./environment/environment")),
|
|
@@ -204,7 +204,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
204
204
|
// Ruleset (Selector '.class', [
|
|
205
205
|
// Rule ("color", Value ([Expression [Color #fff]]))
|
|
206
206
|
// Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]]))
|
|
207
|
-
// Rule ("width", Value ([Expression [Operation "+" [Variable "@w"][Dimension 4px]]]))
|
|
207
|
+
// Rule ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]]))
|
|
208
208
|
// Ruleset (Selector [Element '>', '.child'], [...])
|
|
209
209
|
// ])
|
|
210
210
|
//
|
|
@@ -454,7 +454,9 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
454
454
|
var rgb;
|
|
455
455
|
|
|
456
456
|
if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))) {
|
|
457
|
-
|
|
457
|
+
// strip colons, brackets, whitespaces and other characters that should not
|
|
458
|
+
// definitely be part of color string
|
|
459
|
+
var colorCandidateString = rgb.input.match(/^#([\w]+).*/);
|
|
458
460
|
colorCandidateString = colorCandidateString[1];
|
|
459
461
|
if (!colorCandidateString.match(/^[A-Fa-f0-9]+$/)) { // verify if candidate consists only of allowed HEX characters
|
|
460
462
|
error("Invalid HEX color code");
|
|
@@ -550,8 +552,9 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
550
552
|
}
|
|
551
553
|
|
|
552
554
|
option = option && option[1];
|
|
553
|
-
if (!elements)
|
|
555
|
+
if (!elements) {
|
|
554
556
|
error("Missing target selector for :extend().");
|
|
557
|
+
}
|
|
555
558
|
extend = new(tree.Extend)(new(tree.Selector)(elements), option, index);
|
|
556
559
|
if (extendList) { extendList.push(extend); } else { extendList = [ extend ]; }
|
|
557
560
|
|
|
@@ -861,8 +864,10 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
861
864
|
|
|
862
865
|
c = this.combinator();
|
|
863
866
|
|
|
864
|
-
e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) ||
|
|
865
|
-
parserInput.$
|
|
867
|
+
e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) ||
|
|
868
|
+
parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) ||
|
|
869
|
+
parserInput.$char('*') || parserInput.$char('&') || this.attribute() ||
|
|
870
|
+
parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[\.#:](?=@)/) ||
|
|
866
871
|
this.entities.variableCurly();
|
|
867
872
|
|
|
868
873
|
if (! e) {
|
|
@@ -1606,8 +1611,8 @@ Parser.serializeVars = function(vars) {
|
|
|
1606
1611
|
for (var name in vars) {
|
|
1607
1612
|
if (Object.hasOwnProperty.call(vars, name)) {
|
|
1608
1613
|
var value = vars[name];
|
|
1609
|
-
s += ((name[0] === '@') ? '' : '@') + name +': '+ value +
|
|
1610
|
-
(((
|
|
1614
|
+
s += ((name[0] === '@') ? '' : '@') + name + ': ' + value +
|
|
1615
|
+
((String(value).slice(-1) === ';') ? '' : ';');
|
|
1611
1616
|
}
|
|
1612
1617
|
}
|
|
1613
1618
|
|
|
@@ -15,7 +15,7 @@ module.exports = function (environment) {
|
|
|
15
15
|
}
|
|
16
16
|
if (options.sourceMapRootpath) {
|
|
17
17
|
this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/');
|
|
18
|
-
if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1) !== '/') {
|
|
18
|
+
if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') {
|
|
19
19
|
this._sourceMapRootpath += '/';
|
|
20
20
|
}
|
|
21
21
|
} else {
|
|
@@ -66,11 +66,11 @@ module.exports = function (environment) {
|
|
|
66
66
|
}
|
|
67
67
|
inputSource = inputSource.substring(0, index);
|
|
68
68
|
sourceLines = inputSource.split("\n");
|
|
69
|
-
sourceColumns = sourceLines[sourceLines.length-1];
|
|
69
|
+
sourceColumns = sourceLines[sourceLines.length - 1];
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
lines = chunk.split("\n");
|
|
73
|
-
columns = lines[lines.length-1];
|
|
73
|
+
columns = lines[lines.length - 1];
|
|
74
74
|
|
|
75
75
|
if (fileInfo) {
|
|
76
76
|
if (!mapLines) {
|
|
@@ -45,7 +45,7 @@ module.exports = function(root, options) {
|
|
|
45
45
|
|
|
46
46
|
if (options.pluginManager) {
|
|
47
47
|
var pluginVisitors = options.pluginManager.getVisitors();
|
|
48
|
-
for(i =0; i < pluginVisitors.length; i++) {
|
|
48
|
+
for(i = 0; i < pluginVisitors.length; i++) {
|
|
49
49
|
var pluginVisitor = pluginVisitors[i];
|
|
50
50
|
if (pluginVisitor.isPreEvalVisitor) {
|
|
51
51
|
preEvalVisitors.push(pluginVisitor);
|
|
@@ -26,7 +26,7 @@ Condition.prototype.eval = function (context) {
|
|
|
26
26
|
default: return false;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
})
|
|
29
|
+
})(this.op, this.lvalue.eval(context), this.rvalue.eval(context));
|
|
30
30
|
|
|
31
31
|
return this.negate ? !result : result;
|
|
32
32
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var debugInfo = function(context, ctx, lineSeparator) {
|
|
2
|
-
var result="";
|
|
2
|
+
var result = "";
|
|
3
3
|
if (context.dumpLineNumbers && !context.compress) {
|
|
4
4
|
switch(context.dumpLineNumbers) {
|
|
5
5
|
case 'comments':
|
|
@@ -21,8 +21,12 @@ debugInfo.asComment = function(ctx) {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
debugInfo.asMediaQuery = function(ctx) {
|
|
24
|
+
var filenameWithProtocol = ctx.debugInfo.fileName;
|
|
25
|
+
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
|
|
26
|
+
filenameWithProtocol = 'file://' + filenameWithProtocol;
|
|
27
|
+
}
|
|
24
28
|
return '@media -sass-debug-info{filename{font-family:' +
|
|
25
|
-
|
|
29
|
+
filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
|
|
26
30
|
if (a == '\\') {
|
|
27
31
|
a = '\/';
|
|
28
32
|
}
|
|
@@ -25,7 +25,7 @@ Dimension.prototype.toColor = function () {
|
|
|
25
25
|
};
|
|
26
26
|
Dimension.prototype.genCSS = function (context, output) {
|
|
27
27
|
if ((context && context.strictUnits) && !this.unit.isSingular()) {
|
|
28
|
-
throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());
|
|
28
|
+
throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString());
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var value = this.fround(context, this.value),
|
|
@@ -59,9 +59,21 @@ Directive.prototype.eval = function (context) {
|
|
|
59
59
|
return new Directive(this.name, value, rules,
|
|
60
60
|
this.index, this.currentFileInfo, this.debugInfo, this.isReferenced);
|
|
61
61
|
};
|
|
62
|
-
Directive.prototype.variable = function (name) {
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
Directive.prototype.variable = function (name) {
|
|
63
|
+
if (this.rules) {
|
|
64
|
+
return Ruleset.prototype.variable.call(this.rules, name);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
Directive.prototype.find = function () {
|
|
68
|
+
if (this.rules) {
|
|
69
|
+
return Ruleset.prototype.find.apply(this.rules, arguments);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
Directive.prototype.rulesets = function () {
|
|
73
|
+
if (this.rules) {
|
|
74
|
+
return Ruleset.prototype.rulesets.apply(this.rules);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
65
77
|
Directive.prototype.markReferenced = function () {
|
|
66
78
|
var i, rules;
|
|
67
79
|
this.isReferenced = true;
|
package/lib/less/tree/import.js
CHANGED
|
@@ -100,7 +100,7 @@ Import.prototype.evalPath = function (context) {
|
|
|
100
100
|
var pathValue = path.value;
|
|
101
101
|
// Add the base path if the import is relative
|
|
102
102
|
if (pathValue && context.isPathRelative(pathValue)) {
|
|
103
|
-
path.value = rootpath +pathValue;
|
|
103
|
+
path.value = rootpath + pathValue;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
path.value = context.normalizePath(path.value);
|
package/lib/less/tree/media.js
CHANGED
|
@@ -154,8 +154,9 @@ Media.prototype.permute = function (arr) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
Media.prototype.bubbleSelectors = function (selectors) {
|
|
157
|
-
if (!selectors)
|
|
158
|
-
|
|
157
|
+
if (!selectors) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
159
160
|
this.rules = [new Ruleset(selectors.slice(0), [this.rules[0]])];
|
|
160
161
|
};
|
|
161
162
|
module.exports = Media;
|
|
@@ -22,7 +22,7 @@ MixinCall.prototype.accept = function (visitor) {
|
|
|
22
22
|
};
|
|
23
23
|
MixinCall.prototype.eval = function (context) {
|
|
24
24
|
var mixins, mixin, mixinPath, args, rules = [], match = false, i, m, f, isRecursive, isOneFound, rule,
|
|
25
|
-
candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase
|
|
25
|
+
candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase = -1,
|
|
26
26
|
defNone = 0, defTrue = 1, defFalse = 2, count, originalRuleset, noArgumentsFilter;
|
|
27
27
|
|
|
28
28
|
function calcDefGroup(mixin, mixinPath) {
|
|
@@ -84,7 +84,7 @@ MixinCall.prototype.eval = function (context) {
|
|
|
84
84
|
if (mixin.matchArgs(args, context)) {
|
|
85
85
|
candidate = {mixin: mixin, group: calcDefGroup(mixin, mixinPath)};
|
|
86
86
|
|
|
87
|
-
if (candidate.group!==defFalseEitherCase) {
|
|
87
|
+
if (candidate.group !== defFalseEitherCase) {
|
|
88
88
|
candidates.push(candidate);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -105,8 +105,7 @@ MixinCall.prototype.eval = function (context) {
|
|
|
105
105
|
defaultResult = defTrue;
|
|
106
106
|
if ((count[defTrue] + count[defFalse]) > 1) {
|
|
107
107
|
throw { type: 'Runtime',
|
|
108
|
-
message: 'Ambiguous use of `default()` found when matching for `'
|
|
109
|
-
+ this.format(args) + '`',
|
|
108
|
+
message: 'Ambiguous use of `default()` found when matching for `' + this.format(args) + '`',
|
|
110
109
|
index: this.index, filename: this.currentFileInfo.filename };
|
|
111
110
|
}
|
|
112
111
|
}
|
|
@@ -132,9 +132,10 @@ Definition.prototype.evalCall = function (context, args, important) {
|
|
|
132
132
|
Definition.prototype.matchCondition = function (args, context) {
|
|
133
133
|
if (this.condition && !this.condition.eval(
|
|
134
134
|
new contexts.Eval(context,
|
|
135
|
-
[this.evalParams(context,
|
|
136
|
-
.
|
|
137
|
-
|
|
135
|
+
[this.evalParams(context, /* the parameter variables*/
|
|
136
|
+
new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]
|
|
137
|
+
.concat(this.frames) // the parent namespace/mixin frames
|
|
138
|
+
.concat(context.frames)))) { // the current environment frames
|
|
138
139
|
return false;
|
|
139
140
|
}
|
|
140
141
|
return true;
|
package/lib/less/tree/quoted.js
CHANGED
|
@@ -37,7 +37,7 @@ Quoted.prototype.eval = function (context) {
|
|
|
37
37
|
do {
|
|
38
38
|
value = evaluatedValue;
|
|
39
39
|
evaluatedValue = value.replace(regexp, replacementFnc);
|
|
40
|
-
} while (value!==evaluatedValue);
|
|
40
|
+
} while (value !== evaluatedValue);
|
|
41
41
|
return evaluatedValue;
|
|
42
42
|
}
|
|
43
43
|
value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement);
|
package/lib/less/tree/rule.js
CHANGED
|
@@ -42,9 +42,8 @@ Rule.prototype.eval = function (context) {
|
|
|
42
42
|
if (typeof name !== "string") {
|
|
43
43
|
// expand 'primitive' name directly to get
|
|
44
44
|
// things faster (~10% for benchmark.less):
|
|
45
|
-
name = (name.length === 1)
|
|
46
|
-
|
|
47
|
-
? name[0].value : evalName(context, name);
|
|
45
|
+
name = (name.length === 1) && (name[0] instanceof Keyword) ?
|
|
46
|
+
name[0].value : evalName(context, name);
|
|
48
47
|
variable = false; // never treat expanded interpolation as new variable name
|
|
49
48
|
}
|
|
50
49
|
if (name === "font" && !context.strictMath) {
|