18 Commits

Author SHA1 Message Date
Jordan Pittman
bf44941049
Allow resolving content paths relative to the config file (#9396)
* Update lockfile

* Tweak formatting

* Refactor content path parsing

* Allow resolving content paths relative to the config file

* Include resolved symlinks as additional content paths

* Update changelog

* Work on suite of tests for content resolution

* reformat integration test list

* Move content resolution tests to integration

* Update future and experimental types
2022-09-23 08:09:02 -04:00
Robin Malfait
4fddd2d611
Polish matchVariant API (#9313)
* convert the `matchVariant` to look more like `addVariant`

With the biggest difference that the `matchVariant` will have a callback
function that receives the current value of the variant.

* use object as argument for `matchVariant` callback

This will allow us to add more properties in the future if needed
without breaking changes.

- This is a breaking change: `(value) => ...` -> `({ value, other }) => ...`
- This is **not** a breaking change: `({ value }) => ...` -> `({ value, other }) => ...`

* add types for `matchVariant`
2022-09-16 15:37:35 +02:00
Brad Cornes
bcf14b1e1b
Fix fontFamily config types (#9214) 2022-08-30 12:22:15 +01:00
Augustine Calvino
da850424dc
fix safelist variant key required by typings (#9200) 2022-08-28 19:00:22 +02:00
Tmk
6729524185 Support font-weight in font-size utilities (#8763)
* Support font-weight in font-size utilities

* WIP update tests

* Update changelog

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2022-07-04 17:01:06 -04:00
Jordan Pittman
d4f1f1561c
Allows fallback values in plugin API helpers (#8762)
* Update types to allow for fallback property values in add/matchUtilities/Components/etc…

* Update changelog
2022-07-01 16:48:28 -04:00
Maxime Garcia
ad98a619a4
Fix casing of import of corePluginList type definition (#8587)
* Fix: Wrong import of CorePluginList type file

* Update changelog

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2022-06-10 09:56:15 -04:00
Jordan Pittman
c44dd7b8e7
Fix postcss plugin type (#8564)
* Fix postcss plugin type

* Update changelog
2022-06-09 16:38:45 -04:00
Robin Malfait
4a745439f0
Add type annotations to the tailwind.config.js file (#8493)
* add type annotation to the config by default

* use `@type {import('tailwindcss').Config}` instead
2022-06-02 16:44:12 +02:00
Brad Cornes
22f9dc8895
Use single-line syntax for private types comments (#8420)
This prevents the comments from appearing in editors
2022-05-25 10:49:20 +01:00
Brad Cornes
c3cf064ae5
Improve theme.extend types (#8419) 2022-05-24 13:26:26 +01:00
Robin Malfait
83b4811c60
Improve types of the tailwindcss/plugin (#8400)
* improve types of the `tailwindcss/plugin`

This also exposes/types the `plugin.withOptions` as described here: https://tailwindcss.com/docs/plugins#exposing-options

* update changelog
2022-05-23 12:35:19 +02:00
Brad Cornes
6fc8d777da
Update screens types (#8042) 2022-04-05 11:46:50 +01:00
Brad Cornes
b9dec5feb7
Update theme.fontSize types (#8040) 2022-04-04 14:35:33 +01: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
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