Skip to content

Commit a1f78a2

Browse files
authored
Don't register properties with types unless necessary (#15215)
This PR updates many of our `@property` rules to use `syntax: "*"` instead of a specific type. Registering custom properties with types triggers all sorts of obscure edge-case bugs in different browsers (mostly Safari, sometimes Firefox), but using `"*"` always seems to work. So unless we know we actually need to animate a custom property, it's safer to register is as `"*"`. Many of the places our custom properties are used are already inherently animatable (like the `translate`, `scale`, and `transform`) even when the underlying properties are not typed, so removing types for things like `--tw-scale-x` doesn't actually stop the `scale-*` utilities from being animateable. I've also updated the `--tw-gradient-from/via/to-position` properties to use `<length-percentage>` instead of `<length> | <percentage>` because for some reason I don't understand, only `<length-percentage>` works correctly when using `calc(…)` in arbitrary values. Fixes #15188, #14277. --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent aa15964 commit a1f78a2

File tree

5 files changed

+137
-134
lines changed

5 files changed

+137
-134
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- Fix scanning classes delimited by tab characters ([#15169](https://github.com/tailwindlabs/tailwindcss/pull/15169))
2121
- Ensure opacity modifiers and semi-transparent gradients render correctly by default in Safari ([#15201](https://github.com/tailwindlabs/tailwindcss/pull/15201))
2222
- Fix element size thrashing when transitioning gradients on elements with a defined font-size in Safari ([#15216](https://github.com/tailwindlabs/tailwindcss/pull/15216))
23+
- Ensure `translate-*` utilities work with arbitrary values that use `calc(…)` ([#15215](https://github.com/tailwindlabs/tailwindcss/pull/15215))
24+
- Ensure gradient stop position utilities work with arbitrary values that use `calc(…)` ([#15215](https://github.com/tailwindlabs/tailwindcss/pull/15215))
2325

2426
### Changed
2527

2628
- Interpolate gradients using OKLAB instead of OKLCH by default ([#15201](https://github.com/tailwindlabs/tailwindcss/pull/15201))
2729
- Error when `layer(…)` in `@import` is not first in the list of functions/conditions ([#15109](https://github.com/tailwindlabs/tailwindcss/pull/15109))
2830
- Use unitless line-height values for font-size variables in default theme ([#15216](https://github.com/tailwindlabs/tailwindcss/pull/15216))
31+
- Don't register custom properties with explicit types unless those custom properties need to be animateable ([#15215](https://github.com/tailwindlabs/tailwindcss/pull/15215))
2932

3033
## [4.0.0-beta.2] - 2024-11-22
3134

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ exports[`border-* 1`] = `
127127
}
128128
129129
@property --tw-border-style {
130-
syntax: "<custom-ident>";
130+
syntax: "*";
131131
inherits: false;
132132
initial-value: solid;
133133
}"
@@ -260,7 +260,7 @@ exports[`border-b-* 1`] = `
260260
}
261261
262262
@property --tw-border-style {
263-
syntax: "<custom-ident>";
263+
syntax: "*";
264264
inherits: false;
265265
initial-value: solid;
266266
}"
@@ -393,7 +393,7 @@ exports[`border-e-* 1`] = `
393393
}
394394
395395
@property --tw-border-style {
396-
syntax: "<custom-ident>";
396+
syntax: "*";
397397
inherits: false;
398398
initial-value: solid;
399399
}"
@@ -526,7 +526,7 @@ exports[`border-l-* 1`] = `
526526
}
527527
528528
@property --tw-border-style {
529-
syntax: "<custom-ident>";
529+
syntax: "*";
530530
inherits: false;
531531
initial-value: solid;
532532
}"
@@ -659,7 +659,7 @@ exports[`border-r-* 1`] = `
659659
}
660660
661661
@property --tw-border-style {
662-
syntax: "<custom-ident>";
662+
syntax: "*";
663663
inherits: false;
664664
initial-value: solid;
665665
}"
@@ -792,7 +792,7 @@ exports[`border-s-* 1`] = `
792792
}
793793
794794
@property --tw-border-style {
795-
syntax: "<custom-ident>";
795+
syntax: "*";
796796
inherits: false;
797797
initial-value: solid;
798798
}"
@@ -925,7 +925,7 @@ exports[`border-t-* 1`] = `
925925
}
926926
927927
@property --tw-border-style {
928-
syntax: "<custom-ident>";
928+
syntax: "*";
929929
inherits: false;
930930
initial-value: solid;
931931
}"
@@ -1058,7 +1058,7 @@ exports[`border-x-* 1`] = `
10581058
}
10591059
10601060
@property --tw-border-style {
1061-
syntax: "<custom-ident>";
1061+
syntax: "*";
10621062
inherits: false;
10631063
initial-value: solid;
10641064
}"
@@ -1191,7 +1191,7 @@ exports[`border-y-* 1`] = `
11911191
}
11921192
11931193
@property --tw-border-style {
1194-
syntax: "<custom-ident>";
1194+
syntax: "*";
11951195
inherits: false;
11961196
initial-value: solid;
11971197
}"

packages/tailwindcss/src/index.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,19 @@ describe('@apply', () => {
302302
}
303303
304304
@property --tw-translate-x {
305-
syntax: "<length> | <percentage>";
305+
syntax: "*";
306306
inherits: false;
307307
initial-value: 0;
308308
}
309309
310310
@property --tw-translate-y {
311-
syntax: "<length> | <percentage>";
311+
syntax: "*";
312312
inherits: false;
313313
initial-value: 0;
314314
}
315315
316316
@property --tw-translate-z {
317-
syntax: "<length>";
317+
syntax: "*";
318318
inherits: false;
319319
initial-value: 0;
320320
}"
@@ -717,7 +717,7 @@ describe('sorting', () => {
717717
}
718718
719719
@property --tw-space-x-reverse {
720-
syntax: "<number>";
720+
syntax: "*";
721721
inherits: false;
722722
initial-value: 0;
723723
}"

0 commit comments

Comments
 (0)