No description
Find a file
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
.github Update CONTRIBUTING.md (#7723) 2022-03-02 08:14:18 -05:00
integrations Add TypeScript types for the tailwind.config.js file (#7891) 2022-03-22 10:24:28 +01:00
jest JIT: Optimize universal selector usage by inlining only the relevant selectors (#4850) 2021-07-01 06:33:37 -04:00
nesting Ensure to transpile the PostCSS Nesting plugin (tailwindcss/nesting) (#7080) 2022-01-15 16:07:20 +01:00
perf Performance improvements + memory leak fix (#3032) 2020-12-11 15:03:49 +01:00
scripts Add TypeScript types for the tailwind.config.js file (#7891) 2022-03-22 10:24:28 +01:00
src fix formatting 2022-03-25 22:36:05 +01:00
standalone-cli Remove cross-env and postcss-cli deps (#6964) 2022-01-07 15:40:36 -05:00
stubs Added border-spacing utility (#7102) 2022-03-04 11:20:23 -05:00
tests fix plugin order 2022-03-25 22:36:18 +01:00
types Types: allow for arbitrary theme values (for 3rd party plugins) (#7926) 2022-03-31 23:58:31 +02:00
.editorconfig Convert new stuff to use ES6 modules 2017-08-27 18:02:41 -04:00
.eslintignore Generate plugin list file (#4725) 2021-06-23 14:13:03 -04:00
.eslintrc.json Remove duplicate prettier.config.js settings from .eslintrc.json (#5087) 2021-09-01 17:41:43 +02:00
.gitignore ensure generated types are published as well 2022-03-22 10:46:38 +01:00
.swcrc Switch to swc from babel (#5593) 2021-09-24 19:17:19 +02:00
base.css Remove preflight CSS export in favor of base 2019-02-11 12:38:46 -05:00
CHANGELOG.md Types: allow for arbitrary theme values (for 3rd party plugins) (#7926) 2022-03-31 23:58:31 +02:00
colors.d.ts Add TypeScript types for the tailwind.config.js file (#7891) 2022-03-22 10:24:28 +01:00
colors.js Add default interop to public available functions (#6348) 2021-12-10 11:25:10 +01:00
components.css Move CSS files to root for easier imports 2018-03-13 10:05:24 -04:00
defaultConfig.d.ts Add TypeScript types for the tailwind.config.js file (#7891) 2022-03-22 10:24:28 +01:00
defaultConfig.js Add default interop to public available functions (#6348) 2021-12-10 11:25:10 +01:00
defaultTheme.d.ts Add TypeScript types for the tailwind.config.js file (#7891) 2022-03-22 10:24:28 +01:00
defaultTheme.js Add default interop to public available functions (#6348) 2021-12-10 11:25:10 +01:00
LICENSE Update LICENSE 2022-02-05 15:22:47 -05:00
package-lock.json Update lilconfig to version 2.0.5 2022-03-30 23:43:26 +00:00
package.json Update lilconfig to version 2.0.5 2022-03-30 23:43:26 +00:00
plugin.d.ts Add TypeScript types for the tailwind.config.js file (#7891) 2022-03-22 10:24:28 +01:00
plugin.js Add default interop to public available functions (#6348) 2021-12-10 11:25:10 +01:00
prettier.config.js Add Prettier configuration file (prettier.config.js) (#3713) 2021-05-13 09:07:24 -04:00
README.md Update logo in readme 2021-12-17 15:25:53 -05:00
resolveConfig.js Add default interop to public available functions (#6348) 2021-12-10 11:25:10 +01:00
screens.css Add screen.css file for postcss-import convenience 2019-05-12 10:36:59 -04:00
tailwind.css Undo accidental changes to CDN build process 2019-12-25 13:54:09 -05:00
types.d.ts Add TypeScript types for the tailwind.config.js file (#7891) 2022-03-22 10:24:28 +01:00
utilities.css Move CSS files to root for easier imports 2018-03-13 10:05:24 -04:00
variants.css JIT: Replace @tailwind screens with @tailwind variants (#4356) 2021-05-14 13:58:52 -04:00

Tailwind CSS Tailwind CSS

A utility-first CSS framework for rapidly building custom user interfaces.

Build Status Total Downloads Latest Release License


Documentation

For full documentation, visit tailwindcss.com.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discuss Tailwind CSS on GitHub

For casual chit-chat with others using the framework:

Join the Tailwind CSS Discord Server

Contributing

If you're interested in contributing to Tailwind CSS, please read our contributing docs before submitting a pull request.