mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-25 16:44:12 +00:00
Support bare spacing scale values for font-size
This commit is contained in:
parent
d573991871
commit
66be2a6bb5
@ -243,7 +243,7 @@ export class Theme {
|
||||
}
|
||||
|
||||
resolveWith(
|
||||
candidateValue: string,
|
||||
candidateValue: string | null,
|
||||
themeKeys: ThemeKey[],
|
||||
nestedKeys: `--${string}`[] = [],
|
||||
): [string, Record<string, string>] | null {
|
||||
|
||||
@ -5095,6 +5095,20 @@ export function createUtilities(theme: Theme) {
|
||||
['--text', '--spacing'],
|
||||
['--line-height', '--letter-spacing', '--font-weight'],
|
||||
)
|
||||
|
||||
// Bare values use the spacing scale
|
||||
if (!value) {
|
||||
let multiplier = theme.resolveWith(
|
||||
null,
|
||||
['--spacing'],
|
||||
['--line-height', '--letter-spacing', '--font-weight'],
|
||||
)
|
||||
if (!multiplier) return
|
||||
if (!isValidSpacingMultiplier(candidate.value.value)) return
|
||||
|
||||
value = [`calc(${multiplier[0]} * ${candidate.value.value})`, multiplier[1]]
|
||||
}
|
||||
|
||||
if (value) {
|
||||
let [fontSize, options = {}] = Array.isArray(value) ? value : [value]
|
||||
|
||||
@ -5158,7 +5172,7 @@ export function createUtilities(theme: Theme) {
|
||||
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
||||
},
|
||||
{
|
||||
values: [],
|
||||
values: theme.get(['--spacing']) ? DEFAULT_SPACING_SUGGESTIONS : [],
|
||||
valueThemeKeys: ['--text', '--spacing'],
|
||||
modifiers: [],
|
||||
modifierThemeKeys: ['--leading', '--spacing'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user