Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error('Could not find import name for ' + rule);
}
if (PROTOCOL_RE.test(dep)) {
return;
}
// If this came from an inline <style> tag, don't inline the imported file. Replace with the correct URL instead.
// TODO: run CSSPackager on inline style tags.
let inlineHTML =
this.options.rendition && this.options.rendition.inlineHTML;
if (inlineHTML) {
name.value = this.addURLDependency(dep, {loc: rule.source.start});
rule.params = params.toString();
} else {
media = valueParser.stringify(media).trim();
this.addDependency(dep, {media, loc: rule.source.start});
rule.remove();
}
this.ast.dirty = true;
});
</style>
export default (node, localOpts, direction, decl, firstColumnSetLength, foundColumnsAndRows, prevSourceIndex, locallySpecified, lastColumnSetLength) => {
// Grab all the contents within the function and sort them into size sets.
const value: string = valueParser.stringify(node.nodes)
const sizeSets: Array = postcss.list.comma(value)
let totalSizes: number = 0
sizeSets.map(sizeSet => {
totalSizes += postcss.list.space(sizeSet).length
})
// Determine if this is the last/first columns() or rows() call in the declaration value.
let lastCall: boolean = false
let firstCall: boolean = false
if (node.sourceIndex > prevSourceIndex) {
lastCall = true
}
if (node.sourceIndex === 0){
firstCall = true
}
break
case `${localOpts.namespace}support`:
localOpts.support = valueParser.stringify(node.nodes) ? valueParser.stringify(node.nodes) : opts.support
break
case `${localOpts.namespace}pluck`:
localOpts.pluck = Number(valueParser.stringify(node.nodes)) ? Number(valueParser.stringify(node.nodes)) : opts.pluck
break
case `${localOpts.namespace}bump`:
localOpts.bump = ` ${valueParser.stringify(node.nodes)}` ? ` ${valueParser.stringify(node.nodes)}` : opts.bump
break
case `${localOpts.namespace}technique`:
localOpts.technique = valueParser.stringify(node.nodes) ? valueParser.stringify(node.nodes) : opts.technique
break
case `${localOpts.namespace}children`:
localOpts.children = valueParser.stringify(node.nodes) ? valueParser.stringify(node.nodes) : opts.children
break
default:
break
}
// Poorly erase the function (leaves whitespace). It would be nice if there was a .remove() method in valueParser.
node.value = ''
}
}, false) // shallow
_proto.oldWebkit = function oldWebkit(node) {
var nodes = node.nodes;
var string = parser.stringify(node.nodes);
if (this.name !== 'linear-gradient') {
return false;
}
if (nodes[0] && nodes[0].value.includes('deg')) {
return false;
}
if (string.includes('px') || string.includes('-corner') || string.includes('-side')) {
return false;
}
var params = [[]];
for (var _iterator4 = _createForOfIteratorHelperLoose(nodes), _step4; !(_step4 = _iterator4()).done;) {
Gradient.prototype.oldWebkit = function oldWebkit(node) {
var nodes = node.nodes;
var string = parser.stringify(node.nodes);
if (this.name !== 'linear-gradient') {
return false;
}
if (nodes[0] && nodes[0].value.indexOf('deg') !== -1) {
return false;
}
if (string.indexOf('px') !== -1 || string.indexOf('-corner') !== -1 || string.indexOf('-side') !== -1) {
return false;
}
var params = [[]];
for (var _iterator3 = nodes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
var matchColor = function matchColor(node) {
if (node.type === 'word' && (hexColorRe.test(node.value) || node.value in cssColorKeywords || node.value === 'transparent')) {
return node.value;
} else if (node.type === 'function' && cssFunctionNameRe.test(node.value)) {
return parse.stringify(node);
}
return null;
};
valueParser(value).walk((valueNode) => {
if (valueNode.type !== 'word') {
return;
}
valuesToShorthand.push(valueParser.stringify(valueNode));
});
}
if (
child.nodes[i + 1] &&
child.nodes[i + 1].value === ':'
) {
n.value = span(n.value, t.property);
}
}
});
child.value = span('(', t.parenthesis) +
stringify(child.nodes) +
span(')', t.parenthesis);
child.nodes = null;
}
});
params = stringify(parsed);
}
if (typeof node.raws.afterName !== 'undefined') {
name += node.raws.afterName;
} else if (params) {
name += ' ';
}
if (node.nodes) {
this.block(node, span(name + params, t.atRule));
} else {
let semi = semicolon ? span(';', t.semicolon) : '';
let end = (node.raws.between || '') + semi;
this.builder(span(name + params + end, t.atRule), node);
}
}
.forEach(e => {
proxyAllCssVar.appendKeyframes(
root,
e.type === "function" ? valueParser.stringify(e) : e.value
);
});
});
Gradient.prototype.colorStops = function colorStops(params) {
var result = [];
for (var i = 0; i < params.length; i++) {
var pos = void 0;
var param = params[i];
var item = void 0;
if (i === 0) {
continue;
}
var color = parser.stringify(param[0]);
if (param[1] && param[1].type === 'word') {
pos = param[1].value;
} else if (param[2] && param[2].type === 'word') {
pos = param[2].value;
}
var stop = void 0;
if (i === 1 && (!pos || pos === '0%')) {
stop = 'from(' + color + ')';
} else if (i === params.length - 1 && (!pos || pos === '100%')) {
stop = 'to(' + color + ')';
} else if (pos) {
stop = 'color-stop(' + pos + ', ' + color + ')';
} else {
stop = 'color-stop(' + color + ')';
}