1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
|
'use strict';
var node_stream = require('node:stream');
var Tokenize = require('css-tokenize');
var Duplexify = require('duplexify');
var postcss = require('postcss');
var sourcemap = require('source-map');
var multimatch = require('multimatch');
var browserslist = require('browserslist');
var caniuse = require('caniuse-lite');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var Tokenize__default = /*#__PURE__*/_interopDefaultLegacy(Tokenize);
var Duplexify__default = /*#__PURE__*/_interopDefaultLegacy(Duplexify);
var postcss__default = /*#__PURE__*/_interopDefaultLegacy(postcss);
var sourcemap__default = /*#__PURE__*/_interopDefaultLegacy(sourcemap);
var multimatch__default = /*#__PURE__*/_interopDefaultLegacy(multimatch);
var browserslist__default = /*#__PURE__*/_interopDefaultLegacy(browserslist);
var caniuse__namespace = /*#__PURE__*/_interopNamespace(caniuse);
/**
* No description available.
*
* See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Alternate+stylesheet
*/
// This feature is only in HTML, so we don't lint it
/**
* @type {import('../features').Feature}
*/
var alternateStylesheet = {};
/**
* Method of defining how a background image is attached to a scrollable element. Values include `scroll` (default), `fixed` and `local`.
*
* See: https://caniuse.com/background-attachment
*/
/**
* @type {import('../features').Feature}
*/
var backgroundAttachment = {
'background-attachment': [
'fixed',
'local',
],
};
/**
* Non-standard method of clipping a background image to the foreground text.
*
* See: https://caniuse.com/background-clip-text
*/
/**
* @type {import('../features').Feature}
*/
var backgroundClipText = {
'background-clip': 'text',
'-webkit-background-clip': 'text',
};
var backgroundImgOpts = {
'background-clip': true,
'background-origin': true,
'background-size': true,
};
var backgroundPositionXY = {
'background-position-x': true,
'background-position-y': true,
};
/**
* Allows CSS background images to be repeated without clipping.
*
* See: https://caniuse.com/background-repeat-round-space
*/
/**
* @type {import('../features').Feature}
*/
var backgroundRepeatRoundSpace = {
'background-repeat': ['round', 'space'],
};
var borderImage = {
'border-image': true,
'border-image-outset': true,
'border-image-repeat': true,
'border-image-slice': true,
'border-image-source': true,
'border-image-width': true,
};
var borderRadius = {
'border-radius': true,
'border-top-left-radius': true,
'border-top-right-radius': true,
'border-bottom-right-radius': true,
'border-bottom-left-radius': true,
};
var calc = {
'': 'calc(',
};
/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */
/**
* @param {string} browserKey
* @param {string[]} [versions]
* @return {string}
*/
function formatBrowserName(browserKey, versions) {
const entry = caniuse.agents[browserKey];
const browserName = entry ? entry.browser : null;
if (!versions) {
return browserName || '';
}
return (`${browserName} (${versions.join(',')})`);
}
/**
*
* @param {FeatureCheck|FeatureCheck[]} check
* @param {?string|undefined} candidate
*/
function performFeatureCheck(check, candidate) {
if (check == null || candidate == null) return false;
if (check instanceof RegExp) {
return check.test(candidate);
}
switch (typeof check) {
case 'string':
return candidate.includes(check);
case 'function':
return check(candidate);
case 'boolean':
return check;
case 'object':
if (Array.isArray(check)) {
return check.some((c) => performFeatureCheck(c, candidate));
}
// Fallthrough
default:
console.error(check);
throw new TypeError(`Unexpected feature check: ${check}`);
}
}
/**
* @param {FeatureCheck|FeatureCheck[]} selector
* @return {(rule:import('postcss').ChildNode) => boolean}
*/
function checkSelector(selector) {
return (rule) => rule.type === 'rule'
&& performFeatureCheck(selector, rule.selector);
}
/**
* @param {FeatureCheck|FeatureCheck[]} [name]
* @param {FeatureCheck|FeatureCheck[]} [parameters]
* @return {(rule:import('postcss').ChildNode) => boolean}
*/
function checkAtRule(name, parameters) {
return (rule) => rule.type === 'atrule'
&& performFeatureCheck(name, rule.name)
&& (!parameters || performFeatureCheck(parameters, rule.params));
}
/**
* @see https://drafts.csswg.org/css-values/#lengths
* @see https://drafts.csswg.org/css-values/#number-value
* @param {string[]} units
* @return {(rule:import('postcss').ChildNode) => boolean}
*/
function checkCSSLengthUnits(...units) {
const regexp = new RegExp(`(\\+-)?[\\d.]*\\.?\\d+(e(\\+-)?\\d+)?(${units.join('|')})`, 'i');
return (rule) => (
(rule.type === 'decl') ? performFeatureCheck(regexp, rule.value)
: ((rule.type === 'atrule') ? performFeatureCheck(regexp, rule.params)
: false));
}
/**
* Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts.
* @see https://caniuse.com/ch-unit
* @type {import('../features').Feature}
*/
var chUnit = checkCSSLengthUnits('ch');
var cssAll = {
'all': true,
};
var cssAnimation = {
'animation': true,
'animation-name': true,
'animation-duration': true,
'animation-timing-function': true,
'animation-iteration-count': true,
'animation-direction': true,
'animation-play-state': true,
'animation-delay': true,
'animation-fill-mode': true,
};
// @keyframes isn't checked for, but if you try to use it,
// you'll still get a warning anyway because of the 'animation' property
var cssAnyLink = checkSelector([':any-link', ':-webkit-any-link']);
var cssAppearance = {
'appearance': true,
'-webkit-appearance': true,
'-moz-appearance': true,
};
var cssAtCounterStyle = checkAtRule('counter-style');
var cssAutofill = checkSelector([':autofill', ':-webkit-autofill']);
var cssBackdropFilter = {
'backdrop-filter': true,
};
/**
* @param {import('postcss').ChildNode} rule
* @return {boolean}
*/
var cssBackgroundOffsets = (rule) => {
if (rule.type !== 'decl') return false;
if (rule.prop !== 'background-position') return false;
return postcss.list.space(rule.value).length > 2;
};
var cssBackgroundblendmode = {
'background-blend-mode': true,
};
/**
* Controls whether the box's margins, borders, padding, and other decorations wrap the broken edges of the box fragments (when the box is split by a break (page/column/region/line).
*
* See: https://caniuse.com/css-boxdecorationbreak
*/
/**
* @type {import('../features').Feature}
*/
var cssBoxdecorationbreak = {
'box-decoration-break': true,
'-webkit-box-decoration-break': true,
};
var cssBoxshadow = {
'box-shadow': true,
};
/**
* @param {import('postcss').ChildNode} rule
* @return {boolean}
*/
var cssCanvas = (rule) => {
if (rule.type !== 'decl') return false;
if (!rule.prop.startsWith('background')) return false;
return rule.value.startsWith('-webkit-canvas');
};
/**
* The `caret-color` property allows the color to be set of the caret (blinking text insertion pointer) in an editable text area.
*
* See: https://caniuse.com/css-caret-color
*/
/**
* @type {import('../features').Feature}
*/
var cssCaretColor = {
'caret-color': true,
};
/**
* The `@layer` at-rule allows authors to explicitly layer their styles in the cascade, before specificity and order of appearance are considered.
*
* See: https://caniuse.com/css-cascade-layers
*/
/**
* @type {import('../features').Feature}
*/
var cssCascadeLayers = checkAtRule('layer');
/**
* Including an `i` before the `]` in a CSS attribute selector causes the attribute value to be matched in an ASCII-case-insensitive manner. For example, `[b="xyz" i]` would match both `<a b="xyz">` and `<a b="XYZ">`.
*
* See: https://caniuse.com/css-case-insensitive
*/
/**
* @type {import('../features').Feature}
*/
var cssCaseInsensitive = (rule) => {
if (rule.type !== 'rule') { return false; }
if (/\[.*i]/.test(rule.selector)) { return true; }
return false;
};
var cssClipPath = {
'clip-path': true,
};
/**
* The `print-color-adjust` (or `-webkit-print-color-adjust` as prefixed in WebKit/Blink browsers) property is a CSS extension that can be used to force printing of background colors and images.
*
* See: https://caniuse.com/css-color-adjust
*/
/**
* @type {import('../features').Feature}
*/
var cssColorAdjust = {
'print-color-adjust': true,
'-webkit-print-color-adjust': true,
};
/**
* The CSS `color()` function allows the browser to display colors in any color space, such as the P3 color space which can display colors outside of the default sRGB color space.
*
* See: https://caniuse.com/css-color-function
*/
/**
* @type {import('../features').Feature}
*/
var cssColorFunction = {
'': 'color(',
};
const REGEX$2 = /(^|[^-])(repeating-)?conic-gradient/;
var cssConicGradients = {
'background': REGEX$2,
'background-image': REGEX$2,
'border-image': REGEX$2,
'border-image-source': REGEX$2,
'content': REGEX$2,
'cursor': REGEX$2,
'list-style': REGEX$2,
'list-style-image': REGEX$2,
};
/**
* Size queries in Container Queries provide a way to query the size of a container, and conditionally apply CSS to the content of that container.
*
* See: https://caniuse.com/css-container-queries
*/
/**
* @type {import('../features').Feature}
*/
var cssContainerQueries = checkAtRule('container');
var cssContainerQueriesStyle = checkAtRule('container', 'style(');
var cssContainerQueryUnits = checkCSSLengthUnits(
'cqw',
'cqh',
'cqi',
'cqb',
'cqmin',
'cqmax',
);
/**
* The CSS `contain` property lets developers limit the scope of the browser's styles, layout and paint work for faster and more efficient rendering.
*
* See: https://caniuse.com/css-containment
*/
/**
* @type {import('../features').Feature}
*/
var cssContainment = {
'contain': true,
};
/**
* Provides control over when elements are rendered, so rendering can be skipped for elements not yet in the user's viewport.
*
* See: https://caniuse.com/css-content-visibility
*/
/**
* @type {import('../features').Feature}
*/
var cssContentVisibility = {
'content-visibility': true,
};
var cssCounters = {
'counter-reset': true,
'counter-increment': true,
'': 'counter(',
};
/**
* Scales images with an algorithm that preserves edges and contrast, without smoothing colors or introducing blur. This is intended for images such as pixel art. Official values that accomplish this for the `image-rendering` property are `crisp-edges` and `pixelated`.
*
* See: https://caniuse.com/css-crisp-edges
*/
/**
* @type {import('../features').Feature}
*/
var cssCrispEdges = {
'image-rendering': ['crisp-edges', 'pixelated'],
};
/**
* Image function to create a "crossfade" between images. This allows one image to transition (fade) into another based on a percentage value.
*
* See: https://caniuse.com/css-cross-fade
*/
/**
* @type {import('../features').Feature}
*/
var cssCrossFade = {
'': [
'cross-fade(',
'-webkit-cross-fade(',
],
};
/**
* The `:default` pseudo-class matches checkboxes and radio buttons which are checked by default, `<option>`s with the `selected` attribute, and the default submit button (if any) of a form.
*
* See: https://caniuse.com/css-default-pseudo
*/
/**
* @type {import('../features').Feature}
*/
var cssDefaultPseudo = checkSelector(':default');
/**
* An explicit, non-whitespace spelling of the descendant combinator. `A >> B` is equivalent to `A B`.
*
* See: https://caniuse.com/css-descendant-gtgt
*/
/**
* @type {import('../features').Feature}
*/
var cssDescendantGtgt = checkSelector('>>');
/**
* Method of overriding the size of viewport in web page using the `@viewport` rule, replacing Apple's own popular `<meta>` viewport implementation. Includes the `extend-to-zoom` width value.
*
* See: https://caniuse.com/css-deviceadaptation
*/
/**
* @type {import('../features').Feature}
*/
var cssDeviceadaptation = checkAtRule('viewport');
/**
* Matches elements based on their directionality. `:dir(ltr)` matches elements which are Left-to-Right. `:dir(rtl)` matches elements which are Right-to-Left.
*
* See: https://caniuse.com/css-dir-pseudo
*/
/**
* @type {import('../features').Feature}
*/
var cssDirPseudo = checkSelector(':dir(');
/**
* `display: contents` causes an element's children to appear as if they were direct children of the element's parent, ignoring the element itself. This can be useful when a wrapper element should be ignored when using CSS grid or similar layout techniques.
*
* See: https://caniuse.com/css-display-contents
*/
/**
* @type {import('../features').Feature}
*/
var cssDisplayContents = {
'display': 'contents',
};
/**
* This function renders a live image generated from an arbitrary HTML element
*
* See: https://caniuse.com/css-element-function
*/
/**
* @type {import('../features').Feature}
*/
var cssElementFunction = {
'': 'element(',
};
var cssEnvFunction = {
'': 'env(',
};
/**
* Exclusions defines how inline content flows around elements. It extends the content wrapping ability of floats to any block-level element.
*
* See: https://caniuse.com/css-exclusions
*/
/**
* @type {import('../features').Feature}
*/
var cssExclusions = {
'wrap-flow': true,
'-ms-wrap-flow': true,
};
var cssFeaturequeries = checkAtRule(['supports']);
/**
* No description available.
*
* See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=::file-selector-button+CSS+pseudo-element
*/
/**
* @type {import('../features').Feature}
*/
var cssFileSelectorButton = checkSelector(':file-selector-button');
/**
* This function filters a CSS input image with a set of filter functions (like blur, grayscale or hue)
*
* See: https://caniuse.com/css-filter-function
*/
/**
* @type {import('../features').Feature}
*/
var cssFilterFunction = {
'': 'filter(',
};
var cssFilters = {
'filter': true,
};
/**
* CSS pseudo-element that allows styling only the first "letter" of text within an element. Useful for implementing initial caps or drop caps styling.
*
* See: https://caniuse.com/css-first-letter
*/
/**
* @type {import('../features').Feature}
*/
var cssFirstLetter = checkSelector(':first-letter');
/**
* Allows styling specifically for the first line of text using the `::first-line` pseudo-element. Note that only a limited set of properties can be applied.
*
* See: https://caniuse.com/css-first-line
*/
/**
* @type {import('../features').Feature}
*/
var cssFirstLine = checkSelector(':first-line');
var cssFixed = {
'position': 'fixed',
};
/**
* The `:focus-visible` pseudo-class applies while an element matches the `:focus` pseudo-class, and the UA determines via heuristics that the focus should be specially indicated on the element (typically via a “focus ring”).
*
* See: https://caniuse.com/css-focus-visible
*/
/**
* @type {import('../features').Feature}
*/
var cssFocusVisible = checkSelector(':focus-visible');
/**
* The `:focus-within` pseudo-class matches elements that either themselves match `:focus` or that have descendants which match `:focus`.
*
* See: https://caniuse.com/css-focus-within
*/
/**
* @type {import('../features').Feature}
*/
var cssFocusWithin = checkSelector(':focus-within');
var cssFontPalette = [
(rule) => performFeatureCheck('font-palette', rule.name),
checkAtRule('font-palette-values'),
];
/**
* `@font-face` descriptor `font-display` that allows control over how a downloadable font renders before it is fully loaded.
*
* See: https://caniuse.com/css-font-rendering-controls
*/
/**
* @type {import('../features').Feature}
*/
var cssFontRenderingControls = {
'font-display': true,
};
var cssFontStretch = {
'font-stretch': true,
};
var cssGencontent = checkSelector([':before', ':after']);
const REGEX$1 = /(^|[^-])((linear)|(radial))-gradient/;
var cssGradients = {
'background': REGEX$1,
'background-image': REGEX$1,
'border-image': REGEX$1,
'border-image-source': REGEX$1,
'content': REGEX$1,
'cursor': REGEX$1,
'list-style': REGEX$1,
'list-style-image': REGEX$1,
};
/** @see https://drafts.csswg.org/css-grid/ */
var cssGrid = {
'display': ['grid', 'inline-grid', '-ms-grid'],
'grid': true,
'grid-area': true,
'grid-auto-columns': true,
'grid-auto-flow': true,
'grid-auto-rows': true,
'grid-column': true,
'grid-column-end': true,
'grid-column-start': true,
'grid-row': true,
'grid-row-end': true,
'grid-row-start': true,
'grid-template': true,
'grid-template-areas': true,
'grid-template-columns': true,
'grid-template-rows': true,
};
const REGEX = /grid/;
var cssGridAnimation = {
'transition': REGEX,
'transition-property': REGEX,
};
/**
* Allows some punctuation characters from start (or the end) of text elements to be placed "outside" of the box in order to preserve the reading flow.
* @see https://caniuse.com/css-hanging-punctuation
*/
/**
* @type {import('../features').Feature}
*/
var cssHangingPunctuation = {
'hanging-punctuation': true,
};
/**
* Select elements containing specific content. For example, `a:has(img)` selects all `<a>` elements that contain an `<img>` child.
* @see https://caniuse.com/css-has
*/
/**
* @type {import('../features').Feature}
*/
var cssHas = checkSelector(':has');
var cssHyphens = {
'hyphens': true,
};
var cssImageOrientation = {
'image-orientation': true,
};
/**
* Method of letting the browser pick the most appropriate CSS image from a given set.
* @see https://caniuse.com/css-image-set
*/
/**
* @type {import('../features').Feature}
*/
var cssImageSet = {
'': 'image-set(',
};
/**
* If a temporal or number `<input>` has `max` and/or `min` attributes, then `:in-range` matches when the value is within the specified range and `:out-of-range` matches when the value is outside the specified range. If there are no range constraints, then neither pseudo-class matches.
* @see https://caniuse.com/css-in-out-of-range
*/
/**
* @type {import('../features').Feature}
*/
var cssInOutOfRange = checkSelector([
':in-range',
':out-of-range',
]);
/**
* The `:indeterminate` pseudo-class matches indeterminate checkboxes, indeterminate `<progress>` bars, and radio buttons with no checked button in their radio button group.
* @see https://caniuse.com/css-indeterminate-pseudo
*/
/**
* @type {import('../features').Feature}
*/
var cssIndeterminatePseudo = checkSelector(':indeterminate');
/**
* Method of creating an enlarged cap, including a drop or raised cap, in a robust way.
* @see https://caniuse.com/css-initial-letter
*/
/**
* @type {import('../features').Feature}
*/
var cssInitialLetter = {
'initial-letter': true,
};
var cssInitialValue = {
'': 'initial',
};
/**
* The `lch()` and `lab()` color functions are based on the CIE LAB color space, representing colors in a way that closely matches human perception and provides access to a wider spectrum of colors than offered by the usual RGB color space.
* @see https://caniuse.com/css-lch-lab
*/
/**
* @type {import('../features').Feature}
*/
var cssLchLab = {
'': [
'lch(',
'lab(',
],
};
/**
* Controls spacing between characters of text (i.e. "tracking" in typographical terms). Not to be confused with kerning.
* @see https://caniuse.com/css-letter-spacing
*/
/**
* @type {import('../features').Feature}
*/
var cssLetterSpacing = {
'letter-spacing': true,
};
/**
* CSS property that will contain text to a given amount of lines when used in combination with `display: -webkit-box`. It will end with ellipsis when `text-overflow: ellipsis` is included.
* @see https://caniuse.com/css-line-clamp
*/
/**
* @type {import('../features').Feature}
*/
var cssLineClamp = {
'line-clamp': true,
'-webkit-line-clamp': true,
};
var cssLogicalProps = {
'block-size': true,
'inline-size': true,
'min-block-size': true,
'min-inline-size': true,
'max-block-size': true,
'max-inline-size': true,
'margin-block-start': true,
'margin-block-end': true,
'margin-inline-start': true,
'margin-inline-end': true,
'margin-block': true,
'margin-inline': true,
'inset-block-start': true,
'inset-block-end': true,
'inset-inline-start': true,
'inset-inline-end': true,
'inset-block': true,
'inset-inline': true,
'inset': true,
'padding-block-start': true,
'padding-block-end': true,
'padding-inline-start': true,
'padding-inline-end': true,
'padding-block': true,
'padding-inline': true,
'border-block-start-width': true,
'border-block-end-width': true,
'border-inline-start-width': true,
'border-inline-end-width': true,
'border-block-width': true,
'border-inline-width': true,
'border-block-start-style': true,
'border-block-end-style': true,
'border-inline-start-style': true,
'border-inline-end-style': true,
'border-block-style': true,
'border-inline-style': true,
'border-block-start-color': true,
'border-block-end-color': true,
'border-inline-start-color': true,
'border-inline-end-color': true,
'border-block-color': true,
'border-inline-color': true,
'border-block-start': true,
'border-block-end': true,
'border-inline-start': true,
'border-inline-end': true,
'border-block': true,
'border-inline': true,
'border-start-start-radius': true,
'border-start-end-radius': true,
'border-end-start-radius': true,
'border-end-end-radius': true,
'text-align': ['start', 'end'],
'float': ['inline-start', 'inline-end'],
'resize': ['block', 'inline'],
'overflow-block': true,
'overflow-inline': true,
};
/**
* The `::marker` pseudo-element allows list item markers to be styled or have their content value customized.
* @see https://caniuse.com/css-marker-pseudo
*/
/**
* @type {import('../features').Feature}
*/
var cssMarkerPseudo = checkSelector(':marker');
var cssMasks = {
'clip-path': true,
'mask': true,
'mask-border': true,
'mask-border-mode': true,
'mask-border-outset': true,
'mask-border-repeat': true,
'mask-border-slice': true,
'mask-border-source': true,
'mask-border-width': true,
'mask-clip': true,
'mask-composite': true,
'mask-image': true,
'mask-mode': true,
'mask-origin': true,
'mask-position': true,
'mask-repeat': true,
'mask-size': true,
'mask-type': true,
// and webkit versions
'-webkit-clip-path': true,
'-webkit-mask': true,
'-webkit-mask-border': true,
'-webkit-mask-border-mode': true,
'-webkit-mask-border-outset': true,
'-webkit-mask-border-repeat': true,
'-webkit-mask-border-slice': true,
'-webkit-mask-border-source': true,
'-webkit-mask-border-width': true,
'-webkit-mask-clip': true,
'-webkit-mask-composite': true,
'-webkit-mask-image': true,
'-webkit-mask-mode': true,
'-webkit-mask-origin': true,
'-webkit-mask-position': true,
'-webkit-mask-repeat': true,
'-webkit-mask-size': true,
'-webkit-mask-type': true,
};
var cssMatchesPseudo = checkSelector([
':is',
':where',
':matches',
':any',
':-webkit-any',
':-webkit-is',
':-webkit-where',
':-webkit-matches',
]);
var cssMathFunctions = {
'': ['min(', 'max(', 'clamp('],
};
/**
* Allows a media query to be set based on the presence and accuracy of the user's pointing device, and whether they have the ability to hover over elements on the page. This includes the `pointer`, `any-pointer`, `hover`, and `any-hover` media features.
* @see https://caniuse.com/css-media-interaction
*/
/**
* @type {import('../features').Feature}
*/
var cssMediaInteraction = checkAtRule('media', [
'pointer',
'any-pointer',
'hover',
'any-hover',
]);
var cssMediaRangeSyntax = checkAtRule('media', [' > ', ' < ', ' <= ', ' >= ']);
var cssMediaResolution = checkAtRule('media', ['min-resolution', 'max-resolution', 'resolution', 'device-pixel-ratio']);
/**
* No description available.
* @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Media+Queries:+scripting+media+feature
*/
/**
* @type {import('../features').Feature}
*/
var cssMediaScripting = checkAtRule('media', ['scripting']);
var cssMediaqueries = checkAtRule(['media']);
var cssMixblendmode = {
'mix-blend-mode': true,
};
var cssMotionPaths = {
'offset-path': true,
};
/**
* Using the `@namespace` at-rule, elements of other namespaces (e.g. SVG) can be targeted using the pipe (`|`) selector.
* @see https://caniuse.com/css-namespaces
*/
/**
* @type {import('../features').Feature}
*/
var cssNamespaces = checkAtRule('namespace');
/**
* CSS nesting provides the ability to nest one style rule inside another, with the selector of the child rule relative to the selector of the parent rule. Similar behavior previously required a CSS pre-processor.
* @see https://caniuse.com/css-nesting
*/
/**
* @type {import('../features').Feature}
*/
var cssNesting = (rule) => {
if (rule.type === 'rule' && rule.parent.type === 'rule') {
return true;
}
if (rule.type === 'atrule' && rule.parent.type === 'rule') {
return true;
}
return false;
};
/**
* Selectors Level 3 only allowed `:not()` pseudo-class to accept a single simple selector, which the element must not match any of. Thus, `:not(a, .b, [c])` or `:not(a.b[c])` did not work. Selectors Level 4 allows `:not()` to accept a list of selectors. Thus, `:not(a):not(.b):not([c])` can instead be written as `:not(a, .b, [c])` and `:not(a.b[c])` works as intended.
* @see https://caniuse.com/css-not-sel-list
*/
/**
* @type {import('../features').Feature}
*/
var cssNotSelList = checkSelector(
(selector) => selector.includes(':not(') && !/:not\(.?#?-?[\w[\]-]+\)/.test(selector),
);
/**
* The newest versions of `:nth-child()` and `:nth-last-child()` accept an optional `of S` clause which filters the children to only those which match the selector list `S`. For example, `:nth-child(1 of .foo)` selects the first child among the children that have the `foo` class (ignoring any non-`foo` children which precede that child). Similar to `:nth-of-type`, but for arbitrary selectors instead of only type selectors.
* @see https://caniuse.com/css-nth-child-of
*/
/**
* @type {import('../features').Feature}
*/
var cssNthChildOf = checkSelector(
(selector) => /:nth-(child|last-child)\(\s*\d+\s*of/.test(selector),
);
var cssOpacity = {
'opacity': true,
};
/**
* The `:optional` pseudo-class matches form inputs (`<input>`, `<textarea>`, `<select>`) which are not `:required`.
* @see https://caniuse.com/css-optional-pseudo
*/
/**
* @type {import('../features').Feature}
*/
var cssOptionalPseudo = checkSelector(':optional');
/**
* Originally a single property for controlling overflowing content in both horizontal & vertical directions, the `overflow` property is now a shorthand for `overflow-x` & `overflow-y`. The latest version of the specification also introduces the `clip` value that blocks programmatic scrolling.
* @see https://caniuse.com/css-overflow
*/
/**
* @type {import('../features').Feature}
*/
var cssOverflow = {
'overflow': true,
'overflow-x': true,
'overflow-y': true,
};
/**
* Changes in DOM elements above the visible region of a scrolling box can result in the page moving while the user is in the middle of consuming the content. By default, the value of `overflow-anchor` is `auto`, it can mitigate this jarring user experience by keeping track of the position of an anchor node and adjusting the scroll offset accordingly
* @see https://caniuse.com/css-overflow-anchor
*/
/**
* @type {import('../features').Feature}
*/
var cssOverflowAnchor = {
'overflow-anchor': true,
};
var cssOverflowOverlay = {
'overflow': 'overlay',
};
var cssOverscrollBehavior = {
'overscroll-behavior': true,
'overscroll-behavior-x': true,
'overscroll-behavior-y': true,
};
/**
* Properties to control the way elements are broken across (printed) pages.
* @see https://caniuse.com/css-page-break
*/
/**
* @type {import('../features').Feature}
*/
var cssPageBreak = {
'page-break-after': true,
'page-break-before': true,
'page-break-inside': true,
};
/**
* CSS at-rule (`@page`) to define page-specific rules when printing web pages, such as margin per page and page dimensions.
* @see https://caniuse.com/css-paged-media
*/
/**
* @type {import('../features').Feature}
*/
var cssPagedMedia = checkAtRule('page');
/**
* Allows programmatic generation of images used by CSS
* @see https://caniuse.com/css-paint-api
*/
/**
* @type {import('../features').Feature}
*/
var cssPaintApi = { '': 'paint(' };
var cssPlaceholder = [
checkSelector(':placeholder'),
];
/**
* :placeholder-shown CSS pseudo-class
* Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the placeholder attribute in HTML5. The :placeholder-shown pseudo-class matches an input element that is showing such placeholder text.
* @see https://caniuse.com/css-placeholder-shown
*/
/**
* @type {import('../features').Feature}
*/
var cssPlaceholderShown = checkSelector(':placeholder-shown');
var cssPrintColorAdjust = {
'print-color-adjust': true,
};
/**
* CSS :read-only and :read-write selectors
* :read-only and :read-write pseudo-classes to match elements which are considered user-alterable
* @see https://caniuse.com/css-read-only-write
*/
/**
* @type {import('../features').Feature}
*/
var cssReadOnlyWrite = checkSelector([':read-only', ':read-write']);
/**
* Rebeccapurple color
* The new color added in CSS Color Module Level 4
* @see https://caniuse.com/css-rebeccapurple
*/
/**
* @type {import('../features').Feature}
*/
var cssRebeccapurple = {
'': 'rebeccapurple',
};
var cssReflections = {
'box-reflect': true,
'-webkit-box-reflect': true,
};
/**
* CSS Regions
* Method of flowing content into multiple elements, allowing magazine-like layouts. While once supported in WebKit-based browsers and Internet Explorer, implementing the feature is no longer being pursued by any browser.
* @see https://caniuse.com/css-regions
*/
/**
* @type {import('../features').Feature}
*/
var cssRegions = {
'flow-into': true,
'flow-from': true,
'-webkit-flow-into': true,
'-webkit-flow-from': true,
};
/**
* CSS Relative colors
* The CSS Relative Color syntax allows a color to be defined relative to another color using the `from` keyword and optionally `calc()` for any of the color values.
* @see https://caniuse.com/css-relative-colors
*/
/**
* @type {import('../features').Feature}
*/
var cssRelativeColors = {
'': /((rgb)|(rgba)|(hsl)|(hsla)|(hwb))\(\s*from/,
};
var cssRepeatingGradients = {
'': [
'repeating-linear-gradient',
'repeating-radial-gradient',
],
};
var cssResize = {
'resize': true,
};
var cssRevertValue = {
'': 'revert',
};
/**
* #rrggbbaa hex color notation
* The CSS Color Module Level 4 defines new 4 & 8 character hex notation for color to include the opacity level.
* @see https://caniuse.com/css-rrggbbaa
*/
/**
* @type {import('../features').Feature}
*/
var cssRrggbbaa = {
'': [
/#[\da-f]{8}/i,
/#[\da-f]{4}(\W|$)/i,
],
};
/**
* CSS Scroll-behavior
* Method of specifying the scrolling behavior for a scrolling box, when scrolling happens due to navigation or CSSOM scrolling APIs.
* @see https://caniuse.com/css-scroll-behavior
*/
/**
* @type {import('../features').Feature}
*/
var cssScrollBehavior = {
'scroll-behavior': true,
};
/**
* CSS @scroll-timeline
* CSS property that allows animations to be driven by a container's scroll position
* @see https://caniuse.com/css-scroll-timeline
*/
const checkAt = checkAtRule('scroll-timeline');
/**
* @type {import('../features').Feature}
*/
var cssScrollTimeline = (node) => {
// check for @scroll-timeline
if (checkAt(node)) {
return true;
}
// check for animation-timeline
if (node.type !== 'decl') return false;
if (node.prop.startsWith('animation-timeline')) {
return true;
}
return false;
};
var cssScrollbar = {
'scrollbar-color': true,
'scrollbar-width': true,
};
const ATTRIBUTE_IDENTIFIER$1 = '[^\\~|^$*\\]]*';
// Export for testing
const REGEXES$1 = {
'HAS_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\]`),
'MATCH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}=${ATTRIBUTE_IDENTIFIER$1}\\]`),
'WORD_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\~=${ATTRIBUTE_IDENTIFIER$1}\\]`),
'SUBCODE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\|=${ATTRIBUTE_IDENTIFIER$1}\\]`),
'BRACKET_PARENS': /(\[[^=\]]*(=("[^"]*")|[^\]]+|)])|(\([^)]*\))/g,
};
/**
* @param {RegExp} pattern
* @return {(str:string) => boolean}
*/
function matchOutsideOfBrackets(pattern) {
if (!(pattern instanceof RegExp)) {
throw new TypeError('matchOutsideOfBrackets expects a RegExp');
}
return (string) => pattern.test(string.replaceAll(REGEXES$1.BRACKET_PARENS, ''));
}
var cssSel2 = checkSelector([
':first-child',
':link',
':visited',
':active',
':hover',
':focus',
':lang',
REGEXES$1.HAS_ATTRIBUTE,
REGEXES$1.MATCH_ATTRIBUTE,
REGEXES$1.WORD_ATTRIBUTE,
REGEXES$1.SUBCODE_ATTRIBUTE,
matchOutsideOfBrackets(/\*/),
matchOutsideOfBrackets(/>/),
matchOutsideOfBrackets(/\+/),
matchOutsideOfBrackets(/\./),
matchOutsideOfBrackets(/#/),
]);
const ATTRIBUTE_IDENTIFIER = '[^\\~|^$*\\]]*';
// Export for testing
const REGEXES = {
'SIBLING_SELECTOR': /^[^[]*~/,
'STARTSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\^=${ATTRIBUTE_IDENTIFIER}\\]`),
'ENDSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\$=${ATTRIBUTE_IDENTIFIER}\\]`),
'INSENSITIVE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\*=${ATTRIBUTE_IDENTIFIER}\\]`),
};
var cssSel3 = checkSelector([
':root',
':nth-child',
':nth-last-child',
'nth-of-type',
'nth-last-of-type',
':last-child',
':first-of-type',
':last-of-type',
':only-child',
':only-of-type',
':empty',
':target',
':enabled',
':disabled',
':checked',
':not',
REGEXES.SIBLING_SELECTOR,
REGEXES.STARTSWITH_ATTRIBUTE,
REGEXES.ENDSWITH_ATTRIBUTE,
REGEXES.INSENSITIVE_ATTRIBUTE,
]);
var cssSelection = checkSelector(':selection');
var cssShapes = {
'shape-outside': true,
'shape-image-threshold': true,
'shape-margin': true,
};
/**
* CSS Scroll Snap
* CSS technique that allows customizable scrolling experiences like pagination of carousels by setting defined snap positions.
* @see https://caniuse.com/css-snappoints
*/
/**
* @type {import('../features').Feature}
*/
var cssSnappoints = {
'scroll-snap-type': true,
'scroll-padding': true,
'scroll-padding-top': true,
'scroll-padding-right': true,
'scroll-padding-bottom': true,
'scroll-padding-left': true,
'scroll-padding-inline': true,
'scroll-padding-inline-start': true,
'scroll-padding-inline-end': true,
'scroll-padding-block': true,
'scroll-padding-block-start': true,
'scroll-padding-block-end': true,
'scroll-snap-align': true,
'scroll-margin': true,
'scroll-margin-top': true,
'scroll-margin-right': true,
'scroll-margin-bottom': true,
'scroll-margin-left': true,
'scroll-margin-inline': true,
'scroll-margin-inline-start': true,
'scroll-margin-inline-end': true,
'scroll-margin-block': true,
'scroll-margin-block-start': true,
'scroll-margin-block-end': true,
'scroll-snap-stop': true,
};
var cssSticky = {
'position': 'sticky',
};
/**
* CSS Subgrid
* Feature of the CSS Grid Layout Module Level 2 that allows a grid-item with its own grid to align in one or both dimensions with its parent grid.
* @see https://caniuse.com/css-subgrid
*/
/**
* @type {import('../features').Feature}
*/
var cssSubgrid = {
'': 'subgrid',
};
/**
* CSS.supports() API
* The CSS.supports() static methods returns a Boolean value indicating if the browser supports a given CSS feature, or not.
* @see https://caniuse.com/css-supports-api
*/
/**
* @type {import('../features').Feature}
*/
var cssSupportsApi = {};
/* this feature appears in JS, so it's not linted by this tool */
var cssTable = {
'display': [
'table',
'table-',
'inline-table',
],
};
/**
* CSS3 text-align-last
* CSS property to describe how the last line of a block or a line right before a forced line break when `text-align` is `justify`.
* @see https://caniuse.com/css-text-align-last
*/
/**
* @type {import('../features').Feature}
*/
var cssTextAlignLast = {
'text-align-last': true,
};
/**
* CSS text-box-trim & text-box-edge
* Provides the ability to remove the vertical space appearing above and below text glyphs, allowing more precise positioning and alignment. Previously specified as the `leading-trim` & `text-edge` properties.
* @see https://caniuse.com/css-text-box-trim
*/
/**
* @type {import('../features').Feature}
*/
var cssTextBoxTrim = {
'text-box-trim': true,
'text-box-edge': true,
};
/**
* CSS text-indent
* The `text-indent` property applies indentation to lines of inline content in a block.
* @see https://caniuse.com/css-text-indent
*/
/**
* @type {import('../features').Feature}
*/
var cssTextIndent = {
'text-indent': true,
};
/**
* CSS text-justify
* CSS property to define how text should be justified when `text-align: justify` is set.
* @see https://caniuse.com/css-text-justify
*/
/**
* @type {import('../features').Feature}
*/
var cssTextJustify = {
'text-justify': true,
};
/**
* CSS text-orientation
* The CSS `text-orientation` property specifies the orientation of text within a line. Current values only have an effect in vertical typographic modes (defined with the `writing-mode` property)
* @see https://caniuse.com/css-text-orientation
*/
/**
* @type {import('../features').Feature}
*/
var cssTextOrientation = {
'text-orientation': true,
};
/**
* CSS Text 4 text-spacing
* No description available.
* @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+Text+4+text-spacing
*/
/**
* @type {import('../features').Feature}
*/
var cssTextSpacing = {
'text-spacing': true,
};
var cssTextshadow = {
'text-shadow': true,
};
var cssTouchAction = {
'touch-action': true,
};
var cssTransitions = {
'transition': true,
'transition-property': true,
'transition-duration': true,
'transition-delay': true,
'transition-timing-function': true,
};
/**
* CSS unicode-bidi property
* No description available.
* @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+unicode-bidi+property
*/
/**
* @type {import('../features').Feature}
*/
var cssUnicodeBidi = {
'unicode-bidi': true,
};
var cssUnsetValue = {
'': 'unset',
};
/**
* @param {import('postcss').ChildNode} rule
* @return {boolean}
*/
var cssVariables = (rule) => {
if (rule.type !== 'decl') return false;
return (rule.prop.startsWith('--') || rule.value.includes('var('));
};
/**
* CSS @when / @else conditional rules
* Syntax allowing CSS conditions (like media and support queries) to be written more simply, as well as making it possibly to write mutually exclusive rules using `@else` statements.
* @see https://caniuse.com/css-when-else
*/
/**
* @type {import('../features').Feature}
*/
var cssWhenElse = checkAtRule(['when', 'else']);
/**
* CSS widows & orphans
* CSS properties to control when lines break across pages or columns by defining the amount of lines that must be left before or after the break.
* @see https://caniuse.com/css-widows-orphans
*/
/**
* @type {import('../features').Feature}
*/
var cssWidowsOrphans = {
'widows': true,
'orphans': true,
};
/**
* width: stretch property
* No description available.
* @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=width:+stretch+property
*/
/**
* @type {import('../features').Feature}
*/
var cssWidthStretch = {
'width': 'stretch',
};
/**
* CSS writing-mode property
* Property to define whether lines of text are laid out horizontally or vertically and the direction in which blocks progress.
* @see https://caniuse.com/css-writing-mode
*/
/**
* @type {import('../features').Feature}
*/
var cssWritingMode = {
'writing-mode': true,
};
/**
* CSS zoom
* Non-standard method of scaling content.
* @see https://caniuse.com/css-zoom
*/
/**
* @type {import('../features').Feature}
*/
var cssZoom = {
'zoom': true,
};
/**
* CSS3 attr() function for all properties
* While `attr()` is supported for effectively all browsers for the `content` property, CSS Values and Units Level 5 adds the ability to use `attr()` on **any** CSS property, and to use it for non-string values (e.g. numbers, colors).
* @see https://caniuse.com/css3-attr
*/
/**
* @type {import('../features').Feature}
*/
var css3Attr = (rule) => {
if (rule.type !== 'decl') return false;
if (rule.prop === 'content') {
return false;
}
return rule.toString().includes('attr(');
};
var css3Boxsizing = {
'box-sizing': true,
};
var css3Colors = {
'': [
'rgba',
'hsl',
'hsla',
],
};
var css3Cursors = {
'cursor': [
'none',
'context-menu',
'cell',
'vertical-text',
'alias',
'copy',
'no-drop',
'not-allowed',
'nesw-resize',
'nwse-resize',
'col-resize',
'row-resize',
'all-scroll',
],
};
var css3CursorsGrab = {
'cursor': ['grab', 'grabbing'],
};
var css3CursorsNewer = {
'cursor': ['zoom-in', 'zoom-out'],
};
var css3Tabsize = {
'tab-size': true,
};
/**
* CSS currentColor value
* A CSS value that will apply the existing `color` value to other properties like `background-color`, etc.
* @see https://caniuse.com/currentcolor
*/
/**
* @type {import('../features').Feature}
*/
var currentcolor = {
'': 'currentColor',
};
/**
* Window.devicePixelRatio
* Read-only property that returns the ratio of the (vertical) size of one physical pixel on the current display device to the size of one CSS pixel.
* @see https://caniuse.com/devicepixelratio
*/
/**
* @type {import('../features').Feature}
*/
var devicepixelratio = {};
/* this feature is found in JS and is not linted by this tool */
/**
* ui-serif, ui-sans-serif, ui-monospace and ui-rounded values for font-family
* Allows more control when choosing system interface fonts
* @see https://caniuse.com/extended-system-fonts
*/
/**
* @type {import('../features').Feature}
*/
var extendedSystemFonts = {
'font-family': ['ui-serif', 'ui-sans-serif', 'ui-monospace', 'ui-rounded'],
};
var flexbox = {
'display': [
'flex',
'inline-flex',
],
'flex': true,
'flex-grow': true,
'flex-shrink': true,
'flex-basis': true,
'flex-direction': true,
'flex-wrap': true,
'flex-flow': true,
};
/**
* gap property for Flexbox
* `gap` for flexbox containers to create gaps/gutters between flex items
* @see https://caniuse.com/flexbox-gap
*/
/**
* @type {import('../features').Feature}
*/
var flexboxGap = (rule) => {
if (/display:\s(inline-)?flex/.test(rule.toString())
&& rule.toString().includes('gap:')
) {
return true;
}
return false;
};
/**
* display: flow-root
* The element generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents. It provides a better solution to the most use cases of the "clearfix" hack.
* @see https://caniuse.com/flow-root
*/
/**
* @type {import('../features').Feature}
*/
var flowRoot = {
'display': 'flow-root',
};
/**
* system-ui value for font-family
* Value for `font-family` that represents the default user interface font.
* @see https://caniuse.com/font-family-system-ui
*/
/**
* @type {import('../features').Feature}
*/
var fontFamilySystemUi = {
'font-family': 'system-ui',
};
var fontFeature = {
'font-feature-settings': true,
'font-variant-ligatures': true,
'font-language-override': true,
'font-kerning': true,
};
/**
* CSS3 font-kerning
* Controls the usage of the kerning information (spacing between letters) stored in the font. Note that this only affects OpenType fonts with kerning information, it has no effect on other fonts.
* @see https://caniuse.com/font-kerning
*/
/**
* @type {import('../features').Feature}
*/
var fontKerning = {
'font-kerning': true,
};
/**
* CSS Font Loading
* This CSS module defines a scripting interface to font faces in CSS, allowing font faces to be easily created and loaded from script. It also provides methods to track the loading status of an individual font, or of all the fonts on an entire page.
* @see https://caniuse.com/font-loading
*/
/**
* @type {import('../features').Feature}
*/
var fontLoading = {};
/* this feature appears in JS and as such is not linted */
var fontSizeAdjust = {
'font-size-adjust': true,
};
/**
* CSS font-smooth
* Controls the application of anti-aliasing when fonts are rendered.
* @see https://caniuse.com/font-smooth
*/
/**
* @type {import('../features').Feature}
*/
var fontSmooth = {
'font-smooth': true,
};
var fontUnicodeRange = {
'unicode-range': true,
};
/**
* CSS font-variant-alternates
* Controls the usage of alternate glyphs associated to alternative names defined in @font-feature-values for certain types of OpenType fonts.
* @see https://caniuse.com/font-variant-alternates
*/
/**
* @type {import('../features').Feature}
*/
var fontVariantAlternates = {
'font-variant-alternates': true,
};
/**
* CSS font-variant-numeric
* CSS property that provides different ways of displaying numbers, fractions, and ordinal markers.
* @see https://caniuse.com/font-variant-numeric
*/
/**
* @type {import('../features').Feature}
*/
var fontVariantNumeric = {
'font-variant-numeric': true,
};
var fontface = [
checkAtRule('font-face'),
];
var fullscreen = checkSelector(':fullscreen');
/**
* getComputedStyle
* API to get the current computed CSS styles applied to an element. This may be the current value applied by an animation or as set by a stylesheet.
* @see https://caniuse.com/getcomputedstyle
*/
/**
* @type {import('../features').Feature}
*/
var getcomputedstyle = {};
/* this is a js api, so we don't lint it */
var inlineBlock = {
'display': 'inline-block',
};
const VALUES = ['max-content', 'min-content', 'fit-content', 'fill-available', 'stretch', 'fill'];
var intrinsicWidth = {
'width': VALUES,
'min-width': VALUES,
'max-width': VALUES,
'height': VALUES,
'min-height': VALUES,
'max-height': VALUES,
};
/**
* CSS justify-content: space-evenly
* The "space-evenly" value for the `justify-content` property distributes the space between items evenly. It is similar to space-around but provides equal instead of half-sized space on the edges. Can be used in both CSS flexbox & grid.
* @see https://caniuse.com/justify-content-space-evenly
*/
/**
* @type {import('../features').Feature}
*/
var justifyContentSpaceEvenly = {
'justify-content': 'space-evenly',
};
var kerningPairsLigatures = {
'text-rendering': 'optimizeLegibility',
};
var mdnCssUnicodeBidiIsolate = {
'unicode-bidi': 'isolate',
};
var mdnCssUnicodeBidiIsolateOverride = {
'unicode-bidi': 'isolate-override',
};
var mdnCssUnicodeBidiPlaintext = {
'unicode-bidi': 'plaintext',
};
var mdnTextDecorationColor = {
'text-decoration-color': true,
};
var mdnTextDecorationLine = {
'text-decoration-line': true,
};
var mdnTextDecorationShorthand = {
'text-decoration': true,
};
var mdnTextDecorationStyle = {
'text-decoration-style': true,
};
var minmaxwh = {
'min-width': true,
'max-width': true,
'min-height': true,
'max-height': true,
};
/**
* @param {import('postcss').ChildNode} rule
* @return {boolean}
*/
var multibackgrounds = (rule) => {
if (rule.type !== 'decl') return false;
if (!/^background-?/.test(rule.prop)) return false;
return postcss.list.comma(rule.value).length > 1;
};
var multicolumn = {
'columns': true,
'column-width': true,
'column-gap': true,
'column-rule': true,
'column-rule-color': true,
'column-rule-width': true,
'column-count': true,
'column-rule-style': true,
'column-span': true,
'column-fill': true,
'break-before': true,
'break-after': true,
'break-inside': true,
};
var objectFit = {
'object-fit': true,
'object-position': true,
};
var outline = {
'outline': true,
'outline-style': true,
'outline-width': true,
'outline-color': true,
};
var pointer = {
'touch-action': true,
};
var pointerEvents = {
'pointer-events': true,
};
/**
* prefers-color-scheme media query
* Media query to detect if the user has set their system to use a light or dark color theme.
* @see https://caniuse.com/prefers-color-scheme
*/
/**
* @type {import('../features').Feature}
*/
var prefersColorScheme = checkAtRule('media', 'prefers-color-scheme');
/**
* TODO: initially implement feature
* prefers-reduced-motion media query
* CSS media query based on a user preference for preferring reduced motion (animation, etc).
* @see https://caniuse.com/prefers-reduced-motion
*/
/**
* @type {import('../features').Feature}
*/
var prefersReducedMotion = checkAtRule('media', 'prefers-reduced-motion');
var rem = checkCSSLengthUnits('rem');
/**
* display: run-in
* If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box.
* @see https://caniuse.com/run-in
*/
/**
* @type {import('../features').Feature}
*/
var runIn = {
'display': 'run-in',
};
/**
* Scoped CSS
* Allows CSS rules to be scoped to part of the document, based on the position of the style element. The attribute has been [removed from the current specification](https://github.com/whatwg/html/issues/552).
* @see https://caniuse.com/style-scoped
*/
/**
* @type {import('../features').Feature}
*/
var styleScoped = {};
/* this feature appears in HTML, so we don't lint it */
/**
* SVG in CSS backgrounds
* Method of using SVG images as CSS backgrounds
* @see https://caniuse.com/svg-css
*/
/**
* @type {import('../features').Feature}
*/
var svgCss = (rule) => {
if (rule.type !== 'decl') return false;
if (/url\([\S\s]*svg/g.test(
rule.toString(),
)) {
return true;
}
return false;
};
var textDecoration = {
'text-decoration-style': true,
'text-decoration-line': true,
'text-decoration-color': true,
'text-decoration': /\w \w/,
'text-decoration-thickness': true,
'text-decoration-skip': true,
'text-decoration-skip-ink': true,
};
/**
* text-emphasis styling
* Method of using small symbols next to each glyph to emphasize a run of text, commonly used in East Asian languages. The `text-emphasis` shorthand, and its `text-emphasis-style` and `text-emphasis-color` longhands, can be used to apply marks to the text. The `text-emphasis-position` property, which inherits separately, allows setting the emphasis marks' position with respect to the text.
* @see https://caniuse.com/text-emphasis
*/
/**
* @type {import('../features').Feature}
*/
var textEmphasis = {
'text-emphasis': true,
'text-emphasis-style': true,
'text-emphasis-color': true,
'text-emphasis-position': true,
};
var textOverflow = {
'text-overflow': true,
};
var textSizeAdjust = {
'text-size-adjust': true,
};
/**
* CSS text-stroke and text-fill
* Method of declaring the outline (stroke) width and color for text.
* @see https://caniuse.com/text-stroke
*/
/**
* @type {import('../features').Feature}
*/
var textStroke = {
'text-stroke-color': true,
'text-stroke-width': true,
'text-stroke': true,
'text-fill-color': true,
};
var transforms2d = {
'transform': true,
'transform-origin': true,
};
var transforms3d = {
'perspective': true,
'perspective-origin': true,
'transform-style': true,
'backface-visibility': true,
'transform': '3d',
};
/**
* TTF/OTF - TrueType and OpenType font support
* Support for the TrueType (.ttf) and OpenType (.otf) outline font formats in @font-face.
* @see https://caniuse.com/ttf
*/
/**
* @type {import('../features').Feature}
*/
var ttf = (rule) => {
const ruleText = rule.toString();
if (ruleText.includes('@font-face') && (
(ruleText.includes('.ttf') || ruleText.includes('.otf'))
)) {
return true;
}
return false;
};
var userSelectNone = {
'user-select': true,
};
/**
* Variable fonts
* OpenType font settings that allows a single font file to behave like multiple fonts: it can contain all the allowed variations in width, weight, slant, optical size, or any other exposed axes of variation as defined by the font designer. Variations can be applied via the `font-variation-settings` property.
* @see https://caniuse.com/variable-fonts
*/
/**
* @type {import('../features').Feature}
*/
var variableFonts = {
'font-variation-settings': true,
};
/**
* Small, Large, and Dynamic viewport units
* Viewport units similar to `vw` and `vh` that are based on shown or hidden
* browser UI states to address shortcomings of the original units. Currently
* defined as the
* `sv*` units (`svb`, `svh`, `svi`, `svmax`, `svmin`, `svw`),
* `lv*` units (`lvb`, `lvh`, `lvi`, `lvmax`, `lvmin`, `lvw`),
* `dv*` units (`dvb`, `dvh`, `dvi`, `dvmax`, `dvmin`, `dvw`)
* and the logical `vi`/`vb` units.
* @see https://caniuse.com/viewport-unit-variants
* @type {import('../features').Feature}
*/
var viewportUnitVariants = checkCSSLengthUnits(
/* sv* units */
'svb',
'svh',
'svi',
'svmax',
'svmin',
'svw',
/* lv* units */
'lvb',
'lvh',
'lvi',
'lvmax',
'lvmin',
'lvw',
/* dv* units */
'dvb',
'dvh',
'dvi',
'dvmax',
'dvmin',
'dvw',
/* vi/vb units */
'vi',
'vb',
);
var viewportUnits = {
'': [
'vw',
'vh',
'vmin',
'vmax',
],
};
/**
* CSS -webkit-user-drag property
* The non-standard `-webkit-user-drag` CSS property can be used to either make an element draggable or explicitly non-draggable (like links and images). See the standardized [draggable attribute/property](/mdn-api_htmlelement_draggable) for the recommended alternative method of accomplishing the same functionality.
* @see https://caniuse.com/webkit-user-drag
*/
/**
* @type {import('../features').Feature}
*/
var webkitUserDrag = {
'webkit-user-drag': true,
};
var willChange = {
'will-change': true,
};
var wordBreak = {
'word-break': true,
};
var wordwrap = {
'overflow-wrap': true,
'word-wrap': true,
};
/* THIS FILE IS AUTOGENERATED */
/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */
/** @typedef {((rule:import('postcss').ChildNode) => boolean)} RuleCheck */
/** @typedef {Record<string, FeatureCheck|FeatureCheck[]|boolean> | RuleCheck | RuleCheck[]} Feature */
/** @enum {Feature} */
const FEATURES = {
'alternate-stylesheet': alternateStylesheet,
'background-attachment': backgroundAttachment,
'background-clip-text': backgroundClipText,
'background-img-opts': backgroundImgOpts,
'background-position-x-y': backgroundPositionXY,
'background-repeat-round-space': backgroundRepeatRoundSpace,
'border-image': borderImage,
'border-radius': borderRadius,
'calc': calc,
'ch-unit': chUnit,
'css-all': cssAll,
'css-animation': cssAnimation,
'css-any-link': cssAnyLink,
'css-appearance': cssAppearance,
'css-at-counter-style': cssAtCounterStyle,
'css-autofill': cssAutofill,
'css-backdrop-filter': cssBackdropFilter,
'css-background-offsets': cssBackgroundOffsets,
'css-backgroundblendmode': cssBackgroundblendmode,
'css-boxdecorationbreak': cssBoxdecorationbreak,
'css-boxshadow': cssBoxshadow,
'css-canvas': cssCanvas,
'css-caret-color': cssCaretColor,
'css-cascade-layers': cssCascadeLayers,
'css-case-insensitive': cssCaseInsensitive,
'css-clip-path': cssClipPath,
'css-color-adjust': cssColorAdjust,
'css-color-function': cssColorFunction,
'css-conic-gradients': cssConicGradients,
'css-container-queries': cssContainerQueries,
'css-container-queries-style': cssContainerQueriesStyle,
'css-container-query-units': cssContainerQueryUnits,
'css-containment': cssContainment,
'css-content-visibility': cssContentVisibility,
'css-counters': cssCounters,
'css-crisp-edges': cssCrispEdges,
'css-cross-fade': cssCrossFade,
'css-default-pseudo': cssDefaultPseudo,
'css-descendant-gtgt': cssDescendantGtgt,
'css-deviceadaptation': cssDeviceadaptation,
'css-dir-pseudo': cssDirPseudo,
'css-display-contents': cssDisplayContents,
'css-element-function': cssElementFunction,
'css-env-function': cssEnvFunction,
'css-exclusions': cssExclusions,
'css-featurequeries': cssFeaturequeries,
'css-file-selector-button': cssFileSelectorButton,
'css-filter-function': cssFilterFunction,
'css-filters': cssFilters,
'css-first-letter': cssFirstLetter,
'css-first-line': cssFirstLine,
'css-fixed': cssFixed,
'css-focus-visible': cssFocusVisible,
'css-focus-within': cssFocusWithin,
'css-font-palette': cssFontPalette,
'css-font-rendering-controls': cssFontRenderingControls,
'css-font-stretch': cssFontStretch,
'css-gencontent': cssGencontent,
'css-gradients': cssGradients,
'css-grid': cssGrid,
'css-grid-animation': cssGridAnimation,
'css-hanging-punctuation': cssHangingPunctuation,
'css-has': cssHas,
'css-hyphens': cssHyphens,
'css-image-orientation': cssImageOrientation,
'css-image-set': cssImageSet,
'css-in-out-of-range': cssInOutOfRange,
'css-indeterminate-pseudo': cssIndeterminatePseudo,
'css-initial-letter': cssInitialLetter,
'css-initial-value': cssInitialValue,
'css-lch-lab': cssLchLab,
'css-letter-spacing': cssLetterSpacing,
'css-line-clamp': cssLineClamp,
'css-logical-props': cssLogicalProps,
'css-marker-pseudo': cssMarkerPseudo,
'css-masks': cssMasks,
'css-matches-pseudo': cssMatchesPseudo,
'css-math-functions': cssMathFunctions,
'css-media-interaction': cssMediaInteraction,
'css-media-range-syntax': cssMediaRangeSyntax,
'css-media-resolution': cssMediaResolution,
'css-media-scripting': cssMediaScripting,
'css-mediaqueries': cssMediaqueries,
'css-mixblendmode': cssMixblendmode,
'css-motion-paths': cssMotionPaths,
'css-namespaces': cssNamespaces,
'css-nesting': cssNesting,
'css-not-sel-list': cssNotSelList,
'css-nth-child-of': cssNthChildOf,
'css-opacity': cssOpacity,
'css-optional-pseudo': cssOptionalPseudo,
'css-overflow': cssOverflow,
'css-overflow-anchor': cssOverflowAnchor,
'css-overflow-overlay': cssOverflowOverlay,
'css-overscroll-behavior': cssOverscrollBehavior,
'css-page-break': cssPageBreak,
'css-paged-media': cssPagedMedia,
'css-paint-api': cssPaintApi,
'css-placeholder': cssPlaceholder,
'css-placeholder-shown': cssPlaceholderShown,
'css-print-color-adjust': cssPrintColorAdjust,
'css-read-only-write': cssReadOnlyWrite,
'css-rebeccapurple': cssRebeccapurple,
'css-reflections': cssReflections,
'css-regions': cssRegions,
'css-relative-colors': cssRelativeColors,
'css-repeating-gradients': cssRepeatingGradients,
'css-resize': cssResize,
'css-revert-value': cssRevertValue,
'css-rrggbbaa': cssRrggbbaa,
'css-scroll-behavior': cssScrollBehavior,
'css-scroll-timeline': cssScrollTimeline,
'css-scrollbar': cssScrollbar,
'css-sel2': cssSel2,
'css-sel3': cssSel3,
'css-selection': cssSelection,
'css-shapes': cssShapes,
'css-snappoints': cssSnappoints,
'css-sticky': cssSticky,
'css-subgrid': cssSubgrid,
'css-supports-api': cssSupportsApi,
'css-table': cssTable,
'css-text-align-last': cssTextAlignLast,
'css-text-box-trim': cssTextBoxTrim,
'css-text-indent': cssTextIndent,
'css-text-justify': cssTextJustify,
'css-text-orientation': cssTextOrientation,
'css-text-spacing': cssTextSpacing,
'css-textshadow': cssTextshadow,
'css-touch-action': cssTouchAction,
'css-transitions': cssTransitions,
'css-unicode-bidi': cssUnicodeBidi,
'css-unset-value': cssUnsetValue,
'css-variables': cssVariables,
'css-when-else': cssWhenElse,
'css-widows-orphans': cssWidowsOrphans,
'css-width-stretch': cssWidthStretch,
'css-writing-mode': cssWritingMode,
'css-zoom': cssZoom,
'css3-attr': css3Attr,
'css3-boxsizing': css3Boxsizing,
'css3-colors': css3Colors,
'css3-cursors': css3Cursors,
'css3-cursors-grab': css3CursorsGrab,
'css3-cursors-newer': css3CursorsNewer,
'css3-tabsize': css3Tabsize,
'currentcolor': currentcolor,
'devicepixelratio': devicepixelratio,
'extended-system-fonts': extendedSystemFonts,
'flexbox': flexbox,
'flexbox-gap': flexboxGap,
'flow-root': flowRoot,
'font-family-system-ui': fontFamilySystemUi,
'font-feature': fontFeature,
'font-kerning': fontKerning,
'font-loading': fontLoading,
'font-size-adjust': fontSizeAdjust,
'font-smooth': fontSmooth,
'font-unicode-range': fontUnicodeRange,
'font-variant-alternates': fontVariantAlternates,
'font-variant-numeric': fontVariantNumeric,
'fontface': fontface,
'fullscreen': fullscreen,
'getcomputedstyle': getcomputedstyle,
'inline-block': inlineBlock,
'intrinsic-width': intrinsicWidth,
'justify-content-space-evenly': justifyContentSpaceEvenly,
'kerning-pairs-ligatures': kerningPairsLigatures,
'mdn-css-unicode-bidi-isolate': mdnCssUnicodeBidiIsolate,
'mdn-css-unicode-bidi-isolate-override': mdnCssUnicodeBidiIsolateOverride,
'mdn-css-unicode-bidi-plaintext': mdnCssUnicodeBidiPlaintext,
'mdn-text-decoration-color': mdnTextDecorationColor,
'mdn-text-decoration-line': mdnTextDecorationLine,
'mdn-text-decoration-shorthand': mdnTextDecorationShorthand,
'mdn-text-decoration-style': mdnTextDecorationStyle,
'minmaxwh': minmaxwh,
'multibackgrounds': multibackgrounds,
'multicolumn': multicolumn,
'object-fit': objectFit,
'outline': outline,
'pointer': pointer,
'pointer-events': pointerEvents,
'prefers-color-scheme': prefersColorScheme,
'prefers-reduced-motion': prefersReducedMotion,
'rem': rem,
'run-in': runIn,
'style-scoped': styleScoped,
'svg-css': svgCss,
'text-decoration': textDecoration,
'text-emphasis': textEmphasis,
'text-overflow': textOverflow,
'text-size-adjust': textSizeAdjust,
'text-stroke': textStroke,
'transforms2d': transforms2d,
'transforms3d': transforms3d,
'ttf': ttf,
'user-select-none': userSelectNone,
'variable-fonts': variableFonts,
'viewport-unit-variants': viewportUnitVariants,
'viewport-units': viewportUnits,
'webkit-user-drag': webkitUserDrag,
'will-change': willChange,
'word-break': wordBreak,
'wordwrap': wordwrap,
};
/**
* @template T
* @typedef {{missing: T, partial: T}} Filter
*/
/**
* @typedef {Object} MissingSupportResultStats
* @prop {string} title
* @prop {caniuse.Feature} caniuseData
* @prop {string} [missing]
* @prop {Record<string, Record<string, string>>} [missingData]
* @prop {string} [partial]
* @prop {Record<string, Record<string, string>>} [partialData]
*/
/**
* @typedef {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} BrowserSupportStats
*/
/**
* @typedef {Object} MissingSupportResult
* @prop {string[][]} browsers
* @prop {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} features
*/
class BrowserSelection {
#list;
/**
* @param {string | string[]} [query]
* @param {string | false} [from]
*/
constructor(query, from) {
this.browsersRequest = query;
const options = from ? { path: from } : {};
this.#list = browserslist__default["default"](this.browsersRequest, options).map((browser) => browser.split(' '));
}
/**
* @param {string} browser
* @param {string} version
* @return {string[]|undefined}
*/
test(browser, version) {
const versions = version.split('-');
if (versions.length === 1) {
versions.push(versions[0]);
}
return this.#list.find(([b, v]) => b === browser && v >= versions[0] && v <= versions[1]);
}
list() {
return [...this.#list];
}
/**
* @param {Record<string, Record<string, string>>} browserStats
* @return {string}
*/
static lackingBrowsers(browserStats) {
const result = [];
for (const browser of Object.keys(browserStats)) {
result.push(formatBrowserName(browser, Object.keys(browserStats[browser])));
}
return result.join(', ');
}
/**
* @param {import('caniuse-lite').StatsByAgentID} stats
* @return {Filter<Record<string,Record<string, string>>>}
*/
filterStats(stats) {
/** @type {Filter<Record<string,Record<string, string>>>} */
const result = { missing: {}, partial: {} };
for (const [browser, versions] of Object.entries(stats)) {
/** @type {Filter<Record<string,string>>} */
const feature = { missing: {}, partial: {} };
for (const [version, support] of Object.entries(versions)) {
const selected = this.test(browser, version);
// check if browser is NOT fully (i.e., don't have 'y' in their stats) supported
if (!selected) continue;
if ((/(^|\s)y($|\s)/.test(support))) continue;
// when it's not partially supported ('a'), it's missing
const type = (/(^|\s)a($|\s)/.test(support) ? 'partial' : 'missing');
if (!feature[type]) {
feature[type] = {};
}
feature[type][selected[1]] = support;
}
if (Object.keys(feature.missing).length > 0) {
result.missing[browser] = feature.missing;
}
if (Object.keys(feature.partial).length > 0) {
result.partial[browser] = feature.partial;
}
}
return result;
}
/**
* Get data on CSS features not supported by the given autoprefixer-like
* browser selection.
* @return {BrowserSupportStats} `features` is an array of:
* ```
* {
* 'feature-name': {
* title: 'Title of feature'
* missing: "IE (8), Chrome (31)"
* missingData: {
* // map of browser -> version -> (lack of)support code
* ie: { '8': 'n' },
* chrome: { '31': 'n' }
* }
* partialData: {
* // map of browser -> version -> (partial)support code
* ie: { '7': 'a' },
* ff: { '29': 'a #1' }
* }
* caniuseData: {
* // caniuse-db json data for this feature
* }
* },
* 'feature-name-2': {} // etc.
* }
* ```
*
* `feature-name` is a caniuse-db slug.
*/
compileBrowserSupport() {
/** @type {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} */
const result = {};
for (const key of Object.keys(FEATURES)) {
const feature = /** @type {keyof FEATURES} */ (key);
const packedFeature = caniuse__namespace.features[feature];
const featureData = caniuse__namespace.feature(packedFeature);
const lackData = this.filterStats(featureData.stats);
const missingData = lackData.missing;
const partialData = lackData.partial;
// browsers with missing or partial support for this feature
const missing = BrowserSelection.lackingBrowsers(missingData);
const partial = BrowserSelection.lackingBrowsers(partialData);
if (missing.length > 0 || partial.length > 0) {
result[feature] = {
title: featureData.title,
caniuseData: featureData,
...(missing.length > 0 ? { missingData, missing } : null),
...(partial.length > 0 ? { partialData, partial } : null),
};
}
}
return result;
}
/**
* @see BrowserSelection.compileBrowserSupport
* @param {ConstructorParameters<typeof this>} constructorParameters
* @return {MissingSupportResult} `{browsers, features}`
*/
static missingSupport(...constructorParameters) {
const selection = new BrowserSelection(...constructorParameters);
return {
browsers: selection.list(),
features: selection.compileBrowserSupport(),
};
}
}
/**
* @typedef DetectorCallbackArgument
* @prop {!import('postcss').ChildNode} usage
* @prop {keyof FEATURES} feature
* @prop {(keyof FEATURES & string)[]} ignore
*/
/**
* @callback DetectorCallback
* @param {DetectorCallbackArgument} result
* @return {any}
*/
const PLUGIN_OPTION_COMMENT = 'doiuse-';
const DISABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}disable`;
const ENABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}enable`;
/**
* Strip the contents of url literals so they aren't matched
* by our naive substring matching.
* @param {string} input
* @return {string}
*/
function stripUrls(input) {
return input.replaceAll(/url\([^)]*\)/g, 'url()');
}
/**
* Detect the use of any of a given list of CSS features.
* ```
* var detector = new Detector(featureList)
* detector.process(css, cb)
* ```
*
* `featureList`: an array of feature slugs (see caniuse-db)
* `cb`: a callback that gets called for each usage of one of the given features,
* called with an argument like:
* ```
* {
* usage: {} // postcss node where usage was found
* feature: {} // caniuse-db feature slug
* ignore: {} // caniuse-db feature to ignore in current file
* }
* ```
*/
class Detector {
/**
* @param {(keyof FEATURES & string)[]} featureList an array of feature slugs (see caniuse-db)
*/
constructor(featureList) {
/** @type {Partial<FEATURES>} */
this.features = {};
for (const feature of featureList) {
if (FEATURES[feature]) {
this.features[feature] = FEATURES[feature];
}
}
/** @type {(keyof FEATURES & string)[]} */
this.ignore = [];
}
/**
* @param {import('postcss').Comment} comment
* @return {void}
*/
comment(comment) {
const text = comment.text.toLowerCase();
if (!text.startsWith(PLUGIN_OPTION_COMMENT)) return;
const option = text.split(' ', 1)[0];
const value = text.replace(option, '').trim();
switch (option) {
case DISABLE_FEATURE_COMMENT: {
if (value === '') {
// @ts-expect-error Skip cast
this.ignore = Object.keys(this.features);
} else {
for (const feat of value.split(',')) {
/** @type {any} */
const f = feat.trim();
if (!this.ignore.includes(f)) {
this.ignore.push(f);
}
}
}
break;
}
case ENABLE_FEATURE_COMMENT: {
if (value === '') {
this.ignore = [];
} else {
const without = new Set(value.split(',').map((feat) => feat.trim()));
this.ignore = this.ignore.filter((index) => !without.has(index));
}
break;
}
}
}
/**
* @param {import('postcss').Container} node
* @param {DetectorCallback} callback
* @return {void}
*/
node(node, callback) {
node.each((child) => {
if (child.type === 'comment') {
this.comment(child);
return;
}
for (const [feat] of Object.entries(this.features).filter(([, featValue]) => {
if (!featValue) return false;
if (typeof featValue === 'function') {
return featValue(child);
}
if (Array.isArray(featValue)) {
return featValue.some((function_) => function_(child));
}
if (child.type !== 'decl') {
return false;
}
return Object.entries(featValue).some(([property, value]) => {
if (property !== '' && property !== child.prop) return false;
if (value === true) return true;
if (value === false) return false;
return performFeatureCheck(value, stripUrls(child.value));
});
})) {
const feature = /** @type {keyof FEATURES} */ (feat);
callback({ usage: child, feature, ignore: this.ignore });
}
if (child.type !== 'decl') {
this.node(child, callback);
}
});
}
/**
* @param {import('postcss').Root} node
* @param {DetectorCallback} callback
* @return {void}
*/
process(node, callback) {
// Reset ignoring rules specified by inline comments per each file
this.ignore = [];
// Recursively walk nodes in file
this.node(node, callback);
}
}
/** @typedef {import('../data/features.js').FeatureKeys} FeatureKeys */
/**
* @typedef {Object} OnFeatureUsageArguments
* @prop {FeatureKeys} feature
* @prop {import('./BrowserSelection.js').MissingSupportResultStats|undefined} featureData
* @prop {import('postcss').Node} usage
* @prop {string} message
*/
/**
* @callback OnFeatureUsage
* @param {OnFeatureUsageArguments} result
* @return {any}
*/
/**
* @typedef {Object} DoIUseOptions
* @prop {ConstructorParameters<typeof BrowserSelection>[0]} [browsers]
* @prop {FeatureKeys[]} [ignore]
* @prop {OnFeatureUsage} [onFeatureUsage]
* @prop {string[]} [ignoreFiles]
*/
class DoIUse {
static default = null;
/**
* @param {DoIUseOptions} [optionsOrBrowserQuery]
*/
constructor(optionsOrBrowserQuery) {
const options = (typeof optionsOrBrowserQuery === 'string')
? { browsers: optionsOrBrowserQuery }
: { ...optionsOrBrowserQuery };
this.browserQuery = options.browsers;
this.onFeatureUsage = options.onFeatureUsage;
this.ignoreOptions = options.ignore;
this.ignoreFiles = options.ignoreFiles;
this.info = this.info.bind(this);
this.postcss = this.postcss.bind(this);
}
/**
* @param {Object} [options]
* @param {ConstructorParameters<typeof BrowserSelection>[1]} [options.from]
*/
info(options = {}) {
const { browsers, features } = BrowserSelection.missingSupport(this.browserQuery, options.from);
return {
browsers,
features,
};
}
/** @type {import('postcss').TransformCallback} */
postcss(css, result) {
let from;
if (css.source && css.source.input) {
from = css.source.input.file;
}
const { features } = BrowserSelection.missingSupport(this.browserQuery, from);
// @ts-expect-error Needs cast
const detector = new Detector(Object.keys(features));
return detector.process(css, ({ feature, usage, ignore }) => {
if (ignore && ignore.includes(feature)) {
return;
}
if (this.ignoreOptions && this.ignoreOptions.includes(feature)) {
return;
}
if (!usage.source) {
throw new Error('No source?');
}
if (this.ignoreFiles && multimatch__default["default"](usage.source.input.from, this.ignoreFiles).length > 0) {
return;
}
const data = features[feature];
if (!data) {
throw new Error('No feature data?');
}
const messages = [];
if (data.missing) {
messages.push(`not supported by: ${data.missing}`);
}
if (data.partial) {
messages.push(`only partially supported by: ${data.partial}`);
}
let message = `${data.title} ${messages.join(' and ')} (${feature})`;
result.warn(message, { node: usage, plugin: 'doiuse' });
if (this.onFeatureUsage) {
if (!usage.source) {
throw new Error('No usage source?');
}
const { start, input } = usage.source;
if (!start) {
throw new Error('No usage source start?');
}
const map = css.source && css.source.input.map;
const mappedStart = map && map.consumer().originalPositionFor(start);
const file = (mappedStart && mappedStart.source) || input.file || input.from;
const line = (mappedStart && mappedStart.line) || start.line;
const column = (mappedStart && mappedStart.column) || start.column;
message = `${file}:${line}:${column}: ${message}`;
this.onFeatureUsage({
feature,
featureData: features[feature],
usage,
message,
});
}
});
}
}
/* eslint-disable no-underscore-dangle */
/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */
/** @typedef {import('./SourceMapTransform.js').SourceMapTransformation} SourceMapTransformation */
class RuleUsageTransform extends node_stream.Transform {
/** @type {import("postcss").Processor} */
#processor;
#skipErrors;
#filename;
/**
* @param {Object} options
* @param {string} options.browsers
* @param {FeatureKeys[]} [options.ignore]
* @param {boolean} [options.skipErrors]
* @param {string} [filename] Filename for outputting source code locations.
*/
constructor(options, filename = '<streaming css input>') {
super({
objectMode: true,
});
this.#processor = postcss__default["default"]([new DoIUse({
browsers: options.browsers,
ignore: options.ignore,
onFeatureUsage: (usage) => {
this.push(usage);
},
})]);
this.#filename = filename;
this.#skipErrors = options.skipErrors;
}
/**
* @param {SourceMapTransformation} rule
* @param {any} encoding
* @param {Function} callback
*/
async _transform(rule, encoding, callback) {
let caughtError;
try {
const mapper = new sourcemap__default["default"].SourceMapGenerator();
const lines = rule.content.split('\n');
let oline = rule.line;
let ocol = rule.column;
for (const [lineNumber, content] of lines.entries()) {
mapper.addMapping({
generated: { line: lineNumber + 1, column: 1 },
original: { line: oline, column: ocol },
source: this.#filename,
});
mapper.addMapping({
generated: { line: lineNumber + 1, column: content.length },
original: { line: oline, column: ocol + content.length },
source: this.#filename,
});
oline += 1;
ocol = 1;
}
await this.#processor.process(rule.content, {
from: this.#filename, map: { prev: mapper.toString() },
});
} catch (error) {
if (this.#skipErrors) {
this.emit('warning', error);
} else {
caughtError = error;
}
}
callback(caughtError);
}
}
/* eslint-disable no-underscore-dangle */
const NEW_LINE_CHAR = '\n'.codePointAt(0);
/**
* @typedef {Object} SourceMapTransformation
* @prop {number} line
* @prop {number} column
* @prop {string} content
*/
class SourceMapTransform extends node_stream.Transform {
constructor() {
super({ objectMode: true });
}
/**
* @type {?{location:[number,number], buffers: Buffer[]}}
* buffer for the current incoming rule.
*/
#current = null;
/** track depth to handle rules nested in at-rules. */
#depth = 0;
/** track this and pass it downstream for source mapping. */
#line = 1;
/** track this and pass it downstream for source mapping. */
#column = 1;
/**
* @param {[string,Buffer]} chunk
* @param {any} encoding
* @param {Function} callback
*/
_transform([type, buf], encoding, callback) {
if ((type === 'rule_start' || type === 'atrule_start')) {
this.#depth += 1;
}
if (this.#depth > 0 && !this.#current) {
this.#current = { location: [this.#line, this.#column], buffers: [] };
}
if (type === 'rule_end' || type === 'atrule_end') {
this.#depth -= 1;
}
if (this.#current) {
this.#current.buffers.push(buf);
if (this.#depth === 0) {
// Push rule
this.push({
line: this.#current.location[0],
column: this.#current.location[1],
content: Buffer.concat(this.#current.buffers).toString(),
});
this.#current = null;
}
}
// Update position
for (const char of buf) {
if (char === NEW_LINE_CHAR) {
this.#line += 1;
this.#column = 1;
} else {
this.#column += 1;
}
}
callback();
}
}
/* eslint-disable no-underscore-dangle */
/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */
class CssUsageDuplex extends Duplexify__default["default"] {
/**
* @param {Object} options
* @param {string} options.browsers
* @param {FeatureKeys[]} [options.ignore]
* @param {boolean} [options.skipErrors]
* @param {string} [filename] Filename for outputting source code locations.
*/
constructor(options, filename) {
const streams = [
new Tokenize__default["default"](),
new SourceMapTransform(),
new RuleUsageTransform(options, filename),
];
node_stream.pipeline(
// @ts-expect-error Bad typings
...streams,
() => {
// noop (Error handled by Duplexify)
},
);
super(streams[0], streams.at(-1), { objectMode: true });
}
}
/**
* @param {ConstructorParameters<typeof CssUsageDuplex>} options
* @return {CssUsageDuplex}
*/
function index(...options) {
return new CssUsageDuplex(...options);
}
module.exports = index;
|