4576 Commits

Author SHA1 Message Date
Brad Cornes
b9dec5feb7
Update theme.fontSize types (#8040) 2022-04-04 14:35:33 +01:00
Robin Malfait
2d3a748d1f
Ensure the percentage data type is validated correctly (#8015)
* ensure the `percentage` data type is validated correctly

When checking for our data types, we have to make sure that each part is
correct, this wasn't happening for the `percentage` data type, which
meant that `top_right_50%` was a valid percentage value because it ended
in `%` which is not correct.

Because of this, the generated code was non-existent because we got a
warning:

  The class `bg-[top_right_50%]` is ambiguous and matches multiple utilities.
     Use `bg-[length:top_right_50%]` for `background-size: top right 50%`
     Use `bg-[position:top_right_50%]` for `background-position: top right 50%`
   If this is content and not a class, replace it with `bg-[top_right_50%]` to silence this warning.

But this is not correct because this can never be a valid background
size due to the `top right` section.

This fixes it by validating each part individually, and now we get
generated css.

* update changelog
2022-04-01 12:37:22 +02:00
Robin Malfait
010f787f5f
Types: allow for arbitrary theme values (for 3rd party plugins) (#7926)
* allow for arbitrary configuration in the `theme` section

This is useful for third party plugins otherwise you will get an error.

* WIP: `theme()` utility function code completion

This will give you code completion in the `theme()` function. The reason
it is still a WIP is that this only works with the default config right
now and not 100% sure if it is possible to define generics in JSDoc.

The idea would be to:
- Provide types from the default config
- Provide types from the custom config (e.g.: 3rd party plugin)
- Override default config types with the overrides of the user's config

Right now this only provides types for the defaultConfig which might
result in dropping all of this in favor of a much simpler:

```ts
theme<D = any>(path: string, defaultValue: D) => D
```

But this sadly doesn't give you "nice" auto completion. However, the
default might be good enough if we don't error on for example
`theme('customPlugin')` which is currently not the case.

* update changelog

* undo all `theme` types, and type it as `theme(path: string): any`

Since currently we don't want to investigate time to make the code
completion *perfect* (because it might be even impossible to do it
properly due to resolving of overrides, extend and deeply nested presets)

For now we will provide a way simpler type, which is better than
incorrect types. So far we only had types for the default config theme
*only*.
2022-03-31 23:58:31 +02:00
depfu[bot]
8ba3d61a82 Update lilconfig to version 2.0.5 2022-03-30 23:43:26 +00:00
depfu[bot]
e361b3accd Update @swc/cli to version 0.1.56 2022-03-28 12:28:33 +00:00
depfu[bot]
4bd8313202 Update @swc/core to version 1.2.160 2022-03-26 14:28:39 +00:00
Robin Malfait
ea80db213a
fix plugin order 2022-03-25 22:36:18 +01:00
Robin Malfait
ba24bccfd8
fix formatting 2022-03-25 22:36:05 +01:00
Adam Wathan
e63206be63 Update changelog 2022-03-25 15:43:38 -04:00
seb-jean
79f018c16b
Add backdrop variant (#7924)
* Update corePlugins.js

* Update variants.test.html

* Update variants.test.css
2022-03-25 15:42:27 -04:00
Adam Wathan
b2dd6ffa42
Remove autoprefixer as peer-dependency (#7949)
* Remove autoprefixer as peer-dependency

* Update lock file

* Update changelog
2022-03-25 09:46:23 -04:00
depfu[bot]
042482a4b0 Update postcss to version 8.4.12 2022-03-24 22:28:42 +00:00
Robin Malfait
315e3a2445
Allow for custom properties in rgb, rgba, hsl and hsla colors (#7933)
* allow for custom properties in `rgb`, `rgba`, `hsl` and `hsla` colors

* update changelog

* add more `parseColor` test cases
2022-03-24 12:43:21 +01:00
depfu[bot]
f3a629a619 Update prettier to version 2.6.0 2022-03-23 04:44:19 +00:00
Robin Malfait
05ace4f32d
fix vulnerability using npm audit fix 2022-03-22 21:11:16 +01:00
depfu[bot]
857299e2bd Update autoprefixer to version 10.4.4 2022-03-22 18:43:50 +00:00
Adam Wathan
c9d2d0d5eb
Add enabled variant (#7905)
* Add enabled variant

* Update changelog
2022-03-22 10:43:39 -04:00
Robin Malfait
949bcb3548
fix types nesting (#7914)
`Partial` is only 1 level deep. We don't want it to be recursively deep,
that's for the plugin itself to decide. But the parts under `theme`
should all be optional.
2022-03-22 11:53:40 +01:00
Robin Malfait
c6b3f96f85
ensure generated types are published as well
In my testing, I was publishing using a node 16 install, but on CI we
are using Node 12. It seems that the NPM that shipped with Node 12
ignores all files for publishing if they are mentioned in `.gitignore`
which I could reproduce locally.

Doing a bit of testing, I used this solution which I think we also used
in v2 when generating `dist/` files. The `npm publish --dry-run` now
_does_ include the generated types as well and they are still ignored
for version control.
2022-03-22 10:46:38 +01:00
Robin Malfait
407a5c368c
Add TypeScript types for the tailwind.config.js file (#7891)
* add generate-types script

This script will generate the full list of core plugins, which will
allow you to get code completion for the `corePlugins` section.

It will also generate all the colors (and deprecated colors) which is
used in multiple places in the config.

* add types for the `tailwind.config.js` config file

* annotate stubs with a JSDoc pointing to the types

* add types to package.json

- Updated the files to make sure that the types are being published
- Add a `types` section in the `package.json`, otherwise your editor by
  default will look for the `DefinitelyTyped` types which got me really
  confused for a second.
- Added some scripts to make sure that the generation of types happens
  when needed (before tests and before building). This way you never
  ever have to think about generating them when working on Tailwind CSS
  internals.

* re-export types top-level

Having a `colors.d.ts` next to the `colors.js` file allows us to type
the `colors.js` file and your editor will pickup the types from
`colors.d.ts`.

* also publish generated types

* update changelog

* enable TypeScript only when using `init --types` for now

* update tests to verify that `--types` works
2022-03-22 10:24:28 +01:00
depfu[bot]
0578f7b5b5 Update eslint-config-prettier to version 8.5.0 2022-03-19 10:59:29 +00:00
depfu[bot]
38c84407c1 Update eslint to version 8.11.0 2022-03-18 23:45:19 +00:00
depfu[bot]
0dcbca5b9b Update cssnano to version 5.1.4 2022-03-18 20:13:50 +00:00
Robin Malfait
48728ed5d3
Fix generation of div:not(.foo) if .foo is never defined (#7815)
* fix little typo

* ensure that `div:not(.unknown-class)` gets generated

* update changelog
2022-03-17 16:35:40 +01:00
Adam Wathan
7b4cc36f5e
Update CHANGELOG.md 2022-03-13 14:23:06 -04:00
Jean-Félix
c245d94e41
Update cssnano: 5.0.17 → 5.1.3 (minor) (#7818) 2022-03-13 14:21:50 -04:00
depfu[bot]
f980ca4ca4 Update esbuild to version 0.14.25 2022-03-11 06:14:11 +00:00
depfu[bot]
3581d7bca0 Update prettier-plugin-tailwindcss to version 0.1.8 2022-03-09 11:13:38 +00:00
Jordan Pittman
68d896bbbe
Don't output unparsable arbitrary values (#7789)
* Refactor

* Don’t output unparsable arbitrary values

* Update changelog
2022-03-08 12:43:06 -05:00
Jonathan Reinink
c6097d59fc
Update CHANGELOG.md 2022-03-04 11:22:32 -05:00
Juan Martín Seery
dbb5b1d8f7
Added border-spacing utility (#7102)
* Added `border-spacing` utility

* Update to base CSS variable approach

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
2022-03-04 11:20:23 -05:00
depfu[bot]
deee3b1995 Update @swc/jest to version 0.2.20 2022-03-04 09:59:08 +00:00
depfu[bot]
25c93cacde Update postcss to version 8.4.7 2022-03-03 22:29:15 +00:00
Jordan Pittman
ee945bbea2
Add an explicit --poll option to the CLI (#7725)
* Refactor

* Allow user to enable polling

* Update changelog
2022-03-02 11:16:06 -05:00
Vanshaj Poonia
f6793628a8
Update CONTRIBUTING.md (#7723)
Fixed a Typo
2022-03-02 08:14:18 -05:00
Samuel Alev
bc46d0e0bc
Fix extraction from template literal/function with array (#7481)
* fix: allow extraction from template literal with array

* fix: support extraction from array in function

* test: add more tests for function and template

* test: add test for dynamic classes

* test: add dynamic class test in js

* test: add dynamic class test in js single quote

* Cleanup a bit

* Update changelog

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2022-03-01 14:23:06 -05:00
vitorrd
7df3d938ec
Correctly parse and prefix animation names with dots (#7163)
* Add prefix alone to animation names. Fixes #7149.

* Add test for keyframe animations with a dot in the name

* Add test for prefixed version

* Fix CS

* Simplify

* Update changelog

* Fix

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2022-03-01 14:08:43 -05:00
Brad Cornes
10103d8baf Merge branch 'master' of github.com:tailwindlabs/tailwindcss 2022-03-01 18:29:49 +00:00
Brad Cornes
e19acc28d4 Update changelog 2022-03-01 18:29:46 +00:00
Bogdan Chadkin
f31c4ee4cf
Replace cosmiconfig with lilconfig (#6038)
* Replace cosmiconfig with lilconfig

It's already replaced in postcss-load-config

See https://github.com/postcss/postcss-load-config/blob/main/package.json#L26

* Manually restore parse-json in lockfile removed by npm conflict resolver

* Revert `postcss` version change

Co-authored-by: Brad Cornes <hello@bradley.dev>
2022-03-01 18:27:56 +00:00
depfu[bot]
e302ef1a0d Update eslint-config-prettier to version 8.4.0 2022-02-26 10:59:10 +00:00
Adam Wathan
5ea4b4ce2a Update changelog 2022-02-25 20:11:24 -05:00
Adam Wathan
ec962f09dd Use tuple syntax for customizing darkMode class name 2022-02-25 20:03:07 -05:00
Michael De Giovanni
77156de519 custom dark mode class 2022-02-25 19:59:23 -05:00
Adam Wathan
0a709bcd6f Update changelog 2022-02-25 19:44:57 -05:00
Alaa Badran
26bd819949
Add text-start and text-end (#6656)
These are useful for RTL languages
2022-02-25 19:43:58 -05:00
depfu[bot]
bbafc8e324 Update eslint to version 8.9.0 2022-02-25 21:29:56 +00:00
Jordan Pittman
4fed060b7c
Add support for PostCSS Document nodes (#7291)
* Run Tailwind CSS once for each root in a postcss document

* Update changelog
2022-02-25 14:52:20 -05:00
Adam Wathan
cd8f109981
Update CONTRIBUTING.md 2022-02-25 14:14:20 -05:00
Jordan Pittman
bbf3a37810
Add rgb and hsl color helpers for CSS variables (#7665)
* Add rgb/hsl color helpers

* Update changelog

Co-authored-by: Stefan Schweiger <staeff@me.com>
2022-02-25 14:03:40 -05:00