Skip to content

Commit 32cf4af

Browse files
authored
Rename --transition-timing-function-* variables to --ease-* (#14886)
This PR renames the `--transition-timing-function-*` theme variables to `--ease-*` to more closely match the utility names and be a bit more terse in general. ```diff @theme { - --transition-timing-function-in: cubic-bezier(0.4, 0, 1, 1); - --transition-timing-function-out: cubic-bezier(0, 0, 0.2, 1); - --transition-timing-function-in-out: cubic-bezier(0.4, 0, 0.2, 1); + --ease-in: cubic-bezier(0.4, 0, 1, 1); + --ease-out: cubic-bezier(0, 0, 0.2, 1); + --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); } ``` This is part of a bigger set of changes where we're renaming other theme variables as well with the same goals, since many existing theme variables like `--shadow-*` and `--radius-*` are already not using the explicit CSS property name. --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent 2aea6e9 commit 32cf4af

File tree

9 files changed

+26
-20
lines changed

9 files changed

+26
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4343
- Remove default `--spacing-*` scale in favor of `--spacing` multiplier ([#14857](https://github.com/tailwindlabs/tailwindcss/pull/14857))
4444
- Remove `var(…)` fallbacks from theme values in utilities ([#14881](https://github.com/tailwindlabs/tailwindcss/pull/14881))
4545
- Remove static `font-weight` utilities and add `--font-weight-*` values to the default theme ([#14883](https://github.com/tailwindlabs/tailwindcss/pull/14883))
46+
- Rename `--transition-timing-function-*` variables to `--ease-*` ([#14886](https://github.com/tailwindlabs/tailwindcss/pull/14886))
4647

4748
## [4.0.0-alpha.31] - 2024-10-29
4849

packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
366366
--perspective-normal: 500px;
367367
--perspective-midrange: 800px;
368368
--perspective-distant: 1200px;
369-
--transition-timing-function-in: cubic-bezier(.4, 0, 1, 1);
370-
--transition-timing-function-out: cubic-bezier(0, 0, .2, 1);
371-
--transition-timing-function-in-out: cubic-bezier(.4, 0, .2, 1);
369+
--ease-in: cubic-bezier(.4, 0, 1, 1);
370+
--ease-out: cubic-bezier(0, 0, .2, 1);
371+
--ease-in-out: cubic-bezier(.4, 0, .2, 1);
372372
}
373373
}
374374

packages/tailwindcss/src/__snapshots__/index.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ exports[`compiling CSS > \`@tailwind utilities\` is replaced by utilities using
365365
--perspective-normal: 500px;
366366
--perspective-midrange: 800px;
367367
--perspective-distant: 1200px;
368-
--transition-timing-function-in: cubic-bezier(.4, 0, 1, 1);
369-
--transition-timing-function-out: cubic-bezier(0, 0, .2, 1);
370-
--transition-timing-function-in-out: cubic-bezier(.4, 0, .2, 1);
368+
--ease-in: cubic-bezier(.4, 0, 1, 1);
369+
--ease-out: cubic-bezier(0, 0, .2, 1);
370+
--ease-in-out: cubic-bezier(.4, 0, .2, 1);
371371
}
372372
373373
.w-4 {

packages/tailwindcss/src/compat/apply-config-to-theme.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ test('config values can be merged into the theme', () => {
5656
'0.5': '60%',
5757
'100%': '100%',
5858
},
59+
60+
transitionTimingFunction: {
61+
fast: 'cubic-bezier(0, 0.55, 0.45, 1)',
62+
},
5963
},
6064
},
6165
base: '/root',
@@ -83,6 +87,7 @@ test('config values can be merged into the theme', () => {
8387
expect(theme.resolve('1/2', ['--width'])).toEqual('60%')
8488
expect(theme.resolve('0.5', ['--width'])).toEqual('60%')
8589
expect(theme.resolve('100%', ['--width'])).toEqual('100%')
90+
expect(theme.resolve('fast', ['--ease'])).toEqual('cubic-bezier(0, 0.55, 0.45, 1)')
8691
})
8792

8893
test('will reset default theme values with overwriting theme values', () => {

packages/tailwindcss/src/compat/apply-config-to-theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export function keyPathToCssProperty(path: string[]) {
133133
if (path[0] === 'borderRadius') path[0] = 'radius'
134134
if (path[0] === 'boxShadow') path[0] = 'shadow'
135135
if (path[0] === 'animation') path[0] = 'animate'
136+
if (path[0] === 'transitionTimingFunction') path[0] = 'ease'
136137
if (path[0] === 'fontFamily') path[0] = 'font'
137138

138139
for (let part of path) {

packages/tailwindcss/src/css-functions.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,10 @@ describe('theme function', () => {
618618
'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
619619
],
620620
['width.xs', '20rem'],
621-
['transition.timing.function.in.out', 'cubic-bezier(.4, 0, .2, 1)'],
621+
['transitionTimingFunction.in-out', 'cubic-bezier(.4, 0, .2, 1)'],
622622
['backgroundColor.red.500', 'oklch(.637 .237 25.331)'],
623623
])('theme(%s) → %s', async (value, result) => {
624624
let defaultTheme = await fs.readFile(path.join(__dirname, '..', 'theme.css'), 'utf8')
625-
626625
let compiled = await compileCss(css`
627626
${defaultTheme}
628627
.custom {

packages/tailwindcss/src/utilities.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13801,17 +13801,17 @@ test('ease', async () => {
1380113801
await compileCss(
1380213802
css`
1380313803
@theme {
13804-
--transition-timing-function-in: cubic-bezier(0.4, 0, 1, 1);
13805-
--transition-timing-function-out: cubic-bezier(0, 0, 0.2, 1);
13804+
--ease-in: cubic-bezier(0.4, 0, 1, 1);
13805+
--ease-out: cubic-bezier(0, 0, 0.2, 1);
1380613806
}
1380713807
@tailwind utilities;
1380813808
`,
1380913809
['ease-in', 'ease-out', 'ease-[var(--value)]'],
1381013810
),
1381113811
).toMatchInlineSnapshot(`
1381213812
":root {
13813-
--transition-timing-function-in: cubic-bezier(.4, 0, 1, 1);
13814-
--transition-timing-function-out: cubic-bezier(0, 0, .2, 1);
13813+
--ease-in: cubic-bezier(.4, 0, 1, 1);
13814+
--ease-out: cubic-bezier(0, 0, .2, 1);
1381513815
}
1381613816
1381713817
.ease-\\[var\\(--value\\)\\] {
@@ -13820,13 +13820,13 @@ test('ease', async () => {
1382013820
}
1382113821
1382213822
.ease-in {
13823-
--tw-ease: var(--transition-timing-function-in);
13824-
transition-timing-function: var(--transition-timing-function-in);
13823+
--tw-ease: var(--ease-in);
13824+
transition-timing-function: var(--ease-in);
1382513825
}
1382613826
1382713827
.ease-out {
13828-
--tw-ease: var(--transition-timing-function-out);
13829-
transition-timing-function: var(--transition-timing-function-out);
13828+
--tw-ease: var(--ease-out);
13829+
transition-timing-function: var(--ease-out);
1383013830
}
1383113831
1383213832
@supports (-moz-orient: inline) {

packages/tailwindcss/src/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@ export function createUtilities(theme: Theme) {
35393539
['transition-timing-function', 'linear'],
35403540
])
35413541
functionalUtility('ease', {
3542-
themeKeys: ['--transition-timing-function'],
3542+
themeKeys: ['--ease'],
35433543
handle: (value) => [
35443544
transitionTimingFunctionProperty(),
35453545
decl('--tw-ease', value),

packages/tailwindcss/theme.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,9 @@
421421
--perspective-distant: 1200px;
422422

423423
/* Transition timing functions */
424-
--transition-timing-function-in: cubic-bezier(0.4, 0, 1, 1);
425-
--transition-timing-function-out: cubic-bezier(0, 0, 0.2, 1);
426-
--transition-timing-function-in-out: cubic-bezier(0.4, 0, 0.2, 1);
424+
--ease-in: cubic-bezier(0.4, 0, 1, 1);
425+
--ease-out: cubic-bezier(0, 0, 0.2, 1);
426+
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
427427

428428
@keyframes spin {
429429
to {

0 commit comments

Comments
 (0)