5171 Commits

Author SHA1 Message Date
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
Jordan Pittman
c15b187ae0 Bump jiti, fast-glob, and browserlist dependencies (#11550)
* bump dependencies

* update changelog
2023-10-24 12:59:59 -04:00
Jordan Pittman
ba04af0e0b Add types for the nesting plugin (#12269)
* Add types for the nesting plugin

* Update changelog
2023-10-23 15:49:22 -04:00
2hu
63989b2be8 Allow plugins from a parent document to be used in an iframe (#12208)
* Fix cross iframe isPlainObject check

* Update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-10-23 15:49:13 -04:00
Jordan Pittman
8e4ed70585 Fix crash when watching renamed files on FreeBSD (#12193)
* Fix file watching bug when renaming files on FreeBSD

* Update changelog

* Add delay to test

* Bump delay

* Update test
2023-10-23 15:48:54 -04:00
Robin Malfait
b162ae725f Ensure variants with arbitrary values and a modifier are correctly matched in the RegEx based parser (#12179)
* add failing test

* ensure variants can have modifiers in regex

* update changelog
2023-10-23 15:48:39 -04:00
Jordan Pittman
58b126f0d8 Fix sorting of utilities that share multiple candidates (#12173)
* Fix sorting of utilities that share multiple candidates

* Update changelog
2023-10-23 15:47:42 -04:00
Robin Malfait
f57c2f90d8 Improve RegEx parser, reduce possibilities as the key for arbitrary properties (#12121)
* optimize handling of RegEx parser results

Previous:
- Copy `results`, for every subsequent result of other `patterns`
- Loop over results to filter out `undefined` values
- Loop over results to map to `clipAtBalancedParens`

Current:
- For each candidate, push the `clipAtBalancedParens(candidate)` into
  the `results`

This way we are not copying existing results, and we are also avoiding
additional loops over the entire array to filter out `undefined` values
and map to `clipAtBalancedParens`.

* do not allow `]` in the first part of arbitrary properties

```
[foo:bar]
 ─┬─
  └── This part cannot contain `]`
```

This is also a very targeted fix for when the arbitrary properties seem
to match a large piece of text, but shouldn't

* add real world tests for parsing candidate strings

* sync package-lock.json

* update changelog
2023-10-23 15:47:22 -04:00
Jordan Pittman
2c23b8da1c Eliminate irrelevant rules when applying variants (#12113)
* Eliminate irrelevant rules when applying variants

* Update changelog
2023-10-23 15:42:47 -04:00
Jordan Pittman
17c7609419 Remove grouping prototype
This code has been sitting around for a while disabled and untested. And it does not work with the Oxide parser. So we’re gonna remove it.
2023-10-23 15:41:41 -04:00
Jordan Pittman
88119e2ecd Don’t crash when important and parent selectors are equal in @apply (#12112)
* Don’t crash when important and parent selectors are equal in `@apply`

* Update changelog
2023-10-23 15:39:15 -04:00
Jordan Pittman
bbe3fca424 Update types to work with Node16 module resolution (#12097)
* Update types to work with Node16 module resolution

* Update changelog
2023-10-23 15:38:23 -04:00
Jordan Pittman
3fa8ab1793 Skip over classes inside :not(…) when nested in an at-rule (#12105)
* Skip over classes inside `:not(…)` when nested in an at-rule

When defining a utility we skip over classes inside `:not(…)` but we missed doing this when classes were contained within an at-rule. This fixes that.

* Update changelog
2023-10-23 15:37:33 -04:00
Jordan Pittman
666c7e4566 Batch reading content files to prevent too many open files error (#12079)
* Refactor

* Refactor

* Batch content file reads in Node into groups of 500

We shouldn’t need to do this for our Rust code because it utilizes Rayon’s default thread pool for parallelism. This threadpool has roughly the number of cores as the number of available threads except when overridden. This generally is much, much lower than 500 and can be explicitly overridden via an env var to work around potential issues with open file descriptors if anyone ever runs into that.

* Fix sequential/parallel flip

* Update changelog
2023-10-23 15:33:33 -04:00
Jordan Pittman
8012d1819b Handle variable colors that have variable fallback values (#12049)
* Parse colors even when variable has fallback that is a variable

* Update changelog
2023-10-23 15:25:58 -04:00
wimbarelds
38fd41ea0b Make content optional for presets in TypeScript types (#11730)
* Update config.d.ts, Make array members partial in Config

Instead of `Partial<Array<Thing>>` have `Array<Partial<Thing>>`

* simplify types further

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-10-23 15:25:26 -04:00
Robin Malfait
808c1f0516 Fix incorrectly generated CSS when using square brackets inside arbitrary properties (#11709)
* ensure nested square brackets are handled properly inside arbitrary properties

* update changelog
2023-10-23 15:25:03 -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
Jordan Pittman
e771a5083e Add spot for v3.3.4 changelogs 2023-10-23 15:19:17 -04:00
Robin Malfait
0bd81a06c4
3.3.3 v3.3.3 2023-07-13 18:02:02 +02:00
Jordan Pittman
6a6ceb5240 Update changelog 2023-07-13 11:53:04 -04:00
Jordan Pittman
f97759f808 Don’t error when a config file is missing 2023-07-13 11:50:43 -04:00
Jordan Pittman
005c1be2ed Don't prefix arbitrary classes in peer/group variants (#11454)
* Refactor

* Don’t prefix classes in arbitrary values for group and peer

* use `foo` instead of `lol`

* handle the prefix inside the group/peer variants

Then add the `NoPrefix` feature to the variant itself, which will skip
prefixing any other class in the generated selector (because we already
took care of prefixing `.group` and `.peer`).

We are using an internal symbol such that:

- We can keep it as a private API
- We don't introduce a breaking change

* refactor to simple object instead

We will still use a symbol as an internal/private marker, but the data
itself will be a simple object for now.

If we want to refactor this (and more) in the future using bitflags then
we can refactor that in a separate PR.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-07-13 11:50:43 -04:00
Robin Malfait
5b9cbb3a81 Make PostCSS plugin async to improve performance (#11548)
* make main plugin async

This way we can improve the `fs.readFileSync` to a bunch of
`fs.promises.readFile` in a `Promise.all` instead.

* make CLI plugin async

* update CHANGELOG
2023-07-13 11:50:35 -04:00
Jordan Pittman
1c9bb387e1 Allow variant to be an at-rule without a prelude (#11589)
* Allow variant to be an at-rule without a prelude

* Update changelog
2023-07-13 11:50:35 -04:00
Jordan Pittman
80f3e85fa0 Sort classes using position of first matching rule (#11504)
* Refactor

* Sort based on first occurence of a candidate

This primarily affects components and utilities which contain multiple matched classes

* Simplify

* Update changelog

* Update
2023-07-13 11:50:35 -04:00
Eran Hirsch
243226887f Reset dialog element styles (#11069)
* disable useragent styling for dialog

* nits

* Update src/css/preflight.css

* Simplify dialog reset

We don’t want to reset everything here. Just the padding should be enough.

* Update test

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-07-13 11:50:34 -04:00
Anthony Ricaud
b885fff544 Add aria-busy utility (#10966)
* Add aria-busy variant

This is useful to show a spinner or dim a region that is updating.

Very useful in conjunction with [Turbo](https://turbo.hotwired.dev/reference/attributes#automatically-added-attributes)

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-07-13 11:48:35 -04:00
Dany Castillo
1fb7486165 Make font settings propagate into buttons, inputs, etc. (#10940)
* Make font settings propagate into buttons, inputs, etc.

* update source-maps test due to preflight change

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-07-13 11:48:35 -04:00
A Dev $el
ac43650f67 Ensure CI jobs don't run for longer than 15 minutes (#11496)
* fix: prevent long unwanted runs!

* add timeout-minutes to all the workflows

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-07-13 11:48:35 -04:00
Jordan Pittman
24c6a99474 Escape animation names when prefixes contain special characters (#11470)
* Escape animation names when prefixes contain special characters

* Update changelog
2023-07-13 11:48:35 -04:00
Jordan Pittman
61cf624e4b Move unknown pseudo elements outside of :is (#11345)
* More pseudo elements outside of `:is` by default

* Update changelog
2023-07-13 11:48:35 -04:00
Daniel Kouznetsov
02147e3cc5 fixed a type in generateRules.js (#11264) 2023-07-13 11:48:35 -04:00
Robin Malfait
63403d84a2 Ensure repeating-conic-gradient is detected as an image (#11180)
* ensure `repeating-conic-gradient` is detected as an image
* update changelog
2023-07-13 11:48:35 -04:00
Jordan Pittman
79b5b12af1 Fix parsing of theme() inside calc() when there are no spaces around operators (#11157)
* Refactor

* Don’t resolve functions for anything not using theme or screen

* Normalize math operators inside calc when handling functions

* Inline postcss-value-parser

* Treat all functions the same as calc

* Remove workaround for calc + operators without spaces

* Remove `postcss-value-parser` dependency

* Update lockfile

* Update sourcemaps

* Update changelog

* Update `value-parser` formatting

* Stop prettier from complaining
2023-07-13 11:48:34 -04:00
Jordan Pittman
7b4de46d2f Fix issues with some pseudo-elements (#11111)
* Fix issues with some pseudo-elements

We’ve included pseudo elements for backdrop, marker, placeholder, and selection and they were all “jumpable” before we made changes in v3.3.2. Ideally they wouldn’t be because if they ever eventually have any interactivity that could become a problem.

* Update changelog
2023-07-13 11:46:19 -04:00
Jordan Pittman
1867744706 3.3.2 v3.3.2 2023-04-25 18:09:57 -04:00
Jordan Pittman
48ff773193 Update test 2023-04-25 17:45:45 -04:00
Jordan Pittman
adc83348df Disable SWC “unused” minification 2023-04-25 17:42:58 -04:00
Jordan Pittman
7bd1a3f060 Revert "Fix standalone CLI tests"
This reverts commit 0e539a7929dfb5475e3c9b4423f572c89ea0fa91.
2023-04-25 16:45:41 -04:00
Jordan Pittman
0e539a7929 Fix standalone CLI tests 2023-04-25 16:34:08 -04:00
Robin Malfait
bd0497fc5d
Drop support for Node.js v12 (#11089)
* bump `postcss-load-config` in the oxide engine

* bump `postcss-load-config` in the stable engine

* update changelog

* Switch to stable

* Update Node to v14

* Update to latest dependency versions

* Update test helper for new version of `rimraf`

Co-Authored-By: Jordan Pittman <jordan@cryptica.me>

* Downgrade `lightningcss` to `v1.18.0`

Co-Authored-By: Jordan Pittman <jordan@cryptica.me>

* Switch back to oxide

* Update Github actions from Node 12 to Node 14

* Update oxide dependencies

* Update stable dependencies

* Update `content-resolution` integration test dependencies

* Update `postcss-cli` integration test dependencies

* Update `rollup` integration test dependencies

* Update `rollup-sass` integration test dependencies

* Update `vite` integration test dependencies

* Update `webpack-5` integration test dependencies

* Update changelog

* Remove `color-name` dependency

* Replace `quick-lru` dependency with `@alloc/quick-lru`

* Replace `quick-lru` dependency with `@alloc/quick-lru` in stable

* Fix standalone CLI test

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-04-25 16:28:20 -04:00
Robin Malfait
9bb45cd162
Normalize arbitrary modifiers (#11057)
* ensure we normalize the arbitrary modifiers

This applies the same rules as arbitrary values. The `_` can be used in
place of a space. If you _do_ want an underscore, you can escape it with
`\_` (`\\_` in JavaScript).

* update changelog
2023-04-21 21:42:58 +02:00
Robin Malfait
0e2b4510a2
Ensure multiple theme(spacing[5]) calls with bracket notation in arbitrary properties work (#11039)
* ensure that last `]` doesn't stop the match

Given this input:
```html
<div class="[width:_calc(theme(spacing[5])_+_theme(spacing[5]))]"></div>
```

Then we would expect the match to be this:
```
[width:_calc(theme(spacing[5])_+_theme(spacing[5]))]
```

However, with the `?`, then it would stop and result in:
```
[width:_calc(theme(spacing[5])_+_theme(spacing[5]
```

Which makes it incomplete because the `))]` are missing at the end.

* update changelog
2023-04-19 23:06:33 +02:00
Robin Malfait
defdc4b6d1
tweak changelog 2023-04-18 12:30:59 +02:00
Robin Malfait
72bc31867b
Replace __OXIDE__ at build time to prevent @tailwindcss/oxide leaks in the stable engine (#10988)
* replace `env.OXIDE` with global `__OXIDE__`

This will allow us to replace the `__OXIDE__` at build time, and fully
remove the branches from the final code so that there is not even any
reference to `@tailwindcss/oxide` on the stable engine.

* update changelog

* use `env.ENGINE` in integration tests

* drop oxide branching for the PostCSS plugin for now

This is currently a redirect to the same file, so doesn't hurt.

* Enable better dead-code elimination

* Update CLI tests

Fix indentation

* Fix indentation

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-04-18 12:19:20 +02:00
Matei Simtinică
9f860197c9
Fix gradient stop positions with transparent colors and/or variants (#11002)
* fixed gradient stop for default transparent

* Inherit gradient stop positions when using variants

* Update tests

* Update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-04-13 16:12:12 -04:00
Jordan Pittman
e3a9d5f53b
Don’t move unknown pseudo-elements to the end of selectors (#10962)
* Don’t move `::deep` pseudo element to end of selector when using `@apply`

* Update changelog

* Move pseudo-elements in two passes

* Rewrite pseudo-element relocation logic

* Update test

`::test` is an unknown pseudo element and therefore may be actionable _and_ nestable

* Add tests

* Simplify tests

* Simplify

* run tests on CI multiple times

This works around the timeouts/flakeyness of GitHub Actions

* Update formatting

* Add comment

* Mark webkit peusdo elements as terminal

* update comment

* only execute the `global-setup` once

* Simplify

NO SORT FN YAY

* Use typedefs

* Update changelog

* Update changelog

* update again

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-04-07 10:45:47 -04:00
Jordan Pittman
467a39e0d5
Don’t move ::ng-deep pseudo element to end of selector when using @apply (#10943)
* Don’t move `::ng-deep` pseudo element

* Update changelog
2023-04-04 12:46:20 -04:00