Explicitly configure Lightning CSS features, and prefer user browserslist over default browserslist (#11402)

* exclude `Features.LogicalProperties` lightningcss feature

We don't want this to automatically apply since we have dedicated
logical property based utilities already.

We also have a feature flag to toggle some utilities to make use of
logical property based ones.

This feature should be opt-in to prevent backwards compatibility (e.g.:
RTL sites that _did_ use a mr-4 explicitly).

* update default browserslist

* explicitly include/exclude Lightning CSS features

* update tests based on new browserslist and include/exclude features from Lightning CSS

* update integration tests

* prefer user browserslist, fallback to built-in browserslist

* always include Nesting

If a custom browserslist config is used, then we don't explicitly set
the include/exclude features from Lightning CSS (except for nesting, we
always want to process nesting)

* ensure to fallback to the current working directory

* update changelog
This commit is contained in:
Robin Malfait 2023-06-09 20:37:36 +02:00 • committed by GitHub
parent ea3d9cd57a
commit ef2ebb28d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 1367 additions and 556 deletions

View file

@ -82,7 +82,7 @@ test('it parses nested pseudo-selectors', () => {
test('it parses top-level media queries', () => {
let result = parseObjectStyles({
'@media (width >= 200px)': {
'@media (min-width: 200px)': {
'.foo': {
backgroundColor: 'orange',
},
@ -90,7 +90,7 @@ test('it parses top-level media queries', () => {
})
expect(toCss(result)).toMatchFormattedCss(css`
@media (width >= 200px) {
@media (min-width: 200px) {
.foo {
background-color: orange;
}
@ -104,7 +104,7 @@ test('it parses nested media queries', () => {
backgroundColor: 'red',
color: 'white',
padding: '1rem',
'@media (width >= 200px)': {
'@media (min-width: 200px)': {
backgroundColor: 'orange',
},
},
@ -116,7 +116,7 @@ test('it parses nested media queries', () => {
color: white;
padding: 1rem;
}
@media (width >= 200px) {
@media (min-width: 200px) {
.foo {
background-color: orange;
}
@ -157,7 +157,7 @@ test('it parses pseudo-selectors in nested media queries', () => {
color: 'white',
padding: '1rem',
'&:hover': {
'@media (width >= 200px)': {
'@media (min-width: 200px)': {
backgroundColor: 'orange',
},
},
@ -170,7 +170,7 @@ test('it parses pseudo-selectors in nested media queries', () => {
color: white;
padding: 1rem;
}
@media (width >= 200px) {
@media (min-width: 200px) {
.foo:hover {
background-color: orange;
}
@ -232,7 +232,7 @@ test('it parses nested multi-class selectors in media queries', () => {
backgroundColor: 'red',
color: 'white',
padding: '1rem',
'@media (width >= 200px)': {
'@media (min-width: 200px)': {
'&.bar': {
backgroundColor: 'orange',
},
@ -246,7 +246,7 @@ test('it parses nested multi-class selectors in media queries', () => {
color: white;
padding: 1rem;
}
@media (width >= 200px) {
@media (min-width: 200px) {
.foo.bar {
background-color: orange;
}