Support fractional bare values

This commit is contained in:
Jordan Pittman 2024-08-15 14:57:45 -04:00
parent 35eb103b8d
commit 1c4a8260df

View file

@ -140,6 +140,7 @@ export function buildPluginApi(
// Resolve the candidate value
let value: string | null = null
let isFraction = false
{
let values = options?.values ?? {}
@ -165,6 +166,8 @@ export function buildPluginApi(
value = values[candidate.value.value]
} else if (values.__BARE_VALUE__) {
value = values.__BARE_VALUE__(candidate.value) ?? null
isFraction = (candidate.value.fraction !== null && value?.includes('/')) ?? false
}
}
@ -190,7 +193,7 @@ export function buildPluginApi(
}
// A modifier was provided but is invalid
if (candidate.modifier && modifier === null) {
if (candidate.modifier && modifier === null && !isFraction) {
// For arbitrary values, return `null` to avoid falling through to the next utility
return candidate.value?.kind === 'arbitrary' ? null : undefined
}