Skip to content

Commit

Permalink
Rename transition-timing-function variables to --ease-*
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed Nov 5, 2024
1 parent 8bd3c85 commit cc9e4b8
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
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
5 changes: 5 additions & 0 deletions packages/tailwindcss/src/compat/apply-config-to-theme.test.ts
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 @@ -13811,17 +13811,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 @@ -13830,13 +13830,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

0 comments on commit cc9e4b8

Please sign in to comment.