Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add safe alignment utilities #14607

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add support for `tailwindcss/colors.js`, `tailwindcss/defaultTheme.js`, and `tailwindcss/plugin.js` exports ([#14595](https://github.com/tailwindlabs/tailwindcss/pull/14595))
- Support `keyframes` in JS config file themes ([#14594](https://github.com/tailwindlabs/tailwindcss/pull/14594))
- Add safe alignment utilities ([#14607](https://github.com/tailwindlabs/tailwindcss/pull/14607))
- _Upgrade (experimental)_: The upgrade tool now automatically discovers your JavaScript config ([#14597](https://github.com/tailwindlabs/tailwindcss/pull/14597))

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,9 @@ exports[`getClassList 1`] = `
"content-baseline",
"content-between",
"content-center",
"content-center-safe",
"content-end",
"content-end-safe",
"content-evenly",
"content-none",
"content-normal",
Expand Down Expand Up @@ -2375,24 +2377,32 @@ exports[`getClassList 1`] = `
"italic",
"items-baseline",
"items-center",
"items-center-safe",
"items-end",
"items-end-safe",
"items-start",
"items-stretch",
"justify-around",
"justify-baseline",
"justify-between",
"justify-center",
"justify-center-safe",
"justify-end",
"justify-end-safe",
"justify-evenly",
"justify-items-center",
"justify-items-center-safe",
"justify-items-end",
"justify-items-end-safe",
"justify-items-normal",
"justify-items-start",
"justify-items-stretch",
"justify-normal",
"justify-self-auto",
"justify-self-center",
"justify-self-center-safe",
"justify-self-end",
"justify-self-end-safe",
"justify-self-start",
"justify-self-stretch",
"justify-start",
Expand Down Expand Up @@ -2756,18 +2766,24 @@ exports[`getClassList 1`] = `
"place-content-baseline",
"place-content-between",
"place-content-center",
"place-content-center-safe",
"place-content-end",
"place-content-end-safe",
"place-content-evenly",
"place-content-start",
"place-content-stretch",
"place-items-baseline",
"place-items-center",
"place-items-center-safe",
"place-items-end",
"place-items-end-safe",
"place-items-start",
"place-items-stretch",
"place-self-auto",
"place-self-center",
"place-self-center-safe",
"place-self-end",
"place-self-end-safe",
"place-self-start",
"place-self-stretch",
"placeholder-current",
Expand Down Expand Up @@ -3261,7 +3277,9 @@ exports[`getClassList 1`] = `
"self-auto",
"self-baseline",
"self-center",
"self-center-safe",
"self-end",
"self-end-safe",
"self-start",
"self-stretch",
"sepia",
Expand Down
101 changes: 99 additions & 2 deletions packages/tailwindcss/src/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6514,8 +6514,10 @@ test('place-content', async () => {
expect(
await run([
'place-content-center',
'place-content-center-safe',
'place-content-start',
'place-content-end',
'place-content-end-safe',
'place-content-between',
'place-content-around',
'place-content-evenly',
Expand All @@ -6539,10 +6541,18 @@ test('place-content', async () => {
place-content: center;
}

.place-content-center-safe {
place-content: safe center;
}

.place-content-end {
place-content: end;
}

.place-content-end-safe {
place-content: safe end;
}

.place-content-evenly {
place-content: evenly;
}
Expand Down Expand Up @@ -6583,7 +6593,9 @@ test('place-items', async () => {
await run([
'place-items-start',
'place-items-end',
'place-items-end-safe',
'place-items-center',
'place-items-center-safe',
'place-items-baseline',
'place-items-stretch',
]),
Expand All @@ -6596,10 +6608,18 @@ test('place-items', async () => {
place-items: center;
}

.place-items-center-safe {
place-items: safe center;
}

.place-items-end {
place-items: end;
}

.place-items-end-safe {
place-items: safe end;
}

.place-items-start {
place-items: start;
}
Expand Down Expand Up @@ -6630,8 +6650,10 @@ test('align-content', async () => {
await run([
'content-normal',
'content-center',
'content-center-safe',
'content-start',
'content-end',
'content-end-safe',
'content-between',
'content-around',
'content-evenly',
Expand All @@ -6655,10 +6677,18 @@ test('align-content', async () => {
align-content: center;
}

.content-center-safe {
align-content: safe center;
}

.content-end {
align-content: flex-end;
}

.content-end-safe {
align-content: safe flex-end;
}

.content-evenly {
align-content: space-evenly;
}
Expand Down Expand Up @@ -6701,8 +6731,17 @@ test('align-content', async () => {
})

test('items', async () => {
expect(await run(['items-start', 'items-end', 'items-center', 'items-baseline', 'items-stretch']))
.toMatchInlineSnapshot(`
expect(
await run([
'items-start',
'items-end',
'items-end-safe',
'items-center',
'items-center-safe',
'items-baseline',
'items-stretch',
]),
).toMatchInlineSnapshot(`
".items-baseline {
align-items: baseline;
}
Expand All @@ -6711,10 +6750,18 @@ test('items', async () => {
align-items: center;
}

.items-center-safe {
align-items: safe center;
}

.items-end {
align-items: flex-end;
}

.items-end-safe {
align-items: safe flex-end;
}

.items-start {
align-items: flex-start;
}
Expand Down Expand Up @@ -6746,7 +6793,9 @@ test('justify', async () => {
'justify-normal',
'justify-start',
'justify-end',
'justify-end-safe',
'justify-center',
'justify-center-safe',
'justify-between',
'justify-around',
'justify-evenly',
Expand All @@ -6765,10 +6814,18 @@ test('justify', async () => {
justify-content: center;
}

.justify-center-safe {
justify-content: safe center;
}

.justify-end {
justify-content: flex-end;
}

.justify-end-safe {
justify-content: safe flex-end;
}

.justify-evenly {
justify-content: space-evenly;
}
Expand Down Expand Up @@ -6813,18 +6870,28 @@ test('justify-items', async () => {
await run([
'justify-items-start',
'justify-items-end',
'justify-items-end-safe',
'justify-items-center',
'justify-items-center-safe',
'justify-items-stretch',
]),
).toMatchInlineSnapshot(`
".justify-items-center {
justify-items: center;
}

.justify-items-center-safe {
justify-items: safe center;
}

.justify-items-end {
justify-items: end;
}

.justify-items-end-safe {
justify-items: safe end;
}

.justify-items-start {
justify-items: start;
}
Expand Down Expand Up @@ -7728,7 +7795,9 @@ test('place-self', async () => {
'place-self-auto',
'place-self-start',
'place-self-end',
'place-self-end-safe',
'place-self-center',
'place-self-center-safe',
'place-self-stretch',
]),
).toMatchInlineSnapshot(`
Expand All @@ -7740,10 +7809,18 @@ test('place-self', async () => {
place-self: center;
}

.place-self-center-safe {
place-self: safe center;
}

.place-self-end {
place-self: end;
}

.place-self-end-safe {
place-self: safe end;
}

.place-self-start {
place-self: start;
}
Expand Down Expand Up @@ -7775,7 +7852,9 @@ test('self', async () => {
'self-auto',
'self-start',
'self-end',
'self-end-safe',
'self-center',
'self-center-safe',
'self-stretch',
'self-baseline',
]),
Expand All @@ -7792,10 +7871,18 @@ test('self', async () => {
align-self: center;
}

.self-center-safe {
align-self: safe center;
}

.self-end {
align-self: flex-end;
}

.self-end-safe {
align-self: safe flex-end;
}

.self-start {
align-self: flex-start;
}
Expand Down Expand Up @@ -7829,7 +7916,9 @@ test('justify-self', async () => {
'justify-self-auto',
'justify-self-start',
'justify-self-end',
'justify-self-end-safe',
'justify-self-center',
'justify-self-center-safe',
'justify-self-stretch',
'justify-self-baseline',
]),
Expand All @@ -7842,10 +7931,18 @@ test('justify-self', async () => {
justify-self: center;
}

.justify-self-center-safe {
justify-self: safe center;
}

.justify-self-end {
justify-self: flex-end;
}

.justify-self-end-safe {
justify-self: safe flex-end;
}

.justify-self-start {
justify-self: flex-start;
}
Expand Down
Loading