drop withAlpha on theme (#9906)

This commit is contained in:
Robin Malfait 2022-11-25 14:03:50 +01:00 committed by GitHub
parent b7c1bee131
commit ab47cee503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,25 +253,18 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
}
function resolveThemeValue(path, defaultValue, opts = {}) {
const [pathRoot, ...subPaths] = toPath(path)
const value = getConfigValue(['theme', pathRoot, ...subPaths], defaultValue)
return transformThemeValue(pathRoot)(value, opts)
let parts = toPath(path)
let value = getConfigValue(['theme', ...parts], defaultValue)
return transformThemeValue(parts[0])(value, opts)
}
const theme = Object.assign(
(path, defaultValue = undefined) => resolveThemeValue(path, defaultValue),
{
withAlpha: (path, opacityValue) => resolveThemeValue(path, undefined, { opacityValue }),
}
)
let variantIdentifier = 0
let api = {
postcss,
prefix: applyConfiguredPrefix,
e: escapeClassName,
config: getConfigValue,
theme,
theme: resolveThemeValue,
corePlugins: (path) => {
if (Array.isArray(tailwindConfig.corePlugins)) {
return tailwindConfig.corePlugins.includes(path)