Skip to content

Commit 292efa5

Browse files
Remove the negative flag from the Candidate AST (#14938)
This PR removes the `negative` flag from the `Candidate` AST. The system itself doesn't this information at all, but it's up to each plugin to handle the `negative` flag themselves. This also means that if you _don't_ handle it, that `foo` and `-foo` results in the same CSS output. To make sure that the negative version of utilities that supported it still work, this PR also adds the negative versions as separate utilities. E.g.: `-scale` is registered in addition to `scale`. This is an internal refactor only, and doesn't change any behavior. --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent d325e70 commit 292efa5

File tree

7 files changed

+365
-378
lines changed

7 files changed

+365
-378
lines changed

packages/@tailwindcss-upgrade/src/template/candidates.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ export function printCandidate(designSystem: DesignSystem, candidate: Candidate)
3131

3232
let base: string = ''
3333

34-
// Handle negative
35-
if (candidate.kind === 'static' || candidate.kind === 'functional') {
36-
if (candidate.negative) {
37-
base += '-'
38-
}
39-
}
40-
4134
// Handle static
4235
if (candidate.kind === 'static') {
4336
base += candidate.root

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ exports[`getClassList 1`] = `
3636
"-bottom-80",
3737
"-bottom-9",
3838
"-bottom-96",
39+
"-bottom-full",
40+
"-bottom-px",
3941
"-col-end-1",
4042
"-col-end-10",
4143
"-col-end-11",
@@ -96,6 +98,8 @@ exports[`getClassList 1`] = `
9698
"-end-80",
9799
"-end-9",
98100
"-end-96",
101+
"-end-full",
102+
"-end-px",
99103
"-indent-0",
100104
"-indent-0.5",
101105
"-indent-1",
@@ -130,6 +134,7 @@ exports[`getClassList 1`] = `
130134
"-indent-80",
131135
"-indent-9",
132136
"-indent-96",
137+
"-indent-px",
133138
"-inset-0",
134139
"-inset-0.5",
135140
"-inset-1",
@@ -164,6 +169,8 @@ exports[`getClassList 1`] = `
164169
"-inset-80",
165170
"-inset-9",
166171
"-inset-96",
172+
"-inset-full",
173+
"-inset-px",
167174
"-inset-x-0",
168175
"-inset-x-0.5",
169176
"-inset-x-1",
@@ -198,6 +205,8 @@ exports[`getClassList 1`] = `
198205
"-inset-x-80",
199206
"-inset-x-9",
200207
"-inset-x-96",
208+
"-inset-x-full",
209+
"-inset-x-px",
201210
"-inset-y-0",
202211
"-inset-y-0.5",
203212
"-inset-y-1",
@@ -232,6 +241,8 @@ exports[`getClassList 1`] = `
232241
"-inset-y-80",
233242
"-inset-y-9",
234243
"-inset-y-96",
244+
"-inset-y-full",
245+
"-inset-y-px",
235246
"-left-0",
236247
"-left-0.5",
237248
"-left-1",
@@ -266,6 +277,8 @@ exports[`getClassList 1`] = `
266277
"-left-80",
267278
"-left-9",
268279
"-left-96",
280+
"-left-full",
281+
"-left-px",
269282
"-m-0",
270283
"-m-0.5",
271284
"-m-1",
@@ -300,6 +313,7 @@ exports[`getClassList 1`] = `
300313
"-m-80",
301314
"-m-9",
302315
"-m-96",
316+
"-m-px",
303317
"-mb-0",
304318
"-mb-0.5",
305319
"-mb-1",
@@ -334,6 +348,7 @@ exports[`getClassList 1`] = `
334348
"-mb-80",
335349
"-mb-9",
336350
"-mb-96",
351+
"-mb-px",
337352
"-me-0",
338353
"-me-0.5",
339354
"-me-1",
@@ -368,6 +383,7 @@ exports[`getClassList 1`] = `
368383
"-me-80",
369384
"-me-9",
370385
"-me-96",
386+
"-me-px",
371387
"-ml-0",
372388
"-ml-0.5",
373389
"-ml-1",
@@ -402,6 +418,7 @@ exports[`getClassList 1`] = `
402418
"-ml-80",
403419
"-ml-9",
404420
"-ml-96",
421+
"-ml-px",
405422
"-mr-0",
406423
"-mr-0.5",
407424
"-mr-1",
@@ -436,6 +453,7 @@ exports[`getClassList 1`] = `
436453
"-mr-80",
437454
"-mr-9",
438455
"-mr-96",
456+
"-mr-px",
439457
"-ms-0",
440458
"-ms-0.5",
441459
"-ms-1",
@@ -470,6 +488,7 @@ exports[`getClassList 1`] = `
470488
"-ms-80",
471489
"-ms-9",
472490
"-ms-96",
491+
"-ms-px",
473492
"-mt-0",
474493
"-mt-0.5",
475494
"-mt-1",
@@ -504,6 +523,7 @@ exports[`getClassList 1`] = `
504523
"-mt-80",
505524
"-mt-9",
506525
"-mt-96",
526+
"-mt-px",
507527
"-mx-0",
508528
"-mx-0.5",
509529
"-mx-1",
@@ -538,6 +558,7 @@ exports[`getClassList 1`] = `
538558
"-mx-80",
539559
"-mx-9",
540560
"-mx-96",
561+
"-mx-px",
541562
"-my-0",
542563
"-my-0.5",
543564
"-my-1",
@@ -572,6 +593,7 @@ exports[`getClassList 1`] = `
572593
"-my-80",
573594
"-my-9",
574595
"-my-96",
596+
"-my-px",
575597
"-order-1",
576598
"-order-10",
577599
"-order-11",
@@ -618,6 +640,8 @@ exports[`getClassList 1`] = `
618640
"-right-80",
619641
"-right-9",
620642
"-right-96",
643+
"-right-full",
644+
"-right-px",
621645
"-rotate-0",
622646
"-rotate-1",
623647
"-rotate-12",
@@ -758,6 +782,7 @@ exports[`getClassList 1`] = `
758782
"-scroll-m-80",
759783
"-scroll-m-9",
760784
"-scroll-m-96",
785+
"-scroll-m-px",
761786
"-scroll-mb-0",
762787
"-scroll-mb-0.5",
763788
"-scroll-mb-1",
@@ -792,6 +817,7 @@ exports[`getClassList 1`] = `
792817
"-scroll-mb-80",
793818
"-scroll-mb-9",
794819
"-scroll-mb-96",
820+
"-scroll-mb-px",
795821
"-scroll-me-0",
796822
"-scroll-me-0.5",
797823
"-scroll-me-1",
@@ -826,6 +852,7 @@ exports[`getClassList 1`] = `
826852
"-scroll-me-80",
827853
"-scroll-me-9",
828854
"-scroll-me-96",
855+
"-scroll-me-px",
829856
"-scroll-ml-0",
830857
"-scroll-ml-0.5",
831858
"-scroll-ml-1",
@@ -860,6 +887,7 @@ exports[`getClassList 1`] = `
860887
"-scroll-ml-80",
861888
"-scroll-ml-9",
862889
"-scroll-ml-96",
890+
"-scroll-ml-px",
863891
"-scroll-mr-0",
864892
"-scroll-mr-0.5",
865893
"-scroll-mr-1",
@@ -894,6 +922,7 @@ exports[`getClassList 1`] = `
894922
"-scroll-mr-80",
895923
"-scroll-mr-9",
896924
"-scroll-mr-96",
925+
"-scroll-mr-px",
897926
"-scroll-ms-0",
898927
"-scroll-ms-0.5",
899928
"-scroll-ms-1",
@@ -928,6 +957,7 @@ exports[`getClassList 1`] = `
928957
"-scroll-ms-80",
929958
"-scroll-ms-9",
930959
"-scroll-ms-96",
960+
"-scroll-ms-px",
931961
"-scroll-mt-0",
932962
"-scroll-mt-0.5",
933963
"-scroll-mt-1",
@@ -962,6 +992,7 @@ exports[`getClassList 1`] = `
962992
"-scroll-mt-80",
963993
"-scroll-mt-9",
964994
"-scroll-mt-96",
995+
"-scroll-mt-px",
965996
"-scroll-mx-0",
966997
"-scroll-mx-0.5",
967998
"-scroll-mx-1",
@@ -996,6 +1027,7 @@ exports[`getClassList 1`] = `
9961027
"-scroll-mx-80",
9971028
"-scroll-mx-9",
9981029
"-scroll-mx-96",
1030+
"-scroll-mx-px",
9991031
"-scroll-my-0",
10001032
"-scroll-my-0.5",
10011033
"-scroll-my-1",
@@ -1030,6 +1062,7 @@ exports[`getClassList 1`] = `
10301062
"-scroll-my-80",
10311063
"-scroll-my-9",
10321064
"-scroll-my-96",
1065+
"-scroll-my-px",
10331066
"-skew-0",
10341067
"-skew-1",
10351068
"-skew-12",
@@ -1082,6 +1115,7 @@ exports[`getClassList 1`] = `
10821115
"-space-x-80",
10831116
"-space-x-9",
10841117
"-space-x-96",
1118+
"-space-x-px",
10851119
"-space-y-0",
10861120
"-space-y-0.5",
10871121
"-space-y-1",
@@ -1116,6 +1150,7 @@ exports[`getClassList 1`] = `
11161150
"-space-y-80",
11171151
"-space-y-9",
11181152
"-space-y-96",
1153+
"-space-y-px",
11191154
"-start-0",
11201155
"-start-0.5",
11211156
"-start-1",
@@ -1150,6 +1185,8 @@ exports[`getClassList 1`] = `
11501185
"-start-80",
11511186
"-start-9",
11521187
"-start-96",
1188+
"-start-full",
1189+
"-start-px",
11531190
"-top-0",
11541191
"-top-0.5",
11551192
"-top-1",
@@ -1184,6 +1221,8 @@ exports[`getClassList 1`] = `
11841221
"-top-80",
11851222
"-top-9",
11861223
"-top-96",
1224+
"-top-full",
1225+
"-top-px",
11871226
"-translate-0",
11881227
"-translate-0.5",
11891228
"-translate-1",
@@ -1218,6 +1257,8 @@ exports[`getClassList 1`] = `
12181257
"-translate-80",
12191258
"-translate-9",
12201259
"-translate-96",
1260+
"-translate-full",
1261+
"-translate-px",
12211262
"-translate-x-0",
12221263
"-translate-x-0.5",
12231264
"-translate-x-1",
@@ -1252,6 +1293,8 @@ exports[`getClassList 1`] = `
12521293
"-translate-x-80",
12531294
"-translate-x-9",
12541295
"-translate-x-96",
1296+
"-translate-x-full",
1297+
"-translate-x-px",
12551298
"-translate-y-0",
12561299
"-translate-y-0.5",
12571300
"-translate-y-1",
@@ -1286,6 +1329,8 @@ exports[`getClassList 1`] = `
12861329
"-translate-y-80",
12871330
"-translate-y-9",
12881331
"-translate-y-96",
1332+
"-translate-y-full",
1333+
"-translate-y-px",
12891334
"-translate-z-0",
12901335
"-translate-z-0.5",
12911336
"-translate-z-1",
@@ -1320,6 +1365,7 @@ exports[`getClassList 1`] = `
13201365
"-translate-z-80",
13211366
"-translate-z-9",
13221367
"-translate-z-96",
1368+
"-translate-z-px",
13231369
"-underline-offset-0",
13241370
"-underline-offset-1",
13251371
"-underline-offset-2",

0 commit comments

Comments
 (0)