Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows fallback values in plugin API helpers #8762

Merged
merged 2 commits into from Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- Allows fallback values in plugin API helpers ([#8762](https://github.com/tailwindlabs/tailwindcss/pull/8762))

## [3.1.4] - 2022-06-21

Expand Down
11 changes: 6 additions & 5 deletions types/config.d.ts
Expand Up @@ -12,6 +12,7 @@ interface RecursiveKeyValuePair<K extends keyof any = string, V = string> {
[key: string]: V | RecursiveKeyValuePair<K, V>
}
type ResolvableTo<T> = T | ((utils: PluginUtils) => T)
type CSSRuleObject = RecursiveKeyValuePair<string, string | string[]>

interface PluginUtils {
colors: DefaultColors
Expand Down Expand Up @@ -242,15 +243,15 @@ type ValueType =
export interface PluginAPI {
// for registering new static utility styles
addUtilities(
utilities: RecursiveKeyValuePair | RecursiveKeyValuePair[],
utilities: CSSRuleObject | CSSRuleObject[],
options?: Partial<{
respectPrefix: boolean
respectImportant: boolean
}>
): void
// for registering new dynamic utility styles
matchUtilities<T>(
utilities: KeyValuePair<string, (value: T) => RecursiveKeyValuePair>,
utilities: KeyValuePair<string, (value: T) => CSSRuleObject>,
options?: Partial<{
respectPrefix: boolean
respectImportant: boolean
Expand All @@ -261,15 +262,15 @@ export interface PluginAPI {
): void
// for registering new static component styles
addComponents(
components: RecursiveKeyValuePair | RecursiveKeyValuePair[],
components: CSSRuleObject | CSSRuleObject[],
options?: Partial<{
respectPrefix: boolean
respectImportant: boolean
}>
): void
// for registering new dynamic component styles
matchComponents<T>(
components: KeyValuePair<string, (value: T) => RecursiveKeyValuePair>,
components: KeyValuePair<string, (value: T) => CSSRuleObject>,
options?: Partial<{
respectPrefix: boolean
respectImportant: boolean
Expand All @@ -279,7 +280,7 @@ export interface PluginAPI {
}>
): void
// for registering new base styles
addBase(base: RecursiveKeyValuePair | RecursiveKeyValuePair[]): void
addBase(base: CSSRuleObject | CSSRuleObject[]): void
// for registering custom variants
addVariant(name: string, definition: string | string[] | (() => string) | (() => string)[]): void
// for looking up values in the user’s theme configuration
Expand Down