Commit graph

817 commits

Author SHA1 Message Date
Robin Malfait
06e96e0767
Prep next release: 4.0.0-alpha.17 (#13951)
* bump to version `4.0.0-alpha.17`

* update changelog
2024-07-04 19:08:10 +02:00
Benoît Rouleau
3b85780f89
Revert “Prevent Preflight from affecting list semantics” (#13907)
Due to difference in how it handles an empty `<li>`: https://codepen.io/benface/pen/MWdRdyY
2024-07-04 11:21:09 -04:00
Adam Wathan
407de01e8d
Use initial for @property fallbacks instead of (#13949)
* Use `initial` for `@property` fallbacks instead of ` `

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-07-04 11:20:05 -04:00
Adam Wathan
62de02a379
Support combining arbitrary shadows without a color with shadow color utilities (#13876)
* Support combining arbitrary shadows without a color with shadow color utilities

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-06-21 17:36:59 -04:00
Benoît Rouleau
332347ed83
Prevent Preflight from affecting list semantics (#13815)
* Prevent Preflight from affecting list semantics

* Use `list-style` property

* Update snapshots

* Update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-06-14 15:52:50 -04:00
Jordan Pittman
d9cd199aa6 Fix spacing 2024-06-14 12:05:15 -04:00
Jordan Pittman
2e1e1673f0 Update changelog 2024-06-14 09:42:05 -04:00
Robin Malfait
564fb78365
Add backdrop-blur-none and blur-none utilities (#13831)
* add `backdrop-blur-none` and `blur-none` utilities

* update changelog
2024-06-13 15:27:45 +02:00
Robin Malfait
5f2d654928
Add rounded-4xl utility (#13827)
* add `rounded-4xl`

* update tests to reflect change

* update changelog
2024-06-12 18:22:37 +02:00
Robin Malfait
c711903af5
Prepare next alpha release: 4.0.0-alpha.16 (#13810)
* bump version to 4.0.0-alpha.16

* update changelog
2024-06-07 18:38:44 +02:00
Robin Malfait
8ddd0c6023
update changelog
Add missing changelog entry for #13806
2024-06-07 10:23:20 +02:00
Jordan Pittman
7b638868dd
[v4] Support arbitrary gradient angles (#13783)
* Support arbitrary gradient angles

* Update changelog

* Use the `bg-linear` namespace instead

* Tweak comments

* Update changelog

* Support negative angles

* Update changelog

* Update changelog

* Update changelog

* Update changelog
2024-06-04 14:18:07 -04:00
Jordan Pittman
640ecf6a93
Use long form <length> | <percentage> syntax for properties (#13660)
* Use longform length + percentage syntax for properties

Using properties that declare the shorthand syntax `<length-percentage>` has a bug where two properties side-by-side e.g. `var(—foo)var(—bar)` invalidate the property value when it should not. Switching the `@property` definition to use the long form syntax `<length> | <percentage>` fixes this.

* Update changelog

* Update tests
2024-06-03 11:49:33 -04:00
Jordan Pittman
1124d1d3c7
Add nth-* variants (#13661)
* Add `nth-*` variants

* Update changelog

* Update snapshots

* Update

* update older `toMatchInlineSnapshot` to `toEqual`

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-06-03 11:41:01 -04:00
Jordan Pittman
2428f8f48c
[v4] Support negative values for {col,row}-{start,end} utilities (#13780)
* Support negative values for `{col,row}-{start,end}` utilities

* Update changelog
2024-06-03 11:34:16 -04:00
Robin Malfait
04906c847e
Use length data type for background-size instead of background-position (#13771)
* move `length` data type from `background-position` to `background-size`

This way it's backwards compatible with v3.

* sort data types

* update changelog

* make sure `length` is inferred later

Otherwise `bg-[120px]` would be inferred as `length` instead of
`position`.

In v3 this maps to `position` instead of `length`.
```css
.bg-\[120px\] {
  background-position: 120px;
}
```

* add explicit test cases for `length` and `size` data types
2024-05-31 17:42:27 +02:00
Robin Malfait
5e737d8587
4.0.0-alpha.15 (#13658) 2024-05-08 19:26:59 +02:00
Jordan Pittman
aceec2ea39
Add fallbacks for @property rules for Firefox (#13655)
* Add `@property` fallbacks for Firefox

* Update tests

* Update changelog
2024-05-08 12:39:10 -04:00
Robin Malfait
3a5934006a
Revert "Remove automatic var(…) injection (#13537)"
This reverts commit cd4711cc21.
2024-05-08 17:56:09 +02:00
Robin Malfait
cb17447ff1
Ensure strings are consumed as-is when using internal segment() (#13608)
* ensure we handle strings as-in

When encountering strings when using `segment` we didn't really treat
them as actual strings. This means that if you used any parens,
brackets, or curlies then we wanted them to be properly balanced.

This should not be the case, whenever we encounter a string, we want to
consume it as-is and don't want to worry about bracket balancing. We
will now consume it until the end of the string (and make sure that
escaped closing quotes are not seen as real closing quotes).

* update changelog

* drop unnecessary test

Already had this test

* ensure we utilities and variants defined

* add example test that parses with unbalanced brackets inside quotes

* improve changelog entry

* hoist comment
2024-04-30 12:22:11 -04:00
Robin Malfait
cd4711cc21
Remove automatic var(…) injection (#13537)
* remove automatic `var(…)` injection

There are a few properties that use "dashed-ident" values, this means
that you can use `--my-thing` as-is without the `var(…)` around it.

This causes issues because we are now injecting a `var(…)` where it's not
needed.

One potential solution is to create a list of properties where dashed
idents can be used. However, they can _also_ use CSS custom properties
that point to another dashed ident.

A workaround that some people used is adding a `_` in front of the
variable: `mt-[_--my-thing]` this way we don't automatically inject the
`var(…)` around it. This is a workaround and gross.

While the idea of automatic var injection is neat, this causes more
trouble than it's worth. Adding `var(…)` explicitly is better.

A side effect of this is that we can simplify the `candidate` data
structure because we don't need to track `dashedIdent` separately
anymore.

* update tests by adding `var(…)` explicitly

* update changelog
2024-04-19 00:40:52 +02:00
Robin Malfait
cc8c069f72
Further improve natural sorting of classes (#13532)
* skip initial character we just saw

Thanks Richard for noticing!

Co-authored-by: Richard van Velzen <richard@frank.nl>

* prevent calling `charCodeAt()` if we already computed the value

* update changelog

---------

Co-authored-by: Richard van Velzen <richard@frank.nl>
2024-04-16 18:12:42 +02:00
Robin Malfait
cd0c308afe
Improve sorting candidates containing numbers (#13507)
* implement custom `compare` for sorting purposes

This `compare` function compares two strings. However, once a number is
reached the numbers are compared as actual numbers instead of the string
representation.

E.g.:

```
p-1
p-2
p-10
p-20
```

Will be sorted as expected in this order, instead of

```
p-1
p-10
p-2
p-20
```

---

This should also make suggestions in the vscode extension more logical.

* update tests to reflect order changes

* update changelog

* reset `i` correctly

This makes the code more correct _and_ improves performance because the
`Number(…)` will now always deal with numbers.

On the tailwindcss.com codebase, sorting now goes from `~3.29ms` to
`~3.10ms`

* drop unreachable code

In this branch, it's guaranteed that numbers are _different_ which means
that they are never going to be the same thus unreachable code.

When we compare two strings such as:

```
foo-123-bar
foo-123-baz
```

Then all characters until the last character is the same character in
both positions. This means that "numbers" that are the same in the same
position will be compared as strings instead of numbers. But that is
fine because they are the same anyway.

* add fallback in case numbers are the same but strings are not

This can happen if we are sorting `0123` and `123`. The `Number`
representation will be equal, but the string is not.

Will rarely or even never happen. But if it does, this makes it
deterministic.

* re-word comment

* add more test cases with numbers in different spots with various lengths

* Update CHANGELOG.md

* cleanup, simplify which variables we increment

This also gets rid of some explanation that can now be omitted entirely.

---------

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2024-04-15 17:56:30 +02:00
Justin Wong
b07cc4d3bd
Fix contain-* utilities (#13521)
* Fix contain-* utilities

Fixes #13520.

* Update changelog

* Update CHANGELOG.md

---------

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2024-04-13 05:56:15 -04:00
Adam Wathan
e4e73e49a8 Update changelog 2024-04-09 21:05:15 -04:00
Robin Malfait
ce0a7347da
4.0.0-alpha.14 (#13487) 2024-04-09 20:55:54 +02:00
Adam Wathan
818692fe17
Don't accommodate hidden elements in space/divide (#13459)
* Don't accommodate hidden elements in space/divide

* Update tests

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-04-09 12:59:08 -04:00
Robin Malfait
d1eedb2324
Invert variant order application (#13478)
* reverse order of variants

This way variants work similar to how you would write them in CSS
itself.

This also allows us to remove the special "fixup" code that fixes the
position of some variants because they have to be in a specific order
(the end). Since the order wasn't intuitive we had to solve this with a
fixup.

This commit should allow us to remove this entirely, because now it is intuitive.

* update tests to reflect variant order change

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-04-09 11:37:56 -04:00
Robin Malfait
4a25bc1fd5
Ensure deterministic SSR builds in @tailwindcss/vite (#13457)
* ensure we wait in the `build` step as well

It looks like when running `astro build` we only run this `build` step
and not the `dev` step where we already use the `waitForRequestsIdle`
code.

Adding this to the `build` part as well does generate the correct
result.

* update changelog

* fix typo

* add comment

* Don’t run transforms more than necessary

* Don’t remove modules from the graph during SSR

* Update changelog

* Add `preview` script

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-04-08 18:10:08 -04:00
Adam Wathan
9b4e93d808 Update changelog 2024-04-04 18:04:29 -04:00
Adam Wathan
835cad4f2b Fix entry in wrong spot in changelog 2024-04-04 18:02:24 -04:00
Adam Wathan
8f5df7f56b Fix typo in changelog 2024-04-04 18:01:55 -04:00
Adam Wathan
cc6094e84f
Don't read variables for shadow sizes (#13449)
* Don't read variables for shadow sizes

* Add UI test

* Handle key suffix in get function instead of ThemeKey

* Remove duplicate theme keys

* Format test in a less insane way

* Revert playground changes

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-04-04 18:01:37 -04:00
Robin Malfait
34fea0e3d3
4.0.0-alpha.12 (#13448) 2024-04-04 17:43:02 +02:00
Adam Wathan
4aefd26f44
Don't reset ::first-letter in Preflight (#13408)
* Don't reset ::first-letter in Preflight

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-03-30 08:06:53 -04:00
Jordan Pittman
500372e728
Enable Vite's waitForRequestsIdle() for client requests only (#13394)
* Enable `waitForRequestsIdle` but only when not doing SSR

* Cleanup comment

* Update changelog
2024-03-28 22:57:16 -04:00
Jordan Pittman
855cd94ff0
Prepare next release: 4.0.0-alpha.11 (#13382)
* bump versions to `4.0.0-alpha.11`

* Update changelog

* Update changelog

* Update changelog

* Update changelog
2024-03-27 13:32:10 -04:00
Kris Braun
94d68255da
Changelog for #13380 (Vite serve fix) (#13381) 2024-03-27 13:04:32 -04:00
Robin Malfait
c815221249
Ensure build command is executed when using --output instead of -o (#13369) 2024-03-27 16:10:55 +01:00
Jordan Pittman
fee039d82f
Inherit letter spacing in form controls (#13328)
* Inherit letter spacing in form controls

* Update changelog

* Update snapshots
2024-03-22 16:01:39 -04:00
Adam Wathan
59038c5734
Include :popover-open in open variant (#13331)
* Include :popover-open in open variant

Co-Authored-By: Luke Warlow <lwarlow@igalia.com>

* Update changelog

* Remove accidental package.json change

* Revert playground changes

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Luke Warlow <lwarlow@igalia.com>
2024-03-22 16:00:07 -04:00
Adam Wathan
de79455b0e
Add variant for @starting-style (#13329)
* Add variant for @starting-style

Co-Authored-By: Han Yeong-woo <han@yeongwoo.dev>

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Han Yeong-woo <han@yeongwoo.dev>
2024-03-22 15:38:06 -04:00
Kris Braun
3249777383
Process Tailwind output with Vite CSS plugins (#13218)
Transform Tailwind-generated CSS with Vite CSS plugins. vite:css does useful things like transforming url() paths and inlining images. vite:css-post generates bundle hashes. Before this change, the CSS bundle hash wasn't changing when the generated CSS changed.

Also adds Vite 5.2 peerDependancy.

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-03-22 14:57:44 -04:00
Robin Malfait
fcdb3279ea
Fix incorrect syntax for translate-z's @property definition (#13327)
* fix incorrect syntax for `translate-z`

This used to be `<length-percentage>`, but we dropped percentage support
because it's not valid in #13321 and I forgot about this one.

* update changelog
2024-03-22 19:49:46 +01:00
Adam Wathan
0f69d4fe6e
[v4] Make 3D rotations composable (#13319)
* Reorganize to co-locate rotate/skew/transform

* Make 3D rotations composable

* Uppercase axis in rotate functions

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-03-22 13:31:57 -04:00
Robin Malfait
86dd6976f0
Remove percentage values for translate-z utilities (#13321)
* handle `translate-z` separately

* do not support fractions for `translate-z`

* update changelog
2024-03-22 17:19:18 +01:00
Robin Malfait
8840019efa
Prepare next release: 4.0.0-alpha.10 (#13281)
* bump versions to `4.0.0-alpha.10`

* update changelog

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-03-21 13:32:03 -04:00
Adam Wathan
89a0b86e73
Remove bare value handling for perspective utilities (#13288)
* Remove bare value handling for perspective utilities

* move `perspective-123` example

This is now moved to the spot where we ensure that nothing is generated
at all. This prevents us from accidentally updating a snapshot and
missing a potential bug.

* update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-03-20 15:25:24 +01:00
Robin Malfait
d25fe81da8
update CHANGELOG 2024-03-19 17:52:51 +01:00
Robin Malfait
f3e78807af
Parse candidates in .svelte files with class:abc="condition" syntax (#13274)
* handle `.svelte` file

In svelte there is a convention where you can use `<div
class:px-4="condition" />` which means that we extract `class:px-4` as a
utility where `class` is a variant.

This is obviously incorrect, to solve this we can ignore the `class:`
part before parsing the whole file.

This is also what we do in v3.

Ideally we have completely separate parsers for various programming
languages (based on file type) and fallback to the generic one we have
now.

Implementing that, is a much bigger scope.

* flatten match arms

* add test to verify we can parse `class:px-4="condition"`

* explicitly ingore everything but the svelte file

* merge tests

There is some funky stuff happening when running `cargo test` where it
sees contents from another test. Maybe a bug in the tmpdir crate.

I don't see this problem locally when running `cargo nextest run`, but
when using the native `cargo test` command it fails.

* update changelog

* run prettier

* Update oxide/crates/core/src/lib.rs

Co-authored-by: Jordan Pittman <jordan@cryptica.me>

* fixup syntax errors

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-03-18 23:24:22 +01:00