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
package/lib/less/tree/element.js
CHANGED
|
@@ -1,63 +1,46 @@
|
|
|
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
|
-
if (typeof value === 'string') {
|
|
29
|
-
_this.value = value.trim();
|
|
30
|
-
}
|
|
31
|
-
else if (value) {
|
|
32
|
-
_this.value = value;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
_this.value = '';
|
|
36
|
-
}
|
|
37
|
-
_this.isVariable = isVariable;
|
|
38
|
-
_this._index = index;
|
|
39
|
-
_this._fileInfo = currentFileInfo;
|
|
40
|
-
_this.copyVisibilityInfo(visibilityInfo);
|
|
41
|
-
_this.setParent(_this.combinator, _this);
|
|
42
|
-
return _this;
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var paren_1 = tslib_1.__importDefault(require("./paren"));
|
|
6
|
+
var combinator_1 = tslib_1.__importDefault(require("./combinator"));
|
|
7
|
+
var Element = function (combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {
|
|
8
|
+
this.combinator = combinator instanceof combinator_1.default ?
|
|
9
|
+
combinator : new combinator_1.default(combinator);
|
|
10
|
+
if (typeof value === 'string') {
|
|
11
|
+
this.value = value.trim();
|
|
43
12
|
}
|
|
44
|
-
|
|
13
|
+
else if (value) {
|
|
14
|
+
this.value = value;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
this.value = '';
|
|
18
|
+
}
|
|
19
|
+
this.isVariable = isVariable;
|
|
20
|
+
this._index = index;
|
|
21
|
+
this._fileInfo = currentFileInfo;
|
|
22
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
23
|
+
this.setParent(this.combinator, this);
|
|
24
|
+
};
|
|
25
|
+
Element.prototype = Object.assign(new node_1.default(), {
|
|
26
|
+
type: 'Element',
|
|
27
|
+
accept: function (visitor) {
|
|
45
28
|
var value = this.value;
|
|
46
29
|
this.combinator = visitor.visit(this.combinator);
|
|
47
30
|
if (typeof value === 'object') {
|
|
48
31
|
this.value = visitor.visit(value);
|
|
49
32
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
33
|
+
},
|
|
34
|
+
eval: function (context) {
|
|
52
35
|
return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
|
|
53
|
-
}
|
|
54
|
-
|
|
36
|
+
},
|
|
37
|
+
clone: function () {
|
|
55
38
|
return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
|
|
56
|
-
}
|
|
57
|
-
|
|
39
|
+
},
|
|
40
|
+
genCSS: function (context, output) {
|
|
58
41
|
output.add(this.toCSS(context), this.fileInfo(), this.getIndex());
|
|
59
|
-
}
|
|
60
|
-
|
|
42
|
+
},
|
|
43
|
+
toCSS: function (context) {
|
|
61
44
|
context = context || {};
|
|
62
45
|
var value = this.value;
|
|
63
46
|
var firstSelector = context.firstSelector;
|
|
@@ -74,9 +57,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
74
57
|
else {
|
|
75
58
|
return this.combinator.toCSS(context) + value;
|
|
76
59
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}(node_1.default));
|
|
80
|
-
Element.prototype.type = 'Element';
|
|
60
|
+
}
|
|
61
|
+
});
|
|
81
62
|
exports.default = Element;
|
|
82
63
|
//# sourceMappingURL=element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/less/tree/element.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/less/tree/element.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,0DAA4B;AAC5B,oEAAsC;AAEtC,IAAM,OAAO,GAAG,UAAS,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc;IAC1F,IAAI,CAAC,UAAU,GAAG,UAAU,YAAY,oBAAU,CAAC,CAAC;QAChD,UAAU,CAAC,CAAC,CAAC,IAAI,oBAAU,CAAC,UAAU,CAAC,CAAC;IAE5C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;KAC7B;SAAM,IAAI,KAAK,EAAE;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACtB;SAAM;QACH,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;KACnB;IACD,IAAI,CAAC,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,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,YAAC,OAAO;QACT,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,IAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC5C,IAAI,KAAK,YAAY,eAAK,EAAE;YACxB,8DAA8D;YAC9D,yDAAyD;YACzD,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;SAChC;QACD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnD,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;QACtC,IAAI,KAAK,KAAK,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACzD,OAAO,EAAE,CAAC;SACb;aAAM;YACH,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;SACjD;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,OAAO,CAAC","sourcesContent":["import Node from './node';\nimport Paren from './paren';\nimport Combinator from './combinator';\n\nconst Element = function(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {\n this.combinator = combinator instanceof Combinator ?\n combinator : new Combinator(combinator);\n\n if (typeof value === 'string') {\n this.value = value.trim();\n } else if (value) {\n this.value = value;\n } else {\n this.value = '';\n }\n this.isVariable = isVariable;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.combinator, this);\n}\n\nElement.prototype = Object.assign(new Node(), {\n type: 'Element',\n\n accept(visitor) {\n const value = this.value;\n this.combinator = visitor.visit(this.combinator);\n if (typeof value === 'object') {\n this.value = visitor.visit(value);\n }\n },\n\n eval(context) {\n return new Element(this.combinator,\n this.value.eval ? this.value.eval(context) : this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n },\n\n clone() {\n return new Element(this.combinator,\n this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n },\n\n genCSS(context, output) {\n output.add(this.toCSS(context), this.fileInfo(), this.getIndex());\n },\n\n toCSS(context) {\n context = context || {};\n let value = this.value;\n const firstSelector = context.firstSelector;\n if (value instanceof Paren) {\n // selector in parens should not be affected by outer selector\n // flags (breaks only interpolated selectors - see #1973)\n context.firstSelector = true;\n }\n value = value.toCSS ? value.toCSS(context) : value;\n context.firstSelector = firstSelector;\n if (value === '' && this.combinator.value.charAt(0) === '&') {\n return '';\n } else {\n return this.combinator.toCSS(context) + value;\n }\n }\n});\n\nexport default Element;\n"]}
|
|
@@ -1,61 +1,25 @@
|
|
|
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
|
|
42
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var paren_1 = tslib_1.__importDefault(require("./paren"));
|
|
6
|
+
var comment_1 = tslib_1.__importDefault(require("./comment"));
|
|
7
|
+
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
|
|
8
|
+
var Constants = tslib_1.__importStar(require("../constants"));
|
|
43
9
|
var MATH = Constants.Math;
|
|
44
|
-
var Expression =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_this.noSpacing = noSpacing;
|
|
50
|
-
if (!value) {
|
|
51
|
-
throw new Error('Expression requires an array parameter');
|
|
52
|
-
}
|
|
53
|
-
return _this;
|
|
10
|
+
var Expression = function (value, noSpacing) {
|
|
11
|
+
this.value = value;
|
|
12
|
+
this.noSpacing = noSpacing;
|
|
13
|
+
if (!value) {
|
|
14
|
+
throw new Error('Expression requires an array parameter');
|
|
54
15
|
}
|
|
55
|
-
|
|
16
|
+
};
|
|
17
|
+
Expression.prototype = Object.assign(new node_1.default(), {
|
|
18
|
+
type: 'Expression',
|
|
19
|
+
accept: function (visitor) {
|
|
56
20
|
this.value = visitor.visitArray(this.value);
|
|
57
|
-
}
|
|
58
|
-
|
|
21
|
+
},
|
|
22
|
+
eval: function (context) {
|
|
59
23
|
var returnValue;
|
|
60
24
|
var mathOn = context.isMathOn();
|
|
61
25
|
var inParenthesis = this.parens;
|
|
@@ -88,22 +52,20 @@ var Expression = /** @class */ (function (_super) {
|
|
|
88
52
|
returnValue = new paren_1.default(returnValue);
|
|
89
53
|
}
|
|
90
54
|
return returnValue;
|
|
91
|
-
}
|
|
92
|
-
|
|
55
|
+
},
|
|
56
|
+
genCSS: function (context, output) {
|
|
93
57
|
for (var i = 0; i < this.value.length; i++) {
|
|
94
58
|
this.value[i].genCSS(context, output);
|
|
95
59
|
if (!this.noSpacing && i + 1 < this.value.length) {
|
|
96
60
|
output.add(' ');
|
|
97
61
|
}
|
|
98
62
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
63
|
+
},
|
|
64
|
+
throwAwayComments: function () {
|
|
101
65
|
this.value = this.value.filter(function (v) {
|
|
102
66
|
return !(v instanceof comment_1.default);
|
|
103
67
|
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}(node_1.default));
|
|
107
|
-
Expression.prototype.type = 'Expression';
|
|
68
|
+
}
|
|
69
|
+
});
|
|
108
70
|
exports.default = Expression;
|
|
109
71
|
//# sourceMappingURL=expression.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../src/less/tree/expression.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","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AAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC","sourcesContent":["import Node from './node';\nimport Paren from './paren';\nimport Comment from './comment';\nimport Dimension from './dimension';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\nconst Expression = function(value, noSpacing) {\n this.value = value;\n this.noSpacing = noSpacing;\n if (!value) {\n throw new Error('Expression requires an array parameter');\n }\n};\n\nExpression.prototype = Object.assign(new Node(), {\n type: 'Expression',\n\n accept(visitor) {\n this.value = visitor.visitArray(this.value);\n },\n\n eval(context) {\n let returnValue;\n const mathOn = context.isMathOn();\n const inParenthesis = this.parens;\n\n let doubleParen = false;\n if (inParenthesis) {\n context.inParenthesis();\n }\n if (this.value.length > 1) {\n returnValue = new Expression(this.value.map(function (e) {\n if (!e.eval) {\n return e;\n }\n return e.eval(context);\n }), this.noSpacing);\n } else if (this.value.length === 1) {\n if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) {\n doubleParen = true;\n }\n returnValue = this.value[0].eval(context);\n } else {\n returnValue = this;\n }\n if (inParenthesis) {\n context.outOfParenthesis();\n }\n if (this.parens && this.parensInOp && !mathOn && !doubleParen \n && (!(returnValue instanceof Dimension))) {\n returnValue = new Paren(returnValue);\n }\n return returnValue;\n },\n\n genCSS(context, output) {\n for (let i = 0; i < this.value.length; i++) {\n this.value[i].genCSS(context, output);\n if (!this.noSpacing && i + 1 < this.value.length) {\n output.add(' ');\n }\n }\n },\n\n throwAwayComments() {\n this.value = this.value.filter(function(v) {\n return !(v instanceof Comment);\n });\n }\n});\n\nexport default Expression;\n"]}
|
package/lib/less/tree/extend.js
CHANGED
|
@@ -1,59 +1,42 @@
|
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_this.allowAfter = false;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
_this.setParent(_this.selector, _this);
|
|
44
|
-
return _this;
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var selector_1 = tslib_1.__importDefault(require("./selector"));
|
|
6
|
+
var Extend = function (selector, option, index, currentFileInfo, visibilityInfo) {
|
|
7
|
+
this.selector = selector;
|
|
8
|
+
this.option = option;
|
|
9
|
+
this.object_id = Extend.next_id++;
|
|
10
|
+
this.parent_ids = [this.object_id];
|
|
11
|
+
this._index = index;
|
|
12
|
+
this._fileInfo = currentFileInfo;
|
|
13
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
14
|
+
this.allowRoot = true;
|
|
15
|
+
switch (option) {
|
|
16
|
+
case 'all':
|
|
17
|
+
this.allowBefore = true;
|
|
18
|
+
this.allowAfter = true;
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
this.allowBefore = false;
|
|
22
|
+
this.allowAfter = false;
|
|
23
|
+
break;
|
|
45
24
|
}
|
|
46
|
-
|
|
25
|
+
this.setParent(this.selector, this);
|
|
26
|
+
};
|
|
27
|
+
Extend.prototype = Object.assign(new node_1.default(), {
|
|
28
|
+
type: 'Extend',
|
|
29
|
+
accept: function (visitor) {
|
|
47
30
|
this.selector = visitor.visit(this.selector);
|
|
48
|
-
}
|
|
49
|
-
|
|
31
|
+
},
|
|
32
|
+
eval: function (context) {
|
|
50
33
|
return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
|
|
51
|
-
}
|
|
52
|
-
|
|
34
|
+
},
|
|
35
|
+
clone: function (context) {
|
|
53
36
|
return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
|
|
54
|
-
}
|
|
37
|
+
},
|
|
55
38
|
// it concatenates (joins) all selectors in selector array
|
|
56
|
-
|
|
39
|
+
findSelfSelectors: function (selectors) {
|
|
57
40
|
var selfElements = [], i, selectorElements;
|
|
58
41
|
for (i = 0; i < selectors.length; i++) {
|
|
59
42
|
selectorElements = selectors[i].elements;
|
|
@@ -66,10 +49,8 @@ var Extend = /** @class */ (function (_super) {
|
|
|
66
49
|
}
|
|
67
50
|
this.selfSelectors = [new selector_1.default(selfElements)];
|
|
68
51
|
this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}(node_1.default));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
72
54
|
Extend.next_id = 0;
|
|
73
|
-
Extend.prototype.type = 'Extend';
|
|
74
55
|
exports.default = Extend;
|
|
75
56
|
//# sourceMappingURL=extend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../../src/less/tree/extend.js"],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;AACnB,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Selector from './selector';\n\nconst Extend = function(selector, option, index, currentFileInfo, visibilityInfo) {\n this.selector = selector;\n this.option = option;\n this.object_id = Extend.next_id++;\n this.parent_ids = [this.object_id];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n switch (option) {\n case 'all':\n this.allowBefore = true;\n this.allowAfter = true;\n break;\n default:\n this.allowBefore = false;\n this.allowAfter = false;\n break;\n }\n this.setParent(this.selector, this);\n};\n\nExtend.prototype = Object.assign(new Node(), {\n type: 'Extend',\n\n accept(visitor) {\n this.selector = visitor.visit(this.selector);\n },\n\n eval(context) {\n return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n clone(context) {\n return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // it concatenates (joins) all selectors in selector array\n findSelfSelectors(selectors) {\n let selfElements = [], i, selectorElements;\n\n for (i = 0; i < selectors.length; i++) {\n selectorElements = selectors[i].elements;\n // duplicate the logic in genCSS function inside the selector node.\n // future TODO - move both logics into the selector joiner visitor\n if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {\n selectorElements[0].combinator.value = ' ';\n }\n selfElements = selfElements.concat(selectors[i].elements);\n }\n\n this.selfSelectors = [new Selector(selfElements)];\n this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());\n }\n});\n\nExtend.next_id = 0;\nexport default Extend;\n"]}
|
package/lib/less/tree/import.js
CHANGED
|
@@ -1,48 +1,14 @@
|
|
|
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
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var node_1 = tslib_1.__importDefault(require("./node"));
|
|
5
|
+
var media_1 = tslib_1.__importDefault(require("./media"));
|
|
6
|
+
var url_1 = tslib_1.__importDefault(require("./url"));
|
|
7
|
+
var quoted_1 = tslib_1.__importDefault(require("./quoted"));
|
|
8
|
+
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
|
|
9
|
+
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
|
|
10
|
+
var utils = tslib_1.__importStar(require("../utils"));
|
|
11
|
+
var less_error_1 = tslib_1.__importDefault(require("../less-error"));
|
|
46
12
|
//
|
|
47
13
|
// CSS @import node
|
|
48
14
|
//
|
|
@@ -55,31 +21,29 @@ var less_error_1 = __importDefault(require("../less-error"));
|
|
|
55
21
|
// `import,push`, we also pass it a callback, which it'll call once
|
|
56
22
|
// the file has been fetched, and parsed.
|
|
57
23
|
//
|
|
58
|
-
var Import =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var pathValue = _this.getPath();
|
|
73
|
-
if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) {
|
|
74
|
-
_this.css = true;
|
|
75
|
-
}
|
|
24
|
+
var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) {
|
|
25
|
+
this.options = options;
|
|
26
|
+
this._index = index;
|
|
27
|
+
this._fileInfo = currentFileInfo;
|
|
28
|
+
this.path = path;
|
|
29
|
+
this.features = features;
|
|
30
|
+
this.allowRoot = true;
|
|
31
|
+
if (this.options.less !== undefined || this.options.inline) {
|
|
32
|
+
this.css = !this.options.less || this.options.inline;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
var pathValue = this.getPath();
|
|
36
|
+
if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) {
|
|
37
|
+
this.css = true;
|
|
76
38
|
}
|
|
77
|
-
_this.copyVisibilityInfo(visibilityInfo);
|
|
78
|
-
_this.setParent(_this.features, _this);
|
|
79
|
-
_this.setParent(_this.path, _this);
|
|
80
|
-
return _this;
|
|
81
39
|
}
|
|
82
|
-
|
|
40
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
41
|
+
this.setParent(this.features, this);
|
|
42
|
+
this.setParent(this.path, this);
|
|
43
|
+
};
|
|
44
|
+
Import.prototype = Object.assign(new node_1.default(), {
|
|
45
|
+
type: 'Import',
|
|
46
|
+
accept: function (visitor) {
|
|
83
47
|
if (this.features) {
|
|
84
48
|
this.features = visitor.visit(this.features);
|
|
85
49
|
}
|
|
@@ -87,8 +51,8 @@ var Import = /** @class */ (function (_super) {
|
|
|
87
51
|
if (!this.options.isPlugin && !this.options.inline && this.root) {
|
|
88
52
|
this.root = visitor.visit(this.root);
|
|
89
53
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
54
|
+
},
|
|
55
|
+
genCSS: function (context, output) {
|
|
92
56
|
if (this.css && this.path._fileInfo.reference === undefined) {
|
|
93
57
|
output.add('@import ', this._fileInfo, this._index);
|
|
94
58
|
this.path.genCSS(context, output);
|
|
@@ -98,12 +62,12 @@ var Import = /** @class */ (function (_super) {
|
|
|
98
62
|
}
|
|
99
63
|
output.add(';');
|
|
100
64
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
65
|
+
},
|
|
66
|
+
getPath: function () {
|
|
103
67
|
return (this.path instanceof url_1.default) ?
|
|
104
68
|
this.path.value.value : this.path.value;
|
|
105
|
-
}
|
|
106
|
-
|
|
69
|
+
},
|
|
70
|
+
isVariableImport: function () {
|
|
107
71
|
var path = this.path;
|
|
108
72
|
if (path instanceof url_1.default) {
|
|
109
73
|
path = path.value;
|
|
@@ -112,15 +76,15 @@ var Import = /** @class */ (function (_super) {
|
|
|
112
76
|
return path.containsVariables();
|
|
113
77
|
}
|
|
114
78
|
return true;
|
|
115
|
-
}
|
|
116
|
-
|
|
79
|
+
},
|
|
80
|
+
evalForImport: function (context) {
|
|
117
81
|
var path = this.path;
|
|
118
82
|
if (path instanceof url_1.default) {
|
|
119
83
|
path = path.value;
|
|
120
84
|
}
|
|
121
85
|
return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());
|
|
122
|
-
}
|
|
123
|
-
|
|
86
|
+
},
|
|
87
|
+
evalPath: function (context) {
|
|
124
88
|
var path = this.path.eval(context);
|
|
125
89
|
var fileInfo = this._fileInfo;
|
|
126
90
|
if (!(path instanceof url_1.default)) {
|
|
@@ -136,8 +100,8 @@ var Import = /** @class */ (function (_super) {
|
|
|
136
100
|
}
|
|
137
101
|
}
|
|
138
102
|
return path;
|
|
139
|
-
}
|
|
140
|
-
|
|
103
|
+
},
|
|
104
|
+
eval: function (context) {
|
|
141
105
|
var result = this.doEval(context);
|
|
142
106
|
if (this.options.reference || this.blocksVisibility()) {
|
|
143
107
|
if (result.length || result.length === 0) {
|
|
@@ -150,8 +114,8 @@ var Import = /** @class */ (function (_super) {
|
|
|
150
114
|
}
|
|
151
115
|
}
|
|
152
116
|
return result;
|
|
153
|
-
}
|
|
154
|
-
|
|
117
|
+
},
|
|
118
|
+
doEval: function (context) {
|
|
155
119
|
var ruleset;
|
|
156
120
|
var registry;
|
|
157
121
|
var features = this.features && this.features.eval(context);
|
|
@@ -201,9 +165,7 @@ var Import = /** @class */ (function (_super) {
|
|
|
201
165
|
else {
|
|
202
166
|
return [];
|
|
203
167
|
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
}(node_1.default));
|
|
207
|
-
Import.prototype.type = 'Import';
|
|
168
|
+
}
|
|
169
|
+
});
|
|
208
170
|
exports.default = Import;
|
|
209
171
|
//# sourceMappingURL=import.js.map
|