Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// /deep/ alias for >>>, since >>> doesn't work in SASS
if (n.type === 'combinator' && n.value === '/deep/') {
n.value = ' '
n.spaces.before = n.spaces.after = ''
return false
}
if (n.type !== 'pseudo' && n.type !== 'combinator') {
node = n
}
})
if (node) {
node.spaces.after = ''
selector.insertAfter(
node,
selectorParser.className( {
value: id
} )
)
}
})
}).processSync(node.selector)
}
// /deep/ alias for >>>, since >>> doesn't work in SASS
if (n.type === 'tag' && n.value === '/deep/') {
var next = n.next()
if (next.type === 'combinator' && next.value === ' ') {
next.remove()
}
n.remove()
return false
}
if (n.type !== 'pseudo' && n.type !== 'combinator') {
node = n
}
})
selector.insertAfter(node, selectorParser.className({
value: opts.id
}))
// TODO, options for mp
// selector.insertAfter(node, selectorParser.attribute({
// attribute: opts.id
// }))
// selector.prepend(selectorParser.className({
// value: `${opts.id} `
// }))
})
}).process(node.selector).result
constructor(key: string, scope: RuleScope, root: postcss.Root, selectorContext: ParsedSelector | undefined) {
this.key = key;
this.scopes = [scope];
this.root = root;
this.selectorContext = selectorContext;
this.declarationMap = new Dictionary>();
this.authoredProps = new Set();
this.declarationInfos = new Set();
let specificitySelector = selectorContext &&
selectorContext.toContext(selectorParser.className({ value: "foo" }));
this.specificity = specificitySelector &&
specificity.calculate(specificitySelector.toString())[0];
}
if (isOnlyPseudoRootSelector(selector)) {
selector.first.replaceWith(selectorParser.className({value: `${ns}-root`}));
map[sourceSelector] = String(`${ns}-root`).replace(/^\./, '');
} else {
for (let i = 0, n = selector.nodes.length; i < n; i++) {
if (isClassSelectorNode(selector, i)) {
let newClass = classNameCache.get(selector.nodes[i].value);
if (!newClass) {
newClass = selectorParser.className({value: `${ns}-${selector.nodes[i].value}`});
classNameCache.set(selector.nodes[i].value, newClass);
}
selector.nodes[i].replaceWith(newClass);
map[sourceSelector] = String(selector.last).replace(/^\./, '');
} else if (isClassWithAttributeSelectorNode(selector, i)) {
const classSelector = selectorParser.className({value: ns});
selector.insertBefore(selector.nodes[i], classSelector);
map[sourceSelector] = String(classSelector).replace(/^\./, '');
}
}
if (selector.last.type === selectorParser.TAG) {
selector.last.replaceWith(selectorParser.className({value:
`${ns}-${selector.last.value}`}));
map[sourceSelector] = String(selector.last).replace(/^\./, '');
}
}
});
};
file.exports[name].forEach((value) =>
s.append(selector.className({ value }))
);
private mutate(e: Exportable, selComponent, selector, contextCB: (newClass:any) => void) {
let newClass = selectorParser.className({value: e.cssClass(this.opts)});
if (selComponent.parent === selector) { contextCB(newClass); }
return [selComponent, newClass];
}
nodes.map(node => {
const { operator, attribute, raws: { unquoted, insensitive }} = node;
const attributeId = operator ? unique(operator + unquoted) : '';
const attributeClassName = `${ componentName }-${ attribute }_${ attributeId }_${ id }`;
node.replaceWith(parser.className({ value: attributeClassName }));
return {
operator,
name: attribute,
value: unquoted,
insensitive,
className: attributeClassName,
};
});
nextCombinatorIndex = selector.nodes.length;
blockComponents.add(componentName);
}
const attributeNodes = getAttributeNodes(tagIndex, nextCombinatorIndex, selector.nodes);
components = _.update(
componentName,
_.flow([
_.set('className', componentClassName),
_.update('attributes', (attributes = []) => [
...attributes,
...parseAttributeNodes(id, componentName, attributeNodes),
]),
]),
components
);
tag.replaceWith(parser.className({ value: componentClassName }));
}
}
};
try {
container.walkNesting(node => {
const className = getDefaultClassName();
const replacementNode = selectorParser.className({ value: className });
node.replaceWith(replacementNode);
});