Skip to content

Commit

Permalink
add support for svh, lvh and dvh` scale values
Browse files Browse the repository at this point in the history
  • Loading branch information
dcastil committed Dec 21, 2023
1 parent 381f117 commit 6047d53
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
40 changes: 36 additions & 4 deletions src/lib/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,21 @@ export function getDefaultConfig() {
* Width
* @see https://tailwindcss.com/docs/width
*/
w: [{ w: ['auto', 'min', 'max', 'fit', isArbitraryValue, spacing] }],
w: [
{
w: [
'auto',
'min',
'max',
'fit',
'svw',
'lvw',
'dvw',
isArbitraryValue,
spacing,
],
},
],
/**
* Min-Width
* @see https://tailwindcss.com/docs/min-width
Expand Down Expand Up @@ -611,17 +625,35 @@ export function getDefaultConfig() {
* Height
* @see https://tailwindcss.com/docs/height
*/
h: [{ h: [isArbitraryValue, spacing, 'auto', 'min', 'max', 'fit'] }],
h: [
{
h: [
isArbitraryValue,
spacing,
'auto',
'min',
'max',
'fit',
'svh',
'lvh',
'dvh',
],
},
],
/**
* Min-Height
* @see https://tailwindcss.com/docs/min-height
*/
'min-h': [{ 'min-h': ['min', 'max', 'fit', isLength, isArbitraryValue] }],
'min-h': [
{ 'min-h': ['min', 'max', 'fit', 'svh', 'lvh', 'dvh', isLength, isArbitraryValue] },
],
/**
* Max-Height
* @see https://tailwindcss.com/docs/max-height
*/
'max-h': [{ 'max-h': [isArbitraryValue, spacing, 'min', 'max', 'fit'] }],
'max-h': [
{ 'max-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] },
],
// Typography
/**
* Font Size
Expand Down
4 changes: 4 additions & 0 deletions tests/tailwind-css-versions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ test('supports Tailwind CSS v3.3 features', () => {
expect(twMerge('content-normal content-center content-stretch')).toBe('content-stretch')
expect(twMerge('whitespace-nowrap whitespace-break-spaces')).toBe('whitespace-break-spaces')
})

test('supports Tailwind CSS v3.4 features', () => {
expect(twMerge('h-svh h-dvh w-svw w-dvw')).toBe('h-dvh w-dvw')
})

0 comments on commit 6047d53

Please sign in to comment.