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

Rename --transition-timing-function-* variables to --ease-* #14886

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove default `--spacing-*` scale in favor of `--spacing` multiplier ([#14857](https://github.com/tailwindlabs/tailwindcss/pull/14857))
- Remove `var(…)` fallbacks from theme values in utilities ([#14881](https://github.com/tailwindlabs/tailwindcss/pull/14881))
- Remove static `font-weight` utilities and add `--font-weight-*` values to the default theme ([#14883](https://github.com/tailwindlabs/tailwindcss/pull/14883))
- Rename `--transition-timing-function-*` variables to `--ease-*` ([#14886](https://github.com/tailwindlabs/tailwindcss/pull/14886))

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
--perspective-normal: 500px;
--perspective-midrange: 800px;
--perspective-distant: 1200px;
--transition-timing-function-in: cubic-bezier(.4, 0, 1, 1);
--transition-timing-function-out: cubic-bezier(0, 0, .2, 1);
--transition-timing-function-in-out: cubic-bezier(.4, 0, .2, 1);
--ease-in: cubic-bezier(.4, 0, 1, 1);
--ease-out: cubic-bezier(0, 0, .2, 1);
--ease-in-out: cubic-bezier(.4, 0, .2, 1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/tailwindcss/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ exports[`compiling CSS > \`@tailwind utilities\` is replaced by utilities using
--perspective-normal: 500px;
--perspective-midrange: 800px;
--perspective-distant: 1200px;
--transition-timing-function-in: cubic-bezier(.4, 0, 1, 1);
--transition-timing-function-out: cubic-bezier(0, 0, .2, 1);
--transition-timing-function-in-out: cubic-bezier(.4, 0, .2, 1);
--ease-in: cubic-bezier(.4, 0, 1, 1);
--ease-out: cubic-bezier(0, 0, .2, 1);
--ease-in-out: cubic-bezier(.4, 0, .2, 1);
}

.w-4 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ test('config values can be merged into the theme', () => {
'0.5': '60%',
'100%': '100%',
},

transitionTimingFunction: {
fast: 'cubic-bezier(0, 0.55, 0.45, 1)',
},
},
},
base: '/root',
Expand Down Expand Up @@ -83,6 +87,7 @@ test('config values can be merged into the theme', () => {
expect(theme.resolve('1/2', ['--width'])).toEqual('60%')
expect(theme.resolve('0.5', ['--width'])).toEqual('60%')
expect(theme.resolve('100%', ['--width'])).toEqual('100%')
expect(theme.resolve('fast', ['--ease'])).toEqual('cubic-bezier(0, 0.55, 0.45, 1)')
})

test('will reset default theme values with overwriting theme values', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/tailwindcss/src/compat/apply-config-to-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export function keyPathToCssProperty(path: string[]) {
if (path[0] === 'borderRadius') path[0] = 'radius'
if (path[0] === 'boxShadow') path[0] = 'shadow'
if (path[0] === 'animation') path[0] = 'animate'
if (path[0] === 'transitionTimingFunction') path[0] = 'ease'

for (let part of path) {
if (!IS_VALID_KEY.test(part)) return null
Expand Down
3 changes: 1 addition & 2 deletions packages/tailwindcss/src/css-functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,10 @@ describe('theme function', () => {
'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
],
['width.xs', '20rem'],
['transition.timing.function.in.out', 'cubic-bezier(.4, 0, .2, 1)'],
['transitionTimingFunction.in-out', 'cubic-bezier(.4, 0, .2, 1)'],
['backgroundColor.red.500', 'oklch(.637 .237 25.331)'],
])('theme(%s) → %s', async (value, result) => {
let defaultTheme = await fs.readFile(path.join(__dirname, '..', 'theme.css'), 'utf8')

let compiled = await compileCss(css`
${defaultTheme}
.custom {
Expand Down
16 changes: 8 additions & 8 deletions packages/tailwindcss/src/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13781,17 +13781,17 @@ test('ease', async () => {
await compileCss(
css`
@theme {
--transition-timing-function-in: cubic-bezier(0.4, 0, 1, 1);
--transition-timing-function-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in: cubic-bezier(0.4, 0, 1, 1);
--ease-out: cubic-bezier(0, 0, 0.2, 1);
}
@tailwind utilities;
`,
['ease-in', 'ease-out', 'ease-[var(--value)]'],
),
).toMatchInlineSnapshot(`
":root {
--transition-timing-function-in: cubic-bezier(.4, 0, 1, 1);
--transition-timing-function-out: cubic-bezier(0, 0, .2, 1);
--ease-in: cubic-bezier(.4, 0, 1, 1);
--ease-out: cubic-bezier(0, 0, .2, 1);
}

.ease-\\[var\\(--value\\)\\] {
Expand All @@ -13800,13 +13800,13 @@ test('ease', async () => {
}

.ease-in {
--tw-ease: var(--transition-timing-function-in);
transition-timing-function: var(--transition-timing-function-in);
--tw-ease: var(--ease-in);
transition-timing-function: var(--ease-in);
}

.ease-out {
--tw-ease: var(--transition-timing-function-out);
transition-timing-function: var(--transition-timing-function-out);
--tw-ease: var(--ease-out);
transition-timing-function: var(--ease-out);
}

@supports (-moz-orient: inline) {
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3538,7 +3538,7 @@ export function createUtilities(theme: Theme) {
['transition-timing-function', 'linear'],
])
functionalUtility('ease', {
themeKeys: ['--transition-timing-function'],
themeKeys: ['--ease'],
handle: (value) => [
transitionTimingFunctionProperty(),
decl('--tw-ease', value),
Expand Down
6 changes: 3 additions & 3 deletions packages/tailwindcss/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@
--perspective-distant: 1200px;

/* Transition timing functions */
--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);

@keyframes spin {
to {
Expand Down