thysultan / stylis

light – weight css preprocessor
https://stylis.js.org
MIT License
1.71k stars 82 forks source link

Add support for container queries #304

Closed lunaris closed 1 year ago

lunaris commented 1 year ago

Fixes #303. Closes #300.

This PR adds support for container queries, parsing and hoisting them in the same manner that media queries are. I'm not sure of the best way to do this in a manner that yields acceptable performance/conforms to the existing patterns in stylis, but I've taken a stab. The challenge is that currently, we only need to look ahead one character after an @ to determine what to do, but with @container this is not sufficient as there is also @counter-style. I've thus taken what feels like a hacky approach to look ahead until the n, which I think is safe and seems to satisfy the test suite. All feedback gratefully received though!

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 912177ef823418eb939dbb5e6627a2e2716a8404-PR-304

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Totals Coverage Status
Change from base Build 3b83b1bfc4e674af1517d3d7de482e5cc3ea397b: -0.1%
Covered Lines: 273
Relevant Lines: 275

💛 - Coveralls