Skip calc() normalisation in nested theme() calls (#11705)
* add `calc` normalisation test cases using `theme()` * ignore formatting in some known functions, such as `theme` * update changelog
This commit is contained in:
parent
ae4d21308d
commit
a72d97cebb
3 changed files with 14 additions and 0 deletions
|
|
@ -59,6 +59,8 @@ export function normalize(value, isRoot = true) {
|
|||
* @returns {string}
|
||||
*/
|
||||
function normalizeMathOperatorSpacing(value) {
|
||||
let preventFormattingInFunctions = ['theme']
|
||||
|
||||
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match) => {
|
||||
let result = ''
|
||||
|
||||
|
|
@ -100,6 +102,11 @@ function normalizeMathOperatorSpacing(value) {
|
|||
result += consumeUntil([')', ','])
|
||||
}
|
||||
|
||||
// Skip formatting inside known functions
|
||||
else if (preventFormattingInFunctions.some((fn) => peek(fn))) {
|
||||
result += consumeUntil([')'])
|
||||
}
|
||||
|
||||
// Handle operators
|
||||
else if (
|
||||
['+', '-', '*', '/'].includes(char) &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue