461 Commits

Author SHA1 Message Date
Emilia
06972065de feat(preflight): simplify sans-serif font stack (#11748)
* feat(preflight): simplify sans-serif font stack

`-apple-system` and `BlinkMacSystemFont` were historically needed for
IE11 and chakra-based Edge (The one that wasn't chromium-based).

https://caniuse.com/font-family-system-ui has more details around it.

* further simplify `font-family`

* update tests

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-12-18 13:58:22 -05:00
Adam Wathan
8201846565 Extend opacity scale to include all steps of 5 (#11832)
* Extend opacity scale to include all steps of 5

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:57:52 -05:00
Adam Wathan
9caa9547b2 Add support for text-wrap property (#11320)
Update changelog

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:57:22 -05:00
Adam Wathan
d72c1893c8 Add has-* variants for :has(...) pseudo-class (#11318)
* Add `has-*` variants for `:has(...)` pseudo-class

* Update changelog

* Fix mistake in test

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:57:08 -05:00
Jordan Pittman
b70f8fd036 Add svh, lvh, and dvh values to default theme (#11317)
* Add svh, lvh, and dvh values to default theme

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:56:52 -05:00
Jordan Pittman
cc94c76ee5 Fix support for container query utilities with arbitrary values (#12534)
* Fix support for container query utilities with arbitrary values

* Update changelog
2023-12-05 12:27:48 -05:00
Jordan Pittman
16fd9ffdb4 Fix candidate detection regex 2023-12-04 11:23:33 -05:00
Robin Malfait
89470d29b4 Improve candidate detection in minified JS arrays (without spaces) (#12396)
* add test to verify `["util1","util2"]` works

* update extractor regex, to reduce valid values in the arbitrary value part

Co-authored-by: Autom <mijnnaamis2112@hotmail.com>

* add special case with deeply nested `[]`

* update changelog

* move oxide changelog itemsto the bottom

---------

Co-authored-by: Autom <mijnnaamis2112@hotmail.com>
2023-12-04 10:38:43 -05:00
Jordan Pittman
2dcb1fcd82 Fix source maps of variant utilities that come from an @layer rule (#12508)
* Refactor

* Keep traversing sibling nodes

* Make sure the root node has a source location for the end

* Add source map test for at-rule variants

* Update changelog
2023-12-01 11:46:18 -05:00
Jordan Pittman
adb6f15bc1 Fix generation of utilities that use slashes in arbitrary modifiers (#12515)
* Fix support for slashes in arbitrary modifiers

* Update changelog
2023-12-01 11:46:18 -05:00
Jordan Pittman
bbfb5a3c66 Don't crash when given applying a variant to a negated version of a simple utility (#12514)
* Don't crash when given applying a variant to a negated version of a simple utility

* Update changelog
2023-12-01 11:46:18 -05:00
Tom
817c466c1e Ensure configured font-feature-settings for mono are included in Preflight (#12342)
* Use the default font-feature-settings for mono

* Update changelog

* Update tests

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-11-02 11:01:17 -04: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
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
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
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
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
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
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
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
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
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
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
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
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
Jordan Pittman
0ecc4642fc
Pull pseudo elements outside of :is and :has when using @apply (#10903)
* Pull pseudo elements outside of `:is` and `:has` when using `@apply`

* Update changelog

* Refactor

* Update important selector handling for :is and :has

* fixup

* fixup

* trigger CI

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-03-29 21:37:26 +02:00
Robin Malfait
51157717da
Add gradient color stop position utilities (#10886)
* add gradient color stop positions

* update tests to include gradient position color stop reset values

* add dedicated color stop position tests

* use `%` sign in the name of the uility

* update changelog

* ensure `length` values and css variables work
2023-03-28 15:39:00 +02:00
Robin Malfait
5b77b42574
Reset all properties when using line-clamp-none (#10876)
* reset other properties on `line-clamp-none`

* update CHANGELOG
2023-03-27 18:56:14 +02:00
Jordan Pittman
1d505e9c8c Revert "Remove blocklisted classes from autocomplete (#10844)"
This reverts commit f1473f53bb9e90b02f319cb1c88093406f10c990.
2023-03-23 15:18:49 -04:00
Jordan Pittman
f1473f53bb
Remove blocklisted classes from autocomplete (#10844)
* Remove blocklisted classes from autocomplete

* Update changelog

* Don't unnecessary loop over classes

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-03-23 15:03:56 -04:00
Adam Wathan
266f0292ba
Use :is to make important selector option insensitive to DOM order (#10835)
* Use `:is` to make important selector option insensitive to DOM order

* WIP

* add `applyImportantSelector` helper

* use new `applyImportantSelector`

* update tests

* remove unnecessary slice adjustment

Not 100% sure.

* update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-03-21 17:50:44 +01:00
Robin Malfait
e4482c7596
ensure stacking dark and rtl variants with pseudo elements works as expected 2023-03-21 15:32:16 +01:00
Adam Wathan
bac5ecf004
Add list-style-image support (#10817)
* add `listStyle` instead of `listStyleType`

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>

* add `listStyleType` related deprecation warnings

* Implement list-style-image as separate plugin

* Remove unused code, update tests

* Always generate `list-none`, don't pull it from theme

* Gracefully handle missing listStyleType configuration

* Just use `list-image-*` fuck it

* Update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Peter Neupauer <peter@neupauer.sk>
2023-03-20 14:40:35 -04:00
Robin Malfait
8132de6660
refactor log.warn checks in tests 2023-03-17 14:49:36 +01:00
Robin Malfait
7e9a53f6cb
Enable ESM and TS based config files (#10785)
* add `jiti` and `detective-typescript` dependencies

* use `jiti` and `detective-typescript`

Instead of `detective`, this way we will be able to support
`tailwind.config.ts` files and `ESM` files.

* use `@swc/core` instead of the built-in `babel` form `jiti`

* update changelog

* add `jiti` and `detective-typescript` dependencies to `stable`

* use `sucrase` to transform the configs

* add `sucrase` dependency to `stable` engine

* make loading the config easier

* use abstracted loading config utils

* WIP: make `load` related files public API

* use new config loader in PostCSS plugin

* add list of default config files to look for

* cleanup unused arguments

* find default config path when using CLI

* improve `init` command

* make eslint happy

* keep all files in `stubs` folder

* add `tailwind.config.js` stub file

* Initialize PostCSS config using the same format as Tailwind config

* Rename config content stubs to config.*.js

* Improve option descriptions for init options

* Remove unused code, remove `constants` file

* Fix TS warning

* apply CLI changes to the Oxide version

* update `--help` output in CLI tests

* WIP: make tests work on CI

TODO: Test all combinations of `--full`, `--ts`, `--postcss`, and `--esm`.

* wip

* remove unused `fs`

* Fix init tests

Did you know you could pass an empty args to a command? No? Me neither. ¯\_(ツ)_/¯

* bump `napi-derive`

* list extensions we are interested in

* no-op the `removeFile` if file doesn't exist

* ensure all `init` flags work

* ensure we cleanup the new files

* test ESM/CJS generation based on package.json

* remove unnecessary test

We are not displaying output in the `--help` anymore based on whether
`type: module` is present or not.
Therefore this test is unneeded.

* only look for `TypeScript` files when the entryFile is `TypeScript` as well

* refactor `load` to be `loadConfig`

This will allow you to use:

```js
import loadConfig from 'tailwindcss/loadConfig'

let config = loadConfig("/Users/xyz/projects/my-app/tailwind.config.ts")
```

The `loadConfig` function will return the configuration object based on
the given absolute path of a tailwind configuration file.

The given path can be a CJS, an ESM or a TS file.

* use the `config.full.js` stub instead of the `defaultConfig.stub.js` file

The root `defaultConfig` is still there for backwards compatibilty
reasons. But the `module.exports = requrie('./config.full.js')` was
causing some problems when actually using tailwindcss.

So dropped it instead.

* apply `load` -> `loadConfig` changes to `Oxide` engine CLI

* ensure we write the config file in the Oxide engine

* improve type in Oxide engine CLI

* catch errors instead of checking if the file exists

A little smaller but just for tests so doesn't matter too much here 👍

* ensure we publish the correct stub files

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Nate Moore <nate@natemoo.re>
Co-authored-by: Enzo Innocenzi <enzo@innocenzi.dev>
2023-03-15 17:04:18 -04:00