less 4.0.1-alpha.0 → 4.1.2
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/.eslintignore +2 -1
- package/.eslintrc.json +70 -2
- package/Gruntfile.js +8 -23
- package/dist/less.js +1161 -1132
- package/dist/less.min.js +3 -3
- package/dist/less.min.js.map +1 -1
- package/lib/less/constants.js +2 -1
- package/lib/less/constants.js.map +1 -1
- package/lib/less/contexts.js +2 -20
- 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/environment/abstract-plugin-loader.js +3 -5
- package/lib/less/environment/abstract-plugin-loader.js.map +1 -1
- package/lib/less/environment/environment.js +2 -4
- 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 +7 -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 +7 -12
- 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 +11 -13
- 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 +4 -6
- 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 +11 -12
- 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 +25 -43
- package/lib/less/index.js.map +1 -1
- package/lib/less/less-error.js +2 -20
- package/lib/less/less-error.js.map +1 -1
- package/lib/less/parse-tree.js +4 -6
- package/lib/less/parse-tree.js.map +1 -1
- package/lib/less/parse.js +6 -27
- package/lib/less/parse.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 +10 -31
- package/lib/less/parser/parser.js.map +1 -1
- package/lib/less/render.js +2 -20
- package/lib/less/render.js.map +1 -1
- package/lib/less/source-map-output.js +5 -1
- package/lib/less/source-map-output.js.map +1 -1
- package/lib/less/transform-tree.js +4 -6
- package/lib/less/transform-tree.js.map +1 -1
- package/lib/less/tree/anonymous.js +22 -41
- package/lib/less/tree/anonymous.js.map +1 -1
- package/lib/less/tree/assignment.js +15 -34
- package/lib/less/tree/assignment.js.map +1 -1
- package/lib/less/tree/atrule.js +49 -68
- package/lib/less/tree/atrule.js.map +1 -1
- package/lib/less/tree/attribute.js +16 -35
- package/lib/less/tree/attribute.js.map +1 -1
- package/lib/less/tree/call.js +20 -39
- package/lib/less/tree/call.js.map +1 -1
- package/lib/less/tree/color.js +75 -94
- package/lib/less/tree/color.js.map +1 -1
- package/lib/less/tree/combinator.js +16 -35
- package/lib/less/tree/combinator.js.map +1 -1
- package/lib/less/tree/comment.js +17 -36
- package/lib/less/tree/comment.js.map +1 -1
- package/lib/less/tree/condition.js +16 -35
- package/lib/less/tree/condition.js.map +1 -1
- package/lib/less/tree/debug-info.js.map +1 -1
- package/lib/less/tree/declaration.js +36 -74
- package/lib/less/tree/declaration.js.map +1 -1
- package/lib/less/tree/detached-ruleset.js +19 -57
- package/lib/less/tree/detached-ruleset.js.map +1 -1
- package/lib/less/tree/dimension.js +36 -53
- package/lib/less/tree/dimension.js.map +1 -1
- package/lib/less/tree/element.js +34 -53
- package/lib/less/tree/element.js.map +1 -1
- package/lib/less/tree/expression.js +23 -61
- package/lib/less/tree/expression.js.map +1 -1
- package/lib/less/tree/extend.js +34 -53
- package/lib/less/tree/extend.js.map +1 -1
- package/lib/less/tree/import.js +46 -84
- package/lib/less/tree/import.js.map +1 -1
- package/lib/less/tree/index.js +71 -46
- package/lib/less/tree/index.js.map +1 -1
- package/lib/less/tree/javascript.js +16 -35
- package/lib/less/tree/javascript.js.map +1 -1
- package/lib/less/tree/js-eval-node.js +14 -31
- package/lib/less/tree/js-eval-node.js.map +1 -1
- package/lib/less/tree/keyword.js +10 -29
- package/lib/less/tree/keyword.js.map +1 -1
- package/lib/less/tree/media.js +40 -78
- package/lib/less/tree/media.js.map +1 -1
- package/lib/less/tree/mixin-call.js +34 -47
- package/lib/less/tree/mixin-call.js.map +1 -1
- package/lib/less/tree/mixin-definition.js +51 -89
- package/lib/less/tree/mixin-definition.js.map +1 -1
- package/lib/less/tree/namespace-value.js +22 -37
- package/lib/less/tree/namespace-value.js.map +1 -1
- package/lib/less/tree/negative.js +14 -33
- package/lib/less/tree/negative.js.map +1 -1
- package/lib/less/tree/node.js +20 -7
- package/lib/less/tree/node.js.map +1 -1
- package/lib/less/tree/operation.js +22 -59
- package/lib/less/tree/operation.js.map +1 -1
- package/lib/less/tree/paren.js +12 -31
- package/lib/less/tree/paren.js.map +1 -1
- package/lib/less/tree/property.js +21 -36
- package/lib/less/tree/property.js.map +1 -1
- package/lib/less/tree/quoted.js +25 -44
- package/lib/less/tree/quoted.js.map +1 -1
- package/lib/less/tree/ruleset.js +69 -107
- package/lib/less/tree/ruleset.js.map +1 -1
- package/lib/less/tree/selector.js +38 -57
- package/lib/less/tree/selector.js.map +1 -1
- package/lib/less/tree/unicode-descriptor.js +8 -27
- package/lib/less/tree/unicode-descriptor.js.map +1 -1
- package/lib/less/tree/unit.js +38 -76
- package/lib/less/tree/unit.js.map +1 -1
- package/lib/less/tree/url.js +20 -39
- package/lib/less/tree/url.js.map +1 -1
- package/lib/less/tree/value.js +21 -40
- package/lib/less/tree/value.js.map +1 -1
- package/lib/less/tree/variable-call.js +17 -36
- package/lib/less/tree/variable-call.js.map +1 -1
- package/lib/less/tree/variable.js +21 -36
- package/lib/less/tree/variable.js.map +1 -1
- package/lib/less/utils.js +5 -33
- package/lib/less/utils.js.map +1 -1
- package/lib/less/visitors/extend-visitor.js +5 -26
- package/lib/less/visitors/extend-visitor.js.map +1 -1
- package/lib/less/visitors/import-sequencer.js.map +1 -1
- package/lib/less/visitors/import-visitor.js +5 -26
- 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 +7 -7
- package/lib/less/visitors/to-css-visitor.js.map +1 -1
- package/lib/less/visitors/visitor.js +2 -4
- 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 +6 -8
- 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 +24 -39
- package/lib/less-node/url-file-manager.js.map +1 -1
- package/package.json +20 -17
- package/test/index.js +20 -2
- package/test/less-test.js +36 -16
- package/tsconfig.json +6 -0
- package/LICENSE +0 -177
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace-value.js","sourceRoot":"","sources":["../../../src/less/tree/namespace-value.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"namespace-value.js","sourceRoot":"","sources":["../../../src/less/tree/namespace-value.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAClC,8DAAgC;AAChC,gEAAkC;AAElC,IAAM,cAAc,GAAG,UAAS,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ;IAC9D,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACpB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;AAC9B,CAAC,CAAC;AAEF,cAAc,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAI,EAAE,EAAE;IACjD,IAAI,EAAE,gBAAgB;IAEtB,IAAI,YAAC,OAAO;QACR,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEjD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAEvB;;;;eAIG;YACH,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACtB,KAAK,GAAG,IAAI,iBAA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AAC,CAAC;iBAChC;gBAED,IAAI,CAAC,KAAK,EAAE;oBACR,MAAM,EAAE,IAAI,EAAE,MAAM;wBAChB,OAAO,EAAE,gBAAa,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAa;wBACjD,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ;wBAClC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;iBAChC;gBACD,8EAA8E;gBAC9E,8CAA8C;gBAC9C,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;aACnC;YAED,IAAI,KAAK,CAAC,KAAK,EAAE;gBACb,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;aACrC;YACD,IAAI,KAAK,CAAC,OAAO,EAAE;gBACf,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACvC;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,cAAc,CAAC","sourcesContent":["import Node from './node';\nimport Variable from './variable';\nimport Ruleset from './ruleset';\nimport Selector from './selector';\n\nconst NamespaceValue = function(ruleCall, lookups, index, fileInfo) {\n this.value = ruleCall;\n this.lookups = lookups;\n this._index = index;\n this._fileInfo = fileInfo;\n};\n\nNamespaceValue.prototype = Object.assign(new Node(), {\n type: 'NamespaceValue',\n\n eval(context) {\n let i, j, name, rules = this.value.eval(context);\n \n for (i = 0; i < this.lookups.length; i++) {\n name = this.lookups[i];\n\n /**\n * Eval'd DRs return rulesets.\n * Eval'd mixins return rules, so let's make a ruleset if we need it.\n * We need to do this because of late parsing of values\n */\n if (Array.isArray(rules)) {\n rules = new Ruleset([new Selector()], rules);\n }\n\n if (name === '') {\n rules = rules.lastDeclaration();\n }\n else if (name.charAt(0) === '@') {\n if (name.charAt(1) === '@') {\n name = `@${new Variable(name.substr(1)).eval(context).value}`;\n }\n if (rules.variables) {\n rules = rules.variable(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `variable ${name} not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n }\n else {\n if (name.substring(0, 2) === '$@') {\n name = `$${new Variable(name.substr(1)).eval(context).value}`;\n }\n else {\n name = name.charAt(0) === '$' ? name : `$${name}`;\n }\n if (rules.properties) {\n rules = rules.property(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `property \"${name.substr(1)}\" not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n // Properties are an array of values, since a ruleset can have multiple props.\n // We pick the last one (the \"cascaded\" value)\n rules = rules[rules.length - 1];\n }\n\n if (rules.value) {\n rules = rules.eval(context).value;\n }\n if (rules.ruleset) {\n rules = rules.ruleset.eval(context);\n }\n }\n return rules;\n }\n});\n\nexport default NamespaceValue;\n"]}
|
|
@@ -1,43 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Negative.prototype.genCSS = function (context, output) {
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var operation_1 = tslib_1.__importDefault(require("./operation"));
|
|
6
|
+
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
|
|
7
|
+
var Negative = function (node) {
|
|
8
|
+
this.value = node;
|
|
9
|
+
};
|
|
10
|
+
Negative.prototype = Object.assign(new node_1.default(), {
|
|
11
|
+
type: 'Negative',
|
|
12
|
+
genCSS: function (context, output) {
|
|
30
13
|
output.add('-');
|
|
31
14
|
this.value.genCSS(context, output);
|
|
32
|
-
}
|
|
33
|
-
|
|
15
|
+
},
|
|
16
|
+
eval: function (context) {
|
|
34
17
|
if (context.isMathOn()) {
|
|
35
18
|
return (new operation_1.default('*', [new dimension_1.default(-1), this.value])).eval(context);
|
|
36
19
|
}
|
|
37
20
|
return new Negative(this.value.eval(context));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}(node_1.default));
|
|
41
|
-
Negative.prototype.type = 'Negative';
|
|
21
|
+
}
|
|
22
|
+
});
|
|
42
23
|
exports.default = Negative;
|
|
43
24
|
//# sourceMappingURL=negative.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negative.js","sourceRoot":"","sources":["../../../src/less/tree/negative.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"negative.js","sourceRoot":"","sources":["../../../src/less/tree/negative.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,kEAAoC;AACpC,kEAAoC;AAEpC,IAAM,QAAQ,GAAG,UAAS,IAAI;IAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC;AAEF,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAI,EAAE,EAAE;IAC3C,IAAI,EAAE,UAAU;IAEhB,MAAM,YAAC,OAAO,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,YAAC,OAAO;QACR,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE;YACpB,OAAO,CAAC,IAAI,mBAAS,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAS,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC9E;QACD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,QAAQ,CAAC","sourcesContent":["import Node from './node';\nimport Operation from './operation';\nimport Dimension from './dimension';\n\nconst Negative = function(node) {\n this.value = node;\n};\n\nNegative.prototype = Object.assign(new Node(), {\n type: 'Negative',\n\n genCSS(context, output) {\n output.add('-');\n this.value.genCSS(context, output);\n },\n\n eval(context) {\n if (context.isMathOn()) {\n return (new Operation('*', [new Dimension(-1), this.value])).eval(context);\n }\n return new Negative(this.value.eval(context));\n }\n});\n\nexport default Negative;\n"]}
|
package/lib/less/tree/node.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* The reason why Node is a class and other nodes simply do not extend
|
|
5
|
+
* from Node (since we're transpiling) is due to this issue:
|
|
6
|
+
*
|
|
7
|
+
* https://github.com/less/less.js/issues/3434
|
|
8
|
+
*/
|
|
3
9
|
var Node = /** @class */ (function () {
|
|
4
10
|
function Node() {
|
|
5
11
|
this.parent = null;
|
|
@@ -7,14 +13,21 @@ var Node = /** @class */ (function () {
|
|
|
7
13
|
this.nodeVisible = undefined;
|
|
8
14
|
this.rootNode = null;
|
|
9
15
|
this.parsed = null;
|
|
10
|
-
var self = this;
|
|
11
|
-
Object.defineProperty(this, 'currentFileInfo', {
|
|
12
|
-
get: function () { return self.fileInfo(); }
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(this, 'index', {
|
|
15
|
-
get: function () { return self.getIndex(); }
|
|
16
|
-
});
|
|
17
16
|
}
|
|
17
|
+
Object.defineProperty(Node.prototype, "currentFileInfo", {
|
|
18
|
+
get: function () {
|
|
19
|
+
return this.fileInfo();
|
|
20
|
+
},
|
|
21
|
+
enumerable: false,
|
|
22
|
+
configurable: true
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(Node.prototype, "index", {
|
|
25
|
+
get: function () {
|
|
26
|
+
return this.getIndex();
|
|
27
|
+
},
|
|
28
|
+
enumerable: false,
|
|
29
|
+
configurable: true
|
|
30
|
+
});
|
|
18
31
|
Node.prototype.setParent = function (nodes, parent) {
|
|
19
32
|
function set(node) {
|
|
20
33
|
if (node && node instanceof Node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/less/tree/node.js"],"names":[],"mappings":";;AAAA;IACI;QACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAClC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/less/tree/node.js"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH;IACI;QACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAClC,IA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,GAAG,IAAI,CAAC,WAAW,CAAC;IACxC,CAAC;IACL,WAAC;AAAD,CAAC,AA/KD,IA+KC;AAED,kBAAe,IAAI,CAAC","sourcesContent":["/**\n * The reason why Node is a class and other nodes simply do not extend\n * from Node (since we're transpiling) is due to this issue:\n * \n * https://github.com/less/less.js/issues/3434\n */\nclass Node {\n constructor() {\n this.parent = null;\n this.visibilityBlocks = undefined;\n this.nodeVisible = undefined;\n this.rootNode = null;\n this.parsed = null;\n }\n\n get currentFileInfo() {\n return this.fileInfo();\n }\n\n get index() {\n return this.getIndex();\n }\n\n setParent(nodes, parent) {\n function set(node) {\n if (node && node instanceof Node) {\n node.parent = parent;\n }\n }\n if (Array.isArray(nodes)) {\n nodes.forEach(set);\n }\n else {\n set(nodes);\n }\n }\n\n getIndex() {\n return this._index || (this.parent && this.parent.getIndex()) || 0;\n }\n\n fileInfo() {\n return this._fileInfo || (this.parent && this.parent.fileInfo()) || {};\n }\n\n isRulesetLike() { return false; }\n\n toCSS(context) {\n const strs = [];\n this.genCSS(context, {\n add: function(chunk, fileInfo, index) {\n strs.push(chunk);\n },\n isEmpty: function () {\n return strs.length === 0;\n }\n });\n return strs.join('');\n }\n\n genCSS(context, output) {\n output.add(this.value);\n }\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n }\n\n eval() { return this; }\n\n _operate(context, op, a, b) {\n switch (op) {\n case '+': return a + b;\n case '-': return a - b;\n case '*': return a * b;\n case '/': return a / b;\n }\n }\n\n fround(context, value) {\n const precision = context && context.numPrecision;\n // add \"epsilon\" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded:\n return (precision) ? Number((value + 2e-16).toFixed(precision)) : value;\n }\n\n static compare(a, b) {\n /* returns:\n -1: a < b\n 0: a = b\n 1: a > b\n and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */\n\n if ((a.compare) &&\n // for \"symmetric results\" force toCSS-based comparison\n // of Quoted or Anonymous if either value is one of those\n !(b.type === 'Quoted' || b.type === 'Anonymous')) {\n return a.compare(b);\n } else if (b.compare) {\n return -b.compare(a);\n } else if (a.type !== b.type) {\n return undefined;\n }\n\n a = a.value;\n b = b.value;\n if (!Array.isArray(a)) {\n return a === b ? 0 : undefined;\n }\n if (a.length !== b.length) {\n return undefined;\n }\n for (let i = 0; i < a.length; i++) {\n if (Node.compare(a[i], b[i]) !== 0) {\n return undefined;\n }\n }\n return 0;\n }\n\n static numericCompare(a, b) {\n return a < b ? -1\n : a === b ? 0\n : a > b ? 1 : undefined;\n }\n\n // Returns true if this node represents root of ast imported by reference\n blocksVisibility() {\n if (this.visibilityBlocks == null) {\n this.visibilityBlocks = 0;\n }\n return this.visibilityBlocks !== 0;\n }\n\n addVisibilityBlock() {\n if (this.visibilityBlocks == null) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks + 1;\n }\n\n removeVisibilityBlock() {\n if (this.visibilityBlocks == null) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks - 1;\n }\n\n // Turns on node visibility - if called node will be shown in output regardless\n // of whether it comes from import by reference or not\n ensureVisibility() {\n this.nodeVisible = true;\n }\n\n // Turns off node visibility - if called node will NOT be shown in output regardless\n // of whether it comes from import by reference or not\n ensureInvisibility() {\n this.nodeVisible = false;\n }\n\n // return values:\n // false - the node must not be visible\n // true - the node must be visible\n // undefined or null - the node has the same visibility as its parent\n isVisible() {\n return this.nodeVisible;\n }\n\n visibilityInfo() {\n return {\n visibilityBlocks: this.visibilityBlocks,\n nodeVisible: this.nodeVisible\n };\n }\n\n copyVisibilityInfo(info) {\n if (!info) {\n return;\n }\n this.visibilityBlocks = info.visibilityBlocks;\n this.nodeVisible = info.nodeVisible;\n }\n}\n\nexport default Node;\n"]}
|
|
@@ -1,58 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
18
|
-
}) : (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
}));
|
|
22
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
-
}) : function(o, v) {
|
|
25
|
-
o["default"] = v;
|
|
26
|
-
});
|
|
27
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var color_1 = tslib_1.__importDefault(require("./color"));
|
|
6
|
+
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
|
|
7
|
+
var Constants = tslib_1.__importStar(require("../constants"));
|
|
42
8
|
var MATH = Constants.Math;
|
|
43
|
-
var Operation =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
Operation.prototype.accept = function (visitor) {
|
|
9
|
+
var Operation = function (op, operands, isSpaced) {
|
|
10
|
+
this.op = op.trim();
|
|
11
|
+
this.operands = operands;
|
|
12
|
+
this.isSpaced = isSpaced;
|
|
13
|
+
};
|
|
14
|
+
Operation.prototype = Object.assign(new node_1.default(), {
|
|
15
|
+
type: 'Operation',
|
|
16
|
+
accept: function (visitor) {
|
|
53
17
|
this.operands = visitor.visitArray(this.operands);
|
|
54
|
-
}
|
|
55
|
-
|
|
18
|
+
},
|
|
19
|
+
eval: function (context) {
|
|
56
20
|
var a = this.operands[0].eval(context), b = this.operands[1].eval(context), op;
|
|
57
21
|
if (context.isMathOn(this.op)) {
|
|
58
22
|
op = this.op === './' ? '/' : this.op;
|
|
@@ -62,8 +26,9 @@ var Operation = /** @class */ (function (_super) {
|
|
|
62
26
|
if (b instanceof dimension_1.default && a instanceof color_1.default) {
|
|
63
27
|
b = b.toColor();
|
|
64
28
|
}
|
|
65
|
-
if (!a.operate) {
|
|
66
|
-
if (a instanceof Operation
|
|
29
|
+
if (!a.operate || !b.operate) {
|
|
30
|
+
if ((a instanceof Operation || b instanceof Operation)
|
|
31
|
+
&& a.op === '/' && context.math === MATH.PARENS_DIVISION) {
|
|
67
32
|
return new Operation(this.op, [a, b], this.isSpaced);
|
|
68
33
|
}
|
|
69
34
|
throw { type: 'Operation',
|
|
@@ -74,8 +39,8 @@ var Operation = /** @class */ (function (_super) {
|
|
|
74
39
|
else {
|
|
75
40
|
return new Operation(this.op, [a, b], this.isSpaced);
|
|
76
41
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
42
|
+
},
|
|
43
|
+
genCSS: function (context, output) {
|
|
79
44
|
this.operands[0].genCSS(context, output);
|
|
80
45
|
if (this.isSpaced) {
|
|
81
46
|
output.add(' ');
|
|
@@ -85,9 +50,7 @@ var Operation = /** @class */ (function (_super) {
|
|
|
85
50
|
output.add(' ');
|
|
86
51
|
}
|
|
87
52
|
this.operands[1].genCSS(context, output);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}(node_1.default));
|
|
91
|
-
Operation.prototype.type = 'Operation';
|
|
53
|
+
}
|
|
54
|
+
});
|
|
92
55
|
exports.default = Operation;
|
|
93
56
|
//# sourceMappingURL=operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/less/tree/operation.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/less/tree/operation.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,0DAA4B;AAC5B,kEAAoC;AACpC,8DAA0C;AAC1C,IAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAG5B,IAAM,SAAS,GAAG,UAAS,EAAE,EAAE,QAAQ,EAAE,QAAQ;IAC7C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7B,CAAC,CAAC;AAEF,SAAS,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAI,EAAE,EAAE;IAC5C,IAAI,EAAE,WAAW;IAEjB,MAAM,YAAC,OAAO;QACV,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,IA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AAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SACxD;IACL,CAAC;IAED,MAAM,YAAC,OAAO,EAAE,MAAM;QAClB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACnB;QACD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACnB;QACD,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,SAAS,CAAC","sourcesContent":["import Node from './node';\nimport Color from './color';\nimport Dimension from './dimension';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\n\nconst Operation = function(op, operands, isSpaced) {\n this.op = op.trim();\n this.operands = operands;\n this.isSpaced = isSpaced;\n};\n\nOperation.prototype = Object.assign(new Node(), {\n type: 'Operation',\n\n accept(visitor) {\n this.operands = visitor.visitArray(this.operands);\n },\n\n eval(context) {\n let a = this.operands[0].eval(context), b = this.operands[1].eval(context), op;\n\n if (context.isMathOn(this.op)) {\n op = this.op === './' ? '/' : this.op;\n if (a instanceof Dimension && b instanceof Color) {\n a = a.toColor();\n }\n if (b instanceof Dimension && a instanceof Color) {\n b = b.toColor();\n }\n if (!a.operate || !b.operate) {\n if (\n (a instanceof Operation || b instanceof Operation)\n && a.op === '/' && context.math === MATH.PARENS_DIVISION\n ) {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n throw { type: 'Operation',\n message: 'Operation on an invalid type' };\n }\n\n return a.operate(context, op, b);\n } else {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n },\n\n genCSS(context, output) {\n this.operands[0].genCSS(context, output);\n if (this.isSpaced) {\n output.add(' ');\n }\n output.add(this.op);\n if (this.isSpaced) {\n output.add(' ');\n }\n this.operands[1].genCSS(context, output);\n }\n});\n\nexport default Operation;\n"]}
|
package/lib/less/tree/paren.js
CHANGED
|
@@ -1,39 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Paren.prototype.genCSS = function (context, output) {
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var Paren = function (node) {
|
|
6
|
+
this.value = node;
|
|
7
|
+
};
|
|
8
|
+
Paren.prototype = Object.assign(new node_1.default(), {
|
|
9
|
+
type: 'Paren',
|
|
10
|
+
genCSS: function (context, output) {
|
|
28
11
|
output.add('(');
|
|
29
12
|
this.value.genCSS(context, output);
|
|
30
13
|
output.add(')');
|
|
31
|
-
}
|
|
32
|
-
|
|
14
|
+
},
|
|
15
|
+
eval: function (context) {
|
|
33
16
|
return new Paren(this.value.eval(context));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}(node_1.default));
|
|
37
|
-
Paren.prototype.type = 'Paren';
|
|
17
|
+
}
|
|
18
|
+
});
|
|
38
19
|
exports.default = Paren;
|
|
39
20
|
//# sourceMappingURL=paren.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paren.js","sourceRoot":"","sources":["../../../src/less/tree/paren.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paren.js","sourceRoot":"","sources":["../../../src/less/tree/paren.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAE1B,IAAM,KAAK,GAAG,UAAS,IAAI;IACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAI,EAAE,EAAE;IACxC,IAAI,EAAE,OAAO;IAEb,MAAM,YAAC,OAAO,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,YAAC,OAAO;QACR,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,KAAK,CAAC","sourcesContent":["import Node from './node';\n\nconst Paren = function(node) {\n this.value = node;\n};\n\nParen.prototype = Object.assign(new Node(), {\n type: 'Paren',\n\n genCSS(context, output) {\n output.add('(');\n this.value.genCSS(context, output);\n output.add(')');\n },\n\n eval(context) {\n return new Paren(this.value.eval(context));\n }\n});\n\nexport default Paren;\n"]}
|
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Property.prototype.eval = function (context) {
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var declaration_1 = tslib_1.__importDefault(require("./declaration"));
|
|
6
|
+
var Property = function (name, index, currentFileInfo) {
|
|
7
|
+
this.name = name;
|
|
8
|
+
this._index = index;
|
|
9
|
+
this._fileInfo = currentFileInfo;
|
|
10
|
+
};
|
|
11
|
+
Property.prototype = Object.assign(new node_1.default(), {
|
|
12
|
+
type: 'Property',
|
|
13
|
+
eval: function (context) {
|
|
31
14
|
var property;
|
|
32
15
|
var name = this.name;
|
|
33
16
|
// TODO: shorten this reference
|
|
34
17
|
var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;
|
|
35
18
|
if (this.evaluating) {
|
|
36
|
-
throw { type: 'Name',
|
|
19
|
+
throw { type: 'Name',
|
|
20
|
+
message: "Recursive property reference for " + name,
|
|
21
|
+
filename: this.fileInfo().filename,
|
|
37
22
|
index: this.getIndex() };
|
|
38
23
|
}
|
|
39
24
|
this.evaluating = true;
|
|
@@ -60,11 +45,13 @@ var Property = /** @class */ (function (_super) {
|
|
|
60
45
|
return property;
|
|
61
46
|
}
|
|
62
47
|
else {
|
|
63
|
-
throw { type: 'Name',
|
|
48
|
+
throw { type: 'Name',
|
|
49
|
+
message: "Property '" + name + "' is undefined",
|
|
50
|
+
filename: this.currentFileInfo.filename,
|
|
64
51
|
index: this.index };
|
|
65
52
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
53
|
+
},
|
|
54
|
+
find: function (obj, fun) {
|
|
68
55
|
for (var i = 0, r = void 0; i < obj.length; i++) {
|
|
69
56
|
r = fun.call(obj, obj[i]);
|
|
70
57
|
if (r) {
|
|
@@ -72,9 +59,7 @@ var Property = /** @class */ (function (_super) {
|
|
|
72
59
|
}
|
|
73
60
|
}
|
|
74
61
|
return null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
}(node_1.default));
|
|
78
|
-
Property.prototype.type = 'Property';
|
|
62
|
+
}
|
|
63
|
+
});
|
|
79
64
|
exports.default = Property;
|
|
80
65
|
//# sourceMappingURL=property.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../../src/less/tree/property.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../../src/less/tree/property.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,sEAAwC;AAExC,IAAM,QAAQ,GAAG,UAAS,IAAI,EAAE,KAAK,EAAE,eAAe;IAClD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,MA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M,EACR,CAAC,CAAC,QAAQ,CACb,CAAC;iBACL;gBACD,UAAU,CAAC,IAAI,CAAC,CAAC;gBAEjB,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,CAAC,SAAS,EAAE;oBACb,IAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;oBACjF,cAAc,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;iBAC1C;gBACD,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC1B,OAAO,CAAC,CAAC;aACZ;QACL,CAAC,CAAC,CAAC;QACH,IAAI,QAAQ,EAAE;YACV,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,OAAO,QAAQ,CAAC;SACnB;aAAM;YACH,MAAM,EAAE,IAAI,EAAE,MAAM;gBAChB,OAAO,EAAE,eAAa,IAAI,mBAAgB;gBAC1C,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ;gBACvC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;SAC3B;IACL,CAAC;IAED,IAAI,YAAC,GAAG,EAAE,GAAG;QACT,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,SAAA,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,EAAE;gBAAE,OAAO,CAAC,CAAC;aAAE;SACvB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,QAAQ,CAAC","sourcesContent":["import Node from './node';\nimport Declaration from './declaration';\n\nconst Property = function(name, index, currentFileInfo) {\n this.name = name;\n this._index = index;\n this._fileInfo = currentFileInfo;\n};\n\nProperty.prototype = Object.assign(new Node(), {\n type: 'Property',\n\n eval(context) {\n let property;\n const name = this.name;\n // TODO: shorten this reference\n const mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;\n\n if (this.evaluating) {\n throw { type: 'Name',\n message: `Recursive property reference for ${name}`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n this.evaluating = true;\n\n property = this.find(context.frames, function (frame) {\n let v;\n const vArr = frame.property(name);\n if (vArr) {\n for (let i = 0; i < vArr.length; i++) {\n v = vArr[i];\n\n vArr[i] = new Declaration(v.name,\n v.value,\n v.important,\n v.merge,\n v.index,\n v.currentFileInfo,\n v.inline,\n v.variable\n );\n }\n mergeRules(vArr);\n\n v = vArr[vArr.length - 1];\n if (v.important) {\n const importantScope = context.importantScope[context.importantScope.length - 1];\n importantScope.important = v.important;\n }\n v = v.value.eval(context);\n return v;\n }\n });\n if (property) {\n this.evaluating = false;\n return property;\n } else {\n throw { type: 'Name',\n message: `Property '${name}' is undefined`,\n filename: this.currentFileInfo.filename,\n index: this.index };\n }\n },\n\n find(obj, fun) {\n for (let i = 0, r; i < obj.length; i++) {\n r = fun.call(obj, obj[i]);\n if (r) { return r; }\n }\n return null;\n }\n});\n\nexport default Property;\n"]}
|
package/lib/less/tree/quoted.js
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Quoted.prototype.genCSS = function (context, output) {
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var variable_1 = tslib_1.__importDefault(require("./variable"));
|
|
6
|
+
var property_1 = tslib_1.__importDefault(require("./property"));
|
|
7
|
+
var Quoted = function (str, content, escaped, index, currentFileInfo) {
|
|
8
|
+
this.escaped = (escaped == null) ? true : escaped;
|
|
9
|
+
this.value = content || '';
|
|
10
|
+
this.quote = str.charAt(0);
|
|
11
|
+
this._index = index;
|
|
12
|
+
this._fileInfo = currentFileInfo;
|
|
13
|
+
this.variableRegex = /@\{([\w-]+)\}/g;
|
|
14
|
+
this.propRegex = /\$\{([\w-]+)\}/g;
|
|
15
|
+
this.allowRoot = escaped;
|
|
16
|
+
};
|
|
17
|
+
Quoted.prototype = Object.assign(new node_1.default(), {
|
|
18
|
+
type: 'Quoted',
|
|
19
|
+
genCSS: function (context, output) {
|
|
37
20
|
if (!this.escaped) {
|
|
38
21
|
output.add(this.quote, this.fileInfo(), this.getIndex());
|
|
39
22
|
}
|
|
@@ -41,11 +24,11 @@ var Quoted = /** @class */ (function (_super) {
|
|
|
41
24
|
if (!this.escaped) {
|
|
42
25
|
output.add(this.quote);
|
|
43
26
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
27
|
+
},
|
|
28
|
+
containsVariables: function () {
|
|
46
29
|
return this.value.match(this.variableRegex);
|
|
47
|
-
}
|
|
48
|
-
|
|
30
|
+
},
|
|
31
|
+
eval: function (context) {
|
|
49
32
|
var that = this;
|
|
50
33
|
var value = this.value;
|
|
51
34
|
var variableReplacement = function (_, name) {
|
|
@@ -67,8 +50,8 @@ var Quoted = /** @class */ (function (_super) {
|
|
|
67
50
|
value = iterativeReplace(value, this.variableRegex, variableReplacement);
|
|
68
51
|
value = iterativeReplace(value, this.propRegex, propertyReplacement);
|
|
69
52
|
return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());
|
|
70
|
-
}
|
|
71
|
-
|
|
53
|
+
},
|
|
54
|
+
compare: function (other) {
|
|
72
55
|
// when comparing quoted strings allow the quote to differ
|
|
73
56
|
if (other.type === 'Quoted' && !this.escaped && !other.escaped) {
|
|
74
57
|
return node_1.default.numericCompare(this.value, other.value);
|
|
@@ -76,9 +59,7 @@ var Quoted = /** @class */ (function (_super) {
|
|
|
76
59
|
else {
|
|
77
60
|
return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
|
|
78
61
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
}(node_1.default));
|
|
82
|
-
Quoted.prototype.type = 'Quoted';
|
|
62
|
+
}
|
|
63
|
+
});
|
|
83
64
|
exports.default = Quoted;
|
|
84
65
|
//# sourceMappingURL=quoted.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quoted.js","sourceRoot":"","sources":["../../../src/less/tree/quoted.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quoted.js","sourceRoot":"","sources":["../../../src/less/tree/quoted.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAClC,gEAAkC;AAGlC,IAAM,MAAM,GAAG,UAAS,GAAG,EAAE,OAAO,E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C,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9G,CAAC;IAED,OAAO,YAAC,KAAK;QACT,0DAA0D;QAC1D,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YAC5D,OAAO,cAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;SACvD;aAAM;YACH,OAAO,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SACxE;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Variable from './variable';\nimport Property from './property';\n\n\nconst Quoted = function(str, content, escaped, index, currentFileInfo) {\n this.escaped = (escaped == null) ? true : escaped;\n this.value = content || '';\n this.quote = str.charAt(0);\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.variableRegex = /@\\{([\\w-]+)\\}/g;\n this.propRegex = /\\$\\{([\\w-]+)\\}/g;\n this.allowRoot = escaped;\n};\n\nQuoted.prototype = Object.assign(new Node(), {\n type: 'Quoted',\n\n genCSS(context, output) {\n if (!this.escaped) {\n output.add(this.quote, this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n if (!this.escaped) {\n output.add(this.quote);\n }\n },\n\n containsVariables() {\n return this.value.match(this.variableRegex);\n },\n\n eval(context) {\n const that = this;\n let value = this.value;\n const variableReplacement = function (_, name) {\n const v = new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n const propertyReplacement = function (_, name) {\n const v = new Property(`$${name}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n function iterativeReplace(value, regexp, replacementFnc) {\n let evaluatedValue = value;\n do {\n value = evaluatedValue.toString();\n evaluatedValue = value.replace(regexp, replacementFnc);\n } while (value !== evaluatedValue);\n return evaluatedValue;\n }\n value = iterativeReplace(value, this.variableRegex, variableReplacement);\n value = iterativeReplace(value, this.propRegex, propertyReplacement);\n return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());\n },\n\n compare(other) {\n // when comparing quoted strings allow the quote to differ\n if (other.type === 'Quoted' && !this.escaped && !other.escaped) {\n return Node.numericCompare(this.value, other.value);\n } else {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n }\n }\n});\n\nexport default Quoted;\n"]}
|