From 6d9ae82ba341eed7b0e608e3fac2036fe825c958 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 11 Sep 2024 19:23:53 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Allow=20`anchor-size(=E2=80=A6)`=20in=20arb?= =?UTF-8?q?itrary=20values=20(#14393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes an issue where using `anchor-size` in arbitrary values resulted in the incorrect css. Input: `w-[calc(anchor-size(width)+8px)]` Output: ```css .w-\[calc\(anchor-size\(width\)\+8px\)\] { width: calc(anchor - size(width) + 8px); } ``` This PR fixes that, by generating the correct CSS: ```css .w-\[calc\(anchor-size\(width\)\+8px\)\] { width: calc(anchor-size(width) + 8px); } ``` --- src/util/dataTypes.js | 2 ++ tests/normalize-data-types.test.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/util/dataTypes.js b/src/util/dataTypes.js index e1db13754e45..9447732938cd 100644 --- a/src/util/dataTypes.js +++ b/src/util/dataTypes.js @@ -147,6 +147,8 @@ function normalizeMathOperatorSpacing(value) { 'repeating-radial-gradient', 'repeating-linear-gradient', 'repeating-conic-gradient', + + 'anchor-size', ] return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match) => { diff --git a/tests/normalize-data-types.test.js b/tests/normalize-data-types.test.js index ba995f43006f..1c302ec28e68 100644 --- a/tests/normalize-data-types.test.js +++ b/tests/normalize-data-types.test.js @@ -96,6 +96,9 @@ let table = [ '[content-start] calc(100% - 1px) [content-end] minmax(1rem,1fr)', ], + // Prevent formatting functions that are not math functions + ['w-[calc(anchor-size(width)+8px)]', 'w-[calc(anchor-size(width) + 8px)]'], + // Misc ['color(0_0_0/1.0)', 'color(0 0 0/1.0)'], ['color(0_0_0_/_1.0)', 'color(0 0 0 / 1.0)'], From 8dd9246a87a5c5fc3b68bb2b6742980a0e588138 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 11 Sep 2024 19:25:13 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81c863478c6e..112b386823ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Allow `anchor-size(…)` in arbitrary values ([#14393](https://github.com/tailwindlabs/tailwindcss/pull/14393)) ## [3.4.10] - 2024-08-13 From 818d10ab8461e682a185475dd4718e741103a4e3 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 11 Sep 2024 19:25:41 +0200 Subject: [PATCH 3/3] 3.4.11 --- CHANGELOG.md | 7 ++++++- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 112b386823ed..8aa30fd036f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Nothing yet! + +## [3.4.11] - 2024-09-11 + ### Fixed - Allow `anchor-size(…)` in arbitrary values ([#14393](https://github.com/tailwindlabs/tailwindcss/pull/14393)) @@ -2433,7 +2437,8 @@ No release notes - Everything! -[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.10...HEAD +[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.11...HEAD +[3.4.11]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.10...v3.4.11 [3.4.10]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.9...v3.4.10 [3.4.9]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.8...v3.4.9 [3.4.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.7...v3.4.8 diff --git a/package-lock.json b/package-lock.json index a7f6e0e1aada..315877375351 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tailwindcss", - "version": "3.4.10", + "version": "3.4.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tailwindcss", - "version": "3.4.10", + "version": "3.4.11", "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", diff --git a/package.json b/package.json index fd6d3aa6218f..b34a8ad7d524 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tailwindcss", - "version": "3.4.10", + "version": "3.4.11", "description": "A utility-first CSS framework for rapidly building custom user interfaces.", "license": "MIT", "main": "lib/index.js",