mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
[JIT] Support CSS Variables in arbitrary calc (#4147)
This commit is contained in:
parent
2db2f60393
commit
7c0e4bce4d
@ -112,7 +112,10 @@ function asValue(modifier, lookup = {}, { validate = () => true, transform = (v)
|
||||
}
|
||||
|
||||
// add spaces around operators inside calc() that do not follow an operator or (
|
||||
return transform(value).replace(/(?<=^calc\(.+?)(?<![-+*/(])([-+*/])/g, ' $1 ')
|
||||
return transform(value).replace(
|
||||
/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g,
|
||||
'$1 $2 '
|
||||
)
|
||||
}
|
||||
|
||||
function asUnit(modifier, units, lookup = {}) {
|
||||
|
||||
@ -49,9 +49,18 @@
|
||||
.w-\[calc\(100\%\+1rem\)\] {
|
||||
width: calc(100% + 1rem);
|
||||
}
|
||||
.w-\[calc\(var\(--10-10px\2c calc\(-20px-\(-30px--40px\)\)\)-50px\)\] {
|
||||
width: calc(var(--10-10px, calc(-20px - (-30px - -40px))) - 50px);
|
||||
}
|
||||
.w-\[var\(--width\)\] {
|
||||
width: var(--width);
|
||||
}
|
||||
.w-\[var\(--width\2c calc\(100\%\+1rem\)\)\] {
|
||||
width: var(--width, calc(100% + 1rem));
|
||||
}
|
||||
.w-\[calc\(100\%\/3-1rem\*2\)\] {
|
||||
width: calc(100% / 3 - 1rem * 2);
|
||||
}
|
||||
.min-w-\[3\.23rem\] {
|
||||
min-width: 3.23rem;
|
||||
}
|
||||
|
||||
@ -16,7 +16,10 @@
|
||||
<div class="border-[2.5px]"></div>
|
||||
<div class="w-[3.23rem]"></div>
|
||||
<div class="w-[calc(100%+1rem)]"></div>
|
||||
<div class="w-[calc(var(--10-10px,calc(-20px-(-30px--40px)))-50px)]"></div>
|
||||
<div class="w-[var(--width)]"></div>
|
||||
<div class="w-[var(--width,calc(100%+1rem))]"></div>
|
||||
<div class="w-[calc(100%/3-1rem*2)]"></div>
|
||||
<div class="min-w-[3.23rem]"></div>
|
||||
<div class="min-w-[calc(100%+1rem)]"></div>
|
||||
<div class="min-w-[var(--width)]"></div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user