Skip to content

Commit 325217b

Browse files
committed
Add object-{top,bottom}-{left,right} utilities
These match the new mask-* and updated bg-* utilities
1 parent f772266 commit 325217b

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

packages/tailwindcss/src/compat/legacy-utilities.ts

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ export function registerLegacyUtilities(designSystem: DesignSystem) {
2929
decl('background-position', 'right bottom'),
3030
])
3131

32+
// Legacy `object-position` utilities for compatibility with v4.0 and earlier
33+
designSystem.utilities.static('object-left-top', () => [decl('object-position', 'left top')])
34+
designSystem.utilities.static('object-right-top', () => [decl('object-position', 'right top')])
35+
designSystem.utilities.static('object-left-bottom', () => [
36+
decl('object-position', 'left bottom'),
37+
])
38+
designSystem.utilities.static('object-right-bottom', () => [
39+
decl('object-position', 'right bottom'),
40+
])
41+
3242
designSystem.utilities.functional('max-w-screen', (candidate) => {
3343
if (!candidate.value) return
3444
if (candidate.value.kind === 'arbitrary') return

packages/tailwindcss/src/utilities.test.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -17706,15 +17706,21 @@ test('object', async () => {
1770617706

1770717707
// object-position
1770817708
'object-[var(--value)]',
17709+
'object-top',
17710+
'object-top-left',
17711+
'object-top-right',
1770917712
'object-bottom',
17710-
'object-center',
17713+
'object-bottom-left',
17714+
'object-bottom-right',
1771117715
'object-left',
17716+
'object-right',
17717+
'object-center',
17718+
17719+
// Legacy versions in v4.0 and earlier
1771217720
'object-left-bottom',
1771317721
'object-left-top',
17714-
'object-right',
1771517722
'object-right-bottom',
1771617723
'object-right-top',
17717-
'object-top',
1771817724
]),
1771917725
).toMatchInlineSnapshot(`
1772017726
".object-contain {

packages/tailwindcss/src/utilities.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -3639,15 +3639,15 @@ export function createUtilities(theme: Theme) {
36393639
staticUtility('object-none', [['object-fit', 'none']])
36403640
staticUtility('object-scale-down', [['object-fit', 'scale-down']])
36413641

3642+
staticUtility('object-top', [['object-position', 'top']])
3643+
staticUtility('object-top-left', [['object-position', 'left top']])
3644+
staticUtility('object-top-right', [['object-position', 'right top']])
36423645
staticUtility('object-bottom', [['object-position', 'bottom']])
3643-
staticUtility('object-center', [['object-position', 'center']])
3646+
staticUtility('object-bottom-left', [['object-position', 'left bottom']])
3647+
staticUtility('object-bottom-right', [['object-position', 'right bottom']])
36443648
staticUtility('object-left', [['object-position', 'left']])
3645-
staticUtility('object-left-bottom', [['object-position', 'left bottom']])
3646-
staticUtility('object-left-top', [['object-position', 'left top']])
36473649
staticUtility('object-right', [['object-position', 'right']])
3648-
staticUtility('object-right-bottom', [['object-position', 'right bottom']])
3649-
staticUtility('object-right-top', [['object-position', 'right top']])
3650-
staticUtility('object-top', [['object-position', 'top']])
3650+
staticUtility('object-center', [['object-position', 'center']])
36513651
functionalUtility('object', {
36523652
themeKeys: ['--object-position'],
36533653
handle: (value) => [decl('object-position', value)],

0 commit comments

Comments
 (0)