@mattsjones/css-core
Advanced tools
Comparing version 0.0.11 to 0.0.12
# @mattsjones/css-core | ||
## 0.0.12 | ||
### Patch Changes | ||
- 29fa416: Fix selectors using class lists | ||
## 0.0.11 | ||
@@ -4,0 +10,0 @@ |
@@ -98,3 +98,3 @@ 'use strict'; | ||
this.conditionalRules = []; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(^|[^\.])(${localClassNames.join('|')})`, 'g') : null; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(${localClassNames.join('|')})`, 'g') : null; | ||
} | ||
@@ -187,5 +187,11 @@ | ||
transformSelector(selector) { | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, leadingChar, className) => `${leadingChar}.${cssesc__default['default'](className, { | ||
isIdentifier: true | ||
})}`) : selector; | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, className, index) => { | ||
if (index > 0 && selector[index - 1] === '.') { | ||
return className; | ||
} | ||
return `.${cssesc__default['default'](className, { | ||
isIdentifier: true | ||
})}`; | ||
}) : selector; | ||
} | ||
@@ -192,0 +198,0 @@ |
@@ -82,3 +82,3 @@ import postcssJs from 'postcss-js'; | ||
this.conditionalRules = []; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(^|[^\.])(${localClassNames.join('|')})`, 'g') : null; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(${localClassNames.join('|')})`, 'g') : null; | ||
} | ||
@@ -171,5 +171,11 @@ | ||
transformSelector(selector) { | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, leadingChar, className) => `${leadingChar}.${cssesc(className, { | ||
isIdentifier: true | ||
})}`) : selector; | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, className, index) => { | ||
if (index > 0 && selector[index - 1] === '.') { | ||
return className; | ||
} | ||
return `.${cssesc(className, { | ||
isIdentifier: true | ||
})}`; | ||
}) : selector; | ||
} | ||
@@ -176,0 +182,0 @@ |
@@ -98,3 +98,3 @@ 'use strict'; | ||
this.conditionalRules = []; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(^|[^\.])(${localClassNames.join('|')})`, 'g') : null; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(${localClassNames.join('|')})`, 'g') : null; | ||
} | ||
@@ -187,5 +187,11 @@ | ||
transformSelector(selector) { | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, leadingChar, className) => `${leadingChar}.${cssesc__default['default'](className, { | ||
isIdentifier: true | ||
})}`) : selector; | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, className, index) => { | ||
if (index > 0 && selector[index - 1] === '.') { | ||
return className; | ||
} | ||
return `.${cssesc__default['default'](className, { | ||
isIdentifier: true | ||
})}`; | ||
}) : selector; | ||
} | ||
@@ -192,0 +198,0 @@ |
@@ -98,3 +98,3 @@ 'use strict'; | ||
this.conditionalRules = []; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(^|[^\.])(${localClassNames.join('|')})`, 'g') : null; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(${localClassNames.join('|')})`, 'g') : null; | ||
} | ||
@@ -187,5 +187,11 @@ | ||
transformSelector(selector) { | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, leadingChar, className) => `${leadingChar}.${cssesc__default['default'](className, { | ||
isIdentifier: true | ||
})}`) : selector; | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, className, index) => { | ||
if (index > 0 && selector[index - 1] === '.') { | ||
return className; | ||
} | ||
return `.${cssesc__default['default'](className, { | ||
isIdentifier: true | ||
})}`; | ||
}) : selector; | ||
} | ||
@@ -192,0 +198,0 @@ |
@@ -82,3 +82,3 @@ import postcssJs from 'postcss-js'; | ||
this.conditionalRules = []; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(^|[^\.])(${localClassNames.join('|')})`, 'g') : null; | ||
this.localClassNameRegex = localClassNames.length > 0 ? RegExp(`(${localClassNames.join('|')})`, 'g') : null; | ||
} | ||
@@ -171,5 +171,11 @@ | ||
transformSelector(selector) { | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, leadingChar, className) => `${leadingChar}.${cssesc(className, { | ||
isIdentifier: true | ||
})}`) : selector; | ||
return this.localClassNameRegex ? selector.replace(this.localClassNameRegex, (_, className, index) => { | ||
if (index > 0 && selector[index - 1] === '.') { | ||
return className; | ||
} | ||
return `.${cssesc(className, { | ||
isIdentifier: true | ||
})}`; | ||
}) : selector; | ||
} | ||
@@ -176,0 +182,0 @@ |
{ | ||
"name": "@mattsjones/css-core", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "dist/mattsjones-css-core.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/mattsjones-css-core.esm.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
101626
2542
0