14 Commits

Author SHA1 Message Date
Jordan Pittman
e2b47e8a5e
v3: Don’t break sibling-*() functions when used inside calc(…) (#19335)
The implementation of v3's math operator normalization uses a safe-list
of function names. Need to add `sibling-index()` and `sibling-count()`
to this list otherwise when used inside math functions like `calc()`
they'll get spaces around the `-`.
2025-11-19 10:35:48 -05:00
Robin Malfait
6d9ae82ba3
Allow anchor-size(…) in arbitrary values (#14393)
This PR fixes an issue where using `anchor-size` in arbitrary values
resulted in the incorrect css.

Input: `w-[calc(anchor-size(width)+8px)]`
Output:
```css
.w-\[calc\(anchor-size\(width\)\+8px\)\] {
  width: calc(anchor - size(width) + 8px);
}
```

This PR fixes that, by generating the correct CSS:
```css
.w-\[calc\(anchor-size\(width\)\+8px\)\] {
  width: calc(anchor-size(width) + 8px);
}
```
2024-09-11 19:23:53 +02:00
Jordan Pittman
9e928ce0be
Disable automatic var() injection for anchor properties (#13826)
* Disable automatic `var()` injection for CSS anchor positioning properties

* Update tests

* Update changelog
2024-06-13 09:19:08 -04:00
Robin Malfait
44b3b429a8
Cleanup oxide — Part #2 (#13312)
* remove all oxide related code

* Update lightningcss to version 1.24.1

* update tests to match bumped Lightning CSS output

---------

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2024-03-22 17:12:14 +01:00
Jordan Pittman
78fedd5cc0 Don't add spaces to gradients and grid track names when followed by calc() (#12704)
* Don’t break gradient functions when following `calc()`

* Don’t break CSS grid track names

* Update changelog
2024-01-03 13:05:06 -05:00
Jordan Pittman
b6d5eca564 Don’t add spaces to negative numbers following a comma (#12324)
* Don’t add spaces to negative numbers following a comma

* Update changelog
2023-10-30 14:45:46 -04:00
Robin Malfait
4b12f838fe
Fix incorrect spaces around - in calc() expression (#12283)
* sync package-lock.json

* prevent formatting inside `env()` when formatting `calc` function

* prevent formatting keywords in `calc`

* add dedicated normalization tests

* `calc()` in `env()` should be formatted

* update changelog
2023-10-25 15:29:29 +02:00
Robin Malfait
2514820dd4 Improve automatic var injection (#12236)
* prevent automatic var injection for properties that accept `<dashed-ident>` for the value

* add test

* add `font-palette`

* improve readability
2023-10-24 13:00:02 -04:00
Robin Malfait
7720e16fa2 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
2023-10-23 15:24:08 -04:00
Robin Malfait
bfd042058d Improve normalisation of calc()-like functions (#11686)
* parse the `calc()`-like expressions and format them

* update changelog

* Add test case for double negatives

wanted to be sure this worked

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-10-23 15:23:15 -04:00
Adam Wathan
42136e94ce
Run test suite against both engines (#10373)
* Run test suite against both engines

* make eslint happy

* only run `stable` tests on Node 12

* use normal expectation instead of snapshot file

When we run the tests only against `stable` (for node 12), then the
snapshots exists for the `Oxide` build. They are marked as `obsolete`
and will cause the `npm run test` script to fail. Sadly.

Inlined them for now, but ideally we make those tests more blackbox-y so
that we test that we get source maps and that we can map the sourcemap
back to the input files (without looking at the actual annotations).

* properly indent inline css

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-01-20 18:45:04 +01:00
Jordan Pittman
00af2e8947
Don’t add spaces around raw / that are preceded by numbers (#8688)
* Don’t add spaces around raw `/` that are preceded by numbers

* Update changelog
2022-06-20 10:49:55 -04:00
Dany Castillo
aad299cf90
Fix missing spaces around arithmetic operators (#8615)
* add tests for spaced around operators in CSS math functions

* fix CSS math functons besides calc not getting the love they deserve

* improve comment

* update changelog

* update changelog

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2022-06-13 11:58:07 +02:00
Jordan Pittman
34c1e36c2a
Don’t split vars with numbers in them inside arbitrary values (#8091)
* Don’t mangle vars with numbers in them

* Update changelog
2022-04-13 09:31:10 -04:00