diff --git a/CHANGELOG.md b/CHANGELOG.md index 29b94cc894f8..35eb85fd2bea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ensure `flex` is suggested ([#15014](https://github.com/tailwindlabs/tailwindcss/pull/15014)) - Improve module resolution for `cjs`-only and `esm`-only plugins ([#15041](https://github.com/tailwindlabs/tailwindcss/pull/15041)) +- Fix `-rotate-*` utilities ([#15044](https://github.com/tailwindlabs/tailwindcss/pull/15044)) - _Upgrade (experimental)_: Resolve imports when specifying a CSS entry point on the command-line ([#15010](https://github.com/tailwindlabs/tailwindcss/pull/15010)) - _Upgrade (experimental)_: Resolve nearest Tailwind config file when CSS file does not contain `@config` ([#15001](https://github.com/tailwindlabs/tailwindcss/pull/15001)) - _Upgrade (experimental)_: Improve output when CSS imports can not be found ([#15038](https://github.com/tailwindlabs/tailwindcss/pull/15038)) diff --git a/packages/tailwindcss/src/utilities.test.ts b/packages/tailwindcss/src/utilities.test.ts index 8e79a3d28098..5483d2085e4a 100644 --- a/packages/tailwindcss/src/utilities.test.ts +++ b/packages/tailwindcss/src/utilities.test.ts @@ -4440,7 +4440,7 @@ test('rotate', async () => { test('rotate-x', async () => { expect(await run(['rotate-x-45', '-rotate-x-45', 'rotate-x-[123deg]'])).toMatchInlineSnapshot(` ".-rotate-x-45 { - --tw-rotate-x: calc(rotateX(45deg) * -1); + --tw-rotate-x: rotateX(calc(45deg * -1)); transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); } @@ -4450,7 +4450,7 @@ test('rotate-x', async () => { } .rotate-x-\\[123deg\\] { - --tw-rotate-x: 123deg; + --tw-rotate-x: rotateX(123deg); transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); } @@ -4510,64 +4510,70 @@ test('rotate-x', async () => { }) test('rotate-y', async () => { - expect(await run(['rotate-y-45', '-rotate-y-45', 'rotate-y-[123deg]'])).toMatchInlineSnapshot(` - ".-rotate-y-45 { - --tw-rotate-y: calc(rotateY(45deg) * -1); - transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); - } + expect(await run(['rotate-y-45', '-rotate-y-45', 'rotate-y-[123deg]', '-rotate-y-[123deg]'])) + .toMatchInlineSnapshot(` + ".-rotate-y-45 { + --tw-rotate-y: rotateY(calc(45deg * -1)); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } - .rotate-y-45 { - --tw-rotate-y: rotateY(45deg); - transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); - } + .-rotate-y-\\[123deg\\] { + --tw-rotate-y: rotateY(calc(123deg * -1)); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } - .rotate-y-\\[123deg\\] { - --tw-rotate-y: 123deg; - transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); - } + .rotate-y-45 { + --tw-rotate-y: rotateY(45deg); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } - @supports (-moz-orient: inline) { - @layer base { - *, :before, :after, ::backdrop { - --tw-rotate-x: rotateX(0); - --tw-rotate-y: rotateY(0); - --tw-rotate-z: rotateZ(0); - --tw-skew-x: skewX(0); - --tw-skew-y: skewY(0); + .rotate-y-\\[123deg\\] { + --tw-rotate-y: rotateY(123deg); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } + + @supports (-moz-orient: inline) { + @layer base { + *, :before, :after, ::backdrop { + --tw-rotate-x: rotateX(0); + --tw-rotate-y: rotateY(0); + --tw-rotate-z: rotateZ(0); + --tw-skew-x: skewX(0); + --tw-skew-y: skewY(0); + } } } - } - @property --tw-rotate-x { - syntax: ""; - inherits: false; - initial-value: rotateX(0); - } + @property --tw-rotate-x { + syntax: ""; + inherits: false; + initial-value: rotateX(0); + } - @property --tw-rotate-y { - syntax: ""; - inherits: false; - initial-value: rotateY(0); - } + @property --tw-rotate-y { + syntax: ""; + inherits: false; + initial-value: rotateY(0); + } - @property --tw-rotate-z { - syntax: ""; - inherits: false; - initial-value: rotateZ(0); - } + @property --tw-rotate-z { + syntax: ""; + inherits: false; + initial-value: rotateZ(0); + } - @property --tw-skew-x { - syntax: ""; - inherits: false; - initial-value: skewX(0); - } + @property --tw-skew-x { + syntax: ""; + inherits: false; + initial-value: skewX(0); + } - @property --tw-skew-y { - syntax: ""; - inherits: false; - initial-value: skewY(0); - }" - `) + @property --tw-skew-y { + syntax: ""; + inherits: false; + initial-value: skewY(0); + }" + `) expect( await run([ 'rotate-y', @@ -4581,6 +4587,84 @@ test('rotate-y', async () => { ).toEqual('') }) +test('rotate-z', async () => { + expect(await run(['rotate-z-45', '-rotate-z-45', 'rotate-z-[123deg]', '-rotate-z-[123deg]'])) + .toMatchInlineSnapshot(` + ".-rotate-z-45 { + --tw-rotate-z: rotateZ(calc(45deg * -1)); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } + + .-rotate-z-\\[123deg\\] { + --tw-rotate-z: rotateZ(calc(123deg * -1)); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } + + .rotate-z-45 { + --tw-rotate-z: rotateZ(45deg); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } + + .rotate-z-\\[123deg\\] { + --tw-rotate-z: rotateZ(123deg); + transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); + } + + @supports (-moz-orient: inline) { + @layer base { + *, :before, :after, ::backdrop { + --tw-rotate-x: rotateX(0); + --tw-rotate-y: rotateY(0); + --tw-rotate-z: rotateZ(0); + --tw-skew-x: skewX(0); + --tw-skew-y: skewY(0); + } + } + } + + @property --tw-rotate-x { + syntax: ""; + inherits: false; + initial-value: rotateX(0); + } + + @property --tw-rotate-y { + syntax: ""; + inherits: false; + initial-value: rotateY(0); + } + + @property --tw-rotate-z { + syntax: ""; + inherits: false; + initial-value: rotateZ(0); + } + + @property --tw-skew-x { + syntax: ""; + inherits: false; + initial-value: skewX(0); + } + + @property --tw-skew-y { + syntax: ""; + inherits: false; + initial-value: skewY(0); + }" + `) + expect( + await run([ + 'rotate-z', + 'rotate-z--1', + '-rotate-z', + 'rotate-z-potato', + 'rotate-z-45/foo', + '-rotate-z-45/foo', + 'rotate-z-[123deg]/foo', + ]), + ).toEqual('') +}) + test('skew', async () => { expect(await run(['skew-6', '-skew-6', 'skew-[123deg]'])).toMatchInlineSnapshot(` ".-skew-6 { diff --git a/packages/tailwindcss/src/utilities.ts b/packages/tailwindcss/src/utilities.ts index e149496d6eca..ee90f9e2e811 100644 --- a/packages/tailwindcss/src/utilities.ts +++ b/packages/tailwindcss/src/utilities.ts @@ -1330,11 +1330,11 @@ export function createUtilities(theme: Theme) { themeKeys: ['--rotate'], handleBareValue: ({ value }) => { if (!isPositiveInteger(value)) return null - return `rotate${axis.toUpperCase()}(${value}deg)` + return `${value}deg` }, handle: (value) => [ transformProperties(), - decl(`--tw-rotate-${axis}`, value), + decl(`--tw-rotate-${axis}`, `rotate${axis.toUpperCase()}(${value})`), decl('transform', transformValue), ], })