Socket
Socket
Sign inDemoInstall

less

Package Overview
Dependencies
14
Maintainers
7
Versions
130
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.13.1 to 4.0.0

2

Gruntfile.js

@@ -286,3 +286,3 @@ "use strict";

"test/**/*.js",
"lib/less*/**/*.js",
"src/less*/**/*.js",
"!test/less/errors/plugin/plugin-error.js"

@@ -289,0 +289,0 @@ ],

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils_1 = require("./utils");
var browser_1 = __importDefault(require("./browser"));
var browser_1 = tslib_1.__importDefault(require("./browser"));
exports.default = (function (window, options) {

@@ -9,0 +7,0 @@ // use options from the current script tag data attribues

@@ -8,9 +8,7 @@ "use strict";

/* global window, document */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var default_options_1 = __importDefault(require("../less/default-options"));
var add_default_options_1 = __importDefault(require("./add-default-options"));
var index_1 = __importDefault(require("./index"));
var tslib_1 = require("tslib");
var default_options_1 = tslib_1.__importDefault(require("../less/default-options"));
var add_default_options_1 = tslib_1.__importDefault(require("./add-default-options"));
var index_1 = tslib_1.__importDefault(require("./index"));
var options = default_options_1.default();

@@ -17,0 +15,0 @@ if (window.less) {

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils = __importStar(require("./utils"));
var tslib_1 = require("tslib");
var utils = tslib_1.__importStar(require("./utils"));
exports.default = {

@@ -24,0 +6,0 @@ createCSS: function (document, styles, sheet) {

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils = __importStar(require("./utils"));
var browser_1 = __importDefault(require("./browser"));
var tslib_1 = require("tslib");
var utils = tslib_1.__importStar(require("./utils"));
var browser_1 = tslib_1.__importDefault(require("./browser"));
exports.default = (function (window, less, options) {

@@ -28,0 +7,0 @@ function errorHTML(e, rootHref) {

"use strict";
/* global window, XMLHttpRequest */
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var abstract_file_manager_js_1 = __importDefault(require("../less/environment/abstract-file-manager.js"));
var tslib_1 = require("tslib");
var abstract_file_manager_js_1 = tslib_1.__importDefault(require("../less/environment/abstract-file-manager.js"));
var options;

@@ -25,11 +10,8 @@ var logger;

// TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load
var FileManager = /** @class */ (function (_super) {
__extends(FileManager, _super);
function FileManager() {
return _super !== null && _super.apply(this, arguments) || this;
}
FileManager.prototype.alwaysMakePathsAbsolute = function () {
var FileManager = function () { };
FileManager.prototype = Object.assign(new abstract_file_manager_js_1.default(), {
alwaysMakePathsAbsolute: function () {
return true;
};
FileManager.prototype.join = function (basePath, laterPath) {
},
join: function (basePath, laterPath) {
if (!basePath) {

@@ -39,4 +21,4 @@ return laterPath;

return this.extractUrlParts(laterPath, basePath).path;
};
FileManager.prototype.doXHR = function (url, type, callback, errback) {
},
doXHR: function (url, type, callback, errback) {
var xhr = new XMLHttpRequest();

@@ -77,10 +59,10 @@ var async = options.isFileProtocol ? options.fileAsync : true;

}
};
FileManager.prototype.supports = function () {
},
supports: function () {
return true;
};
FileManager.prototype.clearFileCache = function () {
},
clearFileCache: function () {
fileCache = {};
};
FileManager.prototype.loadFile = function (filename, currentDirectory, options, environment) {
},
loadFile: function (filename, currentDirectory, options, environment) {
// TODO: Add prefix support like less-node?

@@ -117,5 +99,4 @@ // What about multiple paths?

});
};
return FileManager;
}(abstract_file_manager_js_1.default));
}
});
exports.default = (function (opts, log) {

@@ -122,0 +103,0 @@ options = opts;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var function_registry_1 = __importDefault(require("./../less/functions/function-registry"));
var tslib_1 = require("tslib");
var function_registry_1 = tslib_1.__importDefault(require("./../less/functions/function-registry"));
exports.default = (function () {

@@ -8,0 +6,0 @@ function imageSize() {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
//

@@ -11,10 +9,10 @@ // index.js

var utils_1 = require("./utils");
var less_1 = __importDefault(require("../less"));
var browser_1 = __importDefault(require("./browser"));
var file_manager_1 = __importDefault(require("./file-manager"));
var plugin_loader_1 = __importDefault(require("./plugin-loader"));
var log_listener_1 = __importDefault(require("./log-listener"));
var error_reporting_1 = __importDefault(require("./error-reporting"));
var cache_1 = __importDefault(require("./cache"));
var image_size_1 = __importDefault(require("./image-size"));
var less_1 = tslib_1.__importDefault(require("../less"));
var browser_1 = tslib_1.__importDefault(require("./browser"));
var file_manager_1 = tslib_1.__importDefault(require("./file-manager"));
var plugin_loader_1 = tslib_1.__importDefault(require("./plugin-loader"));
var log_listener_1 = tslib_1.__importDefault(require("./log-listener"));
var error_reporting_1 = tslib_1.__importDefault(require("./error-reporting"));
var cache_1 = tslib_1.__importDefault(require("./cache"));
var image_size_1 = tslib_1.__importDefault(require("./image-size"));
exports.default = (function (window, options) {

@@ -21,0 +19,0 @@ var document = window.document;

"use strict";
// TODO: Add tests for browser @plugin
/* global window */
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var abstract_plugin_loader_js_1 = __importDefault(require("../less/environment/abstract-plugin-loader.js"));
var tslib_1 = require("tslib");
var abstract_plugin_loader_js_1 = tslib_1.__importDefault(require("../less/environment/abstract-plugin-loader.js"));
/**
* Browser Plugin Loader
*/
var PluginLoader = /** @class */ (function (_super) {
__extends(PluginLoader, _super);
function PluginLoader(less) {
var _this = _super.call(this) || this;
_this.less = less;
return _this;
// Should we shim this.require for browser? Probably not?
}
PluginLoader.prototype.loadPlugin = function (filename, basePath, context, environment, fileManager) {
var PluginLoader = function (less) {
this.less = less;
// Should we shim this.require for browser? Probably not?
};
PluginLoader.prototype = Object.assign(new abstract_plugin_loader_js_1.default(), {
loadPlugin: function (filename, basePath, context, environment, fileManager) {
return new Promise(function (fulfill, reject) {

@@ -38,6 +20,5 @@ fileManager.loadFile(filename, basePath, context, environment)

});
};
return PluginLoader;
}(abstract_plugin_loader_js_1.default));
}
});
exports.default = PluginLoader;
//# sourceMappingURL=plugin-loader.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = __importDefault(require("path"));
var fs_1 = __importDefault(require("./fs"));
var abstract_file_manager_js_1 = __importDefault(require("../less/environment/abstract-file-manager.js"));
var FileManager = /** @class */ (function (_super) {
__extends(FileManager, _super);
function FileManager() {
return _super !== null && _super.apply(this, arguments) || this;
}
FileManager.prototype.supports = function () {
var tslib_1 = require("tslib");
var path_1 = tslib_1.__importDefault(require("path"));
var fs_1 = tslib_1.__importDefault(require("./fs"));
var abstract_file_manager_js_1 = tslib_1.__importDefault(require("../less/environment/abstract-file-manager.js"));
var FileManager = function () { };
FileManager.prototype = Object.assign(new abstract_file_manager_js_1.default(), {
supports: function () {
return true;
};
FileManager.prototype.supportsSync = function () {
},
supportsSync: function () {
return true;
};
FileManager.prototype.loadFile = function (filename, currentDirectory, options, environment, callback) {
},
loadFile: function (filename, currentDirectory, options, environment, callback) {
var fullFilename;

@@ -150,10 +132,9 @@ var isAbsoluteFilename = this.isPathAbsolute(filename);

}
};
FileManager.prototype.loadFileSync = function (filename, currentDirectory, options, environment) {
},
loadFileSync: function (filename, currentDirectory, options, environment) {
options.syncImport = true;
return this.loadFile(filename, currentDirectory, options, environment);
};
return FileManager;
}(abstract_file_manager_js_1.default));
}
});
exports.default = FileManager;
//# sourceMappingURL=file-manager.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dimension_1 = __importDefault(require("../less/tree/dimension"));
var expression_1 = __importDefault(require("../less/tree/expression"));
var function_registry_1 = __importDefault(require("./../less/functions/function-registry"));
var tslib_1 = require("tslib");
var dimension_1 = tslib_1.__importDefault(require("../less/tree/dimension"));
var expression_1 = tslib_1.__importDefault(require("../less/tree/expression"));
var function_registry_1 = tslib_1.__importDefault(require("./../less/functions/function-registry"));
exports.default = (function (environment) {

@@ -10,0 +8,0 @@ function imageSize(functionContext, filePathNode) {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var environment_1 = __importDefault(require("./environment"));
var file_manager_1 = __importDefault(require("./file-manager"));
var url_file_manager_1 = __importDefault(require("./url-file-manager"));
var less_1 = __importDefault(require("../less"));
var lessc_helper_1 = __importDefault(require("./lessc-helper"));
var plugin_loader_1 = __importDefault(require("./plugin-loader"));
var fs_1 = __importDefault(require("./fs"));
var default_options_1 = __importDefault(require("../less/default-options"));
var image_size_1 = __importDefault(require("./image-size"));
var tslib_1 = require("tslib");
var environment_1 = tslib_1.__importDefault(require("./environment"));
var file_manager_1 = tslib_1.__importDefault(require("./file-manager"));
var url_file_manager_1 = tslib_1.__importDefault(require("./url-file-manager"));
var less_1 = tslib_1.__importDefault(require("../less"));
var less = less_1.default(environment_1.default, [new file_manager_1.default(), new url_file_manager_1.default()]);
var lessc_helper_1 = tslib_1.__importDefault(require("./lessc-helper"));
// allow people to create less with their own environment
less.createFromEnvironment = less_1.default;
less.lesscHelper = lessc_helper_1.default;
less.PluginLoader = plugin_loader_1.default;
less.fs = fs_1.default;
less.PluginLoader = require('./plugin-loader').default;
less.fs = require('./fs').default;
less.FileManager = file_manager_1.default;
less.UrlFileManager = url_file_manager_1.default;
// Set up options
less.options = default_options_1.default();
less.options = require('../less/default-options').default();
// provide image-size functionality
image_size_1.default(less.environment);
require('./image-size').default(less.environment);
exports.default = less;
//# sourceMappingURL=index.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = __importDefault(require("path"));
var abstract_plugin_loader_js_1 = __importDefault(require("../less/environment/abstract-plugin-loader.js"));
var tslib_1 = require("tslib");
var path_1 = tslib_1.__importDefault(require("path"));
var abstract_plugin_loader_js_1 = tslib_1.__importDefault(require("../less/environment/abstract-plugin-loader.js"));
/**
* Node Plugin Loader
*/
var PluginLoader = /** @class */ (function (_super) {
__extends(PluginLoader, _super);
function PluginLoader(less) {
var _this = _super.call(this) || this;
_this.less = less;
_this.require = function (prefix) {
prefix = path_1.default.dirname(prefix);
return function (id) {
var str = id.substr(0, 2);
if (str === '..' || str === './') {
return require(path_1.default.join(prefix, id));
}
else {
return require(id);
}
};
var PluginLoader = function (less) {
this.less = less;
this.require = function (prefix) {
prefix = path_1.default.dirname(prefix);
return function (id) {
var str = id.substr(0, 2);
if (str === '..' || str === './') {
return require(path_1.default.join(prefix, id));
}
else {
return require(id);
}
};
return _this;
}
PluginLoader.prototype.loadPlugin = function (filename, basePath, context, environment, fileManager) {
};
};
PluginLoader.prototype = Object.assign(new abstract_plugin_loader_js_1.default(), {
loadPlugin: function (filename, basePath, context, environment, fileManager) {
var prefix = filename.slice(0, 1);

@@ -65,10 +47,9 @@ var explicit = prefix === '.' || prefix === '/' || filename.slice(-3).toLowerCase() === '.js';

});
};
PluginLoader.prototype.loadPluginSync = function (filename, basePath, context, environment, fileManager) {
},
loadPluginSync: function (filename, basePath, context, environment, fileManager) {
context.syncImport = true;
return this.loadPlugin(filename, basePath, context, environment, fileManager);
};
return PluginLoader;
}(abstract_plugin_loader_js_1.default));
}
});
exports.default = PluginLoader;
//# sourceMappingURL=plugin-loader.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var isUrlRe = /^(?:https?:)?\/\//i;
var url_1 = __importDefault(require("url"));
var url_1 = tslib_1.__importDefault(require("url"));
var request;
var abstract_file_manager_js_1 = __importDefault(require("../less/environment/abstract-file-manager.js"));
var logger_1 = __importDefault(require("../less/logger"));
var UrlFileManager = /** @class */ (function (_super) {
__extends(UrlFileManager, _super);
function UrlFileManager() {
return _super !== null && _super.apply(this, arguments) || this;
}
UrlFileManager.prototype.supports = function (filename, currentDirectory, options, environment) {
var abstract_file_manager_js_1 = tslib_1.__importDefault(require("../less/environment/abstract-file-manager.js"));
var logger_1 = tslib_1.__importDefault(require("../less/logger"));
var UrlFileManager = function () { };
UrlFileManager.prototype = Object.assign(new abstract_file_manager_js_1.default(), {
supports: function (filename, currentDirectory, options, environment) {
return isUrlRe.test(filename) || isUrlRe.test(currentDirectory);
};
UrlFileManager.prototype.loadFile = function (filename, currentDirectory, options, environment) {
},
loadFile: function (filename, currentDirectory, options, environment) {
return new Promise(function (fulfill, reject) {

@@ -64,6 +46,5 @@ if (request === undefined) {

});
};
return UrlFileManager;
}(abstract_file_manager_js_1.default));
}
});
exports.default = UrlFileManager;
//# sourceMappingURL=url-file-manager.js.map

@@ -7,4 +7,4 @@ "use strict";

PARENS_DIVISION: 1,
PARENS: 2,
STRICT_LEGACY: 3
PARENS: 2
// removed - STRICT_LEGACY: 3
};

@@ -11,0 +11,0 @@ exports.RewriteUrls = {

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var contexts = {};
exports.default = contexts;
var Constants = __importStar(require("./constants"));
var Constants = tslib_1.__importStar(require("./constants"));
var copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) {

@@ -75,2 +57,87 @@ if (!original) {

];
contexts.Eval = function (options, frames) {
copyFromOriginal(options, this, evalCopyProperties);
if (typeof this.paths === 'string') {
this.paths = [this.paths];
}
this.frames = frames || [];
this.importantScope = this.importantScope || [];
};
contexts.Eval.prototype.enterCalc = function () {
if (!this.calcStack) {
this.calcStack = [];
}
this.calcStack.push(true);
this.inCalc = true;
};
contexts.Eval.prototype.exitCalc = function () {
this.calcStack.pop();
if (!this.calcStack.length) {
this.inCalc = false;
}
};
contexts.Eval.prototype.inParenthesis = function () {
if (!this.parensStack) {
this.parensStack = [];
}
this.parensStack.push(true);
};
contexts.Eval.prototype.outOfParenthesis = function () {
this.parensStack.pop();
};
contexts.Eval.prototype.inCalc = false;
contexts.Eval.prototype.mathOn = true;
contexts.Eval.prototype.isMathOn = function (op) {
if (!this.mathOn) {
return false;
}
if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {
return false;
}
if (this.math > Constants.Math.PARENS_DIVISION) {
return this.parensStack && this.parensStack.length;
}
return true;
};
contexts.Eval.prototype.pathRequiresRewrite = function (path) {
var isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;
return isRelative(path);
};
contexts.Eval.prototype.rewritePath = function (path, rootpath) {
var newPath;
rootpath = rootpath || '';
newPath = this.normalizePath(rootpath + path);
// If a path was explicit relative and the rootpath was not an absolute path
// we must ensure that the new path is also explicit relative.
if (isPathLocalRelative(path) &&
isPathRelative(rootpath) &&
isPathLocalRelative(newPath) === false) {
newPath = "./" + newPath;
}
return newPath;
};
contexts.Eval.prototype.normalizePath = function (path) {
var segments = path.split('/').reverse();
var segment;
path = [];
while (segments.length !== 0) {
segment = segments.pop();
switch (segment) {
case '.':
break;
case '..':
if ((path.length === 0) || (path[path.length - 1] === '..')) {
path.push(segment);
}
else {
path.pop();
}
break;
default:
path.push(segment);
break;
}
}
return path.join('/');
};
function isPathRelative(path) {

@@ -82,92 +149,3 @@ return !/^(?:[a-z-]+:|\/|#)/i.test(path);

}
contexts.Eval = /** @class */ (function () {
function Eval(options, frames) {
copyFromOriginal(options, this, evalCopyProperties);
if (typeof this.paths === 'string') {
this.paths = [this.paths];
}
this.frames = frames || [];
this.importantScope = this.importantScope || [];
this.inCalc = false;
this.mathOn = true;
}
Eval.prototype.enterCalc = function () {
if (!this.calcStack) {
this.calcStack = [];
}
this.calcStack.push(true);
this.inCalc = true;
};
Eval.prototype.exitCalc = function () {
this.calcStack.pop();
if (!this.calcStack.length) {
this.inCalc = false;
}
};
Eval.prototype.inParenthesis = function () {
if (!this.parensStack) {
this.parensStack = [];
}
this.parensStack.push(true);
};
;
Eval.prototype.outOfParenthesis = function () {
this.parensStack.pop();
};
;
Eval.prototype.isMathOn = function (op) {
if (!this.mathOn) {
return false;
}
if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {
return false;
}
if (this.math > Constants.Math.PARENS_DIVISION) {
return this.parensStack && this.parensStack.length;
}
return true;
};
Eval.prototype.pathRequiresRewrite = function (path) {
var isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;
return isRelative(path);
};
Eval.prototype.rewritePath = function (path, rootpath) {
var newPath;
rootpath = rootpath || '';
newPath = this.normalizePath(rootpath + path);
// If a path was explicit relative and the rootpath was not an absolute path
// we must ensure that the new path is also explicit relative.
if (isPathLocalRelative(path) &&
isPathRelative(rootpath) &&
isPathLocalRelative(newPath) === false) {
newPath = "./" + newPath;
}
return newPath;
};
Eval.prototype.normalizePath = function (path) {
var segments = path.split('/').reverse();
var segment;
path = [];
while (segments.length !== 0) {
segment = segments.pop();
switch (segment) {
case '.':
break;
case '..':
if ((path.length === 0) || (path[path.length - 1] === '..')) {
path.push(segment);
}
else {
path.pop();
}
break;
default:
path.push(segment);
break;
}
}
return path.join('/');
};
return Eval;
}());
// todo - do the same for the toCSS ?
//# sourceMappingURL=contexts.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var colors_1 = __importDefault(require("./colors"));
var unit_conversions_1 = __importDefault(require("./unit-conversions"));
var tslib_1 = require("tslib");
var colors_1 = tslib_1.__importDefault(require("./colors"));
var unit_conversions_1 = tslib_1.__importDefault(require("./unit-conversions"));
exports.default = { colors: colors_1.default, unitConversions: unit_conversions_1.default };
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Export a new default each time
exports.default = (function () { return ({
/* Inline Javascript - @plugin still allowed */
javascriptEnabled: false,
/* Outputs a makefile import dependency list to stdout. */
depends: false,
/* (DEPRECATED) Compress using less built-in compression.
* This does an okay job but does not utilise all the tricks of
* dedicated css compression. */
compress: false,
/* Runs the less parser and just reports errors without any output. */
lint: false,
/* Sets available include paths.
* If the file in an @import rule does not exist at that exact location,
* less will look for it at the location(s) passed to this option.
* You might use this for instance to specify a path to a library which
* you want to be referenced simply and relatively in the less files. */
paths: [],
/* color output in the terminal */
color: true,
/* The strictImports controls whether the compiler will allow an @import inside of either
* @media blocks or (a later addition) other selector blocks.
* See: https://github.com/less/less.js/issues/656 */
strictImports: false,
/* Allow Imports from Insecure HTTPS Hosts */
insecure: false,
/* Allows you to add a path to every generated import and url in your css.
* This does not affect less import statements that are processed, just ones
* that are left in the output css. */
rootpath: '',
/* By default URLs are kept as-is, so if you import a file in a sub-directory
* that references an image, exactly the same URL will be output in the css.
* This option allows you to re-write URL's in imported files so that the
* URL is always relative to the base imported file */
rewriteUrls: false,
/* How to process math
* 0 always - eagerly try to solve all operations
* 1 parens-division - require parens for division "/"
* 2 parens | strict - require parens for all operations
* 3 strict-legacy - legacy strict behavior (super-strict)
*/
math: 0,
/* Without this option, less attempts to guess at the output unit when it does maths. */
strictUnits: false,
/* Effectively the declaration is put at the top of your base Less file,
* meaning it can be used but it also can be overridden if this variable
* is defined in the file. */
globalVars: null,
/* As opposed to the global variable option, this puts the declaration at the
* end of your base file, meaning it will override anything defined in your Less file. */
modifyVars: null,
/* This option allows you to specify a argument to go on to every URL. */
urlArgs: ''
}); });
function default_1() {
return {
/* Inline Javascript - @plugin still allowed */
javascriptEnabled: false,
/* Outputs a makefile import dependency list to stdout. */
depends: false,
/* (DEPRECATED) Compress using less built-in compression.
* This does an okay job but does not utilise all the tricks of
* dedicated css compression. */
compress: false,
/* Runs the less parser and just reports errors without any output. */
lint: false,
/* Sets available include paths.
* If the file in an @import rule does not exist at that exact location,
* less will look for it at the location(s) passed to this option.
* You might use this for instance to specify a path to a library which
* you want to be referenced simply and relatively in the less files. */
paths: [],
/* color output in the terminal */
color: true,
/* The strictImports controls whether the compiler will allow an @import inside of either
* @media blocks or (a later addition) other selector blocks.
* See: https://github.com/less/less.js/issues/656 */
strictImports: false,
/* Allow Imports from Insecure HTTPS Hosts */
insecure: false,
/* Allows you to add a path to every generated import and url in your css.
* This does not affect less import statements that are processed, just ones
* that are left in the output css. */
rootpath: '',
/* By default URLs are kept as-is, so if you import a file in a sub-directory
* that references an image, exactly the same URL will be output in the css.
* This option allows you to re-write URL's in imported files so that the
* URL is always relative to the base imported file */
rewriteUrls: false,
/* How to process math
* 0 always - eagerly try to solve all operations
* 1 parens-division - require parens for division "/"
* 2 parens | strict - require parens for all operations
* 3 strict-legacy - legacy strict behavior (super-strict)
*/
math: 1,
/* Without this option, less attempts to guess at the output unit when it does maths. */
strictUnits: false,
/* Effectively the declaration is put at the top of your base Less file,
* meaning it can be used but it also can be overridden if this variable
* is defined in the file. */
globalVars: null,
/* As opposed to the global variable option, this puts the declaration at the
* end of your base file, meaning it will override anything defined in your Less file. */
modifyVars: null,
/* This option allows you to specify a argument to go on to every URL. */
urlArgs: ''
};
}
exports.default = default_1;
;
//# sourceMappingURL=default-options.js.map

@@ -26,5 +26,8 @@ "use strict";

};
;
AbstractFileManager.prototype.supportsSync = function () { return false; };
AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () { return false; };
AbstractFileManager.prototype.supportsSync = function () {
return false;
};
AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () {
return false;
};
AbstractFileManager.prototype.isPathAbsolute = function (filename) {

@@ -40,3 +43,2 @@ return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename);

};
;
AbstractFileManager.prototype.pathDiff = function (url, baseUrl) {

@@ -70,3 +72,2 @@ // diff between two paths to create a relative path

};
;
// helper function, not part of API

@@ -121,3 +122,2 @@ AbstractFileManager.prototype.extractUrlParts = function (url, baseUrl) {

};
;
return AbstractFileManager;

@@ -124,0 +124,0 @@ }());

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var function_registry_1 = __importDefault(require("../functions/function-registry"));
var less_error_1 = __importDefault(require("../less-error"));
var tslib_1 = require("tslib");
var function_registry_1 = tslib_1.__importDefault(require("../functions/function-registry"));
var less_error_1 = tslib_1.__importDefault(require("../less-error"));
var AbstractPluginLoader = /** @class */ (function () {
function AbstractPluginLoader() {
// Implemented by Node.js plugin loader
this.require = function () { return null; };
this.require = function () {
return null;
};
}
AbstractPluginLoader.prototype.evalPlugin = function (contents, context, imports, pluginOptions, fileInfo) {
var loader;
var registry;
var pluginObj;
var localModule;
var pluginManager;
var filename;
var result;
var loader, registry, pluginObj, localModule, pluginManager, filename, result;
pluginManager = context.pluginManager;

@@ -22,0 +16,0 @@ if (fileInfo) {

@@ -6,9 +6,7 @@ "use strict";

*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = __importDefault(require("../logger"));
var environment = /** @class */ (function () {
function environment(externalEnvironment, fileManagers) {
var tslib_1 = require("tslib");
var logger_1 = tslib_1.__importDefault(require("../logger"));
var Environment = /** @class */ (function () {
function Environment(externalEnvironment, fileManagers) {
this.fileManagers = fileManagers || [];

@@ -30,3 +28,3 @@ externalEnvironment = externalEnvironment || {};

}
environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) {
Environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) {
if (!filename) {

@@ -50,11 +48,11 @@ logger_1.default.warn('getFileManager called with no filename.. Please report this issue. continuing.');

};
environment.prototype.addFileManager = function (fileManager) {
Environment.prototype.addFileManager = function (fileManager) {
this.fileManagers.push(fileManager);
};
environment.prototype.clearFileManagers = function () {
Environment.prototype.clearFileManagers = function () {
this.fileManagers = [];
};
return environment;
return Environment;
}());
exports.default = environment;
exports.default = Environment;
//# sourceMappingURL=environment.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var anonymous_1 = __importDefault(require("../tree/anonymous"));
var keyword_1 = __importDefault(require("../tree/keyword"));
var tslib_1 = require("tslib");
var anonymous_1 = tslib_1.__importDefault(require("../tree/anonymous"));
var keyword_1 = tslib_1.__importDefault(require("../tree/keyword"));
function boolean(condition) {

@@ -20,3 +18,13 @@ return condition ? keyword_1.default.True : keyword_1.default.False;

If.evalArgs = false;
exports.default = { boolean: boolean, 'if': If };
function isdefined(context, variable) {
try {
variable.eval(context);
return keyword_1.default.True;
}
catch (e) {
return keyword_1.default.False;
}
}
isdefined.evalArgs = false;
exports.default = { isdefined: isdefined, boolean: boolean, 'if': If };
//# sourceMappingURL=boolean.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var color_1 = __importDefault(require("../tree/color"));
var tslib_1 = require("tslib");
var color_1 = tslib_1.__importDefault(require("../tree/color"));
// Color Blending

@@ -8,0 +6,0 @@ // ref: http://www.w3.org/TR/compositing-1

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dimension_1 = __importDefault(require("../tree/dimension"));
var color_1 = __importDefault(require("../tree/color"));
var quoted_1 = __importDefault(require("../tree/quoted"));
var anonymous_1 = __importDefault(require("../tree/anonymous"));
var tslib_1 = require("tslib");
var dimension_1 = tslib_1.__importDefault(require("../tree/dimension"));
var color_1 = tslib_1.__importDefault(require("../tree/color"));
var quoted_1 = tslib_1.__importDefault(require("../tree/quoted"));
var anonymous_1 = tslib_1.__importDefault(require("../tree/anonymous"));
var expression_1 = tslib_1.__importDefault(require("../tree/expression"));
var operation_1 = tslib_1.__importDefault(require("../tree/operation"));
var colorFunctions;

@@ -67,3 +67,23 @@ function clamp(val) {

rgb: function (r, g, b) {
var color = colorFunctions.rgba(r, g, b, 1.0);
var a = 1;
/**
* Comma-less syntax
* e.g. rgb(0 128 255 / 50%)
*/
if (r instanceof expression_1.default) {
var val = r.value;
r = val[0];
g = val[1];
b = val[2];
/**
* @todo - should this be normalized in
* function caller? Or parsed differently?
*/
if (b instanceof operation_1.default) {
var op = b;
b = op.operands[0];
a = op.operands[1];
}
}
var color = colorFunctions.rgba(r, g, b, a);
if (color) {

@@ -92,3 +112,15 @@ color.value = 'rgb';

hsl: function (h, s, l) {
var color = colorFunctions.hsla(h, s, l, 1.0);
var a = 1;
if (h instanceof expression_1.default) {
var val = h.value;
h = val[0];
s = val[1];
l = val[2];
if (l instanceof operation_1.default) {
var op = l;
l = op.operands[0];
a = op.operands[1];
}
}
var color = colorFunctions.hsla(h, s, l, a);
if (color) {

@@ -95,0 +127,0 @@ color.value = 'hsl';

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var quoted_1 = __importDefault(require("../tree/quoted"));
var url_1 = __importDefault(require("../tree/url"));
var utils = __importStar(require("../utils"));
var logger_1 = __importDefault(require("../logger"));
var tslib_1 = require("tslib");
var quoted_1 = tslib_1.__importDefault(require("../tree/quoted"));
var url_1 = tslib_1.__importDefault(require("../tree/url"));
var utils = tslib_1.__importStar(require("../utils"));
var logger_1 = tslib_1.__importDefault(require("../logger"));
exports.default = (function (environment) {

@@ -30,0 +9,0 @@ var fallback = function (functionThis, node) { return new url_1.default(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); };

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var keyword_1 = __importDefault(require("../tree/keyword"));
var tslib_1 = require("tslib");
var keyword_1 = tslib_1.__importDefault(require("../tree/keyword"));
var defaultFunc = {

@@ -8,0 +6,0 @@ eval: function () {

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var expression_1 = __importDefault(require("../tree/expression"));
var tslib_1 = require("tslib");
var expression_1 = tslib_1.__importDefault(require("../tree/expression"));
var functionCaller = /** @class */ (function () {

@@ -27,2 +18,5 @@ function functionCaller(name, context, index, currentFileInfo) {

var _this = this;
if (!(Array.isArray(args))) {
args = [args];
}
var evalArgs = this.func.evalArgs;

@@ -32,31 +26,21 @@ if (evalArgs !== false) {

}
var commentFilter = function (item) { return !(item.type === 'Comment'); };
// This code is terrible and should be replaced as per this issue...
// https://github.com/less/less.js/issues/2477
if (Array.isArray(args)) {
args = args.filter(function (item) {
if (item.type === 'Comment') {
return false;
args = args
.filter(commentFilter)
.map(function (item) {
if (item.type === 'Expression') {
var subNodes = item.value.filter(commentFilter);
if (subNodes.length === 1) {
return subNodes[0];
}
return true;
})
.map(function (item) {
if (item.type === 'Expression') {
var subNodes = item.value.filter(function (item) {
if (item.type === 'Comment') {
return false;
}
return true;
});
if (subNodes.length === 1) {
return subNodes[0];
}
else {
return new expression_1.default(subNodes);
}
else {
return new expression_1.default(subNodes);
}
return item;
});
}
}
return item;
});
if (evalArgs === false) {
return this.func.apply(this, __spreadArrays([this.context], args));
return this.func.apply(this, tslib_1.__spreadArrays([this.context], args));
}

@@ -63,0 +47,0 @@ return this.func.apply(this, args);

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var function_registry_1 = __importDefault(require("./function-registry"));
var function_caller_1 = __importDefault(require("./function-caller"));
var boolean_1 = __importDefault(require("./boolean"));
var default_1 = __importDefault(require("./default"));
var color_1 = __importDefault(require("./color"));
var color_blending_1 = __importDefault(require("./color-blending"));
var data_uri_1 = __importDefault(require("./data-uri"));
var list_1 = __importDefault(require("./list"));
var math_1 = __importDefault(require("./math"));
var number_1 = __importDefault(require("./number"));
var string_1 = __importDefault(require("./string"));
var svg_1 = __importDefault(require("./svg"));
var types_1 = __importDefault(require("./types"));
var tslib_1 = require("tslib");
var function_registry_1 = tslib_1.__importDefault(require("./function-registry"));
var function_caller_1 = tslib_1.__importDefault(require("./function-caller"));
var boolean_1 = tslib_1.__importDefault(require("./boolean"));
var default_1 = tslib_1.__importDefault(require("./default"));
var color_1 = tslib_1.__importDefault(require("./color"));
var color_blending_1 = tslib_1.__importDefault(require("./color-blending"));
var data_uri_1 = tslib_1.__importDefault(require("./data-uri"));
var list_1 = tslib_1.__importDefault(require("./list"));
var math_1 = tslib_1.__importDefault(require("./math"));
var number_1 = tslib_1.__importDefault(require("./number"));
var string_1 = tslib_1.__importDefault(require("./string"));
var svg_1 = tslib_1.__importDefault(require("./svg"));
var types_1 = tslib_1.__importDefault(require("./types"));
exports.default = (function (environment) {

@@ -20,0 +18,0 @@ var functions = { functionRegistry: function_registry_1.default, functionCaller: function_caller_1.default };

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var comment_1 = __importDefault(require("../tree/comment"));
var node_1 = __importDefault(require("../tree/node"));
var dimension_1 = __importDefault(require("../tree/dimension"));
var declaration_1 = __importDefault(require("../tree/declaration"));
var expression_1 = __importDefault(require("../tree/expression"));
var ruleset_1 = __importDefault(require("../tree/ruleset"));
var selector_1 = __importDefault(require("../tree/selector"));
var element_1 = __importDefault(require("../tree/element"));
var quoted_1 = __importDefault(require("../tree/quoted"));
var tslib_1 = require("tslib");
var comment_1 = tslib_1.__importDefault(require("../tree/comment"));
var node_1 = tslib_1.__importDefault(require("../tree/node"));
var dimension_1 = tslib_1.__importDefault(require("../tree/dimension"));
var declaration_1 = tslib_1.__importDefault(require("../tree/declaration"));
var expression_1 = tslib_1.__importDefault(require("../tree/expression"));
var ruleset_1 = tslib_1.__importDefault(require("../tree/ruleset"));
var selector_1 = tslib_1.__importDefault(require("../tree/selector"));
var element_1 = tslib_1.__importDefault(require("../tree/element"));
var quoted_1 = tslib_1.__importDefault(require("../tree/quoted"));
var value_1 = tslib_1.__importDefault(require("../tree/value"));
var getItemsFromNode = function (node) {

@@ -26,2 +25,12 @@ // handle non-array values as an array of length 1

},
'~': function () {
var expr = [];
for (var _i = 0; _i < arguments.length; _i++) {
expr[_i] = arguments[_i];
}
if (expr.length === 1) {
return expr[0];
}
return new value_1.default(expr);
},
extract: function (values, index) {

@@ -28,0 +37,0 @@ // (1-based index)

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dimension_1 = __importDefault(require("../tree/dimension"));
var tslib_1 = require("tslib");
var dimension_1 = tslib_1.__importDefault(require("../tree/dimension"));
var MathHelper = function (fn, unit, n) {

@@ -8,0 +6,0 @@ if (!(n instanceof dimension_1.default)) {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var math_helper_js_1 = __importDefault(require("./math-helper.js"));
var tslib_1 = require("tslib");
var math_helper_js_1 = tslib_1.__importDefault(require("./math-helper.js"));
var mathFunctions = {

@@ -8,0 +6,0 @@ // name, unit

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dimension_1 = __importDefault(require("../tree/dimension"));
var anonymous_1 = __importDefault(require("../tree/anonymous"));
var math_helper_js_1 = __importDefault(require("./math-helper.js"));
var tslib_1 = require("tslib");
var dimension_1 = tslib_1.__importDefault(require("../tree/dimension"));
var anonymous_1 = tslib_1.__importDefault(require("../tree/anonymous"));
var math_helper_js_1 = tslib_1.__importDefault(require("./math-helper.js"));
var minMax = function (isMin, args) {

@@ -65,3 +63,6 @@ args = Array.prototype.slice.call(args);

}
return minMax(true, args);
try {
return minMax(true, args);
}
catch (e) { }
},

@@ -73,3 +74,6 @@ max: function () {

}
return minMax(false, args);
try {
return minMax(false, args);
}
catch (e) { }
},

@@ -76,0 +80,0 @@ convert: function (val, unit) {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var quoted_1 = __importDefault(require("../tree/quoted"));
var anonymous_1 = __importDefault(require("../tree/anonymous"));
var javascript_1 = __importDefault(require("../tree/javascript"));
var tslib_1 = require("tslib");
var quoted_1 = tslib_1.__importDefault(require("../tree/quoted"));
var anonymous_1 = tslib_1.__importDefault(require("../tree/anonymous"));
var javascript_1 = tslib_1.__importDefault(require("../tree/javascript"));
exports.default = {

@@ -10,0 +8,0 @@ e: function (str) {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dimension_1 = __importDefault(require("../tree/dimension"));
var color_1 = __importDefault(require("../tree/color"));
var expression_1 = __importDefault(require("../tree/expression"));
var quoted_1 = __importDefault(require("../tree/quoted"));
var url_1 = __importDefault(require("../tree/url"));
var tslib_1 = require("tslib");
var dimension_1 = tslib_1.__importDefault(require("../tree/dimension"));
var color_1 = tslib_1.__importDefault(require("../tree/color"));
var expression_1 = tslib_1.__importDefault(require("../tree/expression"));
var quoted_1 = tslib_1.__importDefault(require("../tree/quoted"));
var url_1 = tslib_1.__importDefault(require("../tree/url"));
exports.default = (function (environment) {

@@ -12,0 +10,0 @@ return { 'svg-gradient': function (direction) {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var keyword_1 = __importDefault(require("../tree/keyword"));
var detached_ruleset_1 = __importDefault(require("../tree/detached-ruleset"));
var dimension_1 = __importDefault(require("../tree/dimension"));
var color_1 = __importDefault(require("../tree/color"));
var quoted_1 = __importDefault(require("../tree/quoted"));
var anonymous_1 = __importDefault(require("../tree/anonymous"));
var url_1 = __importDefault(require("../tree/url"));
var operation_1 = __importDefault(require("../tree/operation"));
var tslib_1 = require("tslib");
var keyword_1 = tslib_1.__importDefault(require("../tree/keyword"));
var detached_ruleset_1 = tslib_1.__importDefault(require("../tree/detached-ruleset"));
var dimension_1 = tslib_1.__importDefault(require("../tree/dimension"));
var color_1 = tslib_1.__importDefault(require("../tree/color"));
var quoted_1 = tslib_1.__importDefault(require("../tree/quoted"));
var anonymous_1 = tslib_1.__importDefault(require("../tree/anonymous"));
var url_1 = tslib_1.__importDefault(require("../tree/url"));
var operation_1 = tslib_1.__importDefault(require("../tree/operation"));
var isa = function (n, Type) { return (n instanceof Type) ? keyword_1.default.True : keyword_1.default.False; };

@@ -15,0 +13,0 @@ var isunit = function (n, unit) {

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var contexts_1 = __importDefault(require("./contexts"));
var parser_1 = __importDefault(require("./parser/parser"));
var less_error_1 = __importDefault(require("./less-error"));
var utils = __importStar(require("./utils"));
var logger_1 = __importDefault(require("./logger"));
var tslib_1 = require("tslib");
var contexts_1 = tslib_1.__importDefault(require("./contexts"));
var parser_1 = tslib_1.__importDefault(require("./parser/parser"));
var less_error_1 = tslib_1.__importDefault(require("./less-error"));
var utils = tslib_1.__importStar(require("./utils"));
var logger_1 = tslib_1.__importDefault(require("./logger"));
function default_1(environment) {

@@ -31,0 +10,0 @@ // FileInfo = {

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var data_1 = __importDefault(require("./data"));
var tree_1 = __importDefault(require("./tree"));
var environment_1 = __importDefault(require("./environment/environment"));
var abstract_file_manager_1 = __importDefault(require("./environment/abstract-file-manager"));
var abstract_plugin_loader_1 = __importDefault(require("./environment/abstract-plugin-loader"));
var visitors_1 = __importDefault(require("./visitors"));
var parser_1 = __importDefault(require("./parser/parser"));
var functions_1 = __importDefault(require("./functions"));
var contexts_1 = __importDefault(require("./contexts"));
var source_map_output_1 = __importDefault(require("./source-map-output"));
var source_map_builder_1 = __importDefault(require("./source-map-builder"));
var parse_tree_1 = __importDefault(require("./parse-tree"));
var import_manager_1 = __importDefault(require("./import-manager"));
var render_1 = __importDefault(require("./render"));
var parse_1 = __importDefault(require("./parse"));
var less_error_1 = __importDefault(require("./less-error"));
var transform_tree_1 = __importDefault(require("./transform-tree"));
var utils = __importStar(require("./utils"));
var plugin_manager_1 = __importDefault(require("./plugin-manager"));
var logger_1 = __importDefault(require("./logger"));
exports.default = (function (environment, fileManagers) {
/**
* @todo
* This original code could be improved quite a bit.
* Many classes / modules currently add side-effects / mutations to passed in objects,
* which makes it hard to refactor and reason about.
*/
var tslib_1 = require("tslib");
var environment_1 = tslib_1.__importDefault(require("./environment/environment"));
var data_1 = tslib_1.__importDefault(require("./data"));
var tree_1 = tslib_1.__importDefault(require("./tree"));
var abstract_file_manager_1 = tslib_1.__importDefault(require("./environment/abstract-file-manager"));
var abstract_plugin_loader_1 = tslib_1.__importDefault(require("./environment/abstract-plugin-loader"));
var visitors_1 = tslib_1.__importDefault(require("./visitors"));
var parser_1 = tslib_1.__importDefault(require("./parser/parser"));
var functions_1 = tslib_1.__importDefault(require("./functions"));
var contexts_1 = tslib_1.__importDefault(require("./contexts"));
var less_error_1 = tslib_1.__importDefault(require("./less-error"));
var transform_tree_1 = tslib_1.__importDefault(require("./transform-tree"));
var utils = tslib_1.__importStar(require("./utils"));
var plugin_manager_1 = tslib_1.__importDefault(require("./plugin-manager"));
var logger_1 = tslib_1.__importDefault(require("./logger"));
var source_map_output_1 = tslib_1.__importDefault(require("./source-map-output"));
var source_map_builder_1 = tslib_1.__importDefault(require("./source-map-builder"));
var parse_tree_1 = tslib_1.__importDefault(require("./parse-tree"));
var import_manager_1 = tslib_1.__importDefault(require("./import-manager"));
var parse_1 = tslib_1.__importDefault(require("./parse"));
var render_1 = tslib_1.__importDefault(require("./render"));
var package_json_1 = require("../../package.json");
var parse_node_version_1 = tslib_1.__importDefault(require("parse-node-version"));
function default_1(environment, fileManagers) {
var sourceMapOutput, sourceMapBuilder, parseTree, importManager;
environment = new environment_1.default(environment, fileManagers);
var SourceMapOutput = source_map_output_1.default(environment);
var SourceMapBuilder = source_map_builder_1.default(SourceMapOutput, environment);
var ParseTree = parse_tree_1.default(SourceMapBuilder);
var ImportManager = import_manager_1.default(environment);
var render = render_1.default(environment, ParseTree, ImportManager);
var parse = parse_1.default(environment, ParseTree, ImportManager);
var functions = functions_1.default(environment);
/**
* @todo
* This root properties / methods need to be organized.
* It's not clear what should / must be public and why.
*/
sourceMapOutput = source_map_output_1.default(environment);
sourceMapBuilder = source_map_builder_1.default(sourceMapOutput, environment);
parseTree = parse_tree_1.default(sourceMapBuilder);
importManager = import_manager_1.default(environment);
var render = render_1.default(environment, parseTree, importManager);
var parse = parse_1.default(environment, parseTree, importManager);
var v = parse_node_version_1.default("v" + package_json_1.version);
var initial = {
version: [3, 13, 1],
version: [v.major, v.minor, v.patch],
data: data_1.default,

@@ -82,8 +46,8 @@ tree: tree_1.default,

Parser: parser_1.default,
functions: functions,
functions: functions_1.default(environment),
contexts: contexts_1.default,
SourceMapOutput: SourceMapOutput,
SourceMapBuilder: SourceMapBuilder,
ParseTree: ParseTree,
ImportManager: ImportManager,
SourceMapOutput: sourceMapOutput,
SourceMapBuilder: sourceMapBuilder,
ParseTree: parseTree,
ImportManager: importManager,
render: render,

@@ -98,9 +62,9 @@ parse: parse,

// Create a public API
var ctor = function (t) { return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new (t.bind.apply(t, __spreadArrays([void 0], args)))();
}; };
var ctor = function (t) {
return function () {
var obj = Object.create(t.prototype);
t.apply(obj, Array.prototype.slice.call(arguments, 0));
return obj;
};
};
var t;

@@ -131,3 +95,5 @@ var api = Object.create(initial);

return api;
});
}
exports.default = default_1;
;
//# sourceMappingURL=index.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils = __importStar(require("./utils"));
var tslib_1 = require("tslib");
var utils = tslib_1.__importStar(require("./utils"));
var anonymousFunc = /(<anonymous>|Function):(\d+):(\d+)/;

@@ -46,3 +28,3 @@ /**

*/
var LessError = function LessError(e, fileContentMap, currentFilename) {
var LessError = function (e, fileContentMap, currentFilename) {
Error.call(this);

@@ -80,4 +62,4 @@ var filename = e.filename || currentFilename;

var match = e.stack.match(anonymousFunc);
var line_1 = parseInt(match[2]);
lineAdjust = 1 - line_1;
var line = parseInt(match[2]);
lineAdjust = 1 - line;
}

@@ -119,3 +101,3 @@ if (found) {

LessError.prototype.toString = function (options) {
if (options === void 0) { options = {}; }
options = options || {};
var message = '';

@@ -122,0 +104,0 @@ var extract = this.extract || [];

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var less_error_1 = __importDefault(require("./less-error"));
var transform_tree_1 = __importDefault(require("./transform-tree"));
var logger_1 = __importDefault(require("./logger"));
exports.default = (function (SourceMapBuilder) {
var tslib_1 = require("tslib");
var less_error_1 = tslib_1.__importDefault(require("./less-error"));
var transform_tree_1 = tslib_1.__importDefault(require("./transform-tree"));
var logger_1 = tslib_1.__importDefault(require("./logger"));
function default_1(SourceMapBuilder) {
var ParseTree = /** @class */ (function () {

@@ -68,3 +66,5 @@ function ParseTree(root, imports) {

return ParseTree;
});
}
exports.default = default_1;
;
//# sourceMappingURL=parse-tree.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var contexts_1 = __importDefault(require("./contexts"));
var parser_1 = __importDefault(require("./parser/parser"));
var plugin_manager_1 = __importDefault(require("./plugin-manager"));
var less_error_1 = __importDefault(require("./less-error"));
var utils = __importStar(require("./utils"));
exports.default = (function (environment, ParseTree, ImportManager) {
var tslib_1 = require("tslib");
var contexts_1 = tslib_1.__importDefault(require("./contexts"));
var parser_1 = tslib_1.__importDefault(require("./parser/parser"));
var plugin_manager_1 = tslib_1.__importDefault(require("./plugin-manager"));
var less_error_1 = tslib_1.__importDefault(require("./less-error"));
var utils = tslib_1.__importStar(require("./utils"));
function default_1(environment, ParseTree, ImportManager) {
var parse = function (input, options, callback) {

@@ -83,4 +62,3 @@ if (typeof options === 'function') {

options.plugins.forEach(function (plugin) {
var evalResult;
var contents;
var evalResult, contents;
if (plugin.fileContent) {

@@ -108,3 +86,5 @@ contents = plugin.fileContent.replace(/^\uFEFF/, '');

return parse;
});
}
exports.default = default_1;
;
//# sourceMappingURL=parse.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Split the input into chunks.
exports.default = (function (input, fail) {
function default_1(input, fail) {
var len = input.length;

@@ -146,3 +146,5 @@ var level = 0;

return chunks;
});
}
exports.default = default_1;
;
//# sourceMappingURL=chunker.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var chunker_1 = __importDefault(require("./chunker"));
var tslib_1 = require("tslib");
var chunker_1 = tslib_1.__importDefault(require("./chunker"));
exports.default = (function () {

@@ -8,0 +6,0 @@ var // Less input string

@@ -149,3 +149,3 @@ "use strict";

var pm;
function PluginManagerFactory(less, newFactory) {
var PluginManagerFactory = function (less, newFactory) {
if (newFactory || !pm) {

@@ -155,6 +155,5 @@ pm = new PluginManager(less);

return pm;
}
;
};
//
exports.default = PluginManagerFactory;
//# sourceMappingURL=plugin-manager.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils = __importStar(require("./utils"));
exports.default = (function (environment, ParseTree, ImportManager) {
var tslib_1 = require("tslib");
var utils = tslib_1.__importStar(require("./utils"));
function default_1(environment, ParseTree, ImportManager) {
var render = function (input, options, callback) {

@@ -63,3 +45,5 @@ if (typeof options === 'function') {

return render;
});
}
exports.default = default_1;
;
//# sourceMappingURL=render.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (SourceMapOutput, environment) {
function default_1(SourceMapOutput, environment) {
var SourceMapBuilder = /** @class */ (function () {

@@ -71,3 +71,5 @@ function SourceMapBuilder(options) {

return SourceMapBuilder;
});
}
exports.default = default_1;
;
//# sourceMappingURL=source-map-builder.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (environment) {
function default_1(environment) {
var SourceMapOutput = /** @class */ (function () {

@@ -51,7 +51,3 @@ function SourceMapOutput(options) {

}
var lines;
var sourceLines;
var columns;
var sourceColumns;
var i;
var lines, sourceLines, columns, sourceColumns, i;
if (fileInfo && fileInfo.filename) {

@@ -140,3 +136,5 @@ var inputSource = this._contentsMap[fileInfo.filename];

return SourceMapOutput;
});
}
exports.default = default_1;
;
//# sourceMappingURL=source-map-output.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var contexts_1 = __importDefault(require("./contexts"));
var visitors_1 = __importDefault(require("./visitors"));
var tree_1 = __importDefault(require("./tree"));
exports.default = (function (root, options) {
if (options === void 0) { options = {}; }
var tslib_1 = require("tslib");
var contexts_1 = tslib_1.__importDefault(require("./contexts"));
var visitors_1 = tslib_1.__importDefault(require("./visitors"));
var tree_1 = tslib_1.__importDefault(require("./tree"));
function default_1(root, options) {
options = options || {};
var evaldRoot;

@@ -92,3 +90,5 @@ var variables = options.variables;

return evaldRoot;
});
}
exports.default = default_1;
;
//# sourceMappingURL=transform-tree.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) {

@@ -16,20 +14,21 @@ this.value = value;

};
Anonymous.prototype = new node_1.default();
Anonymous.prototype.eval = function () {
return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());
};
Anonymous.prototype.compare = function (other) {
return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
};
Anonymous.prototype.isRulesetLike = function () {
return this.rulesetLike;
};
Anonymous.prototype.genCSS = function (context, output) {
this.nodeVisible = Boolean(this.value);
if (this.nodeVisible) {
output.add(this.value, this._fileInfo, this._index, this.mapLines);
Anonymous.prototype = Object.assign(new node_1.default(), {
type: 'Anonymous',
eval: function () {
return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());
},
compare: function (other) {
return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
},
isRulesetLike: function () {
return this.rulesetLike;
},
genCSS: function (context, output) {
this.nodeVisible = Boolean(this.value);
if (this.nodeVisible) {
output.add(this.value, this._fileInfo, this._index, this.mapLines);
}
}
};
Anonymous.prototype.type = 'Anonymous';
});
exports.default = Anonymous;
//# sourceMappingURL=anonymous.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var Assignment = function (key, val) {

@@ -11,23 +9,24 @@ this.key = key;

};
Assignment.prototype = new node_1.default();
Assignment.prototype.accept = function (visitor) {
this.value = visitor.visit(this.value);
};
Assignment.prototype.eval = function (context) {
if (this.value.eval) {
return new Assignment(this.key, this.value.eval(context));
Assignment.prototype = Object.assign(new node_1.default(), {
type: 'Assignment',
accept: function (visitor) {
this.value = visitor.visit(this.value);
},
eval: function (context) {
if (this.value.eval) {
return new Assignment(this.key, this.value.eval(context));
}
return this;
},
genCSS: function (context, output) {
output.add(this.key + "=");
if (this.value.genCSS) {
this.value.genCSS(context, output);
}
else {
output.add(this.value);
}
}
return this;
};
Assignment.prototype.genCSS = function (context, output) {
output.add(this.key + "=");
if (this.value.genCSS) {
this.value.genCSS(context, output);
}
else {
output.add(this.value);
}
};
Assignment.prototype.type = 'Assignment';
});
exports.default = Assignment;
//# sourceMappingURL=assignment.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var selector_1 = __importDefault(require("./selector"));
var ruleset_1 = __importDefault(require("./ruleset"));
var anonymous_1 = __importDefault(require("./anonymous"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var selector_1 = tslib_1.__importDefault(require("./selector"));
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) {

@@ -34,114 +32,105 @@ var i;

};
AtRule.prototype = new node_1.default();
AtRule.prototype.accept = function (visitor) {
var value = this.value;
var rules = this.rules;
if (rules) {
this.rules = visitor.visitArray(rules);
}
if (value) {
this.value = visitor.visit(value);
}
};
AtRule.prototype.isRulesetLike = function () {
return this.rules || !this.isCharset();
};
AtRule.prototype.isCharset = function () {
return '@charset' === this.name;
};
AtRule.prototype.genCSS = function (context, output) {
var value = this.value;
var rules = this.rules;
output.add(this.name, this.fileInfo(), this.getIndex());
if (value) {
output.add(' ');
value.genCSS(context, output);
}
if (rules) {
this.outputRuleset(context, output, rules);
}
else {
output.add(';');
}
};
AtRule.prototype.eval = function (context) {
var mediaPathBackup;
var mediaBlocksBackup;
var value = this.value;
var rules = this.rules;
// media stored inside other atrule should not bubble over it
// backpup media bubbling information
mediaPathBackup = context.mediaPath;
mediaBlocksBackup = context.mediaBlocks;
// deleted media bubbling information
context.mediaPath = [];
context.mediaBlocks = [];
if (value) {
value = value.eval(context);
}
if (rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
rules = [rules[0].eval(context)];
rules[0].root = true;
}
// restore media bubbling information
context.mediaPath = mediaPathBackup;
context.mediaBlocks = mediaBlocksBackup;
return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());
};
AtRule.prototype.variable = function (name) {
if (this.rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
return ruleset_1.default.prototype.variable.call(this.rules[0], name);
}
};
AtRule.prototype.find = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (this.rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
return ruleset_1.default.prototype.find.apply(this.rules[0], args);
}
};
AtRule.prototype.rulesets = function () {
if (this.rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
return ruleset_1.default.prototype.rulesets.apply(this.rules[0]);
}
};
AtRule.prototype.outputRuleset = function (context, output, rules) {
var ruleCnt = rules.length;
var i;
context.tabLevel = (context.tabLevel | 0) + 1;
// Compressed
if (context.compress) {
output.add('{');
for (i = 0; i < ruleCnt; i++) {
rules[i].genCSS(context, output);
AtRule.prototype = Object.assign(new node_1.default(), {
type: 'AtRule',
accept: function (visitor) {
var value = this.value, rules = this.rules;
if (rules) {
this.rules = visitor.visitArray(rules);
}
output.add('}');
if (value) {
this.value = visitor.visit(value);
}
},
isRulesetLike: function () {
return this.rules || !this.isCharset();
},
isCharset: function () {
return '@charset' === this.name;
},
genCSS: function (context, output) {
var value = this.value, rules = this.rules;
output.add(this.name, this.fileInfo(), this.getIndex());
if (value) {
output.add(' ');
value.genCSS(context, output);
}
if (rules) {
this.outputRuleset(context, output, rules);
}
else {
output.add(';');
}
},
eval: function (context) {
var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules;
// media stored inside other atrule should not bubble over it
// backpup media bubbling information
mediaPathBackup = context.mediaPath;
mediaBlocksBackup = context.mediaBlocks;
// deleted media bubbling information
context.mediaPath = [];
context.mediaBlocks = [];
if (value) {
value = value.eval(context);
}
if (rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
rules = [rules[0].eval(context)];
rules[0].root = true;
}
// restore media bubbling information
context.mediaPath = mediaPathBackup;
context.mediaBlocks = mediaBlocksBackup;
return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());
},
variable: function (name) {
if (this.rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
return ruleset_1.default.prototype.variable.call(this.rules[0], name);
}
},
find: function () {
if (this.rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
return ruleset_1.default.prototype.find.apply(this.rules[0], arguments);
}
},
rulesets: function () {
if (this.rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
return ruleset_1.default.prototype.rulesets.apply(this.rules[0]);
}
},
outputRuleset: function (context, output, rules) {
var ruleCnt = rules.length;
var i;
context.tabLevel = (context.tabLevel | 0) + 1;
// Compressed
if (context.compress) {
output.add('{');
for (i = 0; i < ruleCnt; i++) {
rules[i].genCSS(context, output);
}
output.add('}');
context.tabLevel--;
return;
}
// Non-compressed
var tabSetStr = "\n" + Array(context.tabLevel).join(' '), tabRuleStr = tabSetStr + " ";
if (!ruleCnt) {
output.add(" {" + tabSetStr + "}");
}
else {
output.add(" {" + tabRuleStr);
rules[0].genCSS(context, output);
for (i = 1; i < ruleCnt; i++) {
output.add(tabRuleStr);
rules[i].genCSS(context, output);
}
output.add(tabSetStr + "}");
}
context.tabLevel--;
return;
}
// Non-compressed
var tabSetStr = "\n" + Array(context.tabLevel).join(' ');
var tabRuleStr = tabSetStr + " ";
if (!ruleCnt) {
output.add(" {" + tabSetStr + "}");
}
else {
output.add(" {" + tabRuleStr);
rules[0].genCSS(context, output);
for (i = 1; i < ruleCnt; i++) {
output.add(tabRuleStr);
rules[i].genCSS(context, output);
}
output.add(tabSetStr + "}");
}
context.tabLevel--;
};
AtRule.prototype.type = 'AtRule';
});
exports.default = AtRule;
//# sourceMappingURL=atrule.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var Attribute = function (key, op, value) {

@@ -12,19 +10,20 @@ this.key = key;

};
Attribute.prototype = new node_1.default();
Attribute.prototype.eval = function (context) {
return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value);
};
Attribute.prototype.genCSS = function (context, output) {
output.add(this.toCSS(context));
};
Attribute.prototype.toCSS = function (context) {
var value = this.key.toCSS ? this.key.toCSS(context) : this.key;
if (this.op) {
value += this.op;
value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
Attribute.prototype = Object.assign(new node_1.default(), {
type: 'Attribute',
eval: function (context) {
return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value);
},
genCSS: function (context, output) {
output.add(this.toCSS(context));
},
toCSS: function (context) {
var value = this.key.toCSS ? this.key.toCSS(context) : this.key;
if (this.op) {
value += this.op;
value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
}
return "[" + value + "]";
}
return "[" + value + "]";
};
Attribute.prototype.type = 'Attribute';
});
exports.default = Attribute;
//# sourceMappingURL=attribute.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var anonymous_1 = __importDefault(require("./anonymous"));
var function_caller_1 = __importDefault(require("../functions/function-caller"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var function_caller_1 = tslib_1.__importDefault(require("../functions/function-caller"));
//

@@ -19,54 +17,56 @@ // A function call node.

};
Call.prototype = new node_1.default();
Call.prototype.accept = function (visitor) {
if (this.args) {
this.args = visitor.visitArray(this.args);
}
};
//
// When evaluating a function call,
// we either find the function in the functionRegistry,
// in which case we call it, passing the evaluated arguments,
// if this returns null or we cannot find the function, we
// simply print it out as it appeared originally [2].
//
// The reason why we evaluate the arguments, is in the case where
// we try to pass a variable to a function, like: `saturate(@color)`.
// The function should receive the value, not the variable.
//
Call.prototype.eval = function (context) {
var _this = this;
/**
* Turn off math for calc(), and switch back on for evaluating nested functions
*/
var currentMathContext = context.mathOn;
context.mathOn = !this.calc;
if (this.calc || context.inCalc) {
context.enterCalc();
}
var exitCalc = function () {
if (_this.calc || context.inCalc) {
context.exitCalc();
Call.prototype = Object.assign(new node_1.default(), {
type: 'Call',
accept: function (visitor) {
if (this.args) {
this.args = visitor.visitArray(this.args);
}
context.mathOn = currentMathContext;
};
var result;
var funcCaller = new function_caller_1.default(this.name, context, this.getIndex(), this.fileInfo());
if (funcCaller.isValid()) {
try {
result = funcCaller.call(this.args);
exitCalc();
},
//
// When evaluating a function call,
// we either find the function in the functionRegistry,
// in which case we call it, passing the evaluated arguments,
// if this returns null or we cannot find the function, we
// simply print it out as it appeared originally [2].
//
// The reason why we evaluate the arguments, is in the case where
// we try to pass a variable to a function, like: `saturate(@color)`.
// The function should receive the value, not the variable.
//
eval: function (context) {
var _this = this;
/**
* Turn off math for calc(), and switch back on for evaluating nested functions
*/
var currentMathContext = context.mathOn;
context.mathOn = !this.calc;
if (this.calc || context.inCalc) {
context.enterCalc();
}
catch (e) {
if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) {
throw e;
var exitCalc = function () {
if (_this.calc || context.inCalc) {
context.exitCalc();
}
throw {
type: e.type || 'Runtime',
message: "error evaluating function `" + this.name + "`" + (e.message ? ": " + e.message : ''),
index: this.getIndex(),
filename: this.fileInfo().filename,
line: e.lineNumber,
column: e.columnNumber
};
context.mathOn = currentMathContext;
};
var result;
var funcCaller = new function_caller_1.default(this.name, context, this.getIndex(), this.fileInfo());
if (funcCaller.isValid()) {
try {
result = funcCaller.call(this.args);
exitCalc();
}
catch (e) {
if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) {
throw e;
}
throw {
type: e.type || 'Runtime',
message: "Error evaluating function `" + this.name + "`" + (e.message ? ": " + e.message : ''),
index: this.getIndex(),
filename: this.fileInfo().filename,
line: e.lineNumber,
column: e.columnNumber
};
}
}

@@ -88,19 +88,18 @@ if (result !== null && result !== undefined) {

}
}
var args = this.args.map(function (a) { return a.eval(context); });
exitCalc();
return new Call(this.name, args, this.getIndex(), this.fileInfo());
};
Call.prototype.genCSS = function (context, output) {
output.add(this.name + "(", this.fileInfo(), this.getIndex());
for (var i = 0; i < this.args.length; i++) {
this.args[i].genCSS(context, output);
if (i + 1 < this.args.length) {
output.add(', ');
var args = this.args.map(function (a) { return a.eval(context); });
exitCalc();
return new Call(this.name, args, this.getIndex(), this.fileInfo());
},
genCSS: function (context, output) {
output.add(this.name + "(", this.fileInfo(), this.getIndex());
for (var i = 0; i < this.args.length; i++) {
this.args[i].genCSS(context, output);
if (i + 1 < this.args.length) {
output.add(', ');
}
}
output.add(')');
}
output.add(')');
};
Call.prototype.type = 'Call';
});
exports.default = Call;
//# sourceMappingURL=call.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var colors_1 = __importDefault(require("../data/colors"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var colors_1 = tslib_1.__importDefault(require("../data/colors"));
//

@@ -49,27 +47,43 @@ // RGB Colors - #ff0014, #eee

};
Color.prototype = new node_1.default();
Color.prototype.luma = function () {
var r = this.rgb[0] / 255;
var g = this.rgb[1] / 255;
var b = this.rgb[2] / 255;
r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);
g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);
b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
};
Color.prototype.genCSS = function (context, output) {
output.add(this.toCSS(context));
};
Color.prototype.toCSS = function (context, doNotCompress) {
var compress = context && context.compress && !doNotCompress;
var color;
var alpha;
var colorFunction;
var args = [];
// `value` is set if this color was originally
// converted from a named color string so we need
// to respect this and try to output named color too.
alpha = this.fround(context, this.alpha);
if (this.value) {
if (this.value.indexOf('rgb') === 0) {
Color.prototype = Object.assign(new node_1.default(), {
type: 'Color',
luma: function () {
var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255;
r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);
g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);
b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
},
genCSS: function (context, output) {
output.add(this.toCSS(context));
},
toCSS: function (context, doNotCompress) {
var compress = context && context.compress && !doNotCompress;
var color;
var alpha;
var colorFunction;
var args = [];
// `value` is set if this color was originally
// converted from a named color string so we need
// to respect this and try to output named color too.
alpha = this.fround(context, this.alpha);
if (this.value) {
if (this.value.indexOf('rgb') === 0) {
if (alpha < 1) {
colorFunction = 'rgba';
}
}
else if (this.value.indexOf('hsl') === 0) {
if (alpha < 1) {
colorFunction = 'hsla';
}
else {
colorFunction = 'hsl';
}
}
else {
return this.value;
}
}
else {
if (alpha < 1) {

@@ -79,152 +93,120 @@ colorFunction = 'rgba';

}
else if (this.value.indexOf('hsl') === 0) {
if (alpha < 1) {
colorFunction = 'hsla';
switch (colorFunction) {
case 'rgba':
args = this.rgb.map(function (c) {
return clamp(Math.round(c), 255);
}).concat(clamp(alpha, 1));
break;
case 'hsla':
args.push(clamp(alpha, 1));
case 'hsl':
color = this.toHSL();
args = [
this.fround(context, color.h),
this.fround(context, color.s * 100) + "%",
this.fround(context, color.l * 100) + "%"
].concat(args);
}
if (colorFunction) {
// Values are capped between `0` and `255`, rounded and zero-padded.
return colorFunction + "(" + args.join("," + (compress ? '' : ' ')) + ")";
}
color = this.toRGB();
if (compress) {
var splitcolor = color.split('');
// Convert color to short format
if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) {
color = "#" + splitcolor[1] + splitcolor[3] + splitcolor[5];
}
else {
colorFunction = 'hsl';
}
}
return color;
},
//
// Operations have to be done per-channel, if not,
// channels will spill onto each other. Once we have
// our result, in the form of an integer triplet,
// we create a new Color node to hold the result.
//
operate: function (context, op, other) {
var rgb = new Array(3);
var alpha = this.alpha * (1 - other.alpha) + other.alpha;
for (var c = 0; c < 3; c++) {
rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);
}
return new Color(rgb, alpha);
},
toRGB: function () {
return toHex(this.rgb);
},
toHSL: function () {
var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h;
var s;
var l = (max + min) / 2;
var d = max - min;
if (max === min) {
h = s = 0;
}
else {
return this.value;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
}
h /= 6;
}
}
else {
if (alpha < 1) {
colorFunction = 'rgba';
return { h: h * 360, s: s, l: l, a: a };
},
// Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
toHSV: function () {
var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h;
var s;
var v = max;
var d = max - min;
if (max === 0) {
s = 0;
}
}
switch (colorFunction) {
case 'rgba':
args = this.rgb.map(function (c) { return clamp(Math.round(c), 255); }).concat(clamp(alpha, 1));
break;
case 'hsla':
args.push(clamp(alpha, 1));
case 'hsl':
color = this.toHSL();
args = [
this.fround(context, color.h),
this.fround(context, color.s * 100) + "%",
this.fround(context, color.l * 100) + "%"
].concat(args);
}
if (colorFunction) {
// Values are capped between `0` and `255`, rounded and zero-padded.
return colorFunction + "(" + args.join("," + (compress ? '' : ' ')) + ")";
}
color = this.toRGB();
if (compress) {
var splitcolor = color.split('');
// Convert color to short format
if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) {
color = "#" + splitcolor[1] + splitcolor[3] + splitcolor[5];
else {
s = d / max;
}
}
return color;
};
//
// Operations have to be done per-channel, if not,
// channels will spill onto each other. Once we have
// our result, in the form of an integer triplet,
// we create a new Color node to hold the result.
//
Color.prototype.operate = function (context, op, other) {
var rgb = new Array(3);
var alpha = this.alpha * (1 - other.alpha) + other.alpha;
for (var c = 0; c < 3; c++) {
rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);
}
return new Color(rgb, alpha);
};
Color.prototype.toRGB = function () {
return toHex(this.rgb);
};
Color.prototype.toHSL = function () {
var r = this.rgb[0] / 255;
var g = this.rgb[1] / 255;
var b = this.rgb[2] / 255;
var a = this.alpha;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h;
var s;
var l = (max + min) / 2;
var d = max - min;
if (max === min) {
h = s = 0;
}
else {
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
if (max === min) {
h = 0;
}
h /= 6;
}
return { h: h * 360, s: s, l: l, a: a };
};
// Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
Color.prototype.toHSV = function () {
var r = this.rgb[0] / 255;
var g = this.rgb[1] / 255;
var b = this.rgb[2] / 255;
var a = this.alpha;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h;
var s;
var v = max;
var d = max - min;
if (max === 0) {
s = 0;
}
else {
s = d / max;
}
if (max === min) {
h = 0;
}
else {
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
else {
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
}
h /= 6;
}
h /= 6;
return { h: h * 360, s: s, v: v, a: a };
},
toARGB: function () {
return toHex([this.alpha * 255].concat(this.rgb));
},
compare: function (x) {
return (x.rgb &&
x.rgb[0] === this.rgb[0] &&
x.rgb[1] === this.rgb[1] &&
x.rgb[2] === this.rgb[2] &&
x.alpha === this.alpha) ? 0 : undefined;
}
return { h: h * 360, s: s, v: v, a: a };
};
Color.prototype.toARGB = function () {
return toHex([this.alpha * 255].concat(this.rgb));
};
Color.prototype.compare = function (x) {
return (x.rgb &&
x.rgb[0] === this.rgb[0] &&
x.rgb[1] === this.rgb[1] &&
x.rgb[2] === this.rgb[2] &&
x.alpha === this.alpha) ? 0 : undefined;
};
Color.prototype.type = 'Color';
function clamp(v, max) {
return Math.min(Math.max(v, 0), max);
}
function toHex(v) {
return "#" + v.map(function (c) {
c = clamp(Math.round(c), 255);
return (c < 16 ? '0' : '') + c.toString(16);
}).join('');
}
});
Color.fromKeyword = function (keyword) {

@@ -244,3 +226,12 @@ var c;

};
function clamp(v, max) {
return Math.min(Math.max(v, 0), max);
}
function toHex(v) {
return "#" + v.map(function (c) {
c = clamp(Math.round(c), 255);
return (c < 16 ? '0' : '') + c.toString(16);
}).join('');
}
exports.default = Color;
//# sourceMappingURL=color.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var _noSpaceCombinators = {

@@ -22,9 +20,10 @@ '': true,

};
Combinator.prototype = new node_1.default();
Combinator.prototype.genCSS = function (context, output) {
var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';
output.add(spaceOrEmpty + this.value + spaceOrEmpty);
};
Combinator.prototype.type = 'Combinator';
Combinator.prototype = Object.assign(new node_1.default(), {
type: 'Combinator',
genCSS: function (context, output) {
var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';
output.add(spaceOrEmpty + this.value + spaceOrEmpty);
}
});
exports.default = Combinator;
//# sourceMappingURL=combinator.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var debug_info_1 = __importDefault(require("./debug-info"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var debug_info_1 = tslib_1.__importDefault(require("./debug-info"));
var Comment = function (value, isLineComment, index, currentFileInfo) {

@@ -15,15 +13,16 @@ this.value = value;

};
Comment.prototype = new node_1.default();
Comment.prototype.genCSS = function (context, output) {
if (this.debugInfo) {
output.add(debug_info_1.default(context, this), this.fileInfo(), this.getIndex());
Comment.prototype = Object.assign(new node_1.default(), {
type: 'Comment',
genCSS: function (context, output) {
if (this.debugInfo) {
output.add(debug_info_1.default(context, this), this.fileInfo(), this.getIndex());
}
output.add(this.value);
},
isSilent: function (context) {
var isCompressed = context.compress && this.value[2] !== '!';
return this.isLineComment || isCompressed;
}
output.add(this.value);
};
Comment.prototype.isSilent = function (context) {
var isCompressed = context.compress && this.value[2] !== '!';
return this.isLineComment || isCompressed;
};
Comment.prototype.type = 'Comment';
});
exports.default = Comment;
//# sourceMappingURL=comment.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var Condition = function (op, l, r, i, negate) {

@@ -14,29 +12,30 @@ this.op = op.trim();

};
Condition.prototype = new node_1.default();
Condition.prototype.accept = function (visitor) {
this.lvalue = visitor.visit(this.lvalue);
this.rvalue = visitor.visit(this.rvalue);
};
Condition.prototype.eval = function (context) {
var result = (function (op, a, b) {
switch (op) {
case 'and': return a && b;
case 'or': return a || b;
default:
switch (node_1.default.compare(a, b)) {
case -1:
return op === '<' || op === '=<' || op === '<=';
case 0:
return op === '=' || op === '>=' || op === '=<' || op === '<=';
case 1:
return op === '>' || op === '>=';
default:
return false;
}
}
})(this.op, this.lvalue.eval(context), this.rvalue.eval(context));
return this.negate ? !result : result;
};
Condition.prototype.type = 'Condition';
Condition.prototype = Object.assign(new node_1.default(), {
type: 'Condition',
accept: function (visitor) {
this.lvalue = visitor.visit(this.lvalue);
this.rvalue = visitor.visit(this.rvalue);
},
eval: function (context) {
var result = (function (op, a, b) {
switch (op) {
case 'and': return a && b;
case 'or': return a || b;
default:
switch (node_1.default.compare(a, b)) {
case -1:
return op === '<' || op === '=<' || op === '<=';
case 0:
return op === '=' || op === '>=' || op === '=<' || op === '<=';
case 1:
return op === '>' || op === '>=';
default:
return false;
}
}
})(this.op, this.lvalue.eval(context), this.rvalue.eval(context));
return this.negate ? !result : result;
}
});
exports.default = Condition;
//# sourceMappingURL=condition.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var debugInfo = function (context, ctx, lineSeparator) {
var result = '';
if (context.dumpLineNumbers && !context.compress) {
switch (context.dumpLineNumbers) {
case 'comments':
result = debugInfo.asComment(ctx);
break;
case 'mediaquery':
result = debugInfo.asMediaQuery(ctx);
break;
case 'all':
result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);
break;
var debugInfo = /** @class */ (function () {
function debugInfo(context, ctx, lineSeparator) {
var result = '';
if (context.dumpLineNumbers && !context.compress) {
switch (context.dumpLineNumbers) {
case 'comments':
result = debugInfo.asComment(ctx);
break;
case 'mediaquery':
result = debugInfo.asMediaQuery(ctx);
break;
case 'all':
result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);
break;
}
}
return result;
}
return result;
};
debugInfo.asComment = function (ctx) { return ctx.debugInfo ? "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n" : ''; };
debugInfo.asMediaQuery = function (ctx) {
if (!ctx.debugInfo) {
return '';
}
var filenameWithProtocol = ctx.debugInfo.fileName;
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
filenameWithProtocol = "file://" + filenameWithProtocol;
}
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
if (a == '\\') {
a = '\/';
debugInfo.asComment = function (ctx) {
return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n";
};
debugInfo.asMediaQuery = function (ctx) {
var filenameWithProtocol = ctx.debugInfo.fileName;
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
filenameWithProtocol = "file://" + filenameWithProtocol;
}
return "\\" + a;
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
};
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
if (a == '\\') {
a = '\/';
}
return "\\" + a;
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
};
return debugInfo;
}());
exports.default = debugInfo;
//# sourceMappingURL=debug-info.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var value_1 = __importDefault(require("./value"));
var keyword_1 = __importDefault(require("./keyword"));
var anonymous_1 = __importDefault(require("./anonymous"));
var Constants = __importStar(require("../constants"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var value_1 = tslib_1.__importDefault(require("./value"));
var keyword_1 = tslib_1.__importDefault(require("./keyword"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var Constants = tslib_1.__importStar(require("../constants"));
var MATH = Constants.Math;
function evalName(context, name) {
var value = '';
var i;
var n = name.length;
var output = { add: function (s) { value += s; } };
for (i = 0; i < n; i++) {
name[i].eval(context).genCSS(context, output);
}
return value;
}
var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) {

@@ -44,76 +33,63 @@ this.name = name;

};
Declaration.prototype = new node_1.default();
Declaration.prototype.genCSS = function (context, output) {
output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());
try {
this.value.genCSS(context, output);
}
catch (e) {
e.index = this._index;
e.filename = this._fileInfo.filename;
throw e;
}
output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);
};
Declaration.prototype.eval = function (context) {
var mathBypass = false;
var prevMath;
var name = this.name;
var evaldValue;
var variable = this.variable;
if (typeof name !== 'string') {
// expand 'primitive' name directly to get
// things faster (~10% for benchmark.less):
name = (name.length === 1) && (name[0] instanceof keyword_1.default) ?
name[0].value : evalName(context, name);
variable = false; // never treat expanded interpolation as new variable name
}
// @todo remove when parens-division is default
if (name === 'font' && context.math === MATH.ALWAYS) {
mathBypass = true;
prevMath = context.math;
context.math = MATH.PARENS_DIVISION;
}
try {
context.importantScope.push({});
evaldValue = this.value.eval(context);
if (!this.variable && evaldValue.type === 'DetachedRuleset') {
throw { message: 'Rulesets cannot be evaluated on a property.',
index: this.getIndex(), filename: this.fileInfo().filename };
Declaration.prototype = Object.assign(new node_1.default(), {
type: 'Declaration',
genCSS: function (context, output) {
output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());
try {
this.value.genCSS(context, output);
}
var important = this.important;
var importantResult = context.importantScope.pop();
if (!important && importantResult.important) {
important = importantResult.important;
catch (e) {
e.index = this._index;
e.filename = this._fileInfo.filename;
throw e;
}
return new Declaration(name, evaldValue, important, this.merge, this.getIndex(), this.fileInfo(), this.inline, variable);
}
catch (e) {
if (typeof e.index !== 'number') {
e.index = this.getIndex();
e.filename = this.fileInfo().filename;
output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);
},
eval: function (context) {
var mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable;
if (typeof name !== 'string') {
// expand 'primitive' name directly to get
// things faster (~10% for benchmark.less):
name = (name.length === 1) && (name[0] instanceof keyword_1.default) ?
name[0].value : evalName(context, name);
variable = false; // never treat expanded interpolation as new variable name
}
throw e;
}
finally {
if (mathBypass) {
context.math = prevMath;
// @todo remove when parens-division is default
if (name === 'font' && context.math === MATH.ALWAYS) {
mathBypass = true;
prevMath = context.math;
context.math = MATH.PARENS_DIVISION;
}
try {
context.importantScope.push({});
evaldValue = this.value.eval(context);
if (!this.variable && evaldValue.type === 'DetachedRuleset') {
throw { message: 'Rulesets cannot be evaluated on a property.',
index: this.getIndex(), filename: this.fileInfo().filename };
}
var important = this.important;
var importantResult = context.importantScope.pop();
if (!important && importantResult.important) {
important = importantResult.important;
}
return new Declaration(name, evaldValue, important, this.merge, this.getIndex(), this.fileInfo(), this.inline, variable);
}
catch (e) {
if (typeof e.index !== 'number') {
e.index = this.getIndex();
e.filename = this.fileInfo().filename;
}
throw e;
}
finally {
if (mathBypass) {
context.math = prevMath;
}
}
},
makeImportant: function () {
return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline);
}
};
Declaration.prototype.makeImportant = function () {
return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline);
};
function evalName(context, name) {
var value = '';
var i;
var n = name.length;
var output = { add: function (s) { value += s; } };
for (i = 0; i < n; i++) {
name[i].eval(context).genCSS(context, output);
}
return value;
}
Declaration.prototype.type = 'Declaration';
});
exports.default = Declaration;
//# sourceMappingURL=declaration.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var contexts_1 = __importDefault(require("../contexts"));
var utils = __importStar(require("../utils"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var contexts_1 = tslib_1.__importDefault(require("../contexts"));
var utils = tslib_1.__importStar(require("../utils"));
var DetachedRuleset = function (ruleset, frames) {

@@ -33,16 +12,17 @@ this.ruleset = ruleset;

};
DetachedRuleset.prototype = new node_1.default();
DetachedRuleset.prototype.accept = function (visitor) {
this.ruleset = visitor.visit(this.ruleset);
};
DetachedRuleset.prototype.eval = function (context) {
var frames = this.frames || utils.copyArray(context.frames);
return new DetachedRuleset(this.ruleset, frames);
};
DetachedRuleset.prototype.callEval = function (context) {
return this.ruleset.eval(this.frames ? new contexts_1.default.Eval(context, this.frames.concat(context.frames)) : context);
};
DetachedRuleset.prototype.type = 'DetachedRuleset';
DetachedRuleset.prototype.evalFirst = true;
DetachedRuleset.prototype = Object.assign(new node_1.default(), {
type: 'DetachedRuleset',
evalFirst: true,
accept: function (visitor) {
this.ruleset = visitor.visit(this.ruleset);
},
eval: function (context) {
var frames = this.frames || utils.copyArray(context.frames);
return new DetachedRuleset(this.ruleset, frames);
},
callEval: function (context) {
return this.ruleset.eval(this.frames ? new contexts_1.default.Eval(context, this.frames.concat(context.frames)) : context);
}
});
exports.default = DetachedRuleset;
//# sourceMappingURL=detached-ruleset.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var unit_conversions_1 = __importDefault(require("../data/unit-conversions"));
var unit_1 = __importDefault(require("./unit"));
var color_1 = __importDefault(require("./color"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var unit_conversions_1 = tslib_1.__importDefault(require("../data/unit-conversions"));
var unit_1 = tslib_1.__importDefault(require("./unit"));
var color_1 = tslib_1.__importDefault(require("./color"));
//

@@ -22,139 +20,138 @@ // A number with a unit

};
Dimension.prototype = new node_1.default();
Dimension.prototype.accept = function (visitor) {
this.unit = visitor.visit(this.unit);
};
Dimension.prototype.eval = function (context) {
return this;
};
Dimension.prototype.toColor = function () {
return new color_1.default([this.value, this.value, this.value]);
};
Dimension.prototype.genCSS = function (context, output) {
if ((context && context.strictUnits) && !this.unit.isSingular()) {
throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString());
}
var value = this.fround(context, this.value);
var strValue = String(value);
if (value !== 0 && value < 0.000001 && value > -0.000001) {
// would be output 1e-6 etc.
strValue = value.toFixed(20).replace(/0+$/, '');
}
if (context && context.compress) {
// Zero values doesn't need a unit
if (value === 0 && this.unit.isLength()) {
output.add(strValue);
return;
Dimension.prototype = Object.assign(new node_1.default(), {
type: 'Dimension',
accept: function (visitor) {
this.unit = visitor.visit(this.unit);
},
eval: function (context) {
return this;
},
toColor: function () {
return new color_1.default([this.value, this.value, this.value]);
},
genCSS: function (context, output) {
if ((context && context.strictUnits) && !this.unit.isSingular()) {
throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString());
}
// Float values doesn't need a leading zero
if (value > 0 && value < 1) {
strValue = (strValue).substr(1);
var value = this.fround(context, this.value);
var strValue = String(value);
if (value !== 0 && value < 0.000001 && value > -0.000001) {
// would be output 1e-6 etc.
strValue = value.toFixed(20).replace(/0+$/, '');
}
}
output.add(strValue);
this.unit.genCSS(context, output);
};
// In an operation between two Dimensions,
// we default to the first Dimension's unit,
// so `1px + 2` will yield `3px`.
Dimension.prototype.operate = function (context, op, other) {
/* jshint noempty:false */
var value = this._operate(context, op, this.value, other.value);
var unit = this.unit.clone();
if (op === '+' || op === '-') {
if (unit.numerator.length === 0 && unit.denominator.length === 0) {
unit = other.unit.clone();
if (this.unit.backupUnit) {
unit.backupUnit = this.unit.backupUnit;
if (context && context.compress) {
// Zero values doesn't need a unit
if (value === 0 && this.unit.isLength()) {
output.add(strValue);
return;
}
// Float values doesn't need a leading zero
if (value > 0 && value < 1) {
strValue = (strValue).substr(1);
}
}
else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {
// do nothing
}
else {
other = other.convertTo(this.unit.usedUnits());
if (context.strictUnits && other.unit.toString() !== unit.toString()) {
throw new Error("Incompatible units. Change the units or use the unit function. " +
("Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'."));
output.add(strValue);
this.unit.genCSS(context, output);
},
// In an operation between two Dimensions,
// we default to the first Dimension's unit,
// so `1px + 2` will yield `3px`.
operate: function (context, op, other) {
/* jshint noempty:false */
var value = this._operate(context, op, this.value, other.value), unit = this.unit.clone();
if (op === '+' || op === '-') {
if (unit.numerator.length === 0 && unit.denominator.length === 0) {
unit = other.unit.clone();
if (this.unit.backupUnit) {
unit.backupUnit = this.unit.backupUnit;
}
}
value = this._operate(context, op, this.value, other.value);
else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {
// do nothing
}
else {
other = other.convertTo(this.unit.usedUnits());
if (context.strictUnits && other.unit.toString() !== unit.toString()) {
throw new Error("Incompatible units. Change the units or use the unit function. "
+ ("Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'."));
}
value = this._operate(context, op, this.value, other.value);
}
}
}
else if (op === '*') {
unit.numerator = unit.numerator.concat(other.unit.numerator).sort();
unit.denominator = unit.denominator.concat(other.unit.denominator).sort();
unit.cancel();
}
else if (op === '/') {
unit.numerator = unit.numerator.concat(other.unit.denominator).sort();
unit.denominator = unit.denominator.concat(other.unit.numerator).sort();
unit.cancel();
}
return new Dimension(value, unit);
};
Dimension.prototype.compare = function (other) {
var a;
var b;
if (!(other instanceof Dimension)) {
return undefined;
}
if (this.unit.isEmpty() || other.unit.isEmpty()) {
a = this;
b = other;
}
else {
a = this.unify();
b = other.unify();
if (a.unit.compare(b.unit) !== 0) {
else if (op === '*') {
unit.numerator = unit.numerator.concat(other.unit.numerator).sort();
unit.denominator = unit.denominator.concat(other.unit.denominator).sort();
unit.cancel();
}
else if (op === '/') {
unit.numerator = unit.numerator.concat(other.unit.denominator).sort();
unit.denominator = unit.denominator.concat(other.unit.numerator).sort();
unit.cancel();
}
return new Dimension(value, unit);
},
compare: function (other) {
var a, b;
if (!(other instanceof Dimension)) {
return undefined;
}
}
return node_1.default.numericCompare(a.value, b.value);
};
Dimension.prototype.unify = function () {
return this.convertTo({ length: 'px', duration: 's', angle: 'rad' });
};
Dimension.prototype.convertTo = function (conversions) {
var value = this.value;
var unit = this.unit.clone();
var i;
var groupName;
var group;
var targetUnit;
var derivedConversions = {};
var applyUnit;
if (typeof conversions === 'string') {
for (i in unit_conversions_1.default) {
if (unit_conversions_1.default[i].hasOwnProperty(conversions)) {
derivedConversions = {};
derivedConversions[i] = conversions;
if (this.unit.isEmpty() || other.unit.isEmpty()) {
a = this;
b = other;
}
else {
a = this.unify();
b = other.unify();
if (a.unit.compare(b.unit) !== 0) {
return undefined;
}
}
conversions = derivedConversions;
}
applyUnit = function (atomicUnit, denominator) {
/* jshint loopfunc:true */
if (group.hasOwnProperty(atomicUnit)) {
if (denominator) {
value = value / (group[atomicUnit] / group[targetUnit]);
return node_1.default.numericCompare(a.value, b.value);
},
unify: function () {
return this.convertTo({ length: 'px', duration: 's', angle: 'rad' });
},
convertTo: function (conversions) {
var value = this.value;
var unit = this.unit.clone();
var i;
var groupName;
var group;
var targetUnit;
var derivedConversions = {};
var applyUnit;
if (typeof conversions === 'string') {
for (i in unit_conversions_1.default) {
if (unit_conversions_1.default[i].hasOwnProperty(conversions)) {
derivedConversions = {};
derivedConversions[i] = conversions;
}
}
else {
value = value * (group[atomicUnit] / group[targetUnit]);
conversions = derivedConversions;
}
applyUnit = function (atomicUnit, denominator) {
/* jshint loopfunc:true */
if (group.hasOwnProperty(atomicUnit)) {
if (denominator) {
value = value / (group[atomicUnit] / group[targetUnit]);
}
else {
value = value * (group[atomicUnit] / group[targetUnit]);
}
return targetUnit;
}
return targetUnit;
return atomicUnit;
};
for (groupName in conversions) {
if (conversions.hasOwnProperty(groupName)) {
targetUnit = conversions[groupName];
group = unit_conversions_1.default[groupName];
unit.map(applyUnit);
}
}
return atomicUnit;
};
for (groupName in conversions) {
if (conversions.hasOwnProperty(groupName)) {
targetUnit = conversions[groupName];
group = unit_conversions_1.default[groupName];
unit.map(applyUnit);
}
unit.cancel();
return new Dimension(value, unit);
}
unit.cancel();
return new Dimension(value, unit);
};
Dimension.prototype.type = 'Dimension';
});
exports.default = Dimension;
//# sourceMappingURL=dimension.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var paren_1 = __importDefault(require("./paren"));
var combinator_1 = __importDefault(require("./combinator"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var paren_1 = tslib_1.__importDefault(require("./paren"));
var combinator_1 = tslib_1.__importDefault(require("./combinator"));
var Element = function (combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {

@@ -27,39 +25,40 @@ this.combinator = combinator instanceof combinator_1.default ?

};
Element.prototype = new node_1.default();
Element.prototype.accept = function (visitor) {
var value = this.value;
this.combinator = visitor.visit(this.combinator);
if (typeof value === 'object') {
this.value = visitor.visit(value);
Element.prototype = Object.assign(new node_1.default(), {
type: 'Element',
accept: function (visitor) {
var value = this.value;
this.combinator = visitor.visit(this.combinator);
if (typeof value === 'object') {
this.value = visitor.visit(value);
}
},
eval: function (context) {
return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
},
clone: function () {
return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
},
genCSS: function (context, output) {
output.add(this.toCSS(context), this.fileInfo(), this.getIndex());
},
toCSS: function (context) {
context = context || {};
var value = this.value;
var firstSelector = context.firstSelector;
if (value instanceof paren_1.default) {
// selector in parens should not be affected by outer selector
// flags (breaks only interpolated selectors - see #1973)
context.firstSelector = true;
}
value = value.toCSS ? value.toCSS(context) : value;
context.firstSelector = firstSelector;
if (value === '' && this.combinator.value.charAt(0) === '&') {
return '';
}
else {
return this.combinator.toCSS(context) + value;
}
}
};
Element.prototype.eval = function (context) {
return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
};
Element.prototype.clone = function () {
return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
};
Element.prototype.genCSS = function (context, output) {
output.add(this.toCSS(context), this.fileInfo(), this.getIndex());
};
Element.prototype.toCSS = function (context) {
if (context === void 0) { context = {}; }
var value = this.value;
var firstSelector = context.firstSelector;
if (value instanceof paren_1.default) {
// selector in parens should not be affected by outer selector
// flags (breaks only interpolated selectors - see #1973)
context.firstSelector = true;
}
value = value.toCSS ? value.toCSS(context) : value;
context.firstSelector = firstSelector;
if (value === '' && this.combinator.value.charAt(0) === '&') {
return '';
}
else {
return this.combinator.toCSS(context) + value;
}
};
Element.prototype.type = 'Element';
});
exports.default = Element;
//# sourceMappingURL=element.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var paren_1 = __importDefault(require("./paren"));
var comment_1 = __importDefault(require("./comment"));
var dimension_1 = __importDefault(require("./dimension"));
var Constants = __importStar(require("../constants"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var paren_1 = tslib_1.__importDefault(require("./paren"));
var comment_1 = tslib_1.__importDefault(require("./comment"));
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
var Constants = tslib_1.__importStar(require("../constants"));
var MATH = Constants.Math;

@@ -38,54 +17,56 @@ var Expression = function (value, noSpacing) {

};
Expression.prototype = new node_1.default();
Expression.prototype.accept = function (visitor) {
this.value = visitor.visitArray(this.value);
};
Expression.prototype.eval = function (context) {
var returnValue;
var mathOn = context.isMathOn();
var inParenthesis = this.parens &&
(context.math !== MATH.STRICT_LEGACY || !this.parensInOp);
var doubleParen = false;
if (inParenthesis) {
context.inParenthesis();
}
if (this.value.length > 1) {
returnValue = new Expression(this.value.map(function (e) {
if (!e.eval) {
return e;
Expression.prototype = Object.assign(new node_1.default(), {
type: 'Expression',
accept: function (visitor) {
this.value = visitor.visitArray(this.value);
},
eval: function (context) {
var returnValue;
var mathOn = context.isMathOn();
var inParenthesis = this.parens;
var doubleParen = false;
if (inParenthesis) {
context.inParenthesis();
}
if (this.value.length > 1) {
returnValue = new Expression(this.value.map(function (e) {
if (!e.eval) {
return e;
}
return e.eval(context);
}), this.noSpacing);
}
else if (this.value.length === 1) {
if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) {
doubleParen = true;
}
return e.eval(context);
}), this.noSpacing);
}
else if (this.value.length === 1) {
if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) {
doubleParen = true;
returnValue = this.value[0].eval(context);
}
returnValue = this.value[0].eval(context);
}
else {
returnValue = this;
}
if (inParenthesis) {
context.outOfParenthesis();
}
if (this.parens && this.parensInOp && !mathOn && !doubleParen
&& (!(returnValue instanceof dimension_1.default))) {
returnValue = new paren_1.default(returnValue);
}
return returnValue;
};
Expression.prototype.genCSS = function (context, output) {
for (var i = 0; i < this.value.length; i++) {
this.value[i].genCSS(context, output);
if (!this.noSpacing && i + 1 < this.value.length) {
output.add(' ');
else {
returnValue = this;
}
if (inParenthesis) {
context.outOfParenthesis();
}
if (this.parens && this.parensInOp && !mathOn && !doubleParen
&& (!(returnValue instanceof dimension_1.default))) {
returnValue = new paren_1.default(returnValue);
}
return returnValue;
},
genCSS: function (context, output) {
for (var i = 0; i < this.value.length; i++) {
this.value[i].genCSS(context, output);
if (!this.noSpacing && i + 1 < this.value.length) {
output.add(' ');
}
}
},
throwAwayComments: function () {
this.value = this.value.filter(function (v) {
return !(v instanceof comment_1.default);
});
}
};
Expression.prototype.throwAwayComments = function () {
this.value = this.value.filter(function (v) { return !(v instanceof comment_1.default); });
};
Expression.prototype.type = 'Expression';
});
exports.default = Expression;
//# sourceMappingURL=expression.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var selector_1 = __importDefault(require("./selector"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var selector_1 = tslib_1.__importDefault(require("./selector"));
var Extend = function (selector, option, index, currentFileInfo, visibilityInfo) {

@@ -29,35 +27,31 @@ this.selector = selector;

};
Extend.prototype = new node_1.default();
Extend.prototype.accept = function (visitor) {
this.selector = visitor.visit(this.selector);
};
Extend.prototype.eval = function (context) {
return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
};
Extend.prototype.clone = function (context) {
return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
};
// it concatenates (joins) all selectors in selector array
Extend.prototype.findSelfSelectors = function (selectors) {
var selfElements = [];
var i;
var selectorElements;
for (i = 0; i < selectors.length; i++) {
selectorElements = selectors[i].elements;
// duplicate the logic in genCSS function inside the selector node.
// future TODO - move both logics into the selector joiner visitor
if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {
selectorElements[0].combinator.value = ' ';
Extend.prototype = Object.assign(new node_1.default(), {
type: 'Extend',
accept: function (visitor) {
this.selector = visitor.visit(this.selector);
},
eval: function (context) {
return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
},
clone: function (context) {
return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
},
// it concatenates (joins) all selectors in selector array
findSelfSelectors: function (selectors) {
var selfElements = [], i, selectorElements;
for (i = 0; i < selectors.length; i++) {
selectorElements = selectors[i].elements;
// duplicate the logic in genCSS function inside the selector node.
// future TODO - move both logics into the selector joiner visitor
if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {
selectorElements[0].combinator.value = ' ';
}
selfElements = selfElements.concat(selectors[i].elements);
}
selfElements = selfElements.concat(selectors[i].elements);
this.selfSelectors = [new selector_1.default(selfElements)];
this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());
}
this.selfSelectors = [new selector_1.default(selfElements)];
this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());
};
/**
* Used with the extend visitor
*/
});
Extend.next_id = 0;
Extend.prototype.type = 'Extend';
exports.default = Extend;
//# sourceMappingURL=extend.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var media_1 = __importDefault(require("./media"));
var url_1 = __importDefault(require("./url"));
var quoted_1 = __importDefault(require("./quoted"));
var ruleset_1 = __importDefault(require("./ruleset"));
var anonymous_1 = __importDefault(require("./anonymous"));
var utils = __importStar(require("../utils"));
var less_error_1 = __importDefault(require("../less-error"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var media_1 = tslib_1.__importDefault(require("./media"));
var url_1 = tslib_1.__importDefault(require("./url"));
var quoted_1 = tslib_1.__importDefault(require("./quoted"));
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var utils = tslib_1.__importStar(require("../utils"));
var less_error_1 = tslib_1.__importDefault(require("../less-error"));
//

@@ -65,128 +44,129 @@ // CSS @import node

};
Import.prototype = new node_1.default();
Import.prototype.accept = function (visitor) {
if (this.features) {
this.features = visitor.visit(this.features);
}
this.path = visitor.visit(this.path);
if (!this.options.isPlugin && !this.options.inline && this.root) {
this.root = visitor.visit(this.root);
}
};
Import.prototype.genCSS = function (context, output) {
if (this.css && this.path._fileInfo.reference === undefined) {
output.add('@import ', this._fileInfo, this._index);
this.path.genCSS(context, output);
Import.prototype = Object.assign(new node_1.default(), {
type: 'Import',
accept: function (visitor) {
if (this.features) {
output.add(' ');
this.features.genCSS(context, output);
this.features = visitor.visit(this.features);
}
output.add(';');
}
};
Import.prototype.getPath = function () {
return (this.path instanceof url_1.default) ?
this.path.value.value : this.path.value;
};
Import.prototype.isVariableImport = function () {
var path = this.path;
if (path instanceof url_1.default) {
path = path.value;
}
if (path instanceof quoted_1.default) {
return path.containsVariables();
}
return true;
};
Import.prototype.evalForImport = function (context) {
var path = this.path;
if (path instanceof url_1.default) {
path = path.value;
}
return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());
};
Import.prototype.evalPath = function (context) {
var path = this.path.eval(context);
var fileInfo = this._fileInfo;
if (!(path instanceof url_1.default)) {
// Add the rootpath if the URL requires a rewrite
var pathValue = path.value;
if (fileInfo &&
pathValue &&
context.pathRequiresRewrite(pathValue)) {
path.value = context.rewritePath(pathValue, fileInfo.rootpath);
this.path = visitor.visit(this.path);
if (!this.options.isPlugin && !this.options.inline && this.root) {
this.root = visitor.visit(this.root);
}
else {
path.value = context.normalizePath(path.value);
},
genCSS: function (context, output) {
if (this.css && this.path._fileInfo.reference === undefined) {
output.add('@import ', this._fileInfo, this._index);
this.path.genCSS(context, output);
if (this.features) {
output.add(' ');
this.features.genCSS(context, output);
}
output.add(';');
}
}
return path;
};
Import.prototype.eval = function (context) {
var result = this.doEval(context);
if (this.options.reference || this.blocksVisibility()) {
if (result.length || result.length === 0) {
result.forEach(function (node) {
node.addVisibilityBlock();
});
},
getPath: function () {
return (this.path instanceof url_1.default) ?
this.path.value.value : this.path.value;
},
isVariableImport: function () {
var path = this.path;
if (path instanceof url_1.default) {
path = path.value;
}
else {
result.addVisibilityBlock();
if (path instanceof quoted_1.default) {
return path.containsVariables();
}
}
return result;
};
Import.prototype.doEval = function (context) {
var ruleset;
var registry;
var features = this.features && this.features.eval(context);
if (this.options.isPlugin) {
if (this.root && this.root.eval) {
try {
this.root.eval(context);
return true;
},
evalForImport: function (context) {
var path = this.path;
if (path instanceof url_1.default) {
path = path.value;
}
return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());
},
evalPath: function (context) {
var path = this.path.eval(context);
var fileInfo = this._fileInfo;
if (!(path instanceof url_1.default)) {
// Add the rootpath if the URL requires a rewrite
var pathValue = path.value;
if (fileInfo &&
pathValue &&
context.pathRequiresRewrite(pathValue)) {
path.value = context.rewritePath(pathValue, fileInfo.rootpath);
}
catch (e) {
e.message = 'Plugin error during evaluation';
throw new less_error_1.default(e, this.root.imports, this.root.filename);
else {
path.value = context.normalizePath(path.value);
}
}
registry = context.frames[0] && context.frames[0].functionRegistry;
if (registry && this.root && this.root.functions) {
registry.addMultiple(this.root.functions);
return path;
},
eval: function (context) {
var result = this.doEval(context);
if (this.options.reference || this.blocksVisibility()) {
if (result.length || result.length === 0) {
result.forEach(function (node) {
node.addVisibilityBlock();
});
}
else {
result.addVisibilityBlock();
}
}
return [];
}
if (this.skip) {
if (typeof this.skip === 'function') {
this.skip = this.skip();
return result;
},
doEval: function (context) {
var ruleset;
var registry;
var features = this.features && this.features.eval(context);
if (this.options.isPlugin) {
if (this.root && this.root.eval) {
try {
this.root.eval(context);
}
catch (e) {
e.message = 'Plugin error during evaluation';
throw new less_error_1.default(e, this.root.imports, this.root.filename);
}
}
registry = context.frames[0] && context.frames[0].functionRegistry;
if (registry && this.root && this.root.functions) {
registry.addMultiple(this.root.functions);
}
return [];
}
if (this.skip) {
if (typeof this.skip === 'function') {
this.skip = this.skip();
}
if (this.skip) {
return [];
}
}
if (this.options.inline) {
var contents = new anonymous_1.default(this.root, 0, {
filename: this.importedFilename,
reference: this.path._fileInfo && this.path._fileInfo.reference
}, true, true);
return this.features ? new media_1.default([contents], this.features.value) : [contents];
}
else if (this.css) {
var newImport = new Import(this.evalPath(context), features, this.options, this._index);
if (!newImport.css && this.error) {
throw this.error;
}
return newImport;
}
else if (this.root) {
ruleset = new ruleset_1.default(null, utils.copyArray(this.root.rules));
ruleset.evalImports(context);
return this.features ? new media_1.default(ruleset.rules, this.features.value) : ruleset.rules;
}
else {
return [];
}
}
if (this.options.inline) {
var contents = new anonymous_1.default(this.root, 0, {
filename: this.importedFilename,
reference: this.path._fileInfo && this.path._fileInfo.reference
}, true, true);
return this.features ? new media_1.default([contents], this.features.value) : [contents];
}
else if (this.css) {
var newImport = new Import(this.evalPath(context), features, this.options, this._index);
if (!newImport.css && this.error) {
throw this.error;
}
return newImport;
}
else if (this.root) {
ruleset = new ruleset_1.default(null, utils.copyArray(this.root.rules));
ruleset.evalImports(context);
return this.features ? new media_1.default(ruleset.rules, this.features.value) : ruleset.rules;
}
else {
return [];
}
};
Import.prototype.type = 'Import';
});
exports.default = Import;
//# sourceMappingURL=import.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var color_1 = __importDefault(require("./color"));
var atrule_1 = __importDefault(require("./atrule"));
var detached_ruleset_1 = __importDefault(require("./detached-ruleset"));
var operation_1 = __importDefault(require("./operation"));
var dimension_1 = __importDefault(require("./dimension"));
var unit_1 = __importDefault(require("./unit"));
var keyword_1 = __importDefault(require("./keyword"));
var variable_1 = __importDefault(require("./variable"));
var property_1 = __importDefault(require("./property"));
var ruleset_1 = __importDefault(require("./ruleset"));
var element_1 = __importDefault(require("./element"));
var attribute_1 = __importDefault(require("./attribute"));
var combinator_1 = __importDefault(require("./combinator"));
var selector_1 = __importDefault(require("./selector"));
var quoted_1 = __importDefault(require("./quoted"));
var expression_1 = __importDefault(require("./expression"));
var declaration_1 = __importDefault(require("./declaration"));
var call_1 = __importDefault(require("./call"));
var url_1 = __importDefault(require("./url"));
var import_1 = __importDefault(require("./import"));
var comment_1 = __importDefault(require("./comment"));
var anonymous_1 = __importDefault(require("./anonymous"));
var value_1 = __importDefault(require("./value"));
var javascript_1 = __importDefault(require("./javascript"));
var assignment_1 = __importDefault(require("./assignment"));
var condition_1 = __importDefault(require("./condition"));
var paren_1 = __importDefault(require("./paren"));
var media_1 = __importDefault(require("./media"));
var unicode_descriptor_1 = __importDefault(require("./unicode-descriptor"));
var negative_1 = __importDefault(require("./negative"));
var extend_1 = __importDefault(require("./extend"));
var variable_call_1 = __importDefault(require("./variable-call"));
var namespace_value_1 = __importDefault(require("./namespace-value"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var color_1 = tslib_1.__importDefault(require("./color"));
var atrule_1 = tslib_1.__importDefault(require("./atrule"));
var detached_ruleset_1 = tslib_1.__importDefault(require("./detached-ruleset"));
var operation_1 = tslib_1.__importDefault(require("./operation"));
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
var unit_1 = tslib_1.__importDefault(require("./unit"));
var keyword_1 = tslib_1.__importDefault(require("./keyword"));
var variable_1 = tslib_1.__importDefault(require("./variable"));
var property_1 = tslib_1.__importDefault(require("./property"));
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
var element_1 = tslib_1.__importDefault(require("./element"));
var attribute_1 = tslib_1.__importDefault(require("./attribute"));
var combinator_1 = tslib_1.__importDefault(require("./combinator"));
var selector_1 = tslib_1.__importDefault(require("./selector"));
var quoted_1 = tslib_1.__importDefault(require("./quoted"));
var expression_1 = tslib_1.__importDefault(require("./expression"));
var declaration_1 = tslib_1.__importDefault(require("./declaration"));
var call_1 = tslib_1.__importDefault(require("./call"));
var url_1 = tslib_1.__importDefault(require("./url"));
var import_1 = tslib_1.__importDefault(require("./import"));
var comment_1 = tslib_1.__importDefault(require("./comment"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var value_1 = tslib_1.__importDefault(require("./value"));
var javascript_1 = tslib_1.__importDefault(require("./javascript"));
var assignment_1 = tslib_1.__importDefault(require("./assignment"));
var condition_1 = tslib_1.__importDefault(require("./condition"));
var paren_1 = tslib_1.__importDefault(require("./paren"));
var media_1 = tslib_1.__importDefault(require("./media"));
var unicode_descriptor_1 = tslib_1.__importDefault(require("./unicode-descriptor"));
var negative_1 = tslib_1.__importDefault(require("./negative"));
var extend_1 = tslib_1.__importDefault(require("./extend"));
var variable_call_1 = tslib_1.__importDefault(require("./variable-call"));
var namespace_value_1 = tslib_1.__importDefault(require("./namespace-value"));
// mixins
var mixin_call_1 = __importDefault(require("./mixin-call"));
var mixin_definition_1 = __importDefault(require("./mixin-definition"));
var mixin_call_1 = tslib_1.__importDefault(require("./mixin-call"));
var mixin_definition_1 = tslib_1.__importDefault(require("./mixin-definition"));
exports.default = {

@@ -44,0 +42,0 @@ Node: node_1.default, Color: color_1.default, AtRule: atrule_1.default, DetachedRuleset: detached_ruleset_1.default, Operation: operation_1.default,

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var js_eval_node_1 = __importDefault(require("./js-eval-node"));
var dimension_1 = __importDefault(require("./dimension"));
var quoted_1 = __importDefault(require("./quoted"));
var anonymous_1 = __importDefault(require("./anonymous"));
var tslib_1 = require("tslib");
var js_eval_node_1 = tslib_1.__importDefault(require("./js-eval-node"));
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
var quoted_1 = tslib_1.__importDefault(require("./quoted"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var JavaScript = function (string, escaped, index, currentFileInfo) {

@@ -16,21 +14,22 @@ this.escaped = escaped;

};
JavaScript.prototype = new js_eval_node_1.default();
JavaScript.prototype.eval = function (context) {
var result = this.evaluateJavaScript(this.expression, context);
var type = typeof result;
if (type === 'number' && !isNaN(result)) {
return new dimension_1.default(result);
JavaScript.prototype = Object.assign(new js_eval_node_1.default(), {
type: 'JavaScript',
eval: function (context) {
var result = this.evaluateJavaScript(this.expression, context);
var type = typeof result;
if (type === 'number' && !isNaN(result)) {
return new dimension_1.default(result);
}
else if (type === 'string') {
return new quoted_1.default("\"" + result + "\"", result, this.escaped, this._index);
}
else if (Array.isArray(result)) {
return new anonymous_1.default(result.join(', '));
}
else {
return new anonymous_1.default(result);
}
}
else if (type === 'string') {
return new quoted_1.default("\"" + result + "\"", result, this.escaped, this._index);
}
else if (Array.isArray(result)) {
return new anonymous_1.default(result.join(', '));
}
else {
return new anonymous_1.default(result);
}
};
JavaScript.prototype.type = 'JavaScript';
});
exports.default = JavaScript;
//# sourceMappingURL=javascript.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var variable_1 = __importDefault(require("./variable"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var variable_1 = tslib_1.__importDefault(require("./variable"));
var JsEvalNode = function () { };
JsEvalNode.prototype = new node_1.default();
JsEvalNode.prototype.evaluateJavaScript = function (expression, context) {
var result;
var that = this;
var evalContext = {};
if (!context.javascriptEnabled) {
throw { message: 'Inline JavaScript is not enabled. Is it set in your options?',
filename: this.fileInfo().filename,
index: this.getIndex() };
}
expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { return that.jsify(new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context)); });
try {
expression = new Function("return (" + expression + ")");
}
catch (e) {
throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`", filename: this.fileInfo().filename,
index: this.getIndex() };
}
var variables = context.frames[0].variables();
for (var k in variables) {
if (variables.hasOwnProperty(k)) {
/* jshint loopfunc:true */
evalContext[k.slice(1)] = {
value: variables[k].value,
toJS: function () {
return this.value.eval(context).toCSS();
}
};
JsEvalNode.prototype = Object.assign(new node_1.default(), {
evaluateJavaScript: function (expression, context) {
var result;
var that = this;
var evalContext = {};
if (!context.javascriptEnabled) {
throw { message: 'Inline JavaScript is not enabled. Is it set in your options?',
filename: this.fileInfo().filename,
index: this.getIndex() };
}
expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) {
return that.jsify(new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context));
});
try {
expression = new Function("return (" + expression + ")");
}
catch (e) {
throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`", filename: this.fileInfo().filename,
index: this.getIndex() };
}
var variables = context.frames[0].variables();
for (var k in variables) {
if (variables.hasOwnProperty(k)) {
/* jshint loopfunc:true */
evalContext[k.slice(1)] = {
value: variables[k].value,
toJS: function () {
return this.value.eval(context).toCSS();
}
};
}
}
try {
result = expression.call(evalContext);
}
catch (e) {
throw { message: "JavaScript evaluation error: '" + e.name + ": " + e.message.replace(/["]/g, '\'') + "'", filename: this.fileInfo().filename,
index: this.getIndex() };
}
return result;
},
jsify: function (obj) {
if (Array.isArray(obj.value) && (obj.value.length > 1)) {
return "[" + obj.value.map(function (v) { return v.toCSS(); }).join(', ') + "]";
}
else {
return obj.toCSS();
}
}
try {
result = expression.call(evalContext);
}
catch (e) {
throw { message: "JavaScript evaluation error: '" + e.name + ": " + e.message.replace(/["]/g, '\'') + "'", filename: this.fileInfo().filename,
index: this.getIndex() };
}
return result;
};
JsEvalNode.prototype.jsify = function (obj) {
if (Array.isArray(obj.value) && (obj.value.length > 1)) {
return "[" + obj.value.map(function (v) { return v.toCSS(); }).join(', ') + "]";
}
else {
return obj.toCSS();
}
};
});
exports.default = JsEvalNode;
//# sourceMappingURL=js-eval-node.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var Keyword = function (value) {
this.value = value;
};
Keyword.prototype = new node_1.default();
Keyword.prototype.genCSS = function (context, output) {
if (this.value === '%') {
throw { type: 'Syntax', message: 'Invalid % without number' };
Keyword.prototype = Object.assign(new node_1.default(), {
type: 'Keyword',
genCSS: function (context, output) {
if (this.value === '%') {
throw { type: 'Syntax', message: 'Invalid % without number' };
}
output.add(this.value);
}
output.add(this.value);
};
Keyword.prototype.type = 'Keyword';
});
Keyword.True = new Keyword('true');

@@ -19,0 +18,0 @@ Keyword.False = new Keyword('false');

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var ruleset_1 = __importDefault(require("./ruleset"));
var value_1 = __importDefault(require("./value"));
var selector_1 = __importDefault(require("./selector"));
var anonymous_1 = __importDefault(require("./anonymous"));
var expression_1 = __importDefault(require("./expression"));
var atrule_1 = __importDefault(require("./atrule"));
var utils = __importStar(require("../utils"));
var tslib_1 = require("tslib");
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
var value_1 = tslib_1.__importDefault(require("./value"));
var selector_1 = tslib_1.__importDefault(require("./selector"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var expression_1 = tslib_1.__importDefault(require("./expression"));
var atrule_1 = tslib_1.__importDefault(require("./atrule"));
var utils = tslib_1.__importStar(require("../utils"));
var Media = function (value, features, index, currentFileInfo, visibilityInfo) {

@@ -45,109 +24,110 @@ this._index = index;

};
Media.prototype = new atrule_1.default();
Media.prototype.isRulesetLike = function () {
return true;
};
Media.prototype.accept = function (visitor) {
if (this.features) {
this.features = visitor.visit(this.features);
}
if (this.rules) {
this.rules = visitor.visitArray(this.rules);
}
};
Media.prototype.genCSS = function (context, output) {
output.add('@media ', this._fileInfo, this._index);
this.features.genCSS(context, output);
this.outputRuleset(context, output, this.rules);
};
Media.prototype.eval = function (context) {
if (!context.mediaBlocks) {
context.mediaBlocks = [];
context.mediaPath = [];
}
var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo());
if (this.debugInfo) {
this.rules[0].debugInfo = this.debugInfo;
media.debugInfo = this.debugInfo;
}
media.features = this.features.eval(context);
context.mediaPath.push(media);
context.mediaBlocks.push(media);
this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();
context.frames.unshift(this.rules[0]);
media.rules = [this.rules[0].eval(context)];
context.frames.shift();
context.mediaPath.pop();
return context.mediaPath.length === 0 ? media.evalTop(context) :
media.evalNested(context);
};
Media.prototype.evalTop = function (context) {
var result = this;
// Render all dependent Media blocks.
if (context.mediaBlocks.length > 1) {
var selectors = (new selector_1.default([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();
result = new ruleset_1.default(selectors, context.mediaBlocks);
result.multiMedia = true;
result.copyVisibilityInfo(this.visibilityInfo());
this.setParent(result, this);
}
delete context.mediaBlocks;
delete context.mediaPath;
return result;
};
Media.prototype.evalNested = function (context) {
var i;
var value;
var path = context.mediaPath.concat([this]);
// Extract the media-query conditions separated with `,` (OR).
for (i = 0; i < path.length; i++) {
value = path[i].features instanceof value_1.default ?
path[i].features.value : path[i].features;
path[i] = Array.isArray(value) ? value : [value];
}
// Trace all permutations to generate the resulting media-query.
//
// (a, b and c) with nested (d, e) ->
// a and d
// a and e
// b and c and d
// b and c and e
this.features = new value_1.default(this.permute(path).map(function (path) {
path = path.map(function (fragment) { return fragment.toCSS ? fragment : new anonymous_1.default(fragment); });
for (i = path.length - 1; i > 0; i--) {
path.splice(i, 0, new anonymous_1.default('and'));
Media.prototype = Object.assign(new atrule_1.default(), {
type: 'Media',
isRulesetLike: function () {
return true;
},
accept: function (visitor) {
if (this.features) {
this.features = visitor.visit(this.features);
}
return new expression_1.default(path);
}));
this.setParent(this.features, this);
// Fake a tree-node that doesn't output anything.
return new ruleset_1.default([], []);
};
Media.prototype.permute = function (arr) {
if (arr.length === 0) {
return [];
}
else if (arr.length === 1) {
return arr[0];
}
else {
var result = [];
var rest = this.permute(arr.slice(1));
for (var i = 0; i < rest.length; i++) {
for (var j = 0; j < arr[0].length; j++) {
result.push([arr[0][j]].concat(rest[i]));
if (this.rules) {
this.rules = visitor.visitArray(this.rules);
}
},
genCSS: function (context, output) {
output.add('@media ', this._fileInfo, this._index);
this.features.genCSS(context, output);
this.outputRuleset(context, output, this.rules);
},
eval: function (context) {
if (!context.mediaBlocks) {
context.mediaBlocks = [];
context.mediaPath = [];
}
var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo());
if (this.debugInfo) {
this.rules[0].debugInfo = this.debugInfo;
media.debugInfo = this.debugInfo;
}
media.features = this.features.eval(context);
context.mediaPath.push(media);
context.mediaBlocks.push(media);
this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();
context.frames.unshift(this.rules[0]);
media.rules = [this.rules[0].eval(context)];
context.frames.shift();
context.mediaPath.pop();
return context.mediaPath.length === 0 ? media.evalTop(context) :
media.evalNested(context);
},
evalTop: function (context) {
var result = this;
// Render all dependent Media blocks.
if (context.mediaBlocks.length > 1) {
var selectors = (new selector_1.default([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();
result = new ruleset_1.default(selectors, context.mediaBlocks);
result.multiMedia = true;
result.copyVisibilityInfo(this.visibilityInfo());
this.setParent(result, this);
}
delete context.mediaBlocks;
delete context.mediaPath;
return result;
},
evalNested: function (context) {
var i;
var value;
var path = context.mediaPath.concat([this]);
// Extract the media-query conditions separated with `,` (OR).
for (i = 0; i < path.length; i++) {
value = path[i].features instanceof value_1.default ?
path[i].features.value : path[i].features;
path[i] = Array.isArray(value) ? value : [value];
}
// Trace all permutations to generate the resulting media-query.
//
// (a, b and c) with nested (d, e) ->
// a and d
// a and e
// b and c and d
// b and c and e
this.features = new value_1.default(this.permute(path).map(function (path) {
path = path.map(function (fragment) { return fragment.toCSS ? fragment : new anonymous_1.default(fragment); });
for (i = path.length - 1; i > 0; i--) {
path.splice(i, 0, new anonymous_1.default('and'));
}
return new expression_1.default(path);
}));
this.setParent(this.features, this);
// Fake a tree-node that doesn't output anything.
return new ruleset_1.default([], []);
},
permute: function (arr) {
if (arr.length === 0) {
return [];
}
return result;
else if (arr.length === 1) {
return arr[0];
}
else {
var result = [];
var rest = this.permute(arr.slice(1));
for (var i = 0; i < rest.length; i++) {
for (var j = 0; j < arr[0].length; j++) {
result.push([arr[0][j]].concat(rest[i]));
}
}
return result;
}
},
bubbleSelectors: function (selectors) {
if (!selectors) {
return;
}
this.rules = [new ruleset_1.default(utils.copyArray(selectors), [this.rules[0]])];
this.setParent(this.rules, this);
}
};
Media.prototype.bubbleSelectors = function (selectors) {
if (!selectors) {
return;
}
this.rules = [new ruleset_1.default(utils.copyArray(selectors), [this.rules[0]])];
this.setParent(this.rules, this);
};
Media.prototype.type = 'Media';
});
exports.default = Media;
//# sourceMappingURL=media.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var selector_1 = __importDefault(require("./selector"));
var mixin_definition_1 = __importDefault(require("./mixin-definition"));
var default_1 = __importDefault(require("../functions/default"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var selector_1 = tslib_1.__importDefault(require("./selector"));
var mixin_definition_1 = tslib_1.__importDefault(require("./mixin-definition"));
var default_1 = tslib_1.__importDefault(require("../functions/default"));
var MixinCall = function (elements, args, index, currentFileInfo, important) {

@@ -19,177 +17,175 @@ this.selector = new selector_1.default(elements);

};
MixinCall.prototype = new node_1.default();
MixinCall.prototype.accept = function (visitor) {
if (this.selector) {
this.selector = visitor.visit(this.selector);
}
if (this.arguments.length) {
this.arguments = visitor.visitArray(this.arguments);
}
};
MixinCall.prototype.eval = function (context) {
var mixins;
var mixin;
var mixinPath;
var args = [];
var arg;
var argValue;
var rules = [];
var match = false;
var i;
var m;
var f;
var isRecursive;
var isOneFound;
var candidates = [];
var candidate;
var conditionResult = [];
var defaultResult;
var defFalseEitherCase = -1;
var defNone = 0;
var defTrue = 1;
var defFalse = 2;
var count;
var originalRuleset;
var noArgumentsFilter;
this.selector = this.selector.eval(context);
function calcDefGroup(mixin, mixinPath) {
MixinCall.prototype = Object.assign(new node_1.default(), {
type: 'MixinCall',
accept: function (visitor) {
if (this.selector) {
this.selector = visitor.visit(this.selector);
}
if (this.arguments.length) {
this.arguments = visitor.visitArray(this.arguments);
}
},
eval: function (context) {
var mixins;
var mixin;
var mixinPath;
var args = [];
var arg;
var argValue;
var rules = [];
var match = false;
var i;
var m;
var f;
var p;
var namespace;
for (f = 0; f < 2; f++) {
conditionResult[f] = true;
default_1.default.value(f);
for (p = 0; p < mixinPath.length && conditionResult[f]; p++) {
namespace = mixinPath[p];
if (namespace.matchCondition) {
conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context);
var isRecursive;
var isOneFound;
var candidates = [];
var candidate;
var conditionResult = [];
var defaultResult;
var defFalseEitherCase = -1;
var defNone = 0;
var defTrue = 1;
var defFalse = 2;
var count;
var originalRuleset;
var noArgumentsFilter;
this.selector = this.selector.eval(context);
function calcDefGroup(mixin, mixinPath) {
var f, p, namespace;
for (f = 0; f < 2; f++) {
conditionResult[f] = true;
default_1.default.value(f);
for (p = 0; p < mixinPath.length && conditionResult[f]; p++) {
namespace = mixinPath[p];
if (namespace.matchCondition) {
conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context);
}
}
if (mixin.matchCondition) {
conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context);
}
}
if (mixin.matchCondition) {
conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context);
if (conditionResult[0] || conditionResult[1]) {
if (conditionResult[0] != conditionResult[1]) {
return conditionResult[1] ?
defTrue : defFalse;
}
return defNone;
}
return defFalseEitherCase;
}
if (conditionResult[0] || conditionResult[1]) {
if (conditionResult[0] != conditionResult[1]) {
return conditionResult[1] ?
defTrue : defFalse;
for (i = 0; i < this.arguments.length; i++) {
arg = this.arguments[i];
argValue = arg.value.eval(context);
if (arg.expand && Array.isArray(argValue.value)) {
argValue = argValue.value;
for (m = 0; m < argValue.length; m++) {
args.push({ value: argValue[m] });
}
}
return defNone;
}
return defFalseEitherCase;
}
for (i = 0; i < this.arguments.length; i++) {
arg = this.arguments[i];
argValue = arg.value.eval(context);
if (arg.expand && Array.isArray(argValue.value)) {
argValue = argValue.value;
for (m = 0; m < argValue.length; m++) {
args.push({ value: argValue[m] });
else {
args.push({ name: arg.name, value: argValue });
}
}
else {
args.push({ name: arg.name, value: argValue });
}
}
noArgumentsFilter = function (rule) { return rule.matchArgs(null, context); };
for (i = 0; i < context.frames.length; i++) {
if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) {
isOneFound = true;
// To make `default()` function independent of definition order we have two "subpasses" here.
// At first we evaluate each guard *twice* (with `default() == true` and `default() == false`),
// and build candidate list with corresponding flags. Then, when we know all possible matches,
// we make a final decision.
for (m = 0; m < mixins.length; m++) {
mixin = mixins[m].rule;
mixinPath = mixins[m].path;
isRecursive = false;
for (f = 0; f < context.frames.length; f++) {
if ((!(mixin instanceof mixin_definition_1.default)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) {
isRecursive = true;
break;
noArgumentsFilter = function (rule) { return rule.matchArgs(null, context); };
for (i = 0; i < context.frames.length; i++) {
if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) {
isOneFound = true;
// To make `default()` function independent of definition order we have two "subpasses" here.
// At first we evaluate each guard *twice* (with `default() == true` and `default() == false`),
// and build candidate list with corresponding flags. Then, when we know all possible matches,
// we make a final decision.
for (m = 0; m < mixins.length; m++) {
mixin = mixins[m].rule;
mixinPath = mixins[m].path;
isRecursive = false;
for (f = 0; f < context.frames.length; f++) {
if ((!(mixin instanceof mixin_definition_1.default)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) {
isRecursive = true;
break;
}
}
if (isRecursive) {
continue;
}
if (mixin.matchArgs(args, context)) {
candidate = { mixin: mixin, group: calcDefGroup(mixin, mixinPath) };
if (candidate.group !== defFalseEitherCase) {
candidates.push(candidate);
}
match = true;
}
}
if (isRecursive) {
continue;
default_1.default.reset();
count = [0, 0, 0];
for (m = 0; m < candidates.length; m++) {
count[candidates[m].group]++;
}
if (mixin.matchArgs(args, context)) {
candidate = { mixin: mixin, group: calcDefGroup(mixin, mixinPath) };
if (candidate.group !== defFalseEitherCase) {
candidates.push(candidate);
if (count[defNone] > 0) {
defaultResult = defFalse;
}
else {
defaultResult = defTrue;
if ((count[defTrue] + count[defFalse]) > 1) {
throw { type: 'Runtime', message: "Ambiguous use of `default()` found when matching for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename };
}
match = true;
}
}
default_1.default.reset();
count = [0, 0, 0];
for (m = 0; m < candidates.length; m++) {
count[candidates[m].group]++;
}
if (count[defNone] > 0) {
defaultResult = defFalse;
}
else {
defaultResult = defTrue;
if ((count[defTrue] + count[defFalse]) > 1) {
throw { type: 'Runtime', message: "Ambiguous use of `default()` found when matching for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename };
}
}
for (m = 0; m < candidates.length; m++) {
candidate = candidates[m].group;
if ((candidate === defNone) || (candidate === defaultResult)) {
try {
mixin = candidates[m].mixin;
if (!(mixin instanceof mixin_definition_1.default)) {
originalRuleset = mixin.originalRuleset || mixin;
mixin = new mixin_definition_1.default('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo());
mixin.originalRuleset = originalRuleset;
for (m = 0; m < candidates.length; m++) {
candidate = candidates[m].group;
if ((candidate === defNone) || (candidate === defaultResult)) {
try {
mixin = candidates[m].mixin;
if (!(mixin instanceof mixin_definition_1.default)) {
originalRuleset = mixin.originalRuleset || mixin;
mixin = new mixin_definition_1.default('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo());
mixin.originalRuleset = originalRuleset;
}
var newRules = mixin.evalCall(context, args, this.important).rules;
this._setVisibilityToReplacement(newRules);
Array.prototype.push.apply(rules, newRules);
}
var newRules = mixin.evalCall(context, args, this.important).rules;
this._setVisibilityToReplacement(newRules);
Array.prototype.push.apply(rules, newRules);
catch (e) {
throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack };
}
}
catch (e) {
throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack };
}
}
if (match) {
return rules;
}
}
if (match) {
return rules;
}
}
}
if (isOneFound) {
throw { type: 'Runtime', message: "No matching definition was found for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename };
}
else {
throw { type: 'Name', message: this.selector.toCSS().trim() + " is undefined", index: this.getIndex(), filename: this.fileInfo().filename };
}
};
MixinCall.prototype._setVisibilityToReplacement = function (replacement) {
var i;
var rule;
if (this.blocksVisibility()) {
for (i = 0; i < replacement.length; i++) {
rule = replacement[i];
rule.addVisibilityBlock();
if (isOneFound) {
throw { type: 'Runtime', message: "No matching definition was found for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename };
}
}
};
MixinCall.prototype.format = function (args) {
return this.selector.toCSS().trim() + "(" + (args ? args.map(function (a) {
var argValue = '';
if (a.name) {
argValue += a.name + ":";
else {
throw { type: 'Name', message: this.selector.toCSS().trim() + " is undefined", index: this.getIndex(), filename: this.fileInfo().filename };
}
if (a.value.toCSS) {
argValue += a.value.toCSS();
},
_setVisibilityToReplacement: function (replacement) {
var i, rule;
if (this.blocksVisibility()) {
for (i = 0; i < replacement.length; i++) {
rule = replacement[i];
rule.addVisibilityBlock();
}
}
else {
argValue += '???';
}
return argValue;
}).join(', ') : '') + ")";
};
MixinCall.prototype.type = 'MixinCall';
},
format: function (args) {
return this.selector.toCSS().trim() + "(" + (args ? args.map(function (a) {
var argValue = '';
if (a.name) {
argValue += a.name + ":";
}
if (a.value.toCSS) {
argValue += a.value.toCSS();
}
else {
argValue += '???';
}
return argValue;
}).join(', ') : '') + ")";
}
});
exports.default = MixinCall;
//# sourceMappingURL=mixin-call.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var selector_1 = __importDefault(require("./selector"));
var element_1 = __importDefault(require("./element"));
var ruleset_1 = __importDefault(require("./ruleset"));
var declaration_1 = __importDefault(require("./declaration"));
var detached_ruleset_1 = __importDefault(require("./detached-ruleset"));
var expression_1 = __importDefault(require("./expression"));
var contexts_1 = __importDefault(require("../contexts"));
var utils = __importStar(require("../utils"));
var tslib_1 = require("tslib");
var selector_1 = tslib_1.__importDefault(require("./selector"));
var element_1 = tslib_1.__importDefault(require("./element"));
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
var declaration_1 = tslib_1.__importDefault(require("./declaration"));
var detached_ruleset_1 = tslib_1.__importDefault(require("./detached-ruleset"));
var expression_1 = tslib_1.__importDefault(require("./expression"));
var contexts_1 = tslib_1.__importDefault(require("../contexts"));
var utils = tslib_1.__importStar(require("../utils"));
var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) {

@@ -57,178 +36,179 @@ this.name = name || 'anonymous mixin';

};
Definition.prototype = new ruleset_1.default();
Definition.prototype.accept = function (visitor) {
if (this.params && this.params.length) {
this.params = visitor.visitArray(this.params);
}
this.rules = visitor.visitArray(this.rules);
if (this.condition) {
this.condition = visitor.visit(this.condition);
}
};
Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) {
/* jshint boss:true */
var frame = new ruleset_1.default(null, null);
var varargs;
var arg;
var params = utils.copyArray(this.params);
var i;
var j;
var val;
var name;
var isNamedFound;
var argIndex;
var argsLength = 0;
if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) {
frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit();
}
mixinEnv = new contexts_1.default.Eval(mixinEnv, [frame].concat(mixinEnv.frames));
if (args) {
args = utils.copyArray(args);
argsLength = args.length;
for (i = 0; i < argsLength; i++) {
arg = args[i];
if (name = (arg && arg.name)) {
isNamedFound = false;
for (j = 0; j < params.length; j++) {
if (!evaldArguments[j] && name === params[j].name) {
evaldArguments[j] = arg.value.eval(context);
frame.prependRule(new declaration_1.default(name, arg.value.eval(context)));
isNamedFound = true;
break;
Definition.prototype = Object.assign(new ruleset_1.default(), {
type: 'MixinDefinition',
evalFirst: true,
accept: function (visitor) {
if (this.params && this.params.length) {
this.params = visitor.visitArray(this.params);
}
this.rules = visitor.visitArray(this.rules);
if (this.condition) {
this.condition = visitor.visit(this.condition);
}
},
evalParams: function (context, mixinEnv, args, evaldArguments) {
/* jshint boss:true */
var frame = new ruleset_1.default(null, null);
var varargs;
var arg;
var params = utils.copyArray(this.params);
var i;
var j;
var val;
var name;
var isNamedFound;
var argIndex;
var argsLength = 0;
if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) {
frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit();
}
mixinEnv = new contexts_1.default.Eval(mixinEnv, [frame].concat(mixinEnv.frames));
if (args) {
args = utils.copyArray(args);
argsLength = args.length;
for (i = 0; i < argsLength; i++) {
arg = args[i];
if (name = (arg && arg.name)) {
isNamedFound = false;
for (j = 0; j < params.length; j++) {
if (!evaldArguments[j] && name === params[j].name) {
evaldArguments[j] = arg.value.eval(context);
frame.prependRule(new declaration_1.default(name, arg.value.eval(context)));
isNamedFound = true;
break;
}
}
if (isNamedFound) {
args.splice(i, 1);
i--;
continue;
}
else {
throw { type: 'Runtime', message: "Named argument for " + this.name + " " + args[i].name + " not found" };
}
}
if (isNamedFound) {
args.splice(i, 1);
i--;
continue;
}
else {
throw { type: 'Runtime', message: "Named argument for " + this.name + " " + args[i].name + " not found" };
}
}
}
}
argIndex = 0;
for (i = 0; i < params.length; i++) {
if (evaldArguments[i]) {
continue;
}
arg = args && args[argIndex];
if (name = params[i].name) {
if (params[i].variadic) {
varargs = [];
for (j = argIndex; j < argsLength; j++) {
varargs.push(args[j].value.eval(context));
}
frame.prependRule(new declaration_1.default(name, new expression_1.default(varargs).eval(context)));
argIndex = 0;
for (i = 0; i < params.length; i++) {
if (evaldArguments[i]) {
continue;
}
else {
val = arg && arg.value;
if (val) {
// This was a mixin call, pass in a detached ruleset of it's eval'd rules
if (Array.isArray(val)) {
val = new detached_ruleset_1.default(new ruleset_1.default('', val));
arg = args && args[argIndex];
if (name = params[i].name) {
if (params[i].variadic) {
varargs = [];
for (j = argIndex; j < argsLength; j++) {
varargs.push(args[j].value.eval(context));
}
frame.prependRule(new declaration_1.default(name, new expression_1.default(varargs).eval(context)));
}
else {
val = arg && arg.value;
if (val) {
// This was a mixin call, pass in a detached ruleset of it's eval'd rules
if (Array.isArray(val)) {
val = new detached_ruleset_1.default(new ruleset_1.default('', val));
}
else {
val = val.eval(context);
}
}
else if (params[i].value) {
val = params[i].value.eval(mixinEnv);
frame.resetCache();
}
else {
val = val.eval(context);
throw { type: 'Runtime', message: "wrong number of arguments for " + this.name + " (" + argsLength + " for " + this.arity + ")" };
}
frame.prependRule(new declaration_1.default(name, val));
evaldArguments[i] = val;
}
else if (params[i].value) {
val = params[i].value.eval(mixinEnv);
frame.resetCache();
}
if (params[i].variadic && args) {
for (j = argIndex; j < argsLength; j++) {
evaldArguments[j] = args[j].value.eval(context);
}
else {
throw { type: 'Runtime', message: "wrong number of arguments for " + this.name + " (" + argsLength + " for " + this.arity + ")" };
}
frame.prependRule(new declaration_1.default(name, val));
evaldArguments[i] = val;
}
argIndex++;
}
if (params[i].variadic && args) {
for (j = argIndex; j < argsLength; j++) {
evaldArguments[j] = args[j].value.eval(context);
return frame;
},
makeImportant: function () {
var rules = !this.rules ? this.rules : this.rules.map(function (r) {
if (r.makeImportant) {
return r.makeImportant(true);
}
else {
return r;
}
});
var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames);
return result;
},
eval: function (context) {
return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames));
},
evalCall: function (context, args, important) {
var _arguments = [];
var mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames;
var frame = this.evalParams(context, new contexts_1.default.Eval(context, mixinFrames), args, _arguments);
var rules;
var ruleset;
frame.prependRule(new declaration_1.default('@arguments', new expression_1.default(_arguments).eval(context)));
rules = utils.copyArray(this.rules);
ruleset = new ruleset_1.default(null, rules);
ruleset.originalRuleset = this;
ruleset = ruleset.eval(new contexts_1.default.Eval(context, [this, frame].concat(mixinFrames)));
if (important) {
ruleset = ruleset.makeImportant();
}
argIndex++;
}
return frame;
};
Definition.prototype.makeImportant = function () {
var rules = !this.rules ? this.rules : this.rules.map(function (r) {
if (r.makeImportant) {
return r.makeImportant(true);
return ruleset;
},
matchCondition: function (args, context) {
if (this.condition && !this.condition.eval(new contexts_1.default.Eval(context, [this.evalParams(context, /* the parameter variables */ new contexts_1.default.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]
.concat(this.frames || []) // the parent namespace/mixin frames
.concat(context.frames)))) { // the current environment frames
return false;
}
else {
return r;
return true;
},
matchArgs: function (args, context) {
var allArgsCnt = (args && args.length) || 0;
var len;
var optionalParameters = this.optionalParameters;
var requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) {
if (optionalParameters.indexOf(p.name) < 0) {
return count + 1;
}
else {
return count;
}
}, 0);
if (!this.variadic) {
if (requiredArgsCnt < this.required) {
return false;
}
if (allArgsCnt > this.params.length) {
return false;
}
}
});
var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames);
return result;
};
Definition.prototype.eval = function (context) {
return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames));
};
Definition.prototype.evalCall = function (context, args, important) {
var _arguments = [];
var mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames;
var frame = this.evalParams(context, new contexts_1.default.Eval(context, mixinFrames), args, _arguments);
var rules;
var ruleset;
frame.prependRule(new declaration_1.default('@arguments', new expression_1.default(_arguments).eval(context)));
rules = utils.copyArray(this.rules);
ruleset = new ruleset_1.default(null, rules);
ruleset.originalRuleset = this;
ruleset = ruleset.eval(new contexts_1.default.Eval(context, [this, frame].concat(mixinFrames)));
if (important) {
ruleset = ruleset.makeImportant();
}
return ruleset;
};
Definition.prototype.matchCondition = function (args, context) {
if (this.condition && !this.condition.eval(new contexts_1.default.Eval(context, [this.evalParams(context, /* the parameter variables */ new contexts_1.default.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]
.concat(this.frames || []) // the parent namespace/mixin frames
.concat(context.frames)))) { // the current environment frames
return false;
}
return true;
};
Definition.prototype.matchArgs = function (args, context) {
var allArgsCnt = (args && args.length) || 0;
var len;
var optionalParameters = this.optionalParameters;
var requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) {
if (optionalParameters.indexOf(p.name) < 0) {
return count + 1;
}
else {
return count;
}
}, 0);
if (!this.variadic) {
if (requiredArgsCnt < this.required) {
return false;
}
if (allArgsCnt > this.params.length) {
return false;
}
}
else {
if (requiredArgsCnt < (this.required - 1)) {
return false;
}
}
// check patterns
len = Math.min(requiredArgsCnt, this.arity);
for (var i = 0; i < len; i++) {
if (!this.params[i].name && !this.params[i].variadic) {
if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) {
if (requiredArgsCnt < (this.required - 1)) {
return false;
}
}
// check patterns
len = Math.min(requiredArgsCnt, this.arity);
for (var i = 0; i < len; i++) {
if (!this.params[i].name && !this.params[i].variadic) {
if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) {
return false;
}
}
}
return true;
}
return true;
};
Definition.prototype.type = 'MixinDefinition';
Definition.prototype.evalFirst = true;
});
exports.default = Definition;
//# sourceMappingURL=mixin-definition.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var variable_1 = __importDefault(require("./variable"));
var ruleset_1 = __importDefault(require("./ruleset"));
var selector_1 = __importDefault(require("./selector"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var variable_1 = tslib_1.__importDefault(require("./variable"));
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
var selector_1 = tslib_1.__importDefault(require("./selector"));
var NamespaceValue = function (ruleCall, lookups, index, fileInfo) {

@@ -16,62 +14,60 @@ this.value = ruleCall;

};
NamespaceValue.prototype = new node_1.default();
NamespaceValue.prototype.eval = function (context) {
var i;
var j;
var name;
var rules = this.value.eval(context);
for (i = 0; i < this.lookups.length; i++) {
name = this.lookups[i];
/**
* Eval'd DRs return rulesets.
* Eval'd mixins return rules, so let's make a ruleset if we need it.
* We need to do this because of late parsing of values
*/
if (Array.isArray(rules)) {
rules = new ruleset_1.default([new selector_1.default()], rules);
}
if (name === '') {
rules = rules.lastDeclaration();
}
else if (name.charAt(0) === '@') {
if (name.charAt(1) === '@') {
name = "@" + new variable_1.default(name.substr(1)).eval(context).value;
NamespaceValue.prototype = Object.assign(new node_1.default(), {
type: 'NamespaceValue',
eval: function (context) {
var i, j, name, rules = this.value.eval(context);
for (i = 0; i < this.lookups.length; i++) {
name = this.lookups[i];
/**
* Eval'd DRs return rulesets.
* Eval'd mixins return rules, so let's make a ruleset if we need it.
* We need to do this because of late parsing of values
*/
if (Array.isArray(rules)) {
rules = new ruleset_1.default([new selector_1.default()], rules);
}
if (rules.variables) {
rules = rules.variable(name);
if (name === '') {
rules = rules.lastDeclaration();
}
if (!rules) {
throw { type: 'Name', message: "variable " + name + " not found", filename: this.fileInfo().filename,
index: this.getIndex() };
else if (name.charAt(0) === '@') {
if (name.charAt(1) === '@') {
name = "@" + new variable_1.default(name.substr(1)).eval(context).value;
}
if (rules.variables) {
rules = rules.variable(name);
}
if (!rules) {
throw { type: 'Name', message: "variable " + name + " not found", filename: this.fileInfo().filename,
index: this.getIndex() };
}
}
}
else {
if (name.substring(0, 2) === '$@') {
name = "$" + new variable_1.default(name.substr(1)).eval(context).value;
}
else {
name = name.charAt(0) === '$' ? name : "$" + name;
if (name.substring(0, 2) === '$@') {
name = "$" + new variable_1.default(name.substr(1)).eval(context).value;
}
else {
name = name.charAt(0) === '$' ? name : "$" + name;
}
if (rules.properties) {
rules = rules.property(name);
}
if (!rules) {
throw { type: 'Name', message: "property \"" + name.substr(1) + "\" not found", filename: this.fileInfo().filename,
index: this.getIndex() };
}
// Properties are an array of values, since a ruleset can have multiple props.
// We pick the last one (the "cascaded" value)
rules = rules[rules.length - 1];
}
if (rules.properties) {
rules = rules.property(name);
if (rules.value) {
rules = rules.eval(context).value;
}
if (!rules) {
throw { type: 'Name', message: "property \"" + name.substr(1) + "\" not found", filename: this.fileInfo().filename,
index: this.getIndex() };
if (rules.ruleset) {
rules = rules.ruleset.eval(context);
}
// Properties are an array of values, since a ruleset can have multiple props.
// We pick the last one (the "cascaded" value)
rules = rules[rules.length - 1];
}
if (rules.value) {
rules = rules.eval(context).value;
}
if (rules.ruleset) {
rules = rules.ruleset.eval(context);
}
return rules;
}
return rules;
};
NamespaceValue.prototype.type = 'NamespaceValue';
});
exports.default = NamespaceValue;
//# sourceMappingURL=namespace-value.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var operation_1 = __importDefault(require("./operation"));
var dimension_1 = __importDefault(require("./dimension"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var operation_1 = tslib_1.__importDefault(require("./operation"));
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
var Negative = function (node) {
this.value = node;
};
Negative.prototype = new node_1.default();
Negative.prototype.genCSS = function (context, output) {
output.add('-');
this.value.genCSS(context, output);
};
Negative.prototype.eval = function (context) {
if (context.isMathOn()) {
return (new operation_1.default('*', [new dimension_1.default(-1), this.value])).eval(context);
Negative.prototype = Object.assign(new node_1.default(), {
type: 'Negative',
genCSS: function (context, output) {
output.add('-');
this.value.genCSS(context, output);
},
eval: function (context) {
if (context.isMathOn()) {
return (new operation_1.default('*', [new dimension_1.default(-1), this.value])).eval(context);
}
return new Negative(this.value.eval(context));
}
return new Negative(this.value.eval(context));
};
Negative.prototype.type = 'Negative';
});
exports.default = Negative;
//# sourceMappingURL=negative.js.map

@@ -43,5 +43,3 @@ "use strict";

};
Node.prototype.isRulesetLike = function () {
return false;
};
Node.prototype.isRulesetLike = function () { return false; };
Node.prototype.toCSS = function (context) {

@@ -79,2 +77,40 @@ var strs = [];

};
Node.compare = function (a, b) {
/* returns:
-1: a < b
0: a = b
1: a > b
and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */
if ((a.compare) &&
// for "symmetric results" force toCSS-based comparison
// of Quoted or Anonymous if either value is one of those
!(b.type === 'Quoted' || b.type === 'Anonymous')) {
return a.compare(b);
}
else if (b.compare) {
return -b.compare(a);
}
else if (a.type !== b.type) {
return undefined;
}
a = a.value;
b = b.value;
if (!Array.isArray(a)) {
return a === b ? 0 : undefined;
}
if (a.length !== b.length) {
return undefined;
}
for (var i = 0; i < a.length; i++) {
if (Node.compare(a[i], b[i]) !== 0) {
return undefined;
}
}
return 0;
};
Node.numericCompare = function (a, b) {
return a < b ? -1
: a === b ? 0
: a > b ? 1 : undefined;
};
// Returns true if this node represents root of ast imported by reference

@@ -131,39 +167,3 @@ Node.prototype.blocksVisibility = function () {

}());
Node.compare = function (a, b) {
/* returns:
-1: a < b
0: a = b
1: a > b
and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */
if ((a.compare) &&
// for "symmetric results" force toCSS-based comparison
// of Quoted or Anonymous if either value is one of those
!(b.type === 'Quoted' || b.type === 'Anonymous')) {
return a.compare(b);
}
else if (b.compare) {
return -b.compare(a);
}
else if (a.type !== b.type) {
return undefined;
}
a = a.value;
b = b.value;
if (!Array.isArray(a)) {
return a === b ? 0 : undefined;
}
if (a.length !== b.length) {
return undefined;
}
for (var i = 0; i < a.length; i++) {
if (Node.compare(a[i], b[i]) !== 0) {
return undefined;
}
}
return 0;
};
Node.numericCompare = function (a, b) { return a < b ? -1
: a === b ? 0
: a > b ? 1 : undefined; };
exports.default = Node;
//# sourceMappingURL=node.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var color_1 = __importDefault(require("./color"));
var dimension_1 = __importDefault(require("./dimension"));
var Constants = __importStar(require("../constants"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var color_1 = tslib_1.__importDefault(require("./color"));
var dimension_1 = tslib_1.__importDefault(require("./dimension"));
var Constants = tslib_1.__importStar(require("../constants"));
var MATH = Constants.Math;

@@ -35,44 +14,43 @@ var Operation = function (op, operands, isSpaced) {

};
Operation.prototype = new node_1.default();
Operation.prototype.accept = function (visitor) {
this.operands = visitor.visitArray(this.operands);
};
Operation.prototype.eval = function (context) {
var a = this.operands[0].eval(context);
var b = this.operands[1].eval(context);
var op;
if (context.isMathOn(this.op)) {
op = this.op === './' ? '/' : this.op;
if (a instanceof dimension_1.default && b instanceof color_1.default) {
a = a.toColor();
Operation.prototype = Object.assign(new node_1.default(), {
type: 'Operation',
accept: function (visitor) {
this.operands = visitor.visitArray(this.operands);
},
eval: function (context) {
var a = this.operands[0].eval(context), b = this.operands[1].eval(context), op;
if (context.isMathOn(this.op)) {
op = this.op === './' ? '/' : this.op;
if (a instanceof dimension_1.default && b instanceof color_1.default) {
a = a.toColor();
}
if (b instanceof dimension_1.default && a instanceof color_1.default) {
b = b.toColor();
}
if (!a.operate) {
if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) {
return new Operation(this.op, [a, b], this.isSpaced);
}
throw { type: 'Operation',
message: 'Operation on an invalid type' };
}
return a.operate(context, op, b);
}
if (b instanceof dimension_1.default && a instanceof color_1.default) {
b = b.toColor();
else {
return new Operation(this.op, [a, b], this.isSpaced);
}
if (!a.operate) {
if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) {
return new Operation(this.op, [a, b], this.isSpaced);
}
throw { type: 'Operation',
message: 'Operation on an invalid type' };
},
genCSS: function (context, output) {
this.operands[0].genCSS(context, output);
if (this.isSpaced) {
output.add(' ');
}
return a.operate(context, op, b);
output.add(this.op);
if (this.isSpaced) {
output.add(' ');
}
this.operands[1].genCSS(context, output);
}
else {
return new Operation(this.op, [a, b], this.isSpaced);
}
};
Operation.prototype.genCSS = function (context, output) {
this.operands[0].genCSS(context, output);
if (this.isSpaced) {
output.add(' ');
}
output.add(this.op);
if (this.isSpaced) {
output.add(' ');
}
this.operands[1].genCSS(context, output);
};
Operation.prototype.type = 'Operation';
});
exports.default = Operation;
//# sourceMappingURL=operation.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var Paren = function (node) {
this.value = node;
};
Paren.prototype = new node_1.default();
Paren.prototype.genCSS = function (context, output) {
output.add('(');
this.value.genCSS(context, output);
output.add(')');
};
Paren.prototype.eval = function (context) {
return new Paren(this.value.eval(context));
};
Paren.prototype.type = 'Paren';
Paren.prototype = Object.assign(new node_1.default(), {
type: 'Paren',
genCSS: function (context, output) {
output.add('(');
this.value.genCSS(context, output);
output.add(')');
},
eval: function (context) {
return new Paren(this.value.eval(context));
}
});
exports.default = Paren;
//# sourceMappingURL=paren.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var declaration_1 = __importDefault(require("./declaration"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var declaration_1 = tslib_1.__importDefault(require("./declaration"));
var Property = function (name, index, currentFileInfo) {

@@ -13,51 +11,52 @@ this.name = name;

};
Property.prototype = new node_1.default();
Property.prototype.eval = function (context) {
var property;
var name = this.name;
// TODO: shorten this reference
var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;
if (this.evaluating) {
throw { type: 'Name', message: "Recursive property reference for " + name, filename: this.fileInfo().filename,
index: this.getIndex() };
}
this.evaluating = true;
property = this.find(context.frames, function (frame) {
var v;
var vArr = frame.property(name);
if (vArr) {
for (var i = 0; i < vArr.length; i++) {
v = vArr[i];
vArr[i] = new declaration_1.default(v.name, v.value, v.important, v.merge, v.index, v.currentFileInfo, v.inline, v.variable);
Property.prototype = Object.assign(new node_1.default(), {
type: 'Property',
eval: function (context) {
var property;
var name = this.name;
// TODO: shorten this reference
var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;
if (this.evaluating) {
throw { type: 'Name', message: "Recursive property reference for " + name, filename: this.fileInfo().filename,
index: this.getIndex() };
}
this.evaluating = true;
property = this.find(context.frames, function (frame) {
var v;
var vArr = frame.property(name);
if (vArr) {
for (var i = 0; i < vArr.length; i++) {
v = vArr[i];
vArr[i] = new declaration_1.default(v.name, v.value, v.important, v.merge, v.index, v.currentFileInfo, v.inline, v.variable);
}
mergeRules(vArr);
v = vArr[vArr.length - 1];
if (v.important) {
var importantScope = context.importantScope[context.importantScope.length - 1];
importantScope.important = v.important;
}
v = v.value.eval(context);
return v;
}
mergeRules(vArr);
v = vArr[vArr.length - 1];
if (v.important) {
var importantScope = context.importantScope[context.importantScope.length - 1];
importantScope.important = v.important;
});
if (property) {
this.evaluating = false;
return property;
}
else {
throw { type: 'Name', message: "Property '" + name + "' is undefined", filename: this.currentFileInfo.filename,
index: this.index };
}
},
find: function (obj, fun) {
for (var i = 0, r = void 0; i < obj.length; i++) {
r = fun.call(obj, obj[i]);
if (r) {
return r;
}
v = v.value.eval(context);
return v;
}
});
if (property) {
this.evaluating = false;
return property;
return null;
}
else {
throw { type: 'Name', message: "Property '" + name + "' is undefined", filename: this.currentFileInfo.filename,
index: this.index };
}
};
Property.prototype.find = function (obj, fun) {
for (var i = 0, r = void 0; i < obj.length; i++) {
r = fun.call(obj, obj[i]);
if (r) {
return r;
}
}
return null;
};
Property.prototype.type = 'Property';
});
exports.default = Property;
//# sourceMappingURL=property.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var variable_1 = __importDefault(require("./variable"));
var property_1 = __importDefault(require("./property"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var variable_1 = tslib_1.__importDefault(require("./variable"));
var property_1 = tslib_1.__importDefault(require("./property"));
var Quoted = function (str, content, escaped, index, currentFileInfo) {

@@ -19,49 +17,50 @@ this.escaped = (escaped == null) ? true : escaped;

};
Quoted.prototype = new node_1.default();
Quoted.prototype.genCSS = function (context, output) {
if (!this.escaped) {
output.add(this.quote, this.fileInfo(), this.getIndex());
Quoted.prototype = Object.assign(new node_1.default(), {
type: 'Quoted',
genCSS: function (context, output) {
if (!this.escaped) {
output.add(this.quote, this.fileInfo(), this.getIndex());
}
output.add(this.value);
if (!this.escaped) {
output.add(this.quote);
}
},
containsVariables: function () {
return this.value.match(this.variableRegex);
},
eval: function (context) {
var that = this;
var value = this.value;
var variableReplacement = function (_, name) {
var v = new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context, true);
return (v instanceof Quoted) ? v.value : v.toCSS();
};
var propertyReplacement = function (_, name) {
var v = new property_1.default("$" + name, that.getIndex(), that.fileInfo()).eval(context, true);
return (v instanceof Quoted) ? v.value : v.toCSS();
};
function iterativeReplace(value, regexp, replacementFnc) {
var evaluatedValue = value;
do {
value = evaluatedValue.toString();
evaluatedValue = value.replace(regexp, replacementFnc);
} while (value !== evaluatedValue);
return evaluatedValue;
}
value = iterativeReplace(value, this.variableRegex, variableReplacement);
value = iterativeReplace(value, this.propRegex, propertyReplacement);
return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());
},
compare: function (other) {
// when comparing quoted strings allow the quote to differ
if (other.type === 'Quoted' && !this.escaped && !other.escaped) {
return node_1.default.numericCompare(this.value, other.value);
}
else {
return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
}
}
output.add(this.value);
if (!this.escaped) {
output.add(this.quote);
}
};
Quoted.prototype.containsVariables = function () {
return this.value.match(this.variableRegex);
};
Quoted.prototype.eval = function (context) {
var that = this;
var value = this.value;
var variableReplacement = function (_, name) {
var v = new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context, true);
return (v instanceof Quoted) ? v.value : v.toCSS();
};
var propertyReplacement = function (_, name) {
var v = new property_1.default("$" + name, that.getIndex(), that.fileInfo()).eval(context, true);
return (v instanceof Quoted) ? v.value : v.toCSS();
};
function iterativeReplace(value, regexp, replacementFnc) {
var evaluatedValue = value;
do {
value = evaluatedValue.toString();
evaluatedValue = value.replace(regexp, replacementFnc);
} while (value !== evaluatedValue);
return evaluatedValue;
}
value = iterativeReplace(value, this.variableRegex, variableReplacement);
value = iterativeReplace(value, this.propRegex, propertyReplacement);
return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());
};
Quoted.prototype.compare = function (other) {
// when comparing quoted strings allow the quote to differ
if (other.type === 'Quoted' && !this.escaped && !other.escaped) {
return node_1.default.numericCompare(this.value, other.value);
}
else {
return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
}
};
Quoted.prototype.type = 'Quoted';
});
exports.default = Quoted;
//# sourceMappingURL=quoted.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var declaration_1 = __importDefault(require("./declaration"));
var keyword_1 = __importDefault(require("./keyword"));
var comment_1 = __importDefault(require("./comment"));
var paren_1 = __importDefault(require("./paren"));
var selector_1 = __importDefault(require("./selector"));
var element_1 = __importDefault(require("./element"));
var anonymous_1 = __importDefault(require("./anonymous"));
var contexts_1 = __importDefault(require("../contexts"));
var function_registry_1 = __importDefault(require("../functions/function-registry"));
var default_1 = __importDefault(require("../functions/default"));
var debug_info_1 = __importDefault(require("./debug-info"));
var utils = __importStar(require("../utils"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var declaration_1 = tslib_1.__importDefault(require("./declaration"));
var keyword_1 = tslib_1.__importDefault(require("./keyword"));
var comment_1 = tslib_1.__importDefault(require("./comment"));
var paren_1 = tslib_1.__importDefault(require("./paren"));
var selector_1 = tslib_1.__importDefault(require("./selector"));
var element_1 = tslib_1.__importDefault(require("./element"));
var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
var contexts_1 = tslib_1.__importDefault(require("../contexts"));
var function_registry_1 = tslib_1.__importDefault(require("../functions/function-registry"));
var default_1 = tslib_1.__importDefault(require("../functions/default"));
var debug_info_1 = tslib_1.__importDefault(require("./debug-info"));
var utils = tslib_1.__importStar(require("../utils"));
var Ruleset = function (selectors, rules, strictImports, visibilityInfo) {

@@ -50,738 +29,722 @@ this.selectors = selectors;

};
Ruleset.prototype = new node_1.default();
Ruleset.prototype.isRulesetLike = function () {
return true;
};
Ruleset.prototype.accept = function (visitor) {
if (this.paths) {
this.paths = visitor.visitArray(this.paths, true);
}
else if (this.selectors) {
this.selectors = visitor.visitArray(this.selectors);
}
if (this.rules && this.rules.length) {
this.rules = visitor.visitArray(this.rules);
}
};
Ruleset.prototype.eval = function (context) {
var that = this;
var selectors;
var selCnt;
var selector;
var i;
var hasVariable;
var hasOnePassingSelector = false;
if (this.selectors && (selCnt = this.selectors.length)) {
selectors = new Array(selCnt);
default_1.default.error({
type: 'Syntax',
message: 'it is currently only allowed in parametric mixin guards,'
});
for (i = 0; i < selCnt; i++) {
selector = this.selectors[i].eval(context);
for (var j = 0; j < selector.elements.length; j++) {
if (selector.elements[j].isVariable) {
hasVariable = true;
break;
}
}
selectors[i] = selector;
if (selector.evaldCondition) {
hasOnePassingSelector = true;
}
Ruleset.prototype = Object.assign(new node_1.default(), {
type: 'Ruleset',
isRuleset: true,
isRulesetLike: function () { return true; },
accept: function (visitor) {
if (this.paths) {
this.paths = visitor.visitArray(this.paths, true);
}
if (hasVariable) {
var toParseSelectors = new Array(selCnt);
else if (this.selectors) {
this.selectors = visitor.visitArray(this.selectors);
}
if (this.rules && this.rules.length) {
this.rules = visitor.visitArray(this.rules);
}
},
eval: function (context) {
var that = this;
var selectors;
var selCnt;
var selector;
var i;
var hasVariable;
var hasOnePassingSelector = false;
if (this.selectors && (selCnt = this.selectors.length)) {
selectors = new Array(selCnt);
default_1.default.error({
type: 'Syntax',
message: 'it is currently only allowed in parametric mixin guards,'
});
for (i = 0; i < selCnt; i++) {
selector = selectors[i];
toParseSelectors[i] = selector.toCSS(context);
selector = this.selectors[i].eval(context);
for (var j = 0; j < selector.elements.length; j++) {
if (selector.elements[j].isVariable) {
hasVariable = true;
break;
}
}
selectors[i] = selector;
if (selector.evaldCondition) {
hasOnePassingSelector = true;
}
}
this.parse.parseNode(toParseSelectors.join(','), ["selectors"], selectors[0].getIndex(), selectors[0].fileInfo(), function (err, result) {
if (result) {
selectors = utils.flattenArray(result);
if (hasVariable) {
var toParseSelectors = new Array(selCnt);
for (i = 0; i < selCnt; i++) {
selector = selectors[i];
toParseSelectors[i] = selector.toCSS(context);
}
});
}
default_1.default.reset();
}
else {
hasOnePassingSelector = true;
}
var rules = this.rules ? utils.copyArray(this.rules) : null;
var ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo());
var rule;
var subRule;
ruleset.originalRuleset = this;
ruleset.root = this.root;
ruleset.firstRoot = this.firstRoot;
ruleset.allowImports = this.allowImports;
if (this.debugInfo) {
ruleset.debugInfo = this.debugInfo;
}
if (!hasOnePassingSelector) {
rules.length = 0;
}
// inherit a function registry from the frames stack when possible;
// otherwise from the global registry
ruleset.functionRegistry = (function (frames) {
var i = 0;
var n = frames.length;
var found;
for (; i !== n; ++i) {
found = frames[i].functionRegistry;
if (found) {
return found;
this.parse.parseNode(toParseSelectors.join(','), ["selectors"], selectors[0].getIndex(), selectors[0].fileInfo(), function (err, result) {
if (result) {
selectors = utils.flattenArray(result);
}
});
}
default_1.default.reset();
}
return function_registry_1.default;
})(context.frames).inherit();
// push the current ruleset to the frames stack
var ctxFrames = context.frames;
ctxFrames.unshift(ruleset);
// currrent selectors
var ctxSelectors = context.selectors;
if (!ctxSelectors) {
context.selectors = ctxSelectors = [];
}
ctxSelectors.unshift(this.selectors);
// Evaluate imports
if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) {
ruleset.evalImports(context);
}
// Store the frames around mixin definitions,
// so they can be evaluated like closures when the time comes.
var rsRules = ruleset.rules;
for (i = 0; (rule = rsRules[i]); i++) {
if (rule.evalFirst) {
rsRules[i] = rule.eval(context);
else {
hasOnePassingSelector = true;
}
}
var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0;
// Evaluate mixin calls.
for (i = 0; (rule = rsRules[i]); i++) {
if (rule.type === 'MixinCall') {
/* jshint loopfunc:true */
rules = rule.eval(context).filter(function (r) {
if ((r instanceof declaration_1.default) && r.variable) {
// do not pollute the scope if the variable is
// already there. consider returning false here
// but we need a way to "return" variable from mixins
return !(ruleset.variable(r.name));
}
return true;
});
rsRules.splice.apply(rsRules, [i, 1].concat(rules));
i += rules.length - 1;
ruleset.resetCache();
var rules = this.rules ? utils.copyArray(this.rules) : null;
var ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo());
var rule;
var subRule;
ruleset.originalRuleset = this;
ruleset.root = this.root;
ruleset.firstRoot = this.firstRoot;
ruleset.allowImports = this.allowImports;
if (this.debugInfo) {
ruleset.debugInfo = this.debugInfo;
}
else if (rule.type === 'VariableCall') {
/* jshint loopfunc:true */
rules = rule.eval(context).rules.filter(function (r) {
if ((r instanceof declaration_1.default) && r.variable) {
// do not pollute the scope at all
return false;
}
return true;
});
rsRules.splice.apply(rsRules, [i, 1].concat(rules));
i += rules.length - 1;
ruleset.resetCache();
if (!hasOnePassingSelector) {
rules.length = 0;
}
}
// Evaluate everything else
for (i = 0; (rule = rsRules[i]); i++) {
if (!rule.evalFirst) {
rsRules[i] = rule = rule.eval ? rule.eval(context) : rule;
}
}
// Evaluate everything else
for (i = 0; (rule = rsRules[i]); i++) {
// for rulesets, check if it is a css guard and can be removed
if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) {
// check if it can be folded in (e.g. & where)
if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) {
rsRules.splice(i--, 1);
for (var j = 0; (subRule = rule.rules[j]); j++) {
if (subRule instanceof node_1.default) {
subRule.copyVisibilityInfo(rule.visibilityInfo());
if (!(subRule instanceof declaration_1.default) || !subRule.variable) {
rsRules.splice(++i, 0, subRule);
}
}
// inherit a function registry from the frames stack when possible;
// otherwise from the global registry
ruleset.functionRegistry = (function (frames) {
var i = 0;
var n = frames.length;
var found;
for (; i !== n; ++i) {
found = frames[i].functionRegistry;
if (found) {
return found;
}
}
return function_registry_1.default;
}(context.frames)).inherit();
// push the current ruleset to the frames stack
var ctxFrames = context.frames;
ctxFrames.unshift(ruleset);
// currrent selectors
var ctxSelectors = context.selectors;
if (!ctxSelectors) {
context.selectors = ctxSelectors = [];
}
}
// Pop the stack
ctxFrames.shift();
ctxSelectors.shift();
if (context.mediaBlocks) {
for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) {
context.mediaBlocks[i].bubbleSelectors(selectors);
ctxSelectors.unshift(this.selectors);
// Evaluate imports
if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) {
ruleset.evalImports(context);
}
}
return ruleset;
};
Ruleset.prototype.evalImports = function (context) {
var rules = this.rules;
var i;
var importRules;
if (!rules) {
return;
}
for (i = 0; i < rules.length; i++) {
if (rules[i].type === 'Import') {
importRules = rules[i].eval(context);
if (importRules && (importRules.length || importRules.length === 0)) {
rules.splice.apply(rules, [i, 1].concat(importRules));
i += importRules.length - 1;
// Store the frames around mixin definitions,
// so they can be evaluated like closures when the time comes.
var rsRules = ruleset.rules;
for (i = 0; (rule = rsRules[i]); i++) {
if (rule.evalFirst) {
rsRules[i] = rule.eval(context);
}
else {
rules.splice(i, 1, importRules);
}
var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0;
// Evaluate mixin calls.
for (i = 0; (rule = rsRules[i]); i++) {
if (rule.type === 'MixinCall') {
/* jshint loopfunc:true */
rules = rule.eval(context).filter(function (r) {
if ((r instanceof declaration_1.default) && r.variable) {
// do not pollute the scope if the variable is
// already there. consider returning false here
// but we need a way to "return" variable from mixins
return !(ruleset.variable(r.name));
}
return true;
});
rsRules.splice.apply(rsRules, [i, 1].concat(rules));
i += rules.length - 1;
ruleset.resetCache();
}
this.resetCache();
else if (rule.type === 'VariableCall') {
/* jshint loopfunc:true */
rules = rule.eval(context).rules.filter(function (r) {
if ((r instanceof declaration_1.default) && r.variable) {
// do not pollute the scope at all
return false;
}
return true;
});
rsRules.splice.apply(rsRules, [i, 1].concat(rules));
i += rules.length - 1;
ruleset.resetCache();
}
}
}
};
Ruleset.prototype.makeImportant = function () {
var result = new Ruleset(this.selectors, this.rules.map(function (r) {
if (r.makeImportant) {
return r.makeImportant();
// Evaluate everything else
for (i = 0; (rule = rsRules[i]); i++) {
if (!rule.evalFirst) {
rsRules[i] = rule = rule.eval ? rule.eval(context) : rule;
}
}
else {
return r;
}
}), this.strictImports, this.visibilityInfo());
return result;
};
Ruleset.prototype.matchArgs = function (args) {
return !args || args.length === 0;
};
// lets you call a css selector with a guard
Ruleset.prototype.matchCondition = function (args, context) {
var lastSelector = this.selectors[this.selectors.length - 1];
if (!lastSelector.evaldCondition) {
return false;
}
if (lastSelector.condition &&
!lastSelector.condition.eval(new contexts_1.default.Eval(context, context.frames))) {
return false;
}
return true;
};
Ruleset.prototype.resetCache = function () {
this._rulesets = null;
this._variables = null;
this._properties = null;
this._lookups = {};
};
Ruleset.prototype.variables = function () {
if (!this._variables) {
this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) {
if (r instanceof declaration_1.default && r.variable === true) {
hash[r.name] = r;
}
// when evaluating variables in an import statement, imports have not been eval'd
// so we need to go inside import statements.
// guard against root being a string (in the case of inlined less)
if (r.type === 'Import' && r.root && r.root.variables) {
var vars = r.root.variables();
for (var name_1 in vars) {
if (vars.hasOwnProperty(name_1)) {
hash[name_1] = r.root.variable(name_1);
// Evaluate everything else
for (i = 0; (rule = rsRules[i]); i++) {
// for rulesets, check if it is a css guard and can be removed
if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) {
// check if it can be folded in (e.g. & where)
if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) {
rsRules.splice(i--, 1);
for (var j = 0; (subRule = rule.rules[j]); j++) {
if (subRule instanceof node_1.default) {
subRule.copyVisibilityInfo(rule.visibilityInfo());
if (!(subRule instanceof declaration_1.default) || !subRule.variable) {
rsRules.splice(++i, 0, subRule);
}
}
}
}
}
return hash;
}, {});
}
return this._variables;
};
Ruleset.prototype.properties = function () {
if (!this._properties) {
this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) {
if (r instanceof declaration_1.default && r.variable !== true) {
var name_2 = (r.name.length === 1) && (r.name[0] instanceof keyword_1.default) ?
r.name[0].value : r.name;
// Properties don't overwrite as they can merge
if (!hash["$" + name_2]) {
hash["$" + name_2] = [r];
}
// Pop the stack
ctxFrames.shift();
ctxSelectors.shift();
if (context.mediaBlocks) {
for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) {
context.mediaBlocks[i].bubbleSelectors(selectors);
}
}
return ruleset;
},
evalImports: function (context) {
var rules = this.rules;
var i;
var importRules;
if (!rules) {
return;
}
for (i = 0; i < rules.length; i++) {
if (rules[i].type === 'Import') {
importRules = rules[i].eval(context);
if (importRules && (importRules.length || importRules.length === 0)) {
rules.splice.apply(rules, [i, 1].concat(importRules));
i += importRules.length - 1;
}
else {
hash["$" + name_2].push(r);
rules.splice(i, 1, importRules);
}
this.resetCache();
}
return hash;
}, {});
}
return this._properties;
};
Ruleset.prototype.variable = function (name) {
var decl = this.variables()[name];
if (decl) {
return this.parseValue(decl);
}
};
Ruleset.prototype.property = function (name) {
var decl = this.properties()[name];
if (decl) {
return this.parseValue(decl);
}
};
Ruleset.prototype.lastDeclaration = function () {
for (var i = this.rules.length; i > 0; i--) {
var decl = this.rules[i - 1];
if (decl instanceof declaration_1.default) {
return this.parseValue(decl);
}
}
};
Ruleset.prototype.parseValue = function (toParse) {
var self = this;
function transformDeclaration(decl) {
if (decl.value instanceof anonymous_1.default && !decl.parsed) {
if (typeof decl.value.value === 'string') {
this.parse.parseNode(decl.value.value, ['value', 'important'], decl.value.getIndex(), decl.fileInfo(), function (err, result) {
if (err) {
decl.parsed = true;
}
if (result) {
decl.value = result[0];
decl.important = result[1] || '';
decl.parsed = true;
}
});
},
makeImportant: function () {
var result = new Ruleset(this.selectors, this.rules.map(function (r) {
if (r.makeImportant) {
return r.makeImportant();
}
else {
decl.parsed = true;
return r;
}
return decl;
}), this.strictImports, this.visibilityInfo());
return result;
},
matchArgs: function (args) {
return !args || args.length === 0;
},
// lets you call a css selector with a guard
matchCondition: function (args, context) {
var lastSelector = this.selectors[this.selectors.length - 1];
if (!lastSelector.evaldCondition) {
return false;
}
else {
return decl;
if (lastSelector.condition &&
!lastSelector.condition.eval(new contexts_1.default.Eval(context, context.frames))) {
return false;
}
}
if (!Array.isArray(toParse)) {
return transformDeclaration.call(self, toParse);
}
else {
var nodes_1 = [];
toParse.forEach(function (n) {
nodes_1.push(transformDeclaration.call(self, n));
});
return nodes_1;
}
};
Ruleset.prototype.rulesets = function () {
if (!this.rules) {
return [];
}
var filtRules = [];
var rules = this.rules;
var i;
var rule;
for (i = 0; (rule = rules[i]); i++) {
if (rule.isRuleset) {
filtRules.push(rule);
}
}
return filtRules;
};
Ruleset.prototype.prependRule = function (rule) {
var rules = this.rules;
if (rules) {
rules.unshift(rule);
}
else {
this.rules = [rule];
}
this.setParent(rule, this);
};
Ruleset.prototype.find = function (selector, self, filter) {
if (self === void 0) { self = this; }
var rules = [];
var match;
var foundMixins;
var key = selector.toCSS();
if (key in this._lookups) {
return this._lookups[key];
}
this.rulesets().forEach(function (rule) {
if (rule !== self) {
for (var j = 0; j < rule.selectors.length; j++) {
match = selector.match(rule.selectors[j]);
if (match) {
if (selector.elements.length > match) {
if (!filter || filter(rule)) {
foundMixins = rule.find(new selector_1.default(selector.elements.slice(match)), self, filter);
for (var i = 0; i < foundMixins.length; ++i) {
foundMixins[i].path.push(rule);
}
Array.prototype.push.apply(rules, foundMixins);
return true;
},
resetCache: function () {
this._rulesets = null;
this._variables = null;
this._properties = null;
this._lookups = {};
},
variables: function () {
if (!this._variables) {
this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) {
if (r instanceof declaration_1.default && r.variable === true) {
hash[r.name] = r;
}
// when evaluating variables in an import statement, imports have not been eval'd
// so we need to go inside import statements.
// guard against root being a string (in the case of inlined less)
if (r.type === 'Import' && r.root && r.root.variables) {
var vars = r.root.variables();
for (var name_1 in vars) {
if (vars.hasOwnProperty(name_1)) {
hash[name_1] = r.root.variable(name_1);
}
}
}
return hash;
}, {});
}
return this._variables;
},
properties: function () {
if (!this._properties) {
this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) {
if (r instanceof declaration_1.default && r.variable !== true) {
var name_2 = (r.name.length === 1) && (r.name[0] instanceof keyword_1.default) ?
r.name[0].value : r.name;
// Properties don't overwrite as they can merge
if (!hash["$" + name_2]) {
hash["$" + name_2] = [r];
}
else {
rules.push({ rule: rule, path: [] });
hash["$" + name_2].push(r);
}
break;
}
}
return hash;
}, {});
}
});
this._lookups[key] = rules;
return rules;
};
Ruleset.prototype.genCSS = function (context, output) {
var i;
var j;
var charsetRuleNodes = [];
var ruleNodes = [];
var // Line number debugging
debugInfo;
var rule;
var path;
context.tabLevel = (context.tabLevel || 0);
if (!this.root) {
context.tabLevel++;
}
var tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' ');
var tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' ');
var sep;
var charsetNodeIndex = 0;
var importNodeIndex = 0;
for (i = 0; (rule = this.rules[i]); i++) {
if (rule instanceof comment_1.default) {
if (importNodeIndex === i) {
importNodeIndex++;
}
ruleNodes.push(rule);
return this._properties;
},
variable: function (name) {
var decl = this.variables()[name];
if (decl) {
return this.parseValue(decl);
}
else if (rule.isCharset && rule.isCharset()) {
ruleNodes.splice(charsetNodeIndex, 0, rule);
charsetNodeIndex++;
importNodeIndex++;
},
property: function (name) {
var decl = this.properties()[name];
if (decl) {
return this.parseValue(decl);
}
else if (rule.type === 'Import') {
ruleNodes.splice(importNodeIndex, 0, rule);
importNodeIndex++;
},
lastDeclaration: function () {
for (var i = this.rules.length; i > 0; i--) {
var decl = this.rules[i - 1];
if (decl instanceof declaration_1.default) {
return this.parseValue(decl);
}
}
else {
ruleNodes.push(rule);
}
}
ruleNodes = charsetRuleNodes.concat(ruleNodes);
// If this is the root node, we don't render
// a selector, or {}.
if (!this.root) {
debugInfo = debug_info_1.default(context, this, tabSetStr);
if (debugInfo) {
output.add(debugInfo);
output.add(tabSetStr);
}
var paths = this.paths;
var pathCnt = paths.length;
var pathSubCnt = void 0;
sep = context.compress ? ',' : (",\n" + tabSetStr);
for (i = 0; i < pathCnt; i++) {
path = paths[i];
if (!(pathSubCnt = path.length)) {
continue;
},
parseValue: function (toParse) {
var self = this;
function transformDeclaration(decl) {
if (decl.value instanceof anonymous_1.default && !decl.parsed) {
if (typeof decl.value.value === 'string') {
this.parse.parseNode(decl.value.value, ['value', 'important'], decl.value.getIndex(), decl.fileInfo(), function (err, result) {
if (err) {
decl.parsed = true;
}
if (result) {
decl.value = result[0];
decl.important = result[1] || '';
decl.parsed = true;
}
});
}
else {
decl.parsed = true;
}
return decl;
}
if (i > 0) {
output.add(sep);
else {
return decl;
}
context.firstSelector = true;
path[0].genCSS(context, output);
context.firstSelector = false;
for (j = 1; j < pathSubCnt; j++) {
path[j].genCSS(context, output);
}
}
output.add((context.compress ? '{' : ' {\n') + tabRuleStr);
}
// Compile rules and rulesets
for (i = 0; (rule = ruleNodes[i]); i++) {
if (i + 1 === ruleNodes.length) {
context.lastRule = true;
if (!Array.isArray(toParse)) {
return transformDeclaration.call(self, toParse);
}
var currentLastRule = context.lastRule;
if (rule.isRulesetLike(rule)) {
context.lastRule = false;
else {
var nodes_1 = [];
toParse.forEach(function (n) {
nodes_1.push(transformDeclaration.call(self, n));
});
return nodes_1;
}
if (rule.genCSS) {
rule.genCSS(context, output);
},
rulesets: function () {
if (!this.rules) {
return [];
}
else if (rule.value) {
output.add(rule.value.toString());
var filtRules = [];
var rules = this.rules;
var i;
var rule;
for (i = 0; (rule = rules[i]); i++) {
if (rule.isRuleset) {
filtRules.push(rule);
}
}
context.lastRule = currentLastRule;
if (!context.lastRule && rule.isVisible()) {
output.add(context.compress ? '' : ("\n" + tabRuleStr));
return filtRules;
},
prependRule: function (rule) {
var rules = this.rules;
if (rules) {
rules.unshift(rule);
}
else {
context.lastRule = false;
this.rules = [rule];
}
}
if (!this.root) {
output.add((context.compress ? '}' : "\n" + tabSetStr + "}"));
context.tabLevel--;
}
if (!output.isEmpty() && !context.compress && this.firstRoot) {
output.add('\n');
}
};
Ruleset.prototype.joinSelectors = function (paths, context, selectors) {
for (var s = 0; s < selectors.length; s++) {
this.joinSelector(paths, context, selectors[s]);
}
};
Ruleset.prototype.joinSelector = function (paths, context, selector) {
function createParenthesis(elementsToPak, originalElement) {
var replacementParen;
this.setParent(rule, this);
},
find: function (selector, self, filter) {
self = self || this;
var rules = [];
var match;
var foundMixins;
var key = selector.toCSS();
if (key in this._lookups) {
return this._lookups[key];
}
this.rulesets().forEach(function (rule) {
if (rule !== self) {
for (var j = 0; j < rule.selectors.length; j++) {
match = selector.match(rule.selectors[j]);
if (match) {
if (selector.elements.length > match) {
if (!filter || filter(rule)) {
foundMixins = rule.find(new selector_1.default(selector.elements.slice(match)), self, filter);
for (var i = 0; i < foundMixins.length; ++i) {
foundMixins[i].path.push(rule);
}
Array.prototype.push.apply(rules, foundMixins);
}
}
else {
rules.push({ rule: rule, path: [] });
}
break;
}
}
}
});
this._lookups[key] = rules;
return rules;
},
genCSS: function (context, output) {
var i;
var j;
if (elementsToPak.length === 0) {
replacementParen = new paren_1.default(elementsToPak[0]);
var charsetRuleNodes = [];
var ruleNodes = [];
var // Line number debugging
debugInfo;
var rule;
var path;
context.tabLevel = (context.tabLevel || 0);
if (!this.root) {
context.tabLevel++;
}
else {
var insideParent = new Array(elementsToPak.length);
for (j = 0; j < elementsToPak.length; j++) {
insideParent[j] = new element_1.default(null, elementsToPak[j], originalElement.isVariable, originalElement._index, originalElement._fileInfo);
var tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' ');
var tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' ');
var sep;
var charsetNodeIndex = 0;
var importNodeIndex = 0;
for (i = 0; (rule = this.rules[i]); i++) {
if (rule instanceof comment_1.default) {
if (importNodeIndex === i) {
importNodeIndex++;
}
ruleNodes.push(rule);
}
replacementParen = new paren_1.default(new selector_1.default(insideParent));
else if (rule.isCharset && rule.isCharset()) {
ruleNodes.splice(charsetNodeIndex, 0, rule);
charsetNodeIndex++;
importNodeIndex++;
}
else if (rule.type === 'Import') {
ruleNodes.splice(importNodeIndex, 0, rule);
importNodeIndex++;
}
else {
ruleNodes.push(rule);
}
}
return replacementParen;
}
function createSelector(containedElement, originalElement) {
var element;
var selector;
element = new element_1.default(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo);
selector = new selector_1.default([element]);
return selector;
}
// joins selector path from `beginningPath` with selector path in `addPath`
// `replacedElement` contains element that is being replaced by `addPath`
// returns concatenated path
function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {
var newSelectorPath;
var lastSelector;
var newJoinedSelector;
// our new selector path
newSelectorPath = [];
// construct the joined selector - if & is the first thing this will be empty,
// if not newJoinedSelector will be the last set of elements in the selector
if (beginningPath.length > 0) {
newSelectorPath = utils.copyArray(beginningPath);
lastSelector = newSelectorPath.pop();
newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements));
ruleNodes = charsetRuleNodes.concat(ruleNodes);
// If this is the root node, we don't render
// a selector, or {}.
if (!this.root) {
debugInfo = debug_info_1.default(context, this, tabSetStr);
if (debugInfo) {
output.add(debugInfo);
output.add(tabSetStr);
}
var paths = this.paths;
var pathCnt = paths.length;
var pathSubCnt = void 0;
sep = context.compress ? ',' : (",\n" + tabSetStr);
for (i = 0; i < pathCnt; i++) {
path = paths[i];
if (!(pathSubCnt = path.length)) {
continue;
}
if (i > 0) {
output.add(sep);
}
context.firstSelector = true;
path[0].genCSS(context, output);
context.firstSelector = false;
for (j = 1; j < pathSubCnt; j++) {
path[j].genCSS(context, output);
}
}
output.add((context.compress ? '{' : ' {\n') + tabRuleStr);
}
else {
newJoinedSelector = originalSelector.createDerived([]);
}
if (addPath.length > 0) {
// /deep/ is a CSS4 selector - (removed, so should deprecate)
// that is valid without anything in front of it
// so if the & does not have a combinator that is "" or " " then
// and there is a combinator on the parent, then grab that.
// this also allows + a { & .b { .a & { ... though not sure why you would want to do that
var combinator = replacedElement.combinator;
var parentEl = addPath[0].elements[0];
if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {
combinator = parentEl.combinator;
// Compile rules and rulesets
for (i = 0; (rule = ruleNodes[i]); i++) {
if (i + 1 === ruleNodes.length) {
context.lastRule = true;
}
// join the elements so far with the first part of the parent
newJoinedSelector.elements.push(new element_1.default(combinator, parentEl.value, replacedElement.isVariable, replacedElement._index, replacedElement._fileInfo));
newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));
var currentLastRule = context.lastRule;
if (rule.isRulesetLike(rule)) {
context.lastRule = false;
}
if (rule.genCSS) {
rule.genCSS(context, output);
}
else if (rule.value) {
output.add(rule.value.toString());
}
context.lastRule = currentLastRule;
if (!context.lastRule && rule.isVisible()) {
output.add(context.compress ? '' : ("\n" + tabRuleStr));
}
else {
context.lastRule = false;
}
}
// now add the joined selector - but only if it is not empty
if (newJoinedSelector.elements.length !== 0) {
newSelectorPath.push(newJoinedSelector);
if (!this.root) {
output.add((context.compress ? '}' : "\n" + tabSetStr + "}"));
context.tabLevel--;
}
// put together the parent selectors after the join (e.g. the rest of the parent)
if (addPath.length > 1) {
var restOfPath = addPath.slice(1);
restOfPath = restOfPath.map(function (selector) { return selector.createDerived(selector.elements, []); });
newSelectorPath = newSelectorPath.concat(restOfPath);
if (!output.isEmpty() && !context.compress && this.firstRoot) {
output.add('\n');
}
return newSelectorPath;
}
// joins selector path from `beginningPath` with every selector path in `addPaths` array
// `replacedElement` contains element that is being replaced by `addPath`
// returns array with all concatenated paths
function addAllReplacementsIntoPath(beginningPath, addPaths, replacedElement, originalSelector, result) {
var j;
for (j = 0; j < beginningPath.length; j++) {
var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);
result.push(newSelectorPath);
},
joinSelectors: function (paths, context, selectors) {
for (var s = 0; s < selectors.length; s++) {
this.joinSelector(paths, context, selectors[s]);
}
return result;
}
function mergeElementsOnToSelectors(elements, selectors) {
var i;
var sel;
if (elements.length === 0) {
return;
},
joinSelector: function (paths, context, selector) {
function createParenthesis(elementsToPak, originalElement) {
var replacementParen, j;
if (elementsToPak.length === 0) {
replacementParen = new paren_1.default(elementsToPak[0]);
}
else {
var insideParent = new Array(elementsToPak.length);
for (j = 0; j < elementsToPak.length; j++) {
insideParent[j] = new element_1.default(null, elementsToPak[j], originalElement.isVariable, originalElement._index, originalElement._fileInfo);
}
replacementParen = new paren_1.default(new selector_1.default(insideParent));
}
return replacementParen;
}
if (selectors.length === 0) {
selectors.push([new selector_1.default(elements)]);
return;
function createSelector(containedElement, originalElement) {
var element, selector;
element = new element_1.default(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo);
selector = new selector_1.default([element]);
return selector;
}
for (i = 0; (sel = selectors[i]); i++) {
// if the previous thing in sel is a parent this needs to join on to it
if (sel.length > 0) {
sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));
// joins selector path from `beginningPath` with selector path in `addPath`
// `replacedElement` contains element that is being replaced by `addPath`
// returns concatenated path
function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {
var newSelectorPath, lastSelector, newJoinedSelector;
// our new selector path
newSelectorPath = [];
// construct the joined selector - if & is the first thing this will be empty,
// if not newJoinedSelector will be the last set of elements in the selector
if (beginningPath.length > 0) {
newSelectorPath = utils.copyArray(beginningPath);
lastSelector = newSelectorPath.pop();
newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements));
}
else {
sel.push(new selector_1.default(elements));
newJoinedSelector = originalSelector.createDerived([]);
}
if (addPath.length > 0) {
// /deep/ is a CSS4 selector - (removed, so should deprecate)
// that is valid without anything in front of it
// so if the & does not have a combinator that is "" or " " then
// and there is a combinator on the parent, then grab that.
// this also allows + a { & .b { .a & { ... though not sure why you would want to do that
var combinator = replacedElement.combinator;
var parentEl = addPath[0].elements[0];
if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {
combinator = parentEl.combinator;
}
// join the elements so far with the first part of the parent
newJoinedSelector.elements.push(new element_1.default(combinator, parentEl.value, replacedElement.isVariable, replacedElement._index, replacedElement._fileInfo));
newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));
}
// now add the joined selector - but only if it is not empty
if (newJoinedSelector.elements.length !== 0) {
newSelectorPath.push(newJoinedSelector);
}
// put together the parent selectors after the join (e.g. the rest of the parent)
if (addPath.length > 1) {
var restOfPath = addPath.slice(1);
restOfPath = restOfPath.map(function (selector) {
return selector.createDerived(selector.elements, []);
});
newSelectorPath = newSelectorPath.concat(restOfPath);
}
return newSelectorPath;
}
}
// replace all parent selectors inside `inSelector` by content of `context` array
// resulting selectors are returned inside `paths` array
// returns true if `inSelector` contained at least one parent selector
function replaceParentSelector(paths, context, inSelector) {
// The paths are [[Selector]]
// The first list is a list of comma separated selectors
// The inner list is a list of inheritance separated selectors
// e.g.
// .a, .b {
// .c {
// }
// }
// == [[.a] [.c]] [[.b] [.c]]
//
var i;
var j;
var k;
var currentElements;
var newSelectors;
var selectorsMultiplied;
var sel;
var el;
var hadParentSelector = false;
var length;
var lastSelector;
function findNestedSelector(element) {
var maybeSelector;
if (!(element.value instanceof paren_1.default)) {
return null;
// joins selector path from `beginningPath` with every selector path in `addPaths` array
// `replacedElement` contains element that is being replaced by `addPath`
// returns array with all concatenated paths
function addAllReplacementsIntoPath(beginningPath, addPaths, replacedElement, originalSelector, result) {
var j;
for (j = 0; j < beginningPath.length; j++) {
var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);
result.push(newSelectorPath);
}
maybeSelector = element.value.value;
if (!(maybeSelector instanceof selector_1.default)) {
return null;
return result;
}
function mergeElementsOnToSelectors(elements, selectors) {
var i, sel;
if (elements.length === 0) {
return;
}
return maybeSelector;
}
// the elements from the current selector so far
currentElements = [];
// the current list of new selectors to add to the path.
// We will build it up. We initiate it with one empty selector as we "multiply" the new selectors
// by the parents
newSelectors = [
[]
];
for (i = 0; (el = inSelector.elements[i]); i++) {
// non parent reference elements just get added
if (el.value !== '&') {
var nestedSelector = findNestedSelector(el);
if (nestedSelector != null) {
// merge the current list of non parent selector elements
// on to the current list of selectors to add
mergeElementsOnToSelectors(currentElements, newSelectors);
var nestedPaths = [];
var replaced = void 0;
var replacedNewSelectors = [];
replaced = replaceParentSelector(nestedPaths, context, nestedSelector);
hadParentSelector = hadParentSelector || replaced;
// the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors
for (k = 0; k < nestedPaths.length; k++) {
var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el);
addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors);
}
newSelectors = replacedNewSelectors;
currentElements = [];
if (selectors.length === 0) {
selectors.push([new selector_1.default(elements)]);
return;
}
for (i = 0; (sel = selectors[i]); i++) {
// if the previous thing in sel is a parent this needs to join on to it
if (sel.length > 0) {
sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));
}
else {
currentElements.push(el);
sel.push(new selector_1.default(elements));
}
}
else {
hadParentSelector = true;
// the new list of selectors to add
selectorsMultiplied = [];
// merge the current list of non parent selector elements
// on to the current list of selectors to add
mergeElementsOnToSelectors(currentElements, newSelectors);
// loop through our current selectors
for (j = 0; j < newSelectors.length; j++) {
sel = newSelectors[j];
// if we don't have any parent paths, the & might be in a mixin so that it can be used
// whether there are parents or not
if (context.length === 0) {
// the combinator used on el should now be applied to the next element instead so that
// it is not lost
if (sel.length > 0) {
sel[0].elements.push(new element_1.default(el.combinator, '', el.isVariable, el._index, el._fileInfo));
}
// replace all parent selectors inside `inSelector` by content of `context` array
// resulting selectors are returned inside `paths` array
// returns true if `inSelector` contained at least one parent selector
function replaceParentSelector(paths, context, inSelector) {
// The paths are [[Selector]]
// The first list is a list of comma separated selectors
// The inner list is a list of inheritance separated selectors
// e.g.
// .a, .b {
// .c {
// }
// }
// == [[.a] [.c]] [[.b] [.c]]
//
var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector;
function findNestedSelector(element) {
var maybeSelector;
if (!(element.value instanceof paren_1.default)) {
return null;
}
maybeSelector = element.value.value;
if (!(maybeSelector instanceof selector_1.default)) {
return null;
}
return maybeSelector;
}
// the elements from the current selector so far
currentElements = [];
// the current list of new selectors to add to the path.
// We will build it up. We initiate it with one empty selector as we "multiply" the new selectors
// by the parents
newSelectors = [
[]
];
for (i = 0; (el = inSelector.elements[i]); i++) {
// non parent reference elements just get added
if (el.value !== '&') {
var nestedSelector = findNestedSelector(el);
if (nestedSelector != null) {
// merge the current list of non parent selector elements
// on to the current list of selectors to add
mergeElementsOnToSelectors(currentElements, newSelectors);
var nestedPaths = [];
var replaced = void 0;
var replacedNewSelectors = [];
replaced = replaceParentSelector(nestedPaths, context, nestedSelector);
hadParentSelector = hadParentSelector || replaced;
// the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors
for (k = 0; k < nestedPaths.length; k++) {
var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el);
addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors);
}
selectorsMultiplied.push(sel);
newSelectors = replacedNewSelectors;
currentElements = [];
}
else {
// and the parent selectors
for (k = 0; k < context.length; k++) {
// We need to put the current selectors
// then join the last selector's elements on to the parents selectors
var newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector);
// add that to our new set of selectors
selectorsMultiplied.push(newSelectorPath);
currentElements.push(el);
}
}
else {
hadParentSelector = true;
// the new list of selectors to add
selectorsMultiplied = [];
// merge the current list of non parent selector elements
// on to the current list of selectors to add
mergeElementsOnToSelectors(currentElements, newSelectors);
// loop through our current selectors
for (j = 0; j < newSelectors.length; j++) {
sel = newSelectors[j];
// if we don't have any parent paths, the & might be in a mixin so that it can be used
// whether there are parents or not
if (context.length === 0) {
// the combinator used on el should now be applied to the next element instead so that
// it is not lost
if (sel.length > 0) {
sel[0].elements.push(new element_1.default(el.combinator, '', el.isVariable, el._index, el._fileInfo));
}
selectorsMultiplied.push(sel);
}
else {
// and the parent selectors
for (k = 0; k < context.length; k++) {
// We need to put the current selectors
// then join the last selector's elements on to the parents selectors
var newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector);
// add that to our new set of selectors
selectorsMultiplied.push(newSelectorPath);
}
}
}
// our new selectors has been multiplied, so reset the state
newSelectors = selectorsMultiplied;
currentElements = [];
}
// our new selectors has been multiplied, so reset the state
newSelectors = selectorsMultiplied;
currentElements = [];
}
}
// if we have any elements left over (e.g. .a& .b == .b)
// add them on to all the current selectors
mergeElementsOnToSelectors(currentElements, newSelectors);
for (i = 0; i < newSelectors.length; i++) {
length = newSelectors[i].length;
if (length > 0) {
paths.push(newSelectors[i]);
lastSelector = newSelectors[i][length - 1];
newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList);
// if we have any elements left over (e.g. .a& .b == .b)
// add them on to all the current selectors
mergeElementsOnToSelectors(currentElements, newSelectors);
for (i = 0; i < newSelectors.length; i++) {
length = newSelectors[i].length;
if (length > 0) {
paths.push(newSelectors[i]);
lastSelector = newSelectors[i][length - 1];
newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList);
}
}
return hadParentSelector;
}
return hadParentSelector;
}
function deriveSelector(visibilityInfo, deriveFrom) {
var newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition);
newSelector.copyVisibilityInfo(visibilityInfo);
return newSelector;
}
// joinSelector code follows
var i;
var newPaths;
var hadParentSelector;
newPaths = [];
hadParentSelector = replaceParentSelector(newPaths, context, selector);
if (!hadParentSelector) {
if (context.length > 0) {
newPaths = [];
for (i = 0; i < context.length; i++) {
var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo()));
concatenated.push(selector);
newPaths.push(concatenated);
function deriveSelector(visibilityInfo, deriveFrom) {
var newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition);
newSelector.copyVisibilityInfo(visibilityInfo);
return newSelector;
}
// joinSelector code follows
var i, newPaths, hadParentSelector;
newPaths = [];
hadParentSelector = replaceParentSelector(newPaths, context, selector);
if (!hadParentSelector) {
if (context.length > 0) {
newPaths = [];
for (i = 0; i < context.length; i++) {
var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo()));
concatenated.push(selector);
newPaths.push(concatenated);
}
}
else {
newPaths = [[selector]];
}
}
else {
newPaths = [[selector]];
for (i = 0; i < newPaths.length; i++) {
paths.push(newPaths[i]);
}
}
for (i = 0; i < newPaths.length; i++) {
paths.push(newPaths[i]);
}
};
Ruleset.prototype.type = 'Ruleset';
Ruleset.prototype.isRuleset = true;
});
exports.default = Ruleset;
//# sourceMappingURL=ruleset.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var element_1 = __importDefault(require("./element"));
var less_error_1 = __importDefault(require("../less-error"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var element_1 = tslib_1.__importDefault(require("./element"));
var less_error_1 = tslib_1.__importDefault(require("../less-error"));
var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) {

@@ -20,108 +18,109 @@ this.extendList = extendList;

};
Selector.prototype = new node_1.default();
Selector.prototype.accept = function (visitor) {
if (this.elements) {
this.elements = visitor.visitArray(this.elements);
}
if (this.extendList) {
this.extendList = visitor.visitArray(this.extendList);
}
if (this.condition) {
this.condition = visitor.visit(this.condition);
}
};
Selector.prototype.createDerived = function (elements, extendList, evaldCondition) {
elements = this.getElements(elements);
var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), this.visibilityInfo());
newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
newSelector.mediaEmpty = this.mediaEmpty;
return newSelector;
};
Selector.prototype.getElements = function (els) {
if (!els) {
return [new element_1.default('', '&', false, this._index, this._fileInfo)];
}
if (typeof els === 'string') {
this.parse.parseNode(els, ['selector'], this._index, this._fileInfo, function (err, result) {
if (err) {
throw new less_error_1.default({
index: err.index,
message: err.message
}, this.parse.imports, this._fileInfo.filename);
Selector.prototype = Object.assign(new node_1.default(), {
type: 'Selector',
accept: function (visitor) {
if (this.elements) {
this.elements = visitor.visitArray(this.elements);
}
if (this.extendList) {
this.extendList = visitor.visitArray(this.extendList);
}
if (this.condition) {
this.condition = visitor.visit(this.condition);
}
},
createDerived: function (elements, extendList, evaldCondition) {
elements = this.getElements(elements);
var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), this.visibilityInfo());
newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
newSelector.mediaEmpty = this.mediaEmpty;
return newSelector;
},
getElements: function (els) {
if (!els) {
return [new element_1.default('', '&', false, this._index, this._fileInfo)];
}
if (typeof els === 'string') {
this.parse.parseNode(els, ['selector'], this._index, this._fileInfo, function (err, result) {
if (err) {
throw new less_error_1.default({
index: err.index,
message: err.message
}, this.parse.imports, this._fileInfo.filename);
}
els = result[0].elements;
});
}
return els;
},
createEmptySelectors: function () {
var el = new element_1.default('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)];
sels[0].mediaEmpty = true;
return sels;
},
match: function (other) {
var elements = this.elements;
var len = elements.length;
var olen;
var i;
other = other.mixinElements();
olen = other.length;
if (olen === 0 || len < olen) {
return 0;
}
else {
for (i = 0; i < olen; i++) {
if (elements[i].value !== other[i]) {
return 0;
}
}
els = result[0].elements;
});
}
return els;
};
Selector.prototype.createEmptySelectors = function () {
var el = new element_1.default('', '&', false, this._index, this._fileInfo);
var sels = [new Selector([el], null, null, this._index, this._fileInfo)];
sels[0].mediaEmpty = true;
return sels;
};
Selector.prototype.match = function (other) {
var elements = this.elements;
var len = elements.length;
var olen;
var i;
other = other.mixinElements();
olen = other.length;
if (olen === 0 || len < olen) {
return 0;
}
else {
for (i = 0; i < olen; i++) {
if (elements[i].value !== other[i]) {
return 0;
}
return olen; // return number of matched elements
},
mixinElements: function () {
if (this.mixinElements_) {
return this.mixinElements_;
}
var elements = this.elements.map(function (v) {
return v.combinator.value + (v.value.value || v.value);
}).join('').match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);
if (elements) {
if (elements[0] === '&') {
elements.shift();
}
}
}
return olen; // return number of matched elements
};
Selector.prototype.mixinElements = function () {
if (this.mixinElements_) {
return this.mixinElements_;
}
var elements = this.elements.map(function (v) { return v.combinator.value + (v.value.value || v.value); }).join('').match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);
if (elements) {
if (elements[0] === '&') {
elements.shift();
else {
elements = [];
}
return (this.mixinElements_ = elements);
},
isJustParentSelector: function () {
return !this.mediaEmpty &&
this.elements.length === 1 &&
this.elements[0].value === '&' &&
(this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === '');
},
eval: function (context) {
var evaldCondition = this.condition && this.condition.eval(context);
var elements = this.elements;
var extendList = this.extendList;
elements = elements && elements.map(function (e) { return e.eval(context); });
extendList = extendList && extendList.map(function (extend) { return extend.eval(context); });
return this.createDerived(elements, extendList, evaldCondition);
},
genCSS: function (context, output) {
var i, element;
if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') {
output.add(' ', this.fileInfo(), this.getIndex());
}
for (i = 0; i < this.elements.length; i++) {
element = this.elements[i];
element.genCSS(context, output);
}
},
getIsOutput: function () {
return this.evaldCondition;
}
else {
elements = [];
}
return (this.mixinElements_ = elements);
};
Selector.prototype.isJustParentSelector = function () {
return !this.mediaEmpty &&
this.elements.length === 1 &&
this.elements[0].value === '&' &&
(this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === '');
};
Selector.prototype.eval = function (context) {
var evaldCondition = this.condition && this.condition.eval(context);
var elements = this.elements;
var extendList = this.extendList;
elements = elements && elements.map(function (e) { return e.eval(context); });
extendList = extendList && extendList.map(function (extend) { return extend.eval(context); });
return this.createDerived(elements, extendList, evaldCondition);
};
Selector.prototype.genCSS = function (context, output) {
var i;
var element;
if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') {
output.add(' ', this.fileInfo(), this.getIndex());
}
for (i = 0; i < this.elements.length; i++) {
element = this.elements[i];
element.genCSS(context, output);
}
};
Selector.prototype.getIsOutput = function () {
return this.evaldCondition;
};
Selector.prototype.type = 'Selector';
});
exports.default = Selector;
//# sourceMappingURL=selector.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var UnicodeDescriptor = function (value) {
this.value = value;
};
UnicodeDescriptor.prototype = new node_1.default();
UnicodeDescriptor.prototype.type = 'UnicodeDescriptor';
UnicodeDescriptor.prototype = Object.assign(new node_1.default(), {
type: 'UnicodeDescriptor'
});
exports.default = UnicodeDescriptor;
//# sourceMappingURL=unicode-descriptor.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var unit_conversions_1 = __importDefault(require("../data/unit-conversions"));
var utils = __importStar(require("../utils"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var unit_conversions_1 = tslib_1.__importDefault(require("../data/unit-conversions"));
var utils = tslib_1.__importStar(require("../utils"));
var Unit = function (numerator, denominator, backupUnit) {

@@ -38,105 +17,105 @@ this.numerator = numerator ? utils.copyArray(numerator).sort() : [];

};
Unit.prototype = new node_1.default();
Unit.prototype.clone = function () {
return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit);
};
Unit.prototype.genCSS = function (context, output) {
// Dimension checks the unit is singular and throws an error if in strict math mode.
var strictUnits = context && context.strictUnits;
if (this.numerator.length === 1) {
output.add(this.numerator[0]); // the ideal situation
}
else if (!strictUnits && this.backupUnit) {
output.add(this.backupUnit);
}
else if (!strictUnits && this.denominator.length) {
output.add(this.denominator[0]);
}
};
Unit.prototype.toString = function () {
var i;
var returnStr = this.numerator.join('*');
for (i = 0; i < this.denominator.length; i++) {
returnStr += "/" + this.denominator[i];
}
return returnStr;
};
Unit.prototype.compare = function (other) {
return this.is(other.toString()) ? 0 : undefined;
};
Unit.prototype.is = function (unitString) {
return this.toString().toUpperCase() === unitString.toUpperCase();
};
Unit.prototype.isLength = function () {
return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS());
};
Unit.prototype.isEmpty = function () {
return this.numerator.length === 0 && this.denominator.length === 0;
};
Unit.prototype.isSingular = function () {
return this.numerator.length <= 1 && this.denominator.length === 0;
};
Unit.prototype.map = function (callback) {
var i;
for (i = 0; i < this.numerator.length; i++) {
this.numerator[i] = callback(this.numerator[i], false);
}
for (i = 0; i < this.denominator.length; i++) {
this.denominator[i] = callback(this.denominator[i], true);
}
};
Unit.prototype.usedUnits = function () {
var group;
var result = {};
var mapUnit;
var groupName;
mapUnit = function (atomicUnit) {
/* jshint loopfunc:true */
if (group.hasOwnProperty(atomicUnit) && !result[groupName]) {
result[groupName] = atomicUnit;
Unit.prototype = Object.assign(new node_1.default(), {
type: 'Unit',
clone: function () {
return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit);
},
genCSS: function (context, output) {
// Dimension checks the unit is singular and throws an error if in strict math mode.
var strictUnits = context && context.strictUnits;
if (this.numerator.length === 1) {
output.add(this.numerator[0]); // the ideal situation
}
return atomicUnit;
};
for (groupName in unit_conversions_1.default) {
if (unit_conversions_1.default.hasOwnProperty(groupName)) {
group = unit_conversions_1.default[groupName];
this.map(mapUnit);
else if (!strictUnits && this.backupUnit) {
output.add(this.backupUnit);
}
}
return result;
};
Unit.prototype.cancel = function () {
var counter = {};
var atomicUnit;
var i;
for (i = 0; i < this.numerator.length; i++) {
atomicUnit = this.numerator[i];
counter[atomicUnit] = (counter[atomicUnit] || 0) + 1;
}
for (i = 0; i < this.denominator.length; i++) {
atomicUnit = this.denominator[i];
counter[atomicUnit] = (counter[atomicUnit] || 0) - 1;
}
this.numerator = [];
this.denominator = [];
for (atomicUnit in counter) {
if (counter.hasOwnProperty(atomicUnit)) {
var count = counter[atomicUnit];
if (count > 0) {
for (i = 0; i < count; i++) {
this.numerator.push(atomicUnit);
}
else if (!strictUnits && this.denominator.length) {
output.add(this.denominator[0]);
}
},
toString: function () {
var i, returnStr = this.numerator.join('*');
for (i = 0; i < this.denominator.length; i++) {
returnStr += "/" + this.denominator[i];
}
return returnStr;
},
compare: function (other) {
return this.is(other.toString()) ? 0 : undefined;
},
is: function (unitString) {
return this.toString().toUpperCase() === unitString.toUpperCase();
},
isLength: function () {
return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS());
},
isEmpty: function () {
return this.numerator.length === 0 && this.denominator.length === 0;
},
isSingular: function () {
return this.numerator.length <= 1 && this.denominator.length === 0;
},
map: function (callback) {
var i;
for (i = 0; i < this.numerator.length; i++) {
this.numerator[i] = callback(this.numerator[i], false);
}
for (i = 0; i < this.denominator.length; i++) {
this.denominator[i] = callback(this.denominator[i], true);
}
},
usedUnits: function () {
var group;
var result = {};
var mapUnit;
var groupName;
mapUnit = function (atomicUnit) {
/* jshint loopfunc:true */
if (group.hasOwnProperty(atomicUnit) && !result[groupName]) {
result[groupName] = atomicUnit;
}
else if (count < 0) {
for (i = 0; i < -count; i++) {
this.denominator.push(atomicUnit);
return atomicUnit;
};
for (groupName in unit_conversions_1.default) {
if (unit_conversions_1.default.hasOwnProperty(groupName)) {
group = unit_conversions_1.default[groupName];
this.map(mapUnit);
}
}
return result;
},
cancel: function () {
var counter = {};
var atomicUnit;
var i;
for (i = 0; i < this.numerator.length; i++) {
atomicUnit = this.numerator[i];
counter[atomicUnit] = (counter[atomicUnit] || 0) + 1;
}
for (i = 0; i < this.denominator.length; i++) {
atomicUnit = this.denominator[i];
counter[atomicUnit] = (counter[atomicUnit] || 0) - 1;
}
this.numerator = [];
this.denominator = [];
for (atomicUnit in counter) {
if (counter.hasOwnProperty(atomicUnit)) {
var count = counter[atomicUnit];
if (count > 0) {
for (i = 0; i < count; i++) {
this.numerator.push(atomicUnit);
}
}
else if (count < 0) {
for (i = 0; i < -count; i++) {
this.denominator.push(atomicUnit);
}
}
}
}
this.numerator.sort();
this.denominator.sort();
}
this.numerator.sort();
this.denominator.sort();
};
Unit.prototype.type = 'Unit';
});
exports.default = Unit;
//# sourceMappingURL=unit.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
function escapePath(path) {
return path.replace(/[\(\)'"\s]/g, function (match) { return "\\" + match; });
}
var URL = function (val, index, currentFileInfo, isEvald) {

@@ -13,49 +14,47 @@ this.value = val;

};
URL.prototype = new node_1.default();
URL.prototype.accept = function (visitor) {
this.value = visitor.visit(this.value);
};
URL.prototype.genCSS = function (context, output) {
output.add('url(');
this.value.genCSS(context, output);
output.add(')');
};
URL.prototype.eval = function (context) {
var val = this.value.eval(context);
var rootpath;
if (!this.isEvald) {
// Add the rootpath if the URL requires a rewrite
rootpath = this.fileInfo() && this.fileInfo().rootpath;
if (typeof rootpath === 'string' &&
typeof val.value === 'string' &&
context.pathRequiresRewrite(val.value)) {
if (!val.quote) {
rootpath = escapePath(rootpath);
URL.prototype = Object.assign(new node_1.default(), {
type: 'Url',
accept: function (visitor) {
this.value = visitor.visit(this.value);
},
genCSS: function (context, output) {
output.add('url(');
this.value.genCSS(context, output);
output.add(')');
},
eval: function (context) {
var val = this.value.eval(context);
var rootpath;
if (!this.isEvald) {
// Add the rootpath if the URL requires a rewrite
rootpath = this.fileInfo() && this.fileInfo().rootpath;
if (typeof rootpath === 'string' &&
typeof val.value === 'string' &&
context.pathRequiresRewrite(val.value)) {
if (!val.quote) {
rootpath = escapePath(rootpath);
}
val.value = context.rewritePath(val.value, rootpath);
}
val.value = context.rewritePath(val.value, rootpath);
}
else {
val.value = context.normalizePath(val.value);
}
// Add url args if enabled
if (context.urlArgs) {
if (!val.value.match(/^\s*data:/)) {
var delimiter = val.value.indexOf('?') === -1 ? '?' : '&';
var urlArgs = delimiter + context.urlArgs;
if (val.value.indexOf('#') !== -1) {
val.value = val.value.replace('#', urlArgs + "#");
else {
val.value = context.normalizePath(val.value);
}
// Add url args if enabled
if (context.urlArgs) {
if (!val.value.match(/^\s*data:/)) {
var delimiter = val.value.indexOf('?') === -1 ? '?' : '&';
var urlArgs = delimiter + context.urlArgs;
if (val.value.indexOf('#') !== -1) {
val.value = val.value.replace('#', urlArgs + "#");
}
else {
val.value += urlArgs;
}
}
else {
val.value += urlArgs;
}
}
}
return new URL(val, this.getIndex(), this.fileInfo(), true);
}
return new URL(val, this.getIndex(), this.fileInfo(), true);
};
URL.prototype.type = 'Url';
function escapePath(path) {
return path.replace(/[\(\)'"\s]/g, function (match) { return "\\" + match; });
}
});
exports.default = URL;
//# sourceMappingURL=url.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var Value = function (value) {

@@ -18,27 +16,30 @@ if (!value) {

};
Value.prototype = new node_1.default();
Value.prototype.accept = function (visitor) {
if (this.value) {
this.value = visitor.visitArray(this.value);
}
};
Value.prototype.eval = function (context) {
if (this.value.length === 1) {
return this.value[0].eval(context);
}
else {
return new Value(this.value.map(function (v) { return v.eval(context); }));
}
};
Value.prototype.genCSS = function (context, output) {
var i;
for (i = 0; i < this.value.length; i++) {
this.value[i].genCSS(context, output);
if (i + 1 < this.value.length) {
output.add((context && context.compress) ? ',' : ', ');
Value.prototype = Object.assign(new node_1.default(), {
type: 'Value',
accept: function (visitor) {
if (this.value) {
this.value = visitor.visitArray(this.value);
}
},
eval: function (context) {
if (this.value.length === 1) {
return this.value[0].eval(context);
}
else {
return new Value(this.value.map(function (v) {
return v.eval(context);
}));
}
},
genCSS: function (context, output) {
var i;
for (i = 0; i < this.value.length; i++) {
this.value[i].genCSS(context, output);
if (i + 1 < this.value.length) {
output.add((context && context.compress) ? ',' : ', ');
}
}
}
};
Value.prototype.type = 'Value';
});
exports.default = Value;
//# sourceMappingURL=value.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var variable_1 = __importDefault(require("./variable"));
var ruleset_1 = __importDefault(require("./ruleset"));
var detached_ruleset_1 = __importDefault(require("./detached-ruleset"));
var less_error_1 = __importDefault(require("../less-error"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var variable_1 = tslib_1.__importDefault(require("./variable"));
var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
var detached_ruleset_1 = tslib_1.__importDefault(require("./detached-ruleset"));
var less_error_1 = tslib_1.__importDefault(require("../less-error"));
var VariableCall = function (variable, index, currentFileInfo) {

@@ -17,29 +15,30 @@ this.variable = variable;

};
VariableCall.prototype = new node_1.default();
VariableCall.prototype.eval = function (context) {
var rules;
var detachedRuleset = new variable_1.default(this.variable, this.getIndex(), this.fileInfo()).eval(context);
var error = new less_error_1.default({ message: "Could not evaluate variable call " + this.variable });
if (!detachedRuleset.ruleset) {
if (detachedRuleset.rules) {
rules = detachedRuleset;
VariableCall.prototype = Object.assign(new node_1.default(), {
type: 'VariableCall',
eval: function (context) {
var rules;
var detachedRuleset = new variable_1.default(this.variable, this.getIndex(), this.fileInfo()).eval(context);
var error = new less_error_1.default({ message: "Could not evaluate variable call " + this.variable });
if (!detachedRuleset.ruleset) {
if (detachedRuleset.rules) {
rules = detachedRuleset;
}
else if (Array.isArray(detachedRuleset)) {
rules = new ruleset_1.default('', detachedRuleset);
}
else if (Array.isArray(detachedRuleset.value)) {
rules = new ruleset_1.default('', detachedRuleset.value);
}
else {
throw error;
}
detachedRuleset = new detached_ruleset_1.default(rules);
}
else if (Array.isArray(detachedRuleset)) {
rules = new ruleset_1.default('', detachedRuleset);
if (detachedRuleset.ruleset) {
return detachedRuleset.callEval(context);
}
else if (Array.isArray(detachedRuleset.value)) {
rules = new ruleset_1.default('', detachedRuleset.value);
}
else {
throw error;
}
detachedRuleset = new detached_ruleset_1.default(rules);
throw error;
}
if (detachedRuleset.ruleset) {
return detachedRuleset.callEval(context);
}
throw error;
};
VariableCall.prototype.type = 'VariableCall';
});
exports.default = VariableCall;
//# sourceMappingURL=variable-call.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_1 = __importDefault(require("./node"));
var call_1 = __importDefault(require("./call"));
var tslib_1 = require("tslib");
var node_1 = tslib_1.__importDefault(require("./node"));
var call_1 = tslib_1.__importDefault(require("./call"));
var Variable = function (name, index, currentFileInfo) {

@@ -13,50 +11,50 @@ this.name = name;

};
Variable.prototype = new node_1.default();
Variable.prototype.eval = function (context) {
var variable;
var name = this.name;
if (name.indexOf('@@') === 0) {
name = "@" + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value;
}
if (this.evaluating) {
throw { type: 'Name', message: "Recursive variable definition for " + name, filename: this.fileInfo().filename,
index: this.getIndex() };
}
this.evaluating = true;
variable = this.find(context.frames, function (frame) {
var v = frame.variable(name);
if (v) {
if (v.important) {
var importantScope = context.importantScope[context.importantScope.length - 1];
importantScope.important = v.important;
Variable.prototype = Object.assign(new node_1.default(), {
type: 'Variable',
eval: function (context) {
var variable, name = this.name;
if (name.indexOf('@@') === 0) {
name = "@" + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value;
}
if (this.evaluating) {
throw { type: 'Name', message: "Recursive variable definition for " + name, filename: this.fileInfo().filename,
index: this.getIndex() };
}
this.evaluating = true;
variable = this.find(context.frames, function (frame) {
var v = frame.variable(name);
if (v) {
if (v.important) {
var importantScope = context.importantScope[context.importantScope.length - 1];
importantScope.important = v.important;
}
// If in calc, wrap vars in a function call to cascade evaluate args first
if (context.inCalc) {
return (new call_1.default('_SELF', [v.value])).eval(context);
}
else {
return v.value.eval(context);
}
}
// If in calc, wrap vars in a function call to cascade evaluate args first
if (context.inCalc) {
return (new call_1.default('_SELF', [v.value])).eval(context);
});
if (variable) {
this.evaluating = false;
return variable;
}
else {
throw { type: 'Name', message: "variable " + name + " is undefined", filename: this.fileInfo().filename,
index: this.getIndex() };
}
},
find: function (obj, fun) {
for (var i = 0, r = void 0; i < obj.length; i++) {
r = fun.call(obj, obj[i]);
if (r) {
return r;
}
else {
return v.value.eval(context);
}
}
});
if (variable) {
this.evaluating = false;
return variable;
return null;
}
else {
throw { type: 'Name', message: "variable " + name + " is undefined", filename: this.fileInfo().filename,
index: this.getIndex() };
}
};
Variable.prototype.find = function (obj, fun) {
for (var i = 0, r = void 0; i < obj.length; i++) {
r = fun.call(obj, obj[i]);
if (r) {
return r;
}
}
return null;
};
Variable.prototype.type = 'Variable';
});
exports.default = Variable;
//# sourceMappingURL=variable.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.flattenArray = exports.merge = exports.copyOptions = exports.defaults = exports.clone = exports.copyArray = exports.getLocation = void 0;
var tslib_1 = require("tslib");
/* jshint proto: true */
var Constants = __importStar(require("./constants"));
var Constants = tslib_1.__importStar(require("./constants"));
var copy_anything_1 = require("copy-anything");

@@ -80,3 +62,3 @@ function getLocation(index, inputStream) {

if (opts.strictMath) {
opts.math = Constants.Math.STRICT_LEGACY;
opts.math = Constants.Math.PARENS;
}

@@ -99,4 +81,4 @@ // Back compat with changed relativeUrls option

break;
case 'strict-legacy':
opts.math = Constants.Math.STRICT_LEGACY;
default:
opts.math = Constants.Math.PARENS;
}

@@ -103,0 +85,0 @@ }

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var tree_1 = __importDefault(require("../tree"));
var visitor_1 = __importDefault(require("./visitor"));
var logger_1 = __importDefault(require("../logger"));
var utils = __importStar(require("../utils"));
var tslib_1 = require("tslib");
var tree_1 = tslib_1.__importDefault(require("../tree"));
var visitor_1 = tslib_1.__importDefault(require("./visitor"));
var logger_1 = tslib_1.__importDefault(require("../logger"));
var utils = tslib_1.__importStar(require("../utils"));
/* jshint loopfunc:true */

@@ -57,4 +36,3 @@ var ExtendFinderVisitor = /** @class */ (function () {

// get &:extend(.a); rules which apply to all selectors in this ruleset
var rules = rulesetNode.rules;
var ruleCnt = rules ? rules.length : 0;
var rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0;
for (i = 0; i < ruleCnt; i++) {

@@ -70,9 +48,9 @@ if (rulesetNode.rules[i] instanceof tree_1.default.Extend) {

for (i = 0; i < paths.length; i++) {
var selectorPath = paths[i];
var selector = selectorPath[selectorPath.length - 1];
var selExtendList = selector.extendList;
var selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList;
extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList)
: allSelectorsExtendList;
if (extendList) {
extendList = extendList.map(function (allSelectorsExtend) { return allSelectorsExtend.clone(); });
extendList = extendList.map(function (allSelectorsExtend) {
return allSelectorsExtend.clone();
});
}

@@ -132,3 +110,5 @@ for (j = 0; j < extendList.length; j++) {

var indices = this.extendIndices;
extendList.filter(function (extend) { return !extend.hasFoundMatches && extend.parent_ids.length == 1; }).forEach(function (extend) {
extendList.filter(function (extend) {
return !extend.hasFoundMatches && extend.parent_ids.length == 1;
}).forEach(function (extend) {
var selector = '_unknown_';

@@ -388,10 +368,3 @@ try {

// for a set of matches, replace each match with the replacement selector
var currentSelectorPathIndex = 0;
var currentSelectorPathElementIndex = 0;
var path = [];
var matchIndex;
var selector;
var firstElement;
var match;
var newElements;
var currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements;
for (matchIndex = 0; matchIndex < matches.length; matchIndex++) {

@@ -398,0 +371,0 @@ match = matches[matchIndex];

@@ -11,4 +11,3 @@ "use strict";

ImportSequencer.prototype.addImport = function (callback) {
var importSequencer = this;
var importItem = {
var importSequencer = this, importItem = {
callback: callback,

@@ -20,7 +19,3 @@ args: null,

return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
importItem.args = Array.prototype.slice.call(args, 0);
importItem.args = Array.prototype.slice.call(arguments, 0);
importItem.isReady = true;

@@ -27,0 +22,0 @@ importSequencer.tryRun();

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var contexts_1 = __importDefault(require("../contexts"));
var visitor_1 = __importDefault(require("./visitor"));
var import_sequencer_1 = __importDefault(require("./import-sequencer"));
var utils = __importStar(require("../utils"));
var tslib_1 = require("tslib");
var contexts_1 = tslib_1.__importDefault(require("../contexts"));
var visitor_1 = tslib_1.__importDefault(require("./visitor"));
var import_sequencer_1 = tslib_1.__importDefault(require("./import-sequencer"));
var utils = tslib_1.__importStar(require("../utils"));
var ImportVisitor = function (importer, finish) {

@@ -101,4 +80,3 @@ this._visitor = new visitor_1.default(this);

}
var onImported = this.onImported.bind(this, evaldImportNode, context);
var sequencedOnImported = this._sequencer.addImport(onImported);
var onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported);
this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported);

@@ -121,7 +99,3 @@ }

}
var importVisitor = this;
var inlineCSS = importNode.options.inline;
var isPlugin = importNode.options.isPlugin;
var isOptional = importNode.options.optional;
var duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
var importVisitor = this, inlineCSS = importNode.options.inline, isPlugin = importNode.options.isPlugin, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
if (!context.importMultiple) {

@@ -128,0 +102,0 @@ if (duplicateImport) {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var visitor_1 = __importDefault(require("./visitor"));
var import_visitor_1 = __importDefault(require("./import-visitor"));
var set_tree_visibility_visitor_1 = __importDefault(require("./set-tree-visibility-visitor"));
var extend_visitor_1 = __importDefault(require("./extend-visitor"));
var join_selector_visitor_1 = __importDefault(require("./join-selector-visitor"));
var to_css_visitor_1 = __importDefault(require("./to-css-visitor"));
var tslib_1 = require("tslib");
var visitor_1 = tslib_1.__importDefault(require("./visitor"));
var import_visitor_1 = tslib_1.__importDefault(require("./import-visitor"));
var set_tree_visibility_visitor_1 = tslib_1.__importDefault(require("./set-tree-visibility-visitor"));
var extend_visitor_1 = tslib_1.__importDefault(require("./extend-visitor"));
var join_selector_visitor_1 = tslib_1.__importDefault(require("./join-selector-visitor"));
var to_css_visitor_1 = tslib_1.__importDefault(require("./to-css-visitor"));
exports.default = {

@@ -13,0 +11,0 @@ Visitor: visitor_1.default,

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var visitor_1 = __importDefault(require("./visitor"));
var tslib_1 = require("tslib");
var visitor_1 = tslib_1.__importDefault(require("./visitor"));
var JoinSelectorVisitor = /** @class */ (function () {

@@ -8,0 +6,0 @@ function JoinSelectorVisitor() {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var tree_1 = __importDefault(require("../tree"));
var visitor_1 = __importDefault(require("./visitor"));
var tslib_1 = require("tslib");
var tree_1 = tslib_1.__importDefault(require("../tree"));
var visitor_1 = tslib_1.__importDefault(require("./visitor"));
var CSSVisitorUtils = /** @class */ (function () {

@@ -182,3 +180,3 @@ function CSSVisitorUtils(context) {

if (ruleNode instanceof tree_1.default.Call) {
throw { message: "Function '" + ruleNode.name + "' is undefined", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
throw { message: "Function '" + ruleNode.name + "' did not return a root node", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
}

@@ -185,0 +183,0 @@ if (ruleNode.type && !ruleNode.allowRoot) {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var tree_1 = __importDefault(require("../tree"));
var tslib_1 = require("tslib");
var tree_1 = tslib_1.__importDefault(require("../tree"));
var _visitArgs = { visitDeeper: true };

@@ -14,4 +12,3 @@ var _hasIndexed = false;

// add .typeIndex to tree node types for lookup table
var key;
var child;
var key, child;
for (key in parent) {

@@ -126,8 +123,3 @@ /* eslint guard-for-in: 0 */

}
var cnt;
var i;
var item;
var nestedCnt;
var j;
var nestedItem;
var cnt, i, item, nestedCnt, j, nestedItem;
for (i = 0, cnt = arr.length; i < cnt; i++) {

@@ -134,0 +126,0 @@ item = arr[i];

{
"name": "less",
"version": "3.13.1",
"version": "4.0.0",
"description": "Leaner CSS",

@@ -57,4 +57,5 @@ "homepage": "http://lesscss.org",

"devDependencies": {
"@less/test-data": "^3.13.0",
"@less/test-import-module": "^3.13.0",
"@less/test-data": "^4.0.0",
"@less/test-import-module": "^4.0.0",
"@rollup/plugin-json": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^3.3.0",

@@ -132,4 +133,5 @@ "@typescript-eslint/parser": "^3.3.0",

"copy-anything": "^2.0.1",
"parse-node-version": "^1.0.1",
"tslib": "^1.10.0"
}
}

@@ -1,4 +0,4 @@

RuntimeError: error evaluating function `image-height`: Image size functions are not supported in browser version of less in image-height-error.less on line 2, column 11:
RuntimeError: Error evaluating function `image-height`: Image size functions are not supported in browser version of less in image-height-error.less on line 2, column 11:
1 .test-height{
2 height: image-height("../data/image.jpg")
3 }

@@ -1,4 +0,4 @@

RuntimeError: error evaluating function `image-size`: Image size functions are not supported in browser version of less in image-size-error.less on line 2, column 9:
RuntimeError: Error evaluating function `image-size`: Image size functions are not supported in browser version of less in image-size-error.less on line 2, column 9:
1 .test-size{
2 size: image-size("../data/image.jpg")
3 }

@@ -1,4 +0,4 @@

RuntimeError: error evaluating function `image-width`: Image size functions are not supported in browser version of less in image-width-error.less on line 2, column 10:
RuntimeError: Error evaluating function `image-width`: Image size functions are not supported in browser version of less in image-width-error.less on line 2, column 10:
1 .test-width{
2 width: image-width("../data/image.jpg")
3 }

@@ -17,5 +17,2 @@ var lessTest = require('./less-test'),

[{
math: 'strict-legacy'
}, 'math/strict-legacy/'],
[{
math: 'parens'

@@ -26,2 +23,5 @@ }, 'math/strict/'],

}, 'math/parens-division/'],
[{
math: 'always'
}, 'math/always/'],
// Use legacy strictMath: true here to demonstrate it still works

@@ -44,4 +44,6 @@ [{strictMath: true, strictUnits: true, javascriptEnabled: true}, '../errors/eval/',

[{math: 'strict', compress: true}, 'compression/'],
[{math: 0, strictUnits: true}, 'strict-units/'],
[{}, 'legacy/'],
[{math: 0, strictUnits: true}, 'units/strict/'],
[{math: 0, strictUnits: false}, 'units/no-strict/'],
[{math: 'strict', strictUnits: true, sourceMap: true, globalVars: true }, 'sourcemaps/',

@@ -80,4 +82,3 @@ lessTester.testSourcemap, null, null,

[{plugin: 'test/plugins/filemanager/'}, 'filemanagerPlugin/'],
[{}, 'no-strict-math/'],
[{}, '3rd-party/'],
[{math: 0}, '3rd-party/'],
[{ processImports: false }, 'process-imports/']

@@ -90,5 +91,5 @@ ];

lessTester.testSyncronous({syncImport: true}, '_main/plugin');
lessTester.testSyncronous({syncImport: true}, 'math/strict-legacy/css');
lessTester.testSyncronous({syncImport: true}, 'math/strict/css');
lessTester.testNoOptions();
lessTester.testJSImport();
lessTester.finished();

@@ -9,2 +9,3 @@ {

"esModuleInterop": true,
"importHelpers": true,
"target": "ES5"

@@ -11,0 +12,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc