Remove bare value handling for perspective utilities (#13288)

* Remove bare value handling for perspective utilities

* move `perspective-123` example

This is now moved to the spot where we ensure that nothing is generated
at all. This prevents us from accidentally updating a snapshot and
missing a potential bug.

* update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
This commit is contained in:
Adam Wathan 2024-03-20 10:25:24 -04:00 committed by GitHub
parent d25fe81da8
commit 89a0b86e73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 17 deletions

View File

@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add `inherit` as a universal color ([#13258](https://github.com/tailwindlabs/tailwindcss/pull/13258))
- Add 3D transform utilities ([#13248](https://github.com/tailwindlabs/tailwindcss/pull/13248))
- Add 3D transform utilities ([#13248](https://github.com/tailwindlabs/tailwindcss/pull/13248), [#13288](https://github.com/tailwindlabs/tailwindcss/pull/13288))
### Fixed

View File

@ -3128,13 +3128,7 @@ test('perspective', () => {
}
@tailwind utilities;
`,
[
'perspective-normal',
'perspective-dramatic',
'perspective-none',
'perspective-123',
'perspective-[456px]',
],
['perspective-normal', 'perspective-dramatic', 'perspective-none', 'perspective-[456px]'],
),
).toMatchInlineSnapshot(`
":root {
@ -3142,10 +3136,6 @@ test('perspective', () => {
--perspective-normal: 500px;
}
.perspective-123 {
perspective: 123px;
}
.perspective-\\[456px\\] {
perspective: 456px;
}
@ -3162,7 +3152,7 @@ test('perspective', () => {
perspective: 500px;
}"
`)
expect(run(['perspective', '-perspective', 'perspective-potato'])).toEqual('')
expect(run(['perspective', '-perspective', 'perspective-potato', 'perspective-123'])).toEqual('')
})
test('cursor', () => {

View File

@ -1501,10 +1501,6 @@ export function createUtilities(theme: Theme) {
staticUtility('perspective-none', [['perspective', 'none']])
functionalUtility('perspective', {
themeKeys: ['--perspective'],
handleBareValue: ({ value }) => {
if (!Number.isInteger(Number(value))) return null
return `${value}px`
},
handle: (value) => [decl('perspective', value)],
})