Comparing version 2.2.3 to 2.3.0
{ | ||
"name": "style-mod", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"description": "A minimal CSS module shim", | ||
@@ -5,0 +5,0 @@ "main": "dist/style-mod.cjs", |
@@ -88,2 +88,3 @@ function sym(name, random) { | ||
this.modules = [] | ||
root[SET] = this | ||
} | ||
@@ -121,2 +122,10 @@ | ||
function extendSelector(template, sel) { | ||
return sel.split(/\s*,\s*/).map(sel => { | ||
let cut = sel.indexOf("/*|*/") | ||
let prefix = cut < 0 ? "" : sel.slice(0, cut + 5) | ||
return prefix + template.replace(/&/g, cut < 0 ? sel : sel.slice(cut + 5)) | ||
}).join(", ") | ||
} | ||
function renderStyle(selector, spec, output) { | ||
@@ -131,3 +140,3 @@ if (typeof spec != "object") throw new RangeError("Expected style object, got " + JSON.stringify(spec)) | ||
} else if (/&/.test(prop)) { | ||
renderStyle(selector.split(/\s*,\s*/).map(sel => prop.replace(/&/g, sel)).join(", "), spec[prop], output) | ||
renderStyle(extendSelector(prop, selector), spec[prop], output) | ||
} else if (prop != "specificity") { | ||
@@ -134,0 +143,0 @@ if (typeof spec[prop] == "object") throw new RangeError("The value of a property (" + prop + ") should be a primitive value.") |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23926
412