less 3.13.1 → 4.1.0
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/Gruntfile.js +1 -1
- package/bin/lessc +14 -3
- package/dist/less.js +11156 -11157
- package/dist/less.min.js +3 -3
- package/dist/less.min.js.map +1 -1
- package/lib/less/constants.js +2 -2
- package/lib/less/constants.js.map +1 -1
- package/lib/less/contexts.js +88 -110
- package/lib/less/contexts.js.map +1 -1
- package/lib/less/data/index.js +3 -5
- package/lib/less/data/index.js.map +1 -1
- package/lib/less/default-options.js +57 -53
- package/lib/less/default-options.js.map +1 -1
- package/lib/less/environment/abstract-file-manager.js +6 -6
- package/lib/less/environment/abstract-file-manager.js.map +1 -1
- package/lib/less/environment/abstract-plugin-loader.js +7 -13
- package/lib/less/environment/abstract-plugin-loader.js.map +1 -1
- package/lib/less/environment/environment.js +9 -11
- package/lib/less/environment/environment.js.map +1 -1
- package/lib/less/functions/boolean.js +14 -6
- package/lib/less/functions/boolean.js.map +1 -1
- package/lib/less/functions/color-blending.js +2 -4
- package/lib/less/functions/color-blending.js.map +1 -1
- package/lib/less/functions/color.js +41 -9
- package/lib/less/functions/color.js.map +1 -1
- package/lib/less/functions/data-uri.js +5 -26
- package/lib/less/functions/data-uri.js.map +1 -1
- package/lib/less/functions/default.js +2 -4
- package/lib/less/functions/default.js.map +1 -1
- package/lib/less/functions/function-caller.js +19 -35
- package/lib/less/functions/function-caller.js.map +1 -1
- package/lib/less/functions/index.js +14 -16
- package/lib/less/functions/index.js.map +1 -1
- package/lib/less/functions/list.js +21 -12
- package/lib/less/functions/list.js.map +1 -1
- package/lib/less/functions/math-helper.js +2 -4
- package/lib/less/functions/math-helper.js.map +1 -1
- package/lib/less/functions/math.js +2 -4
- package/lib/less/functions/math.js.map +1 -1
- package/lib/less/functions/number.js +12 -8
- package/lib/less/functions/number.js.map +1 -1
- package/lib/less/functions/string.js +4 -6
- package/lib/less/functions/string.js.map +1 -1
- package/lib/less/functions/svg.js +6 -8
- package/lib/less/functions/svg.js.map +1 -1
- package/lib/less/functions/types.js +9 -11
- package/lib/less/functions/types.js.map +1 -1
- package/lib/less/import-manager.js +6 -27
- package/lib/less/import-manager.js.map +1 -1
- package/lib/less/index.js +48 -82
- package/lib/less/index.js.map +1 -1
- package/lib/less/less-error.js +6 -24
- package/lib/less/less-error.js.map +1 -1
- package/lib/less/parse-tree.js +8 -8
- package/lib/less/parse-tree.js.map +1 -1
- package/lib/less/parse.js +11 -31
- package/lib/less/parse.js.map +1 -1
- package/lib/less/parser/chunker.js +4 -2
- package/lib/less/parser/chunker.js.map +1 -1
- package/lib/less/parser/parser-input.js +2 -4
- package/lib/less/parser/parser-input.js.map +1 -1
- package/lib/less/parser/parser.js +8 -29
- package/lib/less/parser/parser.js.map +1 -1
- package/lib/less/plugin-manager.js +2 -3
- package/lib/less/plugin-manager.js.map +1 -1
- package/lib/less/render.js +6 -22
- package/lib/less/render.js.map +1 -1
- package/lib/less/source-map-builder.js +4 -2
- package/lib/less/source-map-builder.js.map +1 -1
- package/lib/less/source-map-output.js +5 -7
- package/lib/less/source-map-output.js.map +1 -1
- package/lib/less/transform-tree.js +9 -9
- package/lib/less/transform-tree.js.map +1 -1
- package/lib/less/tree/anonymous.js +19 -20
- package/lib/less/tree/anonymous.js.map +1 -1
- package/lib/less/tree/assignment.js +22 -23
- package/lib/less/tree/assignment.js.map +1 -1
- package/lib/less/tree/atrule.js +105 -116
- package/lib/less/tree/atrule.js.map +1 -1
- package/lib/less/tree/attribute.js +18 -19
- package/lib/less/tree/attribute.js.map +1 -1
- package/lib/less/tree/call.js +68 -69
- package/lib/less/tree/call.js.map +1 -1
- package/lib/less/tree/color.js +163 -172
- package/lib/less/tree/color.js.map +1 -1
- package/lib/less/tree/combinator.js +9 -10
- package/lib/less/tree/combinator.js.map +1 -1
- package/lib/less/tree/comment.js +15 -16
- package/lib/less/tree/comment.js.map +1 -1
- package/lib/less/tree/condition.js +29 -30
- package/lib/less/tree/condition.js.map +1 -1
- package/lib/less/tree/debug-info.js +32 -30
- package/lib/less/tree/debug-info.js.map +1 -1
- package/lib/less/tree/declaration.js +71 -95
- package/lib/less/tree/declaration.js.map +1 -1
- package/lib/less/tree/detached-ruleset.js +18 -38
- package/lib/less/tree/detached-ruleset.js.map +1 -1
- package/lib/less/tree/dimension.js +126 -129
- package/lib/less/tree/dimension.js.map +1 -1
- package/lib/less/tree/element.js +40 -41
- package/lib/less/tree/element.js.map +1 -1
- package/lib/less/tree/expression.js +55 -74
- package/lib/less/tree/expression.js.map +1 -1
- package/lib/less/tree/extend.js +28 -34
- package/lib/less/tree/extend.js.map +1 -1
- package/lib/less/tree/import.js +120 -140
- package/lib/less/tree/import.js.map +1 -1
- package/lib/less/tree/index.js +37 -39
- package/lib/less/tree/index.js.map +1 -1
- package/lib/less/tree/javascript.js +23 -24
- package/lib/less/tree/javascript.js.map +1 -1
- package/lib/less/tree/js-eval-node.js +51 -50
- package/lib/less/tree/js-eval-node.js.map +1 -1
- package/lib/less/tree/keyword.js +10 -11
- package/lib/less/tree/keyword.js.map +1 -1
- package/lib/less/tree/media.js +111 -131
- package/lib/less/tree/media.js.map +1 -1
- package/lib/less/tree/mixin-call.js +156 -160
- package/lib/less/tree/mixin-call.js.map +1 -1
- package/lib/less/tree/mixin-definition.js +164 -184
- package/lib/less/tree/mixin-definition.js.map +1 -1
- package/lib/less/tree/namespace-value.js +53 -57
- package/lib/less/tree/namespace-value.js.map +1 -1
- package/lib/less/tree/negative.js +16 -17
- package/lib/less/tree/negative.js.map +1 -1
- package/lib/less/tree/node.js +39 -39
- package/lib/less/tree/node.js.map +1 -1
- package/lib/less/tree/operation.js +41 -63
- package/lib/less/tree/operation.js.map +1 -1
- package/lib/less/tree/paren.js +13 -14
- package/lib/less/tree/paren.js.map +1 -1
- package/lib/less/tree/property.js +48 -49
- package/lib/less/tree/property.js.map +1 -1
- package/lib/less/tree/quoted.js +50 -51
- package/lib/less/tree/quoted.js.map +1 -1
- package/lib/less/tree/ruleset.js +665 -702
- package/lib/less/tree/ruleset.js.map +1 -1
- package/lib/less/tree/selector.js +105 -106
- package/lib/less/tree/selector.js.map +1 -1
- package/lib/less/tree/unicode-descriptor.js +5 -6
- package/lib/less/tree/unicode-descriptor.js.map +1 -1
- package/lib/less/tree/unit.js +99 -120
- package/lib/less/tree/unit.js.map +1 -1
- package/lib/less/tree/url.js +44 -45
- package/lib/less/tree/url.js.map +1 -1
- package/lib/less/tree/value.js +27 -26
- package/lib/less/tree/value.js.map +1 -1
- package/lib/less/tree/variable-call.js +30 -31
- package/lib/less/tree/variable-call.js.map +1 -1
- package/lib/less/tree/variable.js +46 -48
- package/lib/less/tree/variable.js.map +1 -1
- package/lib/less/utils.js +5 -23
- package/lib/less/utils.js.map +1 -1
- package/lib/less/visitors/extend-visitor.js +14 -41
- package/lib/less/visitors/extend-visitor.js.map +1 -1
- package/lib/less/visitors/import-sequencer.js +2 -7
- package/lib/less/visitors/import-sequencer.js.map +1 -1
- package/lib/less/visitors/import-visitor.js +7 -33
- package/lib/less/visitors/import-visitor.js.map +1 -1
- package/lib/less/visitors/index.js +7 -9
- package/lib/less/visitors/index.js.map +1 -1
- package/lib/less/visitors/join-selector-visitor.js +2 -4
- package/lib/less/visitors/join-selector-visitor.js.map +1 -1
- package/lib/less/visitors/to-css-visitor.js +4 -6
- package/lib/less/visitors/to-css-visitor.js.map +1 -1
- package/lib/less/visitors/visitor.js +4 -12
- package/lib/less/visitors/visitor.js.map +1 -1
- package/lib/less-browser/add-default-options.js +2 -4
- package/lib/less-browser/add-default-options.js.map +1 -1
- package/lib/less-browser/bootstrap.js +4 -6
- package/lib/less-browser/bootstrap.js.map +1 -1
- package/lib/less-browser/browser.js +2 -20
- package/lib/less-browser/browser.js.map +1 -1
- package/lib/less-browser/error-reporting.js +3 -24
- package/lib/less-browser/error-reporting.js.map +1 -1
- package/lib/less-browser/file-manager.js +17 -36
- package/lib/less-browser/file-manager.js.map +1 -1
- package/lib/less-browser/image-size.js +2 -4
- package/lib/less-browser/image-size.js.map +1 -1
- package/lib/less-browser/index.js +9 -11
- package/lib/less-browser/index.js.map +1 -1
- package/lib/less-browser/plugin-loader.js +10 -29
- package/lib/less-browser/plugin-loader.js.map +1 -1
- package/lib/less-node/file-manager.js +15 -34
- package/lib/less-node/file-manager.js.map +1 -1
- package/lib/less-node/image-size.js +4 -6
- package/lib/less-node/image-size.js.map +1 -1
- package/lib/less-node/index.js +10 -16
- package/lib/less-node/index.js.map +1 -1
- package/lib/less-node/plugin-loader.js +23 -42
- package/lib/less-node/plugin-loader.js.map +1 -1
- package/lib/less-node/url-file-manager.js +23 -38
- package/lib/less-node/url-file-manager.js.map +1 -1
- package/package.json +12 -9
- package/test/browser/less/errors/image-height-error.txt +1 -1
- package/test/browser/less/errors/image-size-error.txt +1 -1
- package/test/browser/less/errors/image-width-error.txt +1 -1
- package/test/index.js +28 -9
- package/test/less-test.js +36 -16
- package/tsconfig.json +1 -0
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var debugInfo = function (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
var debugInfo = /** @class */ (function () {
|
|
4
|
+
function debugInfo(context, ctx, lineSeparator) {
|
|
5
|
+
var result = '';
|
|
6
|
+
if (context.dumpLineNumbers && !context.compress) {
|
|
7
|
+
switch (context.dumpLineNumbers) {
|
|
8
|
+
case 'comments':
|
|
9
|
+
result = debugInfo.asComment(ctx);
|
|
10
|
+
break;
|
|
11
|
+
case 'mediaquery':
|
|
12
|
+
result = debugInfo.asMediaQuery(ctx);
|
|
13
|
+
break;
|
|
14
|
+
case 'all':
|
|
15
|
+
result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
16
18
|
}
|
|
19
|
+
return result;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
debugInfo.asMediaQuery = function (ctx) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var filenameWithProtocol = ctx.debugInfo.fileName;
|
|
26
|
-
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
|
|
27
|
-
filenameWithProtocol = "file://" + filenameWithProtocol;
|
|
28
|
-
}
|
|
29
|
-
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
|
|
30
|
-
if (a == '\\') {
|
|
31
|
-
a = '\/';
|
|
21
|
+
debugInfo.asComment = function (ctx) {
|
|
22
|
+
return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n";
|
|
23
|
+
};
|
|
24
|
+
debugInfo.asMediaQuery = function (ctx) {
|
|
25
|
+
var filenameWithProtocol = ctx.debugInfo.fileName;
|
|
26
|
+
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
|
|
27
|
+
filenameWithProtocol = "file://" + filenameWithProtocol;
|
|
32
28
|
}
|
|
33
|
-
return "
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
|
|
30
|
+
if (a == '\\') {
|
|
31
|
+
a = '\/';
|
|
32
|
+
}
|
|
33
|
+
return "\\" + a;
|
|
34
|
+
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
|
|
35
|
+
};
|
|
36
|
+
return debugInfo;
|
|
37
|
+
}());
|
|
36
38
|
exports.default = debugInfo;
|
|
37
39
|
//# sourceMappingURL=debug-info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-info.js","sourceRoot":"","sources":["../../../src/less/tree/debug-info.js"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"debug-info.js","sourceRoot":"","sources":["../../../src/less/tree/debug-info.js"],"names":[],"mappings":";;AAAA;IACI,mBAAY,OAAO,EAAE,GAAG,EAAE,aAAa;QACnC,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,OAAO,CAAC,eAAe,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC9C,QAAQ,OAAO,CAAC,eAAe,EAAE;gBAC7B,KAAK,UAAU;oBACX,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;oBAClC,MAAM;gBACV,KAAK,YAAY;oBACb,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;oBACrC,MAAM;gBACV,KAAK,KAAK;oBACN,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;oBACxF,MAAM;aACb;SACJ;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,mBAAS,GAAhB,UAAiB,GAAG;QAChB,OAAO,aAAW,GAAG,CAAC,SAAS,CAAC,UAAU,UAAK,GAAG,CAAC,SAAS,CAAC,QAAQ,UAAO,CAAC;IACjF,CAAC;IAEM,sBAAY,GAAnB,UAAoB,GAAG;QACnB,IAAI,oBAAoB,GAAG,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC;QAClD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE;YAC7C,oBAAoB,GAAG,YAAU,oBAAsB,CAAC;SAC3D;QACD,OAAO,kDAAgD,oBAAoB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC;YAC1G,IAAI,CAAC,IAAI,IAAI,EAAE;gBACX,CAAC,GAAG,IAAI,CAAC;aACZ;YACD,OAAO,OAAK,CAAG,CAAC;QACpB,CAAC,CAAC,iCAA4B,GAAG,CAAC,SAAS,CAAC,UAAU,SAAM,CAAC;IACjE,CAAC;IACL,gBAAC;AAAD,CAAC,AAnCD,IAmCC;AAED,kBAAe,SAAS,CAAC","sourcesContent":["class debugInfo {\n constructor(context, ctx, lineSeparator) {\n let result = '';\n if (context.dumpLineNumbers && !context.compress) {\n switch (context.dumpLineNumbers) {\n case 'comments':\n result = debugInfo.asComment(ctx);\n break;\n case 'mediaquery':\n result = debugInfo.asMediaQuery(ctx);\n break;\n case 'all':\n result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);\n break;\n }\n }\n return result;\n }\n\n static asComment(ctx) {\n return `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\\n`;\n }\n\n static asMediaQuery(ctx) {\n let filenameWithProtocol = ctx.debugInfo.fileName;\n if (!/^[a-z]+:\\/\\//i.test(filenameWithProtocol)) {\n filenameWithProtocol = `file://${filenameWithProtocol}`;\n }\n return `@media -sass-debug-info{filename{font-family:${filenameWithProtocol.replace(/([.:\\/\\\\])/g, function (a) {\n if (a == '\\\\') {\n a = '\\/';\n }\n return `\\\\${a}`;\n })}}line{font-family:\\\\00003${ctx.debugInfo.lineNumber}}}\\n`;\n }\n}\n\nexport default debugInfo;\n"]}
|
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var value_1 = tslib_1.__importDefault(require("./value"));
|
|
6
|
+
var keyword_1 = tslib_1.__importDefault(require("./keyword"));
|
|
7
|
+
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
|
|
8
|
+
var Constants = tslib_1.__importStar(require("../constants"));
|
|
30
9
|
var MATH = Constants.Math;
|
|
10
|
+
function evalName(context, name) {
|
|
11
|
+
var value = '';
|
|
12
|
+
var i;
|
|
13
|
+
var n = name.length;
|
|
14
|
+
var output = { add: function (s) { value += s; } };
|
|
15
|
+
for (i = 0; i < n; i++) {
|
|
16
|
+
name[i].eval(context).genCSS(context, output);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
31
20
|
var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) {
|
|
32
21
|
this.name = name;
|
|
33
22
|
this.value = (value instanceof node_1.default) ? value : new value_1.default([value ? new anonymous_1.default(value) : null]);
|
|
@@ -41,78 +30,65 @@ var Declaration = function (name, value, important, merge, index, currentFileInf
|
|
|
41
30
|
this.allowRoot = true;
|
|
42
31
|
this.setParent(this.value, this);
|
|
43
32
|
};
|
|
44
|
-
Declaration.prototype = new node_1.default()
|
|
45
|
-
Declaration
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
catch (e) {
|
|
51
|
-
e.index = this._index;
|
|
52
|
-
e.filename = this._fileInfo.filename;
|
|
53
|
-
throw e;
|
|
54
|
-
}
|
|
55
|
-
output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);
|
|
56
|
-
};
|
|
57
|
-
Declaration.prototype.eval = function (context) {
|
|
58
|
-
var mathBypass = false;
|
|
59
|
-
var prevMath;
|
|
60
|
-
var name = this.name;
|
|
61
|
-
var evaldValue;
|
|
62
|
-
var variable = this.variable;
|
|
63
|
-
if (typeof name !== 'string') {
|
|
64
|
-
// expand 'primitive' name directly to get
|
|
65
|
-
// things faster (~10% for benchmark.less):
|
|
66
|
-
name = (name.length === 1) && (name[0] instanceof keyword_1.default) ?
|
|
67
|
-
name[0].value : evalName(context, name);
|
|
68
|
-
variable = false; // never treat expanded interpolation as new variable name
|
|
69
|
-
}
|
|
70
|
-
// @todo remove when parens-division is default
|
|
71
|
-
if (name === 'font' && context.math === MATH.ALWAYS) {
|
|
72
|
-
mathBypass = true;
|
|
73
|
-
prevMath = context.math;
|
|
74
|
-
context.math = MATH.PARENS_DIVISION;
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
context.importantScope.push({});
|
|
78
|
-
evaldValue = this.value.eval(context);
|
|
79
|
-
if (!this.variable && evaldValue.type === 'DetachedRuleset') {
|
|
80
|
-
throw { message: 'Rulesets cannot be evaluated on a property.',
|
|
81
|
-
index: this.getIndex(), filename: this.fileInfo().filename };
|
|
33
|
+
Declaration.prototype = Object.assign(new node_1.default(), {
|
|
34
|
+
type: 'Declaration',
|
|
35
|
+
genCSS: function (context, output) {
|
|
36
|
+
output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());
|
|
37
|
+
try {
|
|
38
|
+
this.value.genCSS(context, output);
|
|
82
39
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
40
|
+
catch (e) {
|
|
41
|
+
e.index = this._index;
|
|
42
|
+
e.filename = this._fileInfo.filename;
|
|
43
|
+
throw e;
|
|
87
44
|
}
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
45
|
+
output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);
|
|
46
|
+
},
|
|
47
|
+
eval: function (context) {
|
|
48
|
+
var mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable;
|
|
49
|
+
if (typeof name !== 'string') {
|
|
50
|
+
// expand 'primitive' name directly to get
|
|
51
|
+
// things faster (~10% for benchmark.less):
|
|
52
|
+
name = (name.length === 1) && (name[0] instanceof keyword_1.default) ?
|
|
53
|
+
name[0].value : evalName(context, name);
|
|
54
|
+
variable = false; // never treat expanded interpolation as new variable name
|
|
94
55
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
context.math =
|
|
56
|
+
// @todo remove when parens-division is default
|
|
57
|
+
if (name === 'font' && context.math === MATH.ALWAYS) {
|
|
58
|
+
mathBypass = true;
|
|
59
|
+
prevMath = context.math;
|
|
60
|
+
context.math = MATH.PARENS_DIVISION;
|
|
100
61
|
}
|
|
62
|
+
try {
|
|
63
|
+
context.importantScope.push({});
|
|
64
|
+
evaldValue = this.value.eval(context);
|
|
65
|
+
if (!this.variable && evaldValue.type === 'DetachedRuleset') {
|
|
66
|
+
throw { message: 'Rulesets cannot be evaluated on a property.',
|
|
67
|
+
index: this.getIndex(), filename: this.fileInfo().filename };
|
|
68
|
+
}
|
|
69
|
+
var important = this.important;
|
|
70
|
+
var importantResult = context.importantScope.pop();
|
|
71
|
+
if (!important && importantResult.important) {
|
|
72
|
+
important = importantResult.important;
|
|
73
|
+
}
|
|
74
|
+
return new Declaration(name, evaldValue, important, this.merge, this.getIndex(), this.fileInfo(), this.inline, variable);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
if (typeof e.index !== 'number') {
|
|
78
|
+
e.index = this.getIndex();
|
|
79
|
+
e.filename = this.fileInfo().filename;
|
|
80
|
+
}
|
|
81
|
+
throw e;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
if (mathBypass) {
|
|
85
|
+
context.math = prevMath;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
makeImportant: function () {
|
|
90
|
+
return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline);
|
|
101
91
|
}
|
|
102
|
-
};
|
|
103
|
-
Declaration.prototype.makeImportant = function () {
|
|
104
|
-
return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline);
|
|
105
|
-
};
|
|
106
|
-
function evalName(context, name) {
|
|
107
|
-
var value = '';
|
|
108
|
-
var i;
|
|
109
|
-
var n = name.length;
|
|
110
|
-
var output = { add: function (s) { value += s; } };
|
|
111
|
-
for (i = 0; i < n; i++) {
|
|
112
|
-
name[i].eval(context).genCSS(context, output);
|
|
113
|
-
}
|
|
114
|
-
return value;
|
|
115
|
-
}
|
|
116
|
-
Declaration.prototype.type = 'Declaration';
|
|
92
|
+
});
|
|
117
93
|
exports.default = Declaration;
|
|
118
94
|
//# sourceMappingURL=declaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/less/tree/declaration.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/less/tree/declaration.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,0DAA4B;AAC5B,8DAAgC;AAChC,kEAAoC;AACpC,8DAA0C;AAC1C,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YACrD,IAAI,CAAC,SAAS,IAAI,eAAe,CAAC,SAAS,EAAE;gBACzC,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC;aACzC;YAED,OAAO,IAAI,WAAW,CAAC,IAAI,EACvB,UAAU,EACV,SAAS,EACT,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,MAAM,EAC7C,QAAQ,CAAC,CAAC;SACjB;QACD,OAAO,CAAC,EAAE;YACN,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,EAAE;gBAC7B,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC1B,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACzC;YACD,MAAM,CAAC,CAAC;SACX;gBACO;YACJ,IAAI,UAAU,EAAE;gBACZ,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;aAC3B;SACJ;IACL,CAAC;IAED,aAAa;QACT,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,EAC5B,IAAI,CAAC,KAAK,EACV,YAAY,EACZ,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,WAAW,CAAC","sourcesContent":["import Node from './node';\nimport Value from './value';\nimport Keyword from './keyword';\nimport Anonymous from './anonymous';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\nfunction evalName(context, name) {\n let value = '';\n let i;\n const n = name.length;\n const output = {add: function (s) {value += s;}};\n for (i = 0; i < n; i++) {\n name[i].eval(context).genCSS(context, output);\n }\n return value;\n}\n\nconst Declaration = function(name, value, important, merge, index, currentFileInfo, inline, variable) {\n this.name = name;\n this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]);\n this.important = important ? ` ${important.trim()}` : '';\n this.merge = merge;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.inline = inline || false;\n this.variable = (variable !== undefined) ? variable\n : (name.charAt && (name.charAt(0) === '@'));\n this.allowRoot = true;\n this.setParent(this.value, this);\n};\n\nDeclaration.prototype = Object.assign(new Node(), {\n type: 'Declaration',\n\n genCSS(context, output) {\n output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());\n try {\n this.value.genCSS(context, output);\n }\n catch (e) {\n e.index = this._index;\n e.filename = this._fileInfo.filename;\n throw e;\n }\n output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);\n },\n\n eval(context) {\n let mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable;\n if (typeof name !== 'string') {\n // expand 'primitive' name directly to get\n // things faster (~10% for benchmark.less):\n name = (name.length === 1) && (name[0] instanceof Keyword) ?\n name[0].value : evalName(context, name);\n variable = false; // never treat expanded interpolation as new variable name\n }\n\n // @todo remove when parens-division is default\n if (name === 'font' && context.math === MATH.ALWAYS) {\n mathBypass = true;\n prevMath = context.math;\n context.math = MATH.PARENS_DIVISION;\n }\n try {\n context.importantScope.push({});\n evaldValue = this.value.eval(context);\n\n if (!this.variable && evaldValue.type === 'DetachedRuleset') {\n throw { message: 'Rulesets cannot be evaluated on a property.',\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n let important = this.important;\n const importantResult = context.importantScope.pop();\n if (!important && importantResult.important) {\n important = importantResult.important;\n }\n\n return new Declaration(name,\n evaldValue,\n important,\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline,\n variable);\n }\n catch (e) {\n if (typeof e.index !== 'number') {\n e.index = this.getIndex();\n e.filename = this.fileInfo().filename;\n }\n throw e;\n }\n finally {\n if (mathBypass) {\n context.math = prevMath;\n }\n }\n },\n\n makeImportant() {\n return new Declaration(this.name,\n this.value,\n '!important',\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline);\n }\n});\n\nexport default Declaration;"]}
|
|
@@ -1,47 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var contexts_1 = tslib_1.__importDefault(require("../contexts"));
|
|
6
|
+
var utils = tslib_1.__importStar(require("../utils"));
|
|
28
7
|
var DetachedRuleset = function (ruleset, frames) {
|
|
29
8
|
this.ruleset = ruleset;
|
|
30
9
|
this.frames = frames;
|
|
31
10
|
this.setParent(this.ruleset, this);
|
|
32
11
|
};
|
|
33
|
-
DetachedRuleset.prototype = new node_1.default()
|
|
34
|
-
DetachedRuleset
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
DetachedRuleset.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
12
|
+
DetachedRuleset.prototype = Object.assign(new node_1.default(), {
|
|
13
|
+
type: 'DetachedRuleset',
|
|
14
|
+
evalFirst: true,
|
|
15
|
+
accept: function (visitor) {
|
|
16
|
+
this.ruleset = visitor.visit(this.ruleset);
|
|
17
|
+
},
|
|
18
|
+
eval: function (context) {
|
|
19
|
+
var frames = this.frames || utils.copyArray(context.frames);
|
|
20
|
+
return new DetachedRuleset(this.ruleset, frames);
|
|
21
|
+
},
|
|
22
|
+
callEval: function (context) {
|
|
23
|
+
return this.ruleset.eval(this.frames ? new contexts_1.default.Eval(context, this.frames.concat(context.frames)) : context);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
46
26
|
exports.default = DetachedRuleset;
|
|
47
27
|
//# sourceMappingURL=detached-ruleset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detached-ruleset.js","sourceRoot":"","sources":["../../../src/less/tree/detached-ruleset.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"detached-ruleset.js","sourceRoot":"","sources":["../../../src/less/tree/detached-ruleset.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,iEAAmC;AACnC,sDAAkC;AAElC,IAAM,eAAe,GAAG,UAAS,OAAO,EAAE,MAAM;IAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,eAAe,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAI,EAAE,EAAE;IAClD,IAAI,EAAE,iBAAiB;IACvB,SAAS,EAAE,IAAI;IAEf,MAAM,YAAC,OAAO;QACV,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,YAAC,OAAO;QACR,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,QAAQ,YAAC,OAAO;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,kBAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACrH,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,eAAe,CAAC","sourcesContent":["import Node from './node';\nimport contexts from '../contexts';\nimport * as utils from '../utils';\n\nconst DetachedRuleset = function(ruleset, frames) {\n this.ruleset = ruleset;\n this.frames = frames;\n this.setParent(this.ruleset, this);\n};\n\nDetachedRuleset.prototype = Object.assign(new Node(), {\n type: 'DetachedRuleset',\n evalFirst: true,\n\n accept(visitor) {\n this.ruleset = visitor.visit(this.ruleset);\n },\n\n eval(context) {\n const frames = this.frames || utils.copyArray(context.frames);\n return new DetachedRuleset(this.ruleset, frames);\n },\n\n callEval(context) {\n return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context);\n }\n});\n\nexport default DetachedRuleset;\n"]}
|