Skip to content

Commit 6942ce7

Browse files
committed
fix: fix inset and negative value handling
1 parent 095d3b0 commit 6942ce7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/extension/utils/tailwind.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,10 @@ export const TAILWIND_CONFIG: Record<string, FamilyConfig> = {
454454
valueKind: 'length',
455455
props: { t: 'margin-top', r: 'margin-right', b: 'margin-bottom', l: 'margin-left' }
456456
},
457-
inset: {
458-
prefix: 'inset-',
459-
mode: 'side',
460-
valueKind: 'length',
461-
props: { t: 'top', r: 'right', b: 'bottom', l: 'left' }
462-
},
457+
top: { prefix: 'top', mode: 'direct', valueKind: 'length', props: { v: 'top' } },
458+
right: { prefix: 'right', mode: 'direct', valueKind: 'length', props: { v: 'right' } },
459+
bottom: { prefix: 'bottom', mode: 'direct', valueKind: 'length', props: { v: 'bottom' } },
460+
left: { prefix: 'left', mode: 'direct', valueKind: 'length', props: { v: 'left' } },
463461
gap: {
464462
prefix: 'gap-',
465463
mode: 'axis',
@@ -759,7 +757,9 @@ function extractValuePart(
759757
familyKey: string,
760758
overrideKind?: ValueKind
761759
): FormattedValue {
762-
const isNegative = val.startsWith('-')
760+
// Leading '-' indicates a negative value for Tailwind, but CSS variable names start with '--'
761+
// and must not be treated as negative.
762+
const isNegative = val.startsWith('-') && !val.startsWith('--')
763763
let inner: string = isNegative ? val.substring(1) : val
764764
let overrideIsKeyword: boolean | undefined
765765

0 commit comments

Comments
 (0)