initial commit
This commit is contained in:
26
node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
26
node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _processor = require('./processor');
|
||||
|
||||
var _processor2 = _interopRequireDefault(_processor);
|
||||
|
||||
var _selectors = require('./selectors');
|
||||
|
||||
var selectors = _interopRequireWildcard(_selectors);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var parser = function parser(processor) {
|
||||
return new _processor2.default(processor);
|
||||
};
|
||||
|
||||
Object.assign(parser, selectors);
|
||||
|
||||
delete parser.__esModule;
|
||||
|
||||
exports.default = parser;
|
||||
module.exports = exports['default'];
|
||||
1088
node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
1088
node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
185
node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
185
node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _parser = require("./parser");
|
||||
|
||||
var _parser2 = _interopRequireDefault(_parser);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Processor = function () {
|
||||
function Processor(func, options) {
|
||||
_classCallCheck(this, Processor);
|
||||
|
||||
this.func = func || function noop() {};
|
||||
this.funcRes = null;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
Processor.prototype._shouldUpdateSelector = function _shouldUpdateSelector(rule) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
if (merged.updateSelector === false) {
|
||||
return false;
|
||||
} else {
|
||||
return typeof rule !== "string";
|
||||
}
|
||||
};
|
||||
|
||||
Processor.prototype._isLossy = function _isLossy() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
if (merged.lossless === false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Processor.prototype._root = function _root(rule) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
var parser = new _parser2.default(rule, this._parseOptions(options));
|
||||
return parser.root;
|
||||
};
|
||||
|
||||
Processor.prototype._parseOptions = function _parseOptions(options) {
|
||||
return {
|
||||
lossy: this._isLossy(options)
|
||||
};
|
||||
};
|
||||
|
||||
Processor.prototype._run = function _run(rule) {
|
||||
var _this = this;
|
||||
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
var root = _this._root(rule, options);
|
||||
Promise.resolve(_this.func(root)).then(function (transform) {
|
||||
var string = undefined;
|
||||
if (_this._shouldUpdateSelector(rule, options)) {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
return { transform: transform, root: root, string: string };
|
||||
}).then(resolve, reject);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Processor.prototype._runSync = function _runSync(rule) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
var root = this._root(rule, options);
|
||||
var transform = this.func(root);
|
||||
if (transform && typeof transform.then === "function") {
|
||||
throw new Error("Selector processor returned a promise to a synchronous call.");
|
||||
}
|
||||
var string = undefined;
|
||||
if (options.updateSelector && typeof rule !== "string") {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
return { transform: transform, root: root, string: string };
|
||||
};
|
||||
|
||||
/**
|
||||
* Process rule into a selector AST.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<parser.Root>} The AST of the selector after processing it.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.ast = function ast(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.root;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Process rule into a selector AST synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {parser.Root} The AST of the selector after processing it.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.astSync = function astSync(rule, options) {
|
||||
return this._runSync(rule, options).root;
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a transformed value asynchronously
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<any>} The value returned by the processor.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.transform = function transform(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.transform;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a transformed value synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {any} The value returned by the processor.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.transformSync = function transformSync(rule, options) {
|
||||
return this._runSync(rule, options).transform;
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a new selector string asynchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.process = function process(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.string || result.root.toString();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a new selector string synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.processSync = function processSync(rule, options) {
|
||||
var result = this._runSync(rule, options);
|
||||
return result.string || result.root.toString();
|
||||
};
|
||||
|
||||
return Processor;
|
||||
}();
|
||||
|
||||
exports.default = Processor;
|
||||
module.exports = exports["default"];
|
||||
468
node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
468
node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
@@ -0,0 +1,468 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _CSSESC_QUOTE_OPTIONS;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
exports.unescapeValue = unescapeValue;
|
||||
|
||||
var _cssesc = require("cssesc");
|
||||
|
||||
var _cssesc2 = _interopRequireDefault(_cssesc);
|
||||
|
||||
var _unesc = require("../util/unesc");
|
||||
|
||||
var _unesc2 = _interopRequireDefault(_unesc);
|
||||
|
||||
var _namespace = require("./namespace");
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _require = require("util"),
|
||||
deprecate = _require.deprecate;
|
||||
|
||||
var WRAPPED_IN_QUOTES = /^('|")(.*)\1$/;
|
||||
|
||||
var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
|
||||
|
||||
var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
|
||||
|
||||
var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
|
||||
|
||||
function unescapeValue(value) {
|
||||
var deprecatedUsage = false;
|
||||
var quoteMark = null;
|
||||
var unescaped = value;
|
||||
var m = unescaped.match(WRAPPED_IN_QUOTES);
|
||||
if (m) {
|
||||
quoteMark = m[1];
|
||||
unescaped = m[2];
|
||||
}
|
||||
unescaped = (0, _unesc2.default)(unescaped);
|
||||
if (unescaped !== value) {
|
||||
deprecatedUsage = true;
|
||||
}
|
||||
return {
|
||||
deprecatedUsage: deprecatedUsage,
|
||||
unescaped: unescaped,
|
||||
quoteMark: quoteMark
|
||||
};
|
||||
}
|
||||
|
||||
function handleDeprecatedContructorOpts(opts) {
|
||||
if (opts.quoteMark !== undefined) {
|
||||
return opts;
|
||||
}
|
||||
if (opts.value === undefined) {
|
||||
return opts;
|
||||
}
|
||||
warnOfDeprecatedConstructor();
|
||||
|
||||
var _unescapeValue = unescapeValue(opts.value),
|
||||
quoteMark = _unescapeValue.quoteMark,
|
||||
unescaped = _unescapeValue.unescaped;
|
||||
|
||||
if (!opts.raws) {
|
||||
opts.raws = {};
|
||||
}
|
||||
if (opts.raws.value === undefined) {
|
||||
opts.raws.value = opts.value;
|
||||
}
|
||||
opts.value = unescaped;
|
||||
opts.quoteMark = quoteMark;
|
||||
return opts;
|
||||
}
|
||||
|
||||
var Attribute = function (_Namespace) {
|
||||
_inherits(Attribute, _Namespace);
|
||||
|
||||
function Attribute() {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
_classCallCheck(this, Attribute);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, handleDeprecatedContructorOpts(opts)));
|
||||
|
||||
_this.type = _types.ATTRIBUTE;
|
||||
_this.raws = _this.raws || {};
|
||||
Object.defineProperty(_this.raws, 'unquoted', {
|
||||
get: deprecate(function () {
|
||||
return _this.value;
|
||||
}, "attr.raws.unquoted is deprecated. Call attr.value instead."),
|
||||
set: deprecate(function () {
|
||||
return _this.value;
|
||||
}, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
|
||||
});
|
||||
_this._constructed = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Attribute's value quoted such that it would be legal to use
|
||||
* in the value of a css file. The original value's quotation setting
|
||||
* used for stringification is left unchanged. See `setValue(value, options)`
|
||||
* if you want to control the quote settings of a new value for the attribute.
|
||||
*
|
||||
* You can also change the quotation used for the current value by setting quoteMark.
|
||||
*
|
||||
* Options:
|
||||
* * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
|
||||
* option is not set, the original value for quoteMark will be used. If
|
||||
* indeterminate, a double quote is used. The legal values are:
|
||||
* * `null` - the value will be unquoted and characters will be escaped as necessary.
|
||||
* * `'` - the value will be quoted with a single quote and single quotes are escaped.
|
||||
* * `"` - the value will be quoted with a double quote and double quotes are escaped.
|
||||
* * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
|
||||
* over the quoteMark option value.
|
||||
* * smart {boolean} - if true, will select a quote mark based on the value
|
||||
* and the other options specified here. See the `smartQuoteMark()`
|
||||
* method.
|
||||
**/
|
||||
|
||||
|
||||
Attribute.prototype.getQuotedValue = function getQuotedValue() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
var quoteMark = this._determineQuoteMark(options);
|
||||
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
|
||||
var escaped = (0, _cssesc2.default)(this._value, cssescopts);
|
||||
return escaped;
|
||||
};
|
||||
|
||||
Attribute.prototype._determineQuoteMark = function _determineQuoteMark(options) {
|
||||
return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the unescaped value with the specified quotation options. The value
|
||||
* provided must not include any wrapping quote marks -- those quotes will
|
||||
* be interpreted as part of the value and escaped accordingly.
|
||||
*/
|
||||
|
||||
|
||||
Attribute.prototype.setValue = function setValue(value) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
this._value = value;
|
||||
this._quoteMark = this._determineQuoteMark(options);
|
||||
this._syncRawValue();
|
||||
};
|
||||
|
||||
/**
|
||||
* Intelligently select a quoteMark value based on the value's contents. If
|
||||
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
|
||||
* mark will be picked that minimizes the number of escapes.
|
||||
*
|
||||
* If there's no clear winner, the quote mark from these options is used,
|
||||
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
|
||||
* true). If the quoteMark is unspecified, a double quote is used.
|
||||
*
|
||||
* @param options This takes the quoteMark and preferCurrentQuoteMark options
|
||||
* from the quoteValue method.
|
||||
*/
|
||||
|
||||
|
||||
Attribute.prototype.smartQuoteMark = function smartQuoteMark(options) {
|
||||
var v = this.value;
|
||||
var numSingleQuotes = v.replace(/[^']/g, '').length;
|
||||
var numDoubleQuotes = v.replace(/[^"]/g, '').length;
|
||||
if (numSingleQuotes + numDoubleQuotes === 0) {
|
||||
var escaped = (0, _cssesc2.default)(v, { isIdentifier: true });
|
||||
if (escaped === v) {
|
||||
return Attribute.NO_QUOTE;
|
||||
} else {
|
||||
var pref = this.preferredQuoteMark(options);
|
||||
if (pref === Attribute.NO_QUOTE) {
|
||||
// pick a quote mark that isn't none and see if it's smaller
|
||||
var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
|
||||
var opts = CSSESC_QUOTE_OPTIONS[quote];
|
||||
var quoteValue = (0, _cssesc2.default)(v, opts);
|
||||
if (quoteValue.length < escaped.length) {
|
||||
return quote;
|
||||
}
|
||||
}
|
||||
return pref;
|
||||
}
|
||||
} else if (numDoubleQuotes === numSingleQuotes) {
|
||||
return this.preferredQuoteMark(options);
|
||||
} else if (numDoubleQuotes < numSingleQuotes) {
|
||||
return Attribute.DOUBLE_QUOTE;
|
||||
} else {
|
||||
return Attribute.SINGLE_QUOTE;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Selects the preferred quote mark based on the options and the current quote mark value.
|
||||
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
|
||||
* instead.
|
||||
*/
|
||||
|
||||
|
||||
Attribute.prototype.preferredQuoteMark = function preferredQuoteMark(options) {
|
||||
var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
|
||||
|
||||
if (quoteMark === undefined) {
|
||||
quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
|
||||
}
|
||||
|
||||
if (quoteMark === undefined) {
|
||||
quoteMark = Attribute.DOUBLE_QUOTE;
|
||||
}
|
||||
|
||||
return quoteMark;
|
||||
};
|
||||
|
||||
Attribute.prototype._syncRawValue = function _syncRawValue() {
|
||||
var rawValue = (0, _cssesc2.default)(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
|
||||
if (rawValue === this._value) {
|
||||
if (this.raws) {
|
||||
delete this.raws.value;
|
||||
}
|
||||
} else {
|
||||
this.raws.value = rawValue;
|
||||
}
|
||||
};
|
||||
|
||||
Attribute.prototype._handleEscapes = function _handleEscapes(prop, value) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc2.default)(value, { isIdentifier: true });
|
||||
if (escaped !== value) {
|
||||
this.raws[prop] = escaped;
|
||||
} else {
|
||||
delete this.raws[prop];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Attribute.prototype._spacesFor = function _spacesFor(name) {
|
||||
var attrSpaces = { before: '', after: '' };
|
||||
var spaces = this.spaces[name] || {};
|
||||
var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
|
||||
return Object.assign(attrSpaces, spaces, rawSpaces);
|
||||
};
|
||||
|
||||
Attribute.prototype._stringFor = function _stringFor(name) {
|
||||
var spaceName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : name;
|
||||
var concat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultAttrConcat;
|
||||
|
||||
var attrSpaces = this._spacesFor(spaceName);
|
||||
return concat(this.stringifyProperty(name), attrSpaces);
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/
|
||||
|
||||
|
||||
Attribute.prototype.offsetOf = function offsetOf(name) {
|
||||
var count = 1;
|
||||
var attributeSpaces = this._spacesFor("attribute");
|
||||
count += attributeSpaces.before.length;
|
||||
if (name === "namespace" || name === "ns") {
|
||||
return this.namespace ? count : -1;
|
||||
}
|
||||
if (name === "attributeNS") {
|
||||
return count;
|
||||
}
|
||||
|
||||
count += this.namespaceString.length;
|
||||
if (this.namespace) {
|
||||
count += 1;
|
||||
}
|
||||
if (name === "attribute") {
|
||||
return count;
|
||||
}
|
||||
|
||||
count += this.stringifyProperty("attribute").length;
|
||||
count += attributeSpaces.after.length;
|
||||
var operatorSpaces = this._spacesFor("operator");
|
||||
count += operatorSpaces.before.length;
|
||||
var operator = this.stringifyProperty("operator");
|
||||
if (name === "operator") {
|
||||
return operator ? count : -1;
|
||||
}
|
||||
|
||||
count += operator.length;
|
||||
count += operatorSpaces.after.length;
|
||||
var valueSpaces = this._spacesFor("value");
|
||||
count += valueSpaces.before.length;
|
||||
var value = this.stringifyProperty("value");
|
||||
if (name === "value") {
|
||||
return value ? count : -1;
|
||||
}
|
||||
|
||||
count += value.length;
|
||||
count += valueSpaces.after.length;
|
||||
var insensitiveSpaces = this._spacesFor("insensitive");
|
||||
count += insensitiveSpaces.before.length;
|
||||
if (name === "insensitive") {
|
||||
return this.insensitive ? count : -1;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
Attribute.prototype.toString = function toString() {
|
||||
var _this2 = this;
|
||||
|
||||
var selector = [this.rawSpaceBefore, '['];
|
||||
|
||||
selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
|
||||
|
||||
if (this.operator && this.value) {
|
||||
selector.push(this._stringFor('operator'));
|
||||
selector.push(this._stringFor('value'));
|
||||
selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
|
||||
if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
|
||||
attrSpaces.before = " ";
|
||||
}
|
||||
return defaultAttrConcat(attrValue, attrSpaces);
|
||||
}));
|
||||
}
|
||||
|
||||
selector.push(']');
|
||||
selector.push(this.rawSpaceAfter);
|
||||
return selector.join('');
|
||||
};
|
||||
|
||||
_createClass(Attribute, [{
|
||||
key: "quoted",
|
||||
get: function get() {
|
||||
var qm = this.quoteMark;
|
||||
return qm === "'" || qm === '"';
|
||||
},
|
||||
set: function set(value) {
|
||||
warnOfDeprecatedQuotedAssignment();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a single (`'`) or double (`"`) quote character if the value is quoted.
|
||||
* returns `null` if the value is not quoted.
|
||||
* returns `undefined` if the quotation state is unknown (this can happen when
|
||||
* the attribute is constructed without specifying a quote mark.)
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "quoteMark",
|
||||
get: function get() {
|
||||
return this._quoteMark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the quote mark to be used by this attribute's value.
|
||||
* If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
|
||||
* value is updated accordingly.
|
||||
*
|
||||
* @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
|
||||
*/
|
||||
,
|
||||
set: function set(quoteMark) {
|
||||
if (!this._constructed) {
|
||||
this._quoteMark = quoteMark;
|
||||
return;
|
||||
}
|
||||
if (this._quoteMark !== quoteMark) {
|
||||
this._quoteMark = quoteMark;
|
||||
this._syncRawValue();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "qualifiedAttribute",
|
||||
get: function get() {
|
||||
return this.qualifiedName(this.raws.attribute || this.attribute);
|
||||
}
|
||||
}, {
|
||||
key: "insensitiveFlag",
|
||||
get: function get() {
|
||||
return this.insensitive ? 'i' : '';
|
||||
}
|
||||
}, {
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return this._value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Before 3.0, the value had to be set to an escaped value including any wrapped
|
||||
* quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
|
||||
* is unescaped during parsing and any quote marks are removed.
|
||||
*
|
||||
* Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
|
||||
* a deprecation warning is raised when the new value contains any characters that would
|
||||
* require escaping (including if it contains wrapped quotes).
|
||||
*
|
||||
* Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
|
||||
* how the new value is quoted.
|
||||
*/
|
||||
,
|
||||
set: function set(v) {
|
||||
if (this._constructed) {
|
||||
var _unescapeValue2 = unescapeValue(v),
|
||||
deprecatedUsage = _unescapeValue2.deprecatedUsage,
|
||||
unescaped = _unescapeValue2.unescaped,
|
||||
quoteMark = _unescapeValue2.quoteMark;
|
||||
|
||||
if (deprecatedUsage) {
|
||||
warnOfDeprecatedValueAssignment();
|
||||
}
|
||||
if (unescaped === this._value && quoteMark === this._quoteMark) {
|
||||
return;
|
||||
}
|
||||
this._value = unescaped;
|
||||
this._quoteMark = quoteMark;
|
||||
this._syncRawValue();
|
||||
} else {
|
||||
this._value = v;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "attribute",
|
||||
get: function get() {
|
||||
return this._attribute;
|
||||
},
|
||||
set: function set(name) {
|
||||
this._handleEscapes("attribute", name);
|
||||
this._attribute = name;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Attribute;
|
||||
}(_namespace2.default);
|
||||
|
||||
Attribute.NO_QUOTE = null;
|
||||
Attribute.SINGLE_QUOTE = "'";
|
||||
Attribute.DOUBLE_QUOTE = '"';
|
||||
exports.default = Attribute;
|
||||
|
||||
|
||||
var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
|
||||
"'": { quotes: 'single', wrap: true },
|
||||
'"': { quotes: 'double', wrap: true }
|
||||
}, _CSSESC_QUOTE_OPTIONS[null] = { isIdentifier: true }, _CSSESC_QUOTE_OPTIONS);
|
||||
|
||||
function defaultAttrConcat(attrValue, attrSpaces) {
|
||||
return "" + attrSpaces.before + attrValue + attrSpaces.after;
|
||||
}
|
||||
67
node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
67
node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _cssesc = require('cssesc');
|
||||
|
||||
var _cssesc2 = _interopRequireDefault(_cssesc);
|
||||
|
||||
var _util = require('../util');
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var ClassName = function (_Node) {
|
||||
_inherits(ClassName, _Node);
|
||||
|
||||
function ClassName(opts) {
|
||||
_classCallCheck(this, ClassName);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.CLASS;
|
||||
_this._constructed = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
ClassName.prototype.toString = function toString() {
|
||||
return [this.rawSpaceBefore, String('.' + this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
_createClass(ClassName, [{
|
||||
key: 'value',
|
||||
set: function set(v) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc2.default)(v, { isIdentifier: true });
|
||||
if (escaped !== v) {
|
||||
(0, _util.ensureObject)(this, "raws");
|
||||
this.raws.value = escaped;
|
||||
} else if (this.raws) {
|
||||
delete this.raws.value;
|
||||
}
|
||||
}
|
||||
this._value = v;
|
||||
},
|
||||
get: function get() {
|
||||
return this._value;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ClassName;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = ClassName;
|
||||
module.exports = exports['default'];
|
||||
35
node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
35
node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Combinator = function (_Node) {
|
||||
_inherits(Combinator, _Node);
|
||||
|
||||
function Combinator(opts) {
|
||||
_classCallCheck(this, Combinator);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.COMBINATOR;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Combinator;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Combinator;
|
||||
module.exports = exports['default'];
|
||||
35
node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
35
node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Comment = function (_Node) {
|
||||
_inherits(Comment, _Node);
|
||||
|
||||
function Comment(opts) {
|
||||
_classCallCheck(this, Comment);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.COMMENT;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Comment;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Comment;
|
||||
module.exports = exports['default'];
|
||||
91
node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
91
node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = undefined;
|
||||
|
||||
var _attribute = require('./attribute');
|
||||
|
||||
var _attribute2 = _interopRequireDefault(_attribute);
|
||||
|
||||
var _className = require('./className');
|
||||
|
||||
var _className2 = _interopRequireDefault(_className);
|
||||
|
||||
var _combinator = require('./combinator');
|
||||
|
||||
var _combinator2 = _interopRequireDefault(_combinator);
|
||||
|
||||
var _comment = require('./comment');
|
||||
|
||||
var _comment2 = _interopRequireDefault(_comment);
|
||||
|
||||
var _id = require('./id');
|
||||
|
||||
var _id2 = _interopRequireDefault(_id);
|
||||
|
||||
var _nesting = require('./nesting');
|
||||
|
||||
var _nesting2 = _interopRequireDefault(_nesting);
|
||||
|
||||
var _pseudo = require('./pseudo');
|
||||
|
||||
var _pseudo2 = _interopRequireDefault(_pseudo);
|
||||
|
||||
var _root = require('./root');
|
||||
|
||||
var _root2 = _interopRequireDefault(_root);
|
||||
|
||||
var _selector = require('./selector');
|
||||
|
||||
var _selector2 = _interopRequireDefault(_selector);
|
||||
|
||||
var _string = require('./string');
|
||||
|
||||
var _string2 = _interopRequireDefault(_string);
|
||||
|
||||
var _tag = require('./tag');
|
||||
|
||||
var _tag2 = _interopRequireDefault(_tag);
|
||||
|
||||
var _universal = require('./universal');
|
||||
|
||||
var _universal2 = _interopRequireDefault(_universal);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var attribute = exports.attribute = function attribute(opts) {
|
||||
return new _attribute2.default(opts);
|
||||
};
|
||||
var className = exports.className = function className(opts) {
|
||||
return new _className2.default(opts);
|
||||
};
|
||||
var combinator = exports.combinator = function combinator(opts) {
|
||||
return new _combinator2.default(opts);
|
||||
};
|
||||
var comment = exports.comment = function comment(opts) {
|
||||
return new _comment2.default(opts);
|
||||
};
|
||||
var id = exports.id = function id(opts) {
|
||||
return new _id2.default(opts);
|
||||
};
|
||||
var nesting = exports.nesting = function nesting(opts) {
|
||||
return new _nesting2.default(opts);
|
||||
};
|
||||
var pseudo = exports.pseudo = function pseudo(opts) {
|
||||
return new _pseudo2.default(opts);
|
||||
};
|
||||
var root = exports.root = function root(opts) {
|
||||
return new _root2.default(opts);
|
||||
};
|
||||
var selector = exports.selector = function selector(opts) {
|
||||
return new _selector2.default(opts);
|
||||
};
|
||||
var string = exports.string = function string(opts) {
|
||||
return new _string2.default(opts);
|
||||
};
|
||||
var tag = exports.tag = function tag(opts) {
|
||||
return new _tag2.default(opts);
|
||||
};
|
||||
var universal = exports.universal = function universal(opts) {
|
||||
return new _universal2.default(opts);
|
||||
};
|
||||
392
node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
392
node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
@@ -0,0 +1,392 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var types = _interopRequireWildcard(_types);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Container = function (_Node) {
|
||||
_inherits(Container, _Node);
|
||||
|
||||
function Container(opts) {
|
||||
_classCallCheck(this, Container);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
if (!_this.nodes) {
|
||||
_this.nodes = [];
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
|
||||
Container.prototype.append = function append(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.push(selector);
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.prepend = function prepend(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.unshift(selector);
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.at = function at(index) {
|
||||
return this.nodes[index];
|
||||
};
|
||||
|
||||
Container.prototype.index = function index(child) {
|
||||
if (typeof child === 'number') {
|
||||
return child;
|
||||
}
|
||||
return this.nodes.indexOf(child);
|
||||
};
|
||||
|
||||
Container.prototype.removeChild = function removeChild(child) {
|
||||
child = this.index(child);
|
||||
this.at(child).parent = undefined;
|
||||
this.nodes.splice(child, 1);
|
||||
|
||||
var index = void 0;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (index >= child) {
|
||||
this.indexes[id] = index - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.removeAll = function removeAll() {
|
||||
for (var _iterator = this.nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var node = _ref;
|
||||
|
||||
node.parent = undefined;
|
||||
}
|
||||
this.nodes = [];
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.empty = function empty() {
|
||||
return this.removeAll();
|
||||
};
|
||||
|
||||
Container.prototype.insertAfter = function insertAfter(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex + 1, 0, newNode);
|
||||
|
||||
newNode.parent = this;
|
||||
|
||||
var index = void 0;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (oldIndex <= index) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.insertBefore = function insertBefore(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex, 0, newNode);
|
||||
|
||||
newNode.parent = this;
|
||||
|
||||
var index = void 0;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (index <= oldIndex) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype._findChildAtPosition = function _findChildAtPosition(line, col) {
|
||||
var found = undefined;
|
||||
this.each(function (node) {
|
||||
if (node.atPosition) {
|
||||
var foundChild = node.atPosition(line, col);
|
||||
if (foundChild) {
|
||||
found = foundChild;
|
||||
return false;
|
||||
}
|
||||
} else if (node.isAtPosition(line, col)) {
|
||||
found = node;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return found;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the most specific node at the line and column number given.
|
||||
* The source location is based on the original parsed location, locations aren't
|
||||
* updated as selector nodes are mutated.
|
||||
*
|
||||
* Note that this location is relative to the location of the first character
|
||||
* of the selector, and not the location of the selector in the overall document
|
||||
* when used in conjunction with postcss.
|
||||
*
|
||||
* If not found, returns undefined.
|
||||
* @param {number} line The line number of the node to find. (1-based index)
|
||||
* @param {number} col The column number of the node to find. (1-based index)
|
||||
*/
|
||||
|
||||
|
||||
Container.prototype.atPosition = function atPosition(line, col) {
|
||||
if (this.isAtPosition(line, col)) {
|
||||
return this._findChildAtPosition(line, col) || this;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
Container.prototype._inferEndPosition = function _inferEndPosition() {
|
||||
if (this.last && this.last.source && this.last.source.end) {
|
||||
this.source = this.source || {};
|
||||
this.source.end = this.source.end || {};
|
||||
Object.assign(this.source.end, this.last.source.end);
|
||||
}
|
||||
};
|
||||
|
||||
Container.prototype.each = function each(callback) {
|
||||
if (!this.lastEach) {
|
||||
this.lastEach = 0;
|
||||
}
|
||||
if (!this.indexes) {
|
||||
this.indexes = {};
|
||||
}
|
||||
|
||||
this.lastEach++;
|
||||
var id = this.lastEach;
|
||||
this.indexes[id] = 0;
|
||||
|
||||
if (!this.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var index = void 0,
|
||||
result = void 0;
|
||||
while (this.indexes[id] < this.length) {
|
||||
index = this.indexes[id];
|
||||
result = callback(this.at(index), index);
|
||||
if (result === false) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.indexes[id] += 1;
|
||||
}
|
||||
|
||||
delete this.indexes[id];
|
||||
|
||||
if (result === false) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Container.prototype.walk = function walk(callback) {
|
||||
return this.each(function (node, i) {
|
||||
var result = callback(node, i);
|
||||
|
||||
if (result !== false && node.length) {
|
||||
result = node.walk(callback);
|
||||
}
|
||||
|
||||
if (result === false) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkAttributes = function walkAttributes(callback) {
|
||||
var _this2 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ATTRIBUTE) {
|
||||
return callback.call(_this2, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkClasses = function walkClasses(callback) {
|
||||
var _this3 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.CLASS) {
|
||||
return callback.call(_this3, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkCombinators = function walkCombinators(callback) {
|
||||
var _this4 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMBINATOR) {
|
||||
return callback.call(_this4, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkComments = function walkComments(callback) {
|
||||
var _this5 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMMENT) {
|
||||
return callback.call(_this5, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkIds = function walkIds(callback) {
|
||||
var _this6 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ID) {
|
||||
return callback.call(_this6, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkNesting = function walkNesting(callback) {
|
||||
var _this7 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.NESTING) {
|
||||
return callback.call(_this7, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkPseudos = function walkPseudos(callback) {
|
||||
var _this8 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.PSEUDO) {
|
||||
return callback.call(_this8, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkTags = function walkTags(callback) {
|
||||
var _this9 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.TAG) {
|
||||
return callback.call(_this9, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkUniversals = function walkUniversals(callback) {
|
||||
var _this10 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.UNIVERSAL) {
|
||||
return callback.call(_this10, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.split = function split(callback) {
|
||||
var _this11 = this;
|
||||
|
||||
var current = [];
|
||||
return this.reduce(function (memo, node, index) {
|
||||
var split = callback.call(_this11, node);
|
||||
current.push(node);
|
||||
if (split) {
|
||||
memo.push(current);
|
||||
current = [];
|
||||
} else if (index === _this11.length - 1) {
|
||||
memo.push(current);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
};
|
||||
|
||||
Container.prototype.map = function map(callback) {
|
||||
return this.nodes.map(callback);
|
||||
};
|
||||
|
||||
Container.prototype.reduce = function reduce(callback, memo) {
|
||||
return this.nodes.reduce(callback, memo);
|
||||
};
|
||||
|
||||
Container.prototype.every = function every(callback) {
|
||||
return this.nodes.every(callback);
|
||||
};
|
||||
|
||||
Container.prototype.some = function some(callback) {
|
||||
return this.nodes.some(callback);
|
||||
};
|
||||
|
||||
Container.prototype.filter = function filter(callback) {
|
||||
return this.nodes.filter(callback);
|
||||
};
|
||||
|
||||
Container.prototype.sort = function sort(callback) {
|
||||
return this.nodes.sort(callback);
|
||||
};
|
||||
|
||||
Container.prototype.toString = function toString() {
|
||||
return this.map(String).join('');
|
||||
};
|
||||
|
||||
_createClass(Container, [{
|
||||
key: 'first',
|
||||
get: function get() {
|
||||
return this.at(0);
|
||||
}
|
||||
}, {
|
||||
key: 'last',
|
||||
get: function get() {
|
||||
return this.at(this.length - 1);
|
||||
}
|
||||
}, {
|
||||
key: 'length',
|
||||
get: function get() {
|
||||
return this.nodes.length;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Container;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Container;
|
||||
module.exports = exports['default'];
|
||||
54
node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
54
node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = undefined;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var _IS_TYPE;
|
||||
|
||||
exports.isNode = isNode;
|
||||
exports.isPseudoElement = isPseudoElement;
|
||||
exports.isPseudoClass = isPseudoClass;
|
||||
exports.isContainer = isContainer;
|
||||
exports.isNamespace = isNamespace;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);
|
||||
|
||||
function isNode(node) {
|
||||
return (typeof node === "undefined" ? "undefined" : _typeof(node)) === "object" && IS_TYPE[node.type];
|
||||
}
|
||||
|
||||
function isNodeType(type, node) {
|
||||
return isNode(node) && node.type === type;
|
||||
}
|
||||
|
||||
var isAttribute = exports.isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
|
||||
var isClassName = exports.isClassName = isNodeType.bind(null, _types.CLASS);
|
||||
var isCombinator = exports.isCombinator = isNodeType.bind(null, _types.COMBINATOR);
|
||||
var isComment = exports.isComment = isNodeType.bind(null, _types.COMMENT);
|
||||
var isIdentifier = exports.isIdentifier = isNodeType.bind(null, _types.ID);
|
||||
var isNesting = exports.isNesting = isNodeType.bind(null, _types.NESTING);
|
||||
var isPseudo = exports.isPseudo = isNodeType.bind(null, _types.PSEUDO);
|
||||
var isRoot = exports.isRoot = isNodeType.bind(null, _types.ROOT);
|
||||
var isSelector = exports.isSelector = isNodeType.bind(null, _types.SELECTOR);
|
||||
var isString = exports.isString = isNodeType.bind(null, _types.STRING);
|
||||
var isTag = exports.isTag = isNodeType.bind(null, _types.TAG);
|
||||
var isUniversal = exports.isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
|
||||
|
||||
function isPseudoElement(node) {
|
||||
return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value === ":before" || node.value === ":after");
|
||||
}
|
||||
function isPseudoClass(node) {
|
||||
return isPseudo(node) && !isPseudoElement(node);
|
||||
}
|
||||
|
||||
function isContainer(node) {
|
||||
return !!(isNode(node) && node.walk);
|
||||
}
|
||||
|
||||
function isNamespace(node) {
|
||||
return isAttribute(node) || isTag(node);
|
||||
}
|
||||
39
node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
39
node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var ID = function (_Node) {
|
||||
_inherits(ID, _Node);
|
||||
|
||||
function ID(opts) {
|
||||
_classCallCheck(this, ID);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.ID;
|
||||
return _this;
|
||||
}
|
||||
|
||||
ID.prototype.toString = function toString() {
|
||||
return [this.rawSpaceBefore, String('#' + this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
return ID;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = ID;
|
||||
module.exports = exports['default'];
|
||||
39
node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
39
node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _types[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _constructors = require("./constructors");
|
||||
|
||||
Object.keys(_constructors).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _constructors[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _guards = require("./guards");
|
||||
|
||||
Object.keys(_guards).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _guards[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
98
node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
98
node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _cssesc = require('cssesc');
|
||||
|
||||
var _cssesc2 = _interopRequireDefault(_cssesc);
|
||||
|
||||
var _util = require('../util');
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Namespace = function (_Node) {
|
||||
_inherits(Namespace, _Node);
|
||||
|
||||
function Namespace() {
|
||||
_classCallCheck(this, Namespace);
|
||||
|
||||
return _possibleConstructorReturn(this, _Node.apply(this, arguments));
|
||||
}
|
||||
|
||||
Namespace.prototype.qualifiedName = function qualifiedName(value) {
|
||||
if (this.namespace) {
|
||||
return this.namespaceString + '|' + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
Namespace.prototype.toString = function toString() {
|
||||
return [this.rawSpaceBefore, this.qualifiedName(this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
_createClass(Namespace, [{
|
||||
key: 'namespace',
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
if (namespace === true || namespace === "*" || namespace === "&") {
|
||||
this._namespace = namespace;
|
||||
if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var escaped = (0, _cssesc2.default)(namespace, { isIdentifier: true });
|
||||
this._namespace = namespace;
|
||||
if (escaped !== namespace) {
|
||||
(0, _util.ensureObject)(this, "raws");
|
||||
this.raws.namespace = escaped;
|
||||
} else if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'ns',
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
}, {
|
||||
key: 'namespaceString',
|
||||
get: function get() {
|
||||
if (this.namespace) {
|
||||
var ns = this.stringifyProperty("namespace");
|
||||
if (ns === true) {
|
||||
return '';
|
||||
} else {
|
||||
return ns;
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Namespace;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Namespace;
|
||||
;
|
||||
module.exports = exports['default'];
|
||||
36
node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
36
node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Nesting = function (_Node) {
|
||||
_inherits(Nesting, _Node);
|
||||
|
||||
function Nesting(opts) {
|
||||
_classCallCheck(this, Nesting);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.NESTING;
|
||||
_this.value = '&';
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Nesting;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Nesting;
|
||||
module.exports = exports['default'];
|
||||
216
node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
216
node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var _util = require('../util');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var cloneNode = function cloneNode(obj, parent) {
|
||||
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var cloned = new obj.constructor();
|
||||
|
||||
for (var i in obj) {
|
||||
if (!obj.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
var value = obj[i];
|
||||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
||||
|
||||
if (i === 'parent' && type === 'object') {
|
||||
if (parent) {
|
||||
cloned[i] = parent;
|
||||
}
|
||||
} else if (value instanceof Array) {
|
||||
cloned[i] = value.map(function (j) {
|
||||
return cloneNode(j, cloned);
|
||||
});
|
||||
} else {
|
||||
cloned[i] = cloneNode(value, cloned);
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
};
|
||||
|
||||
var Node = function () {
|
||||
function Node() {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
_classCallCheck(this, Node);
|
||||
|
||||
Object.assign(this, opts);
|
||||
this.spaces = this.spaces || {};
|
||||
this.spaces.before = this.spaces.before || '';
|
||||
this.spaces.after = this.spaces.after || '';
|
||||
}
|
||||
|
||||
Node.prototype.remove = function remove() {
|
||||
if (this.parent) {
|
||||
this.parent.removeChild(this);
|
||||
}
|
||||
this.parent = undefined;
|
||||
return this;
|
||||
};
|
||||
|
||||
Node.prototype.replaceWith = function replaceWith() {
|
||||
if (this.parent) {
|
||||
for (var index in arguments) {
|
||||
this.parent.insertBefore(this, arguments[index]);
|
||||
}
|
||||
this.remove();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Node.prototype.next = function next() {
|
||||
return this.parent.at(this.parent.index(this) + 1);
|
||||
};
|
||||
|
||||
Node.prototype.prev = function prev() {
|
||||
return this.parent.at(this.parent.index(this) - 1);
|
||||
};
|
||||
|
||||
Node.prototype.clone = function clone() {
|
||||
var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
var cloned = cloneNode(this);
|
||||
for (var name in overrides) {
|
||||
cloned[name] = overrides[name];
|
||||
}
|
||||
return cloned;
|
||||
};
|
||||
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows non standard syntax to be appended to an existing property
|
||||
* by specifying the escaped value. By specifying the escaped value,
|
||||
* illegal characters are allowed to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
|
||||
|
||||
Node.prototype.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
|
||||
if (!this.raws) {
|
||||
this.raws = {};
|
||||
}
|
||||
var originalValue = this[name];
|
||||
var originalEscaped = this.raws[name];
|
||||
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
if (originalEscaped || valueEscaped !== value) {
|
||||
this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
|
||||
} else {
|
||||
delete this.raws[name]; // delete any escaped value that was created by the setter.
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows the escaped value to be specified directly, allowing illegal
|
||||
* characters to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped the escaped value of the property.
|
||||
*/
|
||||
|
||||
|
||||
Node.prototype.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
|
||||
if (!this.raws) {
|
||||
this.raws = {};
|
||||
}
|
||||
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
this.raws[name] = valueEscaped;
|
||||
};
|
||||
|
||||
/**
|
||||
* When you want a value to passed through to CSS directly. This method
|
||||
* deletes the corresponding raw value causing the stringifier to fallback
|
||||
* to the unescaped value.
|
||||
* @param {string} name the property to set.
|
||||
* @param {any} value The value that is both escaped and unescaped.
|
||||
*/
|
||||
|
||||
|
||||
Node.prototype.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
|
||||
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
if (this.raws) {
|
||||
delete this.raws[name];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} line The number (starting with 1)
|
||||
* @param {number} column The column number (starting with 1)
|
||||
*/
|
||||
|
||||
|
||||
Node.prototype.isAtPosition = function isAtPosition(line, column) {
|
||||
if (this.source && this.source.start && this.source.end) {
|
||||
if (this.source.start.line > line) {
|
||||
return false;
|
||||
}
|
||||
if (this.source.end.line < line) {
|
||||
return false;
|
||||
}
|
||||
if (this.source.start.line === line && this.source.start.column > column) {
|
||||
return false;
|
||||
}
|
||||
if (this.source.end.line === line && this.source.end.column < column) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
Node.prototype.stringifyProperty = function stringifyProperty(name) {
|
||||
return this.raws && this.raws[name] || this[name];
|
||||
};
|
||||
|
||||
Node.prototype.toString = function toString() {
|
||||
return [this.rawSpaceBefore, String(this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
_createClass(Node, [{
|
||||
key: 'rawSpaceBefore',
|
||||
get: function get() {
|
||||
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
|
||||
if (rawSpace === undefined) {
|
||||
rawSpace = this.spaces && this.spaces.before;
|
||||
}
|
||||
return rawSpace || "";
|
||||
},
|
||||
set: function set(raw) {
|
||||
(0, _util.ensureObject)(this, "raws", "spaces");
|
||||
this.raws.spaces.before = raw;
|
||||
}
|
||||
}, {
|
||||
key: 'rawSpaceAfter',
|
||||
get: function get() {
|
||||
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
|
||||
if (rawSpace === undefined) {
|
||||
rawSpace = this.spaces.after;
|
||||
}
|
||||
return rawSpace || "";
|
||||
},
|
||||
set: function set(raw) {
|
||||
(0, _util.ensureObject)(this, "raws", "spaces");
|
||||
this.raws.spaces.after = raw;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Node;
|
||||
}();
|
||||
|
||||
exports.default = Node;
|
||||
module.exports = exports['default'];
|
||||
40
node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
40
node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _container = require('./container');
|
||||
|
||||
var _container2 = _interopRequireDefault(_container);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Pseudo = function (_Container) {
|
||||
_inherits(Pseudo, _Container);
|
||||
|
||||
function Pseudo(opts) {
|
||||
_classCallCheck(this, Pseudo);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
|
||||
|
||||
_this.type = _types.PSEUDO;
|
||||
return _this;
|
||||
}
|
||||
|
||||
Pseudo.prototype.toString = function toString() {
|
||||
var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
|
||||
return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
return Pseudo;
|
||||
}(_container2.default);
|
||||
|
||||
exports.default = Pseudo;
|
||||
module.exports = exports['default'];
|
||||
60
node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
60
node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _container = require('./container');
|
||||
|
||||
var _container2 = _interopRequireDefault(_container);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Root = function (_Container) {
|
||||
_inherits(Root, _Container);
|
||||
|
||||
function Root(opts) {
|
||||
_classCallCheck(this, Root);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
|
||||
|
||||
_this.type = _types.ROOT;
|
||||
return _this;
|
||||
}
|
||||
|
||||
Root.prototype.toString = function toString() {
|
||||
var str = this.reduce(function (memo, selector) {
|
||||
memo.push(String(selector));
|
||||
return memo;
|
||||
}, []).join(',');
|
||||
return this.trailingComma ? str + ',' : str;
|
||||
};
|
||||
|
||||
Root.prototype.error = function error(message, options) {
|
||||
if (this._error) {
|
||||
return this._error(message, options);
|
||||
} else {
|
||||
return new Error(message);
|
||||
}
|
||||
};
|
||||
|
||||
_createClass(Root, [{
|
||||
key: 'errorGenerator',
|
||||
set: function set(handler) {
|
||||
this._error = handler;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Root;
|
||||
}(_container2.default);
|
||||
|
||||
exports.default = Root;
|
||||
module.exports = exports['default'];
|
||||
35
node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
35
node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _container = require('./container');
|
||||
|
||||
var _container2 = _interopRequireDefault(_container);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Selector = function (_Container) {
|
||||
_inherits(Selector, _Container);
|
||||
|
||||
function Selector(opts) {
|
||||
_classCallCheck(this, Selector);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
|
||||
|
||||
_this.type = _types.SELECTOR;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Selector;
|
||||
}(_container2.default);
|
||||
|
||||
exports.default = Selector;
|
||||
module.exports = exports['default'];
|
||||
35
node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
35
node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var String = function (_Node) {
|
||||
_inherits(String, _Node);
|
||||
|
||||
function String(opts) {
|
||||
_classCallCheck(this, String);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.STRING;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return String;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = String;
|
||||
module.exports = exports['default'];
|
||||
35
node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
35
node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _namespace = require('./namespace');
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Tag = function (_Namespace) {
|
||||
_inherits(Tag, _Namespace);
|
||||
|
||||
function Tag(opts) {
|
||||
_classCallCheck(this, Tag);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
|
||||
|
||||
_this.type = _types.TAG;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Tag;
|
||||
}(_namespace2.default);
|
||||
|
||||
exports.default = Tag;
|
||||
module.exports = exports['default'];
|
||||
15
node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
15
node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var TAG = exports.TAG = 'tag';
|
||||
var STRING = exports.STRING = 'string';
|
||||
var SELECTOR = exports.SELECTOR = 'selector';
|
||||
var ROOT = exports.ROOT = 'root';
|
||||
var PSEUDO = exports.PSEUDO = 'pseudo';
|
||||
var NESTING = exports.NESTING = 'nesting';
|
||||
var ID = exports.ID = 'id';
|
||||
var COMMENT = exports.COMMENT = 'comment';
|
||||
var COMBINATOR = exports.COMBINATOR = 'combinator';
|
||||
var CLASS = exports.CLASS = 'class';
|
||||
var ATTRIBUTE = exports.ATTRIBUTE = 'attribute';
|
||||
var UNIVERSAL = exports.UNIVERSAL = 'universal';
|
||||
36
node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
36
node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _namespace = require('./namespace');
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Universal = function (_Namespace) {
|
||||
_inherits(Universal, _Namespace);
|
||||
|
||||
function Universal(opts) {
|
||||
_classCallCheck(this, Universal);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
|
||||
|
||||
_this.type = _types.UNIVERSAL;
|
||||
_this.value = '*';
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Universal;
|
||||
}(_namespace2.default);
|
||||
|
||||
exports.default = Universal;
|
||||
module.exports = exports['default'];
|
||||
10
node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
10
node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = sortAscending;
|
||||
function sortAscending(list) {
|
||||
return list.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
};
|
||||
module.exports = exports["default"];
|
||||
39
node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
39
node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var ampersand = exports.ampersand = 38;
|
||||
var asterisk = exports.asterisk = 42;
|
||||
var at = exports.at = 64;
|
||||
var comma = exports.comma = 44;
|
||||
var colon = exports.colon = 58;
|
||||
var semicolon = exports.semicolon = 59;
|
||||
var openParenthesis = exports.openParenthesis = 40;
|
||||
var closeParenthesis = exports.closeParenthesis = 41;
|
||||
var openSquare = exports.openSquare = 91;
|
||||
var closeSquare = exports.closeSquare = 93;
|
||||
var dollar = exports.dollar = 36;
|
||||
var tilde = exports.tilde = 126;
|
||||
var caret = exports.caret = 94;
|
||||
var plus = exports.plus = 43;
|
||||
var equals = exports.equals = 61;
|
||||
var pipe = exports.pipe = 124;
|
||||
var greaterThan = exports.greaterThan = 62;
|
||||
var space = exports.space = 32;
|
||||
var singleQuote = exports.singleQuote = 39;
|
||||
var doubleQuote = exports.doubleQuote = 34;
|
||||
var slash = exports.slash = 47;
|
||||
var bang = exports.bang = 33;
|
||||
|
||||
var backslash = exports.backslash = 92;
|
||||
var cr = exports.cr = 13;
|
||||
var feed = exports.feed = 12;
|
||||
var newline = exports.newline = 10;
|
||||
var tab = exports.tab = 9;
|
||||
|
||||
// Expose aliases primarily for readability.
|
||||
var str = exports.str = singleQuote;
|
||||
|
||||
// No good single character representation!
|
||||
var comment = exports.comment = -1;
|
||||
var word = exports.word = -2;
|
||||
var combinator = exports.combinator = -3;
|
||||
271
node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
271
node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.FIELDS = undefined;
|
||||
|
||||
var _unescapable, _wordDelimiters;
|
||||
|
||||
exports.default = tokenize;
|
||||
|
||||
var _tokenTypes = require('./tokenTypes');
|
||||
|
||||
var t = _interopRequireWildcard(_tokenTypes);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
|
||||
var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
|
||||
|
||||
var hex = {};
|
||||
var hexChars = "0123456789abcdefABCDEF";
|
||||
for (var i = 0; i < hexChars.length; i++) {
|
||||
hex[hexChars.charCodeAt(i)] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last index of the bar css word
|
||||
* @param {string} css The string in which the word begins
|
||||
* @param {number} start The index into the string where word's first letter occurs
|
||||
*/
|
||||
function consumeWord(css, start) {
|
||||
var next = start;
|
||||
var code = void 0;
|
||||
do {
|
||||
code = css.charCodeAt(next);
|
||||
if (wordDelimiters[code]) {
|
||||
return next - 1;
|
||||
} else if (code === t.backslash) {
|
||||
next = consumeEscape(css, next) + 1;
|
||||
} else {
|
||||
// All other characters are part of the word
|
||||
next++;
|
||||
}
|
||||
} while (next < css.length);
|
||||
return next - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last index of the escape sequence
|
||||
* @param {string} css The string in which the sequence begins
|
||||
* @param {number} start The index into the string where escape character (`\`) occurs.
|
||||
*/
|
||||
function consumeEscape(css, start) {
|
||||
var next = start;
|
||||
var code = css.charCodeAt(next + 1);
|
||||
if (unescapable[code]) {
|
||||
// just consume the escape char
|
||||
} else if (hex[code]) {
|
||||
var hexDigits = 0;
|
||||
// consume up to 6 hex chars
|
||||
do {
|
||||
next++;
|
||||
hexDigits++;
|
||||
code = css.charCodeAt(next + 1);
|
||||
} while (hex[code] && hexDigits < 6);
|
||||
// if fewer than 6 hex chars, a trailing space ends the escape
|
||||
if (hexDigits < 6 && code === t.space) {
|
||||
next++;
|
||||
}
|
||||
} else {
|
||||
// the next char is part of the current word
|
||||
next++;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
var FIELDS = exports.FIELDS = {
|
||||
TYPE: 0,
|
||||
START_LINE: 1,
|
||||
START_COL: 2,
|
||||
END_LINE: 3,
|
||||
END_COL: 4,
|
||||
START_POS: 5,
|
||||
END_POS: 6
|
||||
};
|
||||
|
||||
function tokenize(input) {
|
||||
var tokens = [];
|
||||
var css = input.css.valueOf();
|
||||
var _css = css,
|
||||
length = _css.length;
|
||||
|
||||
var offset = -1;
|
||||
var line = 1;
|
||||
var start = 0;
|
||||
var end = 0;
|
||||
|
||||
var code = void 0,
|
||||
content = void 0,
|
||||
endColumn = void 0,
|
||||
endLine = void 0,
|
||||
escaped = void 0,
|
||||
escapePos = void 0,
|
||||
last = void 0,
|
||||
lines = void 0,
|
||||
next = void 0,
|
||||
nextLine = void 0,
|
||||
nextOffset = void 0,
|
||||
quote = void 0,
|
||||
tokenType = void 0;
|
||||
|
||||
function unclosed(what, fix) {
|
||||
if (input.safe) {
|
||||
// fyi: this is never set to true.
|
||||
css += fix;
|
||||
next = css.length - 1;
|
||||
} else {
|
||||
throw input.error('Unclosed ' + what, line, start - offset, start);
|
||||
}
|
||||
}
|
||||
|
||||
while (start < length) {
|
||||
code = css.charCodeAt(start);
|
||||
|
||||
if (code === t.newline) {
|
||||
offset = start;
|
||||
line += 1;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
case t.space:
|
||||
case t.tab:
|
||||
case t.newline:
|
||||
case t.cr:
|
||||
case t.feed:
|
||||
next = start;
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
if (code === t.newline) {
|
||||
offset = next;
|
||||
line += 1;
|
||||
}
|
||||
} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
|
||||
|
||||
tokenType = t.space;
|
||||
endLine = line;
|
||||
endColumn = next - offset - 1;
|
||||
end = next;
|
||||
break;
|
||||
|
||||
case t.plus:
|
||||
case t.greaterThan:
|
||||
case t.tilde:
|
||||
case t.pipe:
|
||||
next = start;
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
|
||||
|
||||
tokenType = t.combinator;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next;
|
||||
break;
|
||||
|
||||
// Consume these characters as single tokens.
|
||||
case t.asterisk:
|
||||
case t.ampersand:
|
||||
case t.bang:
|
||||
case t.comma:
|
||||
case t.equals:
|
||||
case t.dollar:
|
||||
case t.caret:
|
||||
case t.openSquare:
|
||||
case t.closeSquare:
|
||||
case t.colon:
|
||||
case t.semicolon:
|
||||
case t.openParenthesis:
|
||||
case t.closeParenthesis:
|
||||
next = start;
|
||||
tokenType = code;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
|
||||
case t.singleQuote:
|
||||
case t.doubleQuote:
|
||||
quote = code === t.singleQuote ? "'" : '"';
|
||||
next = start;
|
||||
do {
|
||||
escaped = false;
|
||||
next = css.indexOf(quote, next + 1);
|
||||
if (next === -1) {
|
||||
unclosed('quote', quote);
|
||||
}
|
||||
escapePos = next;
|
||||
while (css.charCodeAt(escapePos - 1) === t.backslash) {
|
||||
escapePos -= 1;
|
||||
escaped = !escaped;
|
||||
}
|
||||
} while (escaped);
|
||||
|
||||
tokenType = t.str;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
|
||||
next = css.indexOf('*/', start + 2) + 1;
|
||||
if (next === 0) {
|
||||
unclosed('comment', '*/');
|
||||
}
|
||||
|
||||
content = css.slice(start, next + 1);
|
||||
lines = content.split('\n');
|
||||
last = lines.length - 1;
|
||||
|
||||
if (last > 0) {
|
||||
nextLine = line + last;
|
||||
nextOffset = next - lines[last].length;
|
||||
} else {
|
||||
nextLine = line;
|
||||
nextOffset = offset;
|
||||
}
|
||||
|
||||
tokenType = t.comment;
|
||||
line = nextLine;
|
||||
endLine = nextLine;
|
||||
endColumn = next - nextOffset;
|
||||
} else if (code === t.slash) {
|
||||
next = start;
|
||||
tokenType = code;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
} else {
|
||||
next = consumeWord(css, start);
|
||||
tokenType = t.word;
|
||||
endLine = line;
|
||||
endColumn = next - offset;
|
||||
}
|
||||
|
||||
end = next + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// Ensure that the token structure remains consistent
|
||||
tokens.push([tokenType, // [0] Token type
|
||||
line, // [1] Starting line
|
||||
start - offset, // [2] Starting column
|
||||
endLine, // [3] Ending line
|
||||
endColumn, // [4] Ending column
|
||||
start, // [5] Start position / Source index
|
||||
end] // [6] End position
|
||||
);
|
||||
|
||||
// Reset offset for the next token
|
||||
if (nextOffset) {
|
||||
offset = nextOffset;
|
||||
nextOffset = null;
|
||||
}
|
||||
|
||||
start = end;
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
20
node_modules/postcss-selector-parser/dist/util/ensureObject.js
generated
vendored
Normal file
20
node_modules/postcss-selector-parser/dist/util/ensureObject.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = ensureObject;
|
||||
function ensureObject(obj) {
|
||||
for (var _len = arguments.length, props = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
props[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
while (props.length > 0) {
|
||||
var prop = props.shift();
|
||||
|
||||
if (!obj[prop]) {
|
||||
obj[prop] = {};
|
||||
}
|
||||
|
||||
obj = obj[prop];
|
||||
}
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
22
node_modules/postcss-selector-parser/dist/util/getProp.js
generated
vendored
Normal file
22
node_modules/postcss-selector-parser/dist/util/getProp.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = getProp;
|
||||
function getProp(obj) {
|
||||
for (var _len = arguments.length, props = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
props[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
while (props.length > 0) {
|
||||
var prop = props.shift();
|
||||
|
||||
if (!obj[prop]) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
obj = obj[prop];
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
41
node_modules/postcss-selector-parser/dist/util/index.js
generated
vendored
Normal file
41
node_modules/postcss-selector-parser/dist/util/index.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _unesc = require('./unesc');
|
||||
|
||||
Object.defineProperty(exports, 'unesc', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_unesc).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _getProp = require('./getProp');
|
||||
|
||||
Object.defineProperty(exports, 'getProp', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_getProp).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ensureObject = require('./ensureObject');
|
||||
|
||||
Object.defineProperty(exports, 'ensureObject', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ensureObject).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _stripComments = require('./stripComments');
|
||||
|
||||
Object.defineProperty(exports, 'stripComments', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_stripComments).default;
|
||||
}
|
||||
});
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
21
node_modules/postcss-selector-parser/dist/util/stripComments.js
generated
vendored
Normal file
21
node_modules/postcss-selector-parser/dist/util/stripComments.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = stripComments;
|
||||
function stripComments(str) {
|
||||
var s = "";
|
||||
var commentStart = str.indexOf("/*");
|
||||
var lastEnd = 0;
|
||||
while (commentStart >= 0) {
|
||||
s = s + str.slice(lastEnd, commentStart);
|
||||
var commentEnd = str.indexOf("*/", commentStart + 2);
|
||||
if (commentEnd < 0) {
|
||||
return s;
|
||||
}
|
||||
lastEnd = commentEnd + 2;
|
||||
commentStart = str.indexOf("/*", lastEnd);
|
||||
}
|
||||
s = s + str.slice(lastEnd);
|
||||
return s;
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
18
node_modules/postcss-selector-parser/dist/util/unesc.js
generated
vendored
Normal file
18
node_modules/postcss-selector-parser/dist/util/unesc.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = unesc;
|
||||
var HEX_ESC = /\\(?:([0-9a-fA-F]{6})|([0-9a-fA-F]{1,5})(?: |(?![0-9a-fA-F])))/g;
|
||||
var OTHER_ESC = /\\(.)/g;
|
||||
function unesc(str) {
|
||||
str = str.replace(HEX_ESC, function (_, hex1, hex2) {
|
||||
var hex = hex1 || hex2;
|
||||
var code = parseInt(hex, 16);
|
||||
return String.fromCharCode(code);
|
||||
});
|
||||
str = str.replace(OTHER_ESC, function (_, char) {
|
||||
return char;
|
||||
});
|
||||
return str;
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
Reference in New Issue
Block a user