Commit 1eab49d
authored
Sort text wrapping utilities with typography utilities (#14787)
This PR implements some changes to the way we sort typography utilities,
inspired by #14715.
Prior to this PR, utilities like `text-balance`, `break-words`, and
`text-center` were sorted very early, even before things like border
utilities:
```html
<div class="text-balance break-words border-2 border-blue-500 text-center indent-5 text-2xl font-medium capitalize leading-6 tracking-tight text-red-500 underline"></div>
```
This PR changes the sort order to co-locate these with other typography
utilities which feels a lot more natural:
```html
<div class="border-2 border-blue-500 text-center indent-5 text-2xl leading-6 font-medium tracking-tight text-balance break-words text-red-500 capitalize underline"></div>
```
I've also made some small adjustments to how other typography properties
are sorted based on pairing with @reinink and just deciding what felt
the most intuitive to us and matched the order we'd likely type things
in manually.
To test this change I temporarily added a new test to `sort.test.ts` to
make sure the classes were sorted in the expected order:
```js
[
// Input
'text-red-500 text-center capitalize text-2xl break-words text-balance underline font-medium tracking-tight leading-6 indent-5',
// Expected
'text-center indent-5 text-2xl leading-6 font-medium tracking-tight text-balance break-words text-red-500 capitalize underline',
],
```
Didn't keep the test around because there's no real logic to test here
(it just matches the order in the `property-order.ts` file) and we don't
have any other tests like this.
I've also made some minor unrelated changes here like deleting legacy
properties from `property-order.ts` that are never used, and fixing a
typo where we wrote `work-break` instead of `word-break`.
---------
Co-authored-by: Adam Wathan <[email protected]>1 parent 3fe53dd commit 1eab49d
2 files changed
+13
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
| |||
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 173 | | |
183 | 174 | | |
184 | 175 | | |
| |||
215 | 206 | | |
216 | 207 | | |
217 | 208 | | |
218 | | - | |
219 | | - | |
220 | 209 | | |
221 | | - | |
222 | 210 | | |
223 | 211 | | |
224 | 212 | | |
| |||
263 | 251 | | |
264 | 252 | | |
265 | 253 | | |
| 254 | + | |
266 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
267 | 265 | | |
268 | 266 | | |
269 | 267 | | |
270 | 268 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | 269 | | |
276 | 270 | | |
277 | 271 | | |
278 | 272 | | |
279 | 273 | | |
280 | 274 | | |
281 | 275 | | |
282 | | - | |
283 | | - | |
| 276 | + | |
284 | 277 | | |
285 | 278 | | |
286 | 279 | | |
| |||
301 | 294 | | |
302 | 295 | | |
303 | 296 | | |
304 | | - | |
305 | 297 | | |
306 | 298 | | |
307 | 299 | | |
| |||
0 commit comments