Commit graph

5328 commits

Author SHA1 Message Date
Robin Malfait
7117544d09
update tests to reflect variant order change 2024-04-06 23:53:15 +02:00
Robin Malfait
a685f37bcc
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.
2024-04-06 23:52:53 +02:00
Adam Wathan
9b4e93d808 Update changelog 2024-04-04 18:04:29 -04:00
Adam Wathan
2719903e56 Update versions for alpha.13 2024-04-04 18:03:36 -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
ottomated
5db92a4ceb
Speed up segmentation (#13415)
* Speed up segmentation

* Add segment benchmark

* Add and move comments

* Update

* Tweak comments

* Tweak variable name

* Tweak

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-04-02 16:43:37 -04:00
Aaron Adams
be94e21136
Correct repository fields in package.json files (#13416) 2024-03-31 15:20:53 -04: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
a79fa45bf2
Make isColor faster (#13404)
When the arrays of colors were split, both smaller, and had different values to lookup an `includes` check was faster. Since they’ve been merged a Set is now beneficial.
2024-03-29 09:15:09 -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
Kris Braun
89eb1ba060
Fix Vite serve issues (#13380)
* Temporarily disable waitForRequestIdle

* Only apply vite:css-post in build mode
2024-03-27 12:31:54 -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
Robin Malfait
99c4afd9cd
update comments to better describe what's going on (#13348) 2024-03-25 15:49:14 -04:00
Robin Malfait
19c8fe34fd
remove Rust benchmarks and fixtures (#13335)
We currently don't use these, and they are tested via the benchmarks we
run as an end-to-end benchmark.
2024-03-23 16:16:40 +01:00
Robin Malfait
1c48683a23
Hoist oxide/crates to just crates (#13333)
* move `oxide/crates` to `crates`

* ignore `target/` folder

* ensure pnpm points to `crates` instead of `oxide/crates`

* ensure all paths point to `crates` instead of `oxide/crates`

* update `oxide/crates` -> `crates` path in workflows

* use correct path in .prettierignore

* rename `crates/core` to `crates/oxide`

* remove oxide folder

* fix test script to run `cargo test` directly
2024-03-23 09:00:48 -04: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
b5df5e9202
Use variables with fallbacks for utility classes (#13177)
* Use variables with fallbacks for utility classes

* Update playwright test

* rename `resolveBare` to `resolveValue`

* make private methods really private

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-03-21 18:25:43 +01:00
Robin Malfait
a3cedf253a
Improve transform, transform-cpu and transform-gpu utilities (#13290)
* fix `transform-gpu` translate syntax

* move `skewX` and `skewY` functions into the variable

* use `transform-[…]` with arbitrary values as-is

This will not have any fallbacks to the `skewX` or `skewY` functions.
The arbitrary values will be the only value that's used.

* use `--tw-skew-{x,y}` variables in `transform-cpu` and `transform-gpu`

* update tests

* drop `skewX` and `skewY` functions because they are embedded in the `--tw-skew-x` and `--tw-skew-y` CSS variables

* drop `transform-cpu` and `transform-gpu`

* add `translate-none`, `transform-none`, `rotate-none` and `scale-none`

* ensure `transform` creates a stacking context

* use `<transform-function>` instead of `<angle>`

* re-add `transform-gpu`

* drop the `,`, because `--tw-skew-x` and `--tw-skew-y` will always be defined by the `@property`

* `translate(0)` is not necessary because `--tw-skew-{x,y}` will always be defined

* add skew variables to `transform-gpu`

Otherwise skew's will be gone

* re-add `transform-cpu`
2024-03-21 17:51:15 +01:00
Robin Malfait
6a6186c24a
Remove bare value support for translate utilities (#13289)
* make `themeKeys` optional and default to `[]`

* remove `themeKeys` that already map 1:1 to a number or percentage

These can be handled by bare values without issues.

* remove fallback theme key lookup

- In case of `columns`, bare values can be used for the amount of columns
- In case of `divide-width`, we can always look at `--border-width`

* drop theme keys from suggestions

* drop bare value support for `translate-{axis}`

* add todo

* Revert "remove `themeKeys` that already map 1:1 to a number or percentage"

This reverts commit ef3b47aaee.

* Revert "remove fallback theme key lookup"

This reverts commit 0a5fc2dd39.

* Revert "drop theme keys from suggestions"

This reverts commit 7179a19517.

* Revert "add todo"

This reverts commit 7340cdfcf8.
2024-03-21 17:40:19 +01:00
Robin Malfait
ec72fb6510
rename release-oxide to release (#13301) 2024-03-21 13:35:08 +01:00
Kris Braun
85c3b2b6a2
Use Vite waitForRequestsIdle (#13291) 2024-03-20 16:40:50 -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
Kris Braun
dadb096da2
3D transform utilities (#13248)
* 3D rotation utilities

* Validate rotate values

* Replace forEach with for loop

* transform-style, transform-box, and backface-visibility utilities

* Tests for transform utilities

* 'perspective' utility

* Fix tests

* Remove unnecessary suggestion; move function comments

* scale-z

* Fix Intellisense test

* perspective-origin

* scale-3d

* Only include the z component of scale if it's defined

We want to avoid triggerring unnecessary 3D transformations.

* Comment the reason for setting --tw-rotate

* Test full bare rotate

* Fix merge

* Comment on rotate arbitrary value

* perspective bare values

Support `perspective-123` (but not `perspective-potato`)

* scale-3d as a static modifier to scale

Instead of scale-3d taking a separate scale, it modifies scale to apply in three dimensions.

* Test that scale-x overrides scale

* scale arbitrary values

Support arbitrary value for scale (e.g. `scale-[1_2_3.5]`).

* Specify rotation axis using a modifier

Support single rotation angles in line with the [CSS `rotate` property](https://developer.mozilla.org/en-US/docs/Web/CSS/rotate). Using modifiers (e.g. `rotate-45/x`) makes it clearer that the axis of rotation is modified. Thanks @adamwathan for this suggestion.

Composing angles is only supported in CSS via a pipeline of `transform` functions. I'll add arbitrary value support to `transform` next as an escape hatch for those cases that need more complex transformations.

* Use property defaults for scale-3d

* `transform` arbitrary values

Support arbitrary values for `transform`. The `skew-x` and `skew-y` transforms are applied before any arbitrary transformations.

* Add translate-z and translate-3d

Both work the same way as scale-z and scale-3d.

* Add translate-[xyz]-px

* Comment on how skewX and skewY are applied

* Remove unnecessary suggest

* Simplify translate

* Fix up comment on rotate syntax

* Back to rotate-x and rotate-y rather than rotate modifiers

* 3D transform test fixes
2024-03-19 17:52:32 +01:00
Robin Malfait
d2be632635
Skip newlines when parsing selectors (#13280)
* replace "\n" with " " when parsing CSS

* add test to ensure important whitespace is preserved
2024-03-19 16:23:14 +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
Robin Malfait
cdb0997d6e
Add inherit as a universal color (#13258)
* add `inherit` as a hardcoded color

* add `inherit` to suggestions

* update changelog

* re-order changelog sections
2024-03-15 19:31:36 +01:00
Robin Malfait
1933d8eb76
Fix typos (#13257)
* fix typos

* update test, due to typo in property order list
2024-03-15 18:13:02 +01:00
Robin Malfait
154164d97c
Validate bare values (#13245)
* add validation for bare values

* add bare value validation to `row-span`, `row-start`, `row-end`, `row-span`, `row-start`, and `row-end`

* update changelog

* validate bare values in `utilities.functional` utilities

* mark candidates as invalid if the leftover value is an empty string

* Update packages/tailwindcss/src/candidate.ts

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

* validate `from`, `via` and `to`

This way we make sure that the bare value ends with `%`, and the value
before it is a number.

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-03-15 15:08:26 +01:00
Robin Malfait
9fc5aa16a3
Inline the tailwindcss/index.css contents at publish time (#13233)
* add `pre-publish-optimizations` script

* handle `@import` ourselves

This implementation is fairly simple right now, because we don't have
to worry about resolving folders or modules since we don't use them.

* pretty print index.css file

* update changelog

* Revert "handle `@import` ourselves"

This reverts commit 13a46404c1.

* drop the `1.`

* Update scripts/pre-publish-optimizations.mjs

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

* Update CHANGELOG.md

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>

* run prettier

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2024-03-13 22:26:10 +01:00
Robin Malfait
44394b164a
Prepare 4.0.0-alpha.9 release (#13231)
* update changelog

* bump versions to `4.0.0-alpha.9`

* move the optimizeCss change to `Changed`
2024-03-13 13:11:06 -04:00
Robin Malfait
0ee3508179
Move optimizeCss to the packages where it's used (#13230)
* add `@tailwindcss/optimize` as a separate package

* remove lightningcss from `tailwindcss`

* import `optimizeCss` from `@tailwindcss/optimize`

* ensure we use `src/` files in development

* move `devDependencies` after `dependencies`

Just for consistency

* inline `optimizeCss` in leaf packages

Instead of introducing a custom `@tailwindcss/optimize` package

* update changelog

* fix changelog
2024-03-13 17:25:16 +01:00
Adam Wathan
91fca13981
Don't rely on existence of --default-transition-* variables in transition utilities (#13219)
* Don't rely on existence of --default-transition-* variables in transition utilities

* Update changelog

* Add test with no default transition values defined

* Inline value for --default-transition-timing-function

This is more consistent with how things worked in v3 and ensures things will still work if the user suppresses the output of all CSS variables.

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-03-13 12:14:05 -04:00
Nick Kosarev
7452425505
Fix incorrect properties in line-clamp utilities (#13220)
* Overflow fix for https://github.com/tailwindlabs/tailwindcss/issues/13217

* webkit-box-orient and webkit-line-clamp fix for https://github.com/tailwindlabs/tailwindcss/issues/13217

* tests fix https://github.com/tailwindlabs/tailwindcss/issues/13217

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-03-12 23:02:59 +01:00
Adam Wathan
4e1f98141a
Support @theme reference without @import (#13222)
* Support `@theme reference` without `@import`

* Fix test

* Update tests

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-03-12 14:07:01 -04:00
Adam Wathan
65f6f7c1ca
Prepare alpha.8 release (#13203)
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-03-11 15:10:21 -04:00
Robin Malfait
172bc5d822
Add incremental rebuilds to @tailwindcss/postcss (#13170)
* rename PostCSS plugin name from `tailwindcss-v4` to `@tailwindcss/postcss`

* add incremental rebuilds to `@tailwindcss/postcss`

* improve comment

* update changelog

* Simplify nested conditionals

* Simplify more conditionals

* Refactor file modification tracking

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-03-11 15:01:28 -04:00
Robin Malfait
a458e5ddda
Add incremental rebuilds to @tailwindcss/cli (#13169)
* ensure the root CSS file part of the `cssImportPaths`

* add incremental rebuilds to `@tailwindcss/cli`

* update changelog
2024-03-11 14:32:41 -04:00