@@ -22,29 +22,6 @@ function migrate(designSystem: DesignSystem, userConfig: UserConfig | null, rawC
22
22
}
23
23
24
24
test . each ( [
25
- // Arbitrary variants
26
- [ '[[data-visible]]:flex' , 'data-visible:flex' ] ,
27
- [ '[&[data-visible]]:flex' , 'data-visible:flex' ] ,
28
- [ '[[data-visible]&]:flex' , 'data-visible:flex' ] ,
29
- [ '[&>[data-visible]]:flex' , '*:data-visible:flex' ] ,
30
- [ '[&_>_[data-visible]]:flex' , '*:data-visible:flex' ] ,
31
- [ '[&>*]:flex' , '*:flex' ] ,
32
- [ '[&_>_*]:flex' , '*:flex' ] ,
33
-
34
- [ '[&_[data-visible]]:flex' , '**:data-visible:flex' ] ,
35
- [ '[&_*]:flex' , '**:flex' ] ,
36
-
37
- [ '[&:first-child]:flex' , 'first:flex' ] ,
38
- [ '[&:not(:first-child)]:flex' , 'not-first:flex' ] ,
39
-
40
- // in-* variants
41
- [ '[p_&]:flex' , 'in-[p]:flex' ] ,
42
- [ '[.foo_&]:flex' , 'in-[.foo]:flex' ] ,
43
- [ '[[data-visible]_&]:flex' , 'in-data-visible:flex' ] ,
44
- // Multiple selectors, should stay as-is
45
- [ '[[data-foo][data-bar]_&]:flex' , '[[data-foo][data-bar]_&]:flex' ] ,
46
- // Using `>` instead of ` ` should not be transformed:
47
- [ '[figure>&]:my-0' , '[figure>&]:my-0' ] ,
48
25
// Some extreme examples of what happens in the wild:
49
26
[ 'group-[]:flex' , 'in-[.group]:flex' ] ,
50
27
[ 'group-[]/name:flex' , 'in-[.group\\/name]:flex' ] ,
@@ -59,71 +36,6 @@ test.each([
59
36
[ 'has-group-[]/name:flex' , 'has-in-[.group\\/name]:flex' ] ,
60
37
[ 'not-group-[]:flex' , 'not-in-[.group]:flex' ] ,
61
38
[ 'not-group-[]/name:flex' , 'not-in-[.group\\/name]:flex' ] ,
62
-
63
- // nth-child
64
- [ '[&:nth-child(2)]:flex' , 'nth-2:flex' ] ,
65
- [ '[&:not(:nth-child(2))]:flex' , 'not-nth-2:flex' ] ,
66
-
67
- [ '[&:nth-child(-n+3)]:flex' , 'nth-[-n+3]:flex' ] ,
68
- [ '[&:not(:nth-child(-n+3))]:flex' , 'not-nth-[-n+3]:flex' ] ,
69
- [ '[&:nth-child(-n_+_3)]:flex' , 'nth-[-n+3]:flex' ] ,
70
- [ '[&:not(:nth-child(-n_+_3))]:flex' , 'not-nth-[-n+3]:flex' ] ,
71
-
72
- // nth-last-child
73
- [ '[&:nth-last-child(2)]:flex' , 'nth-last-2:flex' ] ,
74
- [ '[&:not(:nth-last-child(2))]:flex' , 'not-nth-last-2:flex' ] ,
75
-
76
- [ '[&:nth-last-child(-n+3)]:flex' , 'nth-last-[-n+3]:flex' ] ,
77
- [ '[&:not(:nth-last-child(-n+3))]:flex' , 'not-nth-last-[-n+3]:flex' ] ,
78
- [ '[&:nth-last-child(-n_+_3)]:flex' , 'nth-last-[-n+3]:flex' ] ,
79
- [ '[&:not(:nth-last-child(-n_+_3))]:flex' , 'not-nth-last-[-n+3]:flex' ] ,
80
-
81
- // nth-child odd/even
82
- [ '[&:nth-child(odd)]:flex' , 'odd:flex' ] ,
83
- [ '[&:not(:nth-child(odd))]:flex' , 'even:flex' ] ,
84
- [ '[&:nth-child(even)]:flex' , 'even:flex' ] ,
85
- [ '[&:not(:nth-child(even))]:flex' , 'odd:flex' ] ,
86
-
87
- // Keep multiple attribute selectors as-is
88
- [ '[[data-visible][data-dark]]:flex' , '[[data-visible][data-dark]]:flex' ] ,
89
-
90
- // Keep `:where(…)` as is
91
- [ '[:where([data-visible])]:flex' , '[:where([data-visible])]:flex' ] ,
92
-
93
- // Complex attribute selectors with operators, quotes and insensitivity flags
94
- [ '[[data-url*="example"]]:flex' , 'data-[url*="example"]:flex' ] ,
95
- [ '[[data-url$=".com"_i]]:flex' , 'data-[url$=".com"_i]:flex' ] ,
96
- [ '[[data-url$=.com_i]]:flex' , 'data-[url$=.com_i]:flex' ] ,
97
-
98
- // Attribute selector wrapped in `&:is(…)`
99
- [ '[&:is([data-visible])]:flex' , 'data-visible:flex' ] ,
100
-
101
- // Media queries
102
- [ '[@media(pointer:fine)]:flex' , 'pointer-fine:flex' ] ,
103
- [ '[@media_(pointer_:_fine)]:flex' , 'pointer-fine:flex' ] ,
104
- [ '[@media_not_(pointer_:_fine)]:flex' , 'not-pointer-fine:flex' ] ,
105
- [ '[@media_print]:flex' , 'print:flex' ] ,
106
- [ '[@media_not_print]:flex' , 'not-print:flex' ] ,
107
-
108
- // Hoist the `:not` part to a compound variant
109
- [ '[@media_not_(prefers-color-scheme:dark)]:flex' , 'not-dark:flex' ] ,
110
- [
111
- '[@media_not_(prefers-color-scheme:unknown)]:flex' ,
112
- 'not-[@media_(prefers-color-scheme:unknown)]:flex' ,
113
- ] ,
114
-
115
- // Compound arbitrary variants
116
- [ 'has-[[data-visible]]:flex' , 'has-data-visible:flex' ] ,
117
- [ 'has-[&:is([data-visible])]:flex' , 'has-data-visible:flex' ] ,
118
- [ 'has-[&>[data-visible]]:flex' , 'has-[&>[data-visible]]:flex' ] ,
119
-
120
- [ 'has-[[data-slot=description]]:flex' , 'has-data-[slot=description]:flex' ] ,
121
- [ 'has-[&:is([data-slot=description])]:flex' , 'has-data-[slot=description]:flex' ] ,
122
-
123
- [ 'has-[[aria-visible="true"]]:flex' , 'has-aria-visible:flex' ] ,
124
- [ 'has-[[aria-visible]]:flex' , 'has-aria-[visible]:flex' ] ,
125
-
126
- [ 'has-[&:not(:nth-child(even))]:flex' , 'has-odd:flex' ] ,
127
39
] ) ( '%s => %s (%#)' , async ( candidate , result ) => {
128
40
let designSystem = await __unstable__loadDesignSystem ( '@import "tailwindcss";' , {
129
41
base : __dirname ,
0 commit comments