@@ -16,9 +16,6 @@ import {
16
16
transformAllSelectors ,
17
17
transformAllClasses ,
18
18
transformLastClasses ,
19
- asLength ,
20
- asURL ,
21
- asLookupValue ,
22
19
} from './util/pluginUtils'
23
20
import packageJson from '../package.json'
24
21
import log from './util/log'
@@ -520,35 +517,19 @@ export let position = ({ addUtilities }) => {
520
517
} )
521
518
}
522
519
523
- export let inset = ( { matchUtilities, theme } ) => {
524
- let options = {
525
- values : theme ( 'inset' ) ,
526
- type : 'any' ,
527
- }
528
-
529
- matchUtilities (
530
- { inset : ( value ) => ( { top : value , right : value , bottom : value , left : value } ) } ,
531
- options
532
- )
533
-
534
- matchUtilities (
535
- {
536
- 'inset-x' : ( value ) => ( { left : value , right : value } ) ,
537
- 'inset-y' : ( value ) => ( { top : value , bottom : value } ) ,
538
- } ,
539
- options
540
- )
541
-
542
- matchUtilities (
543
- {
544
- top : ( top ) => ( { top } ) ,
545
- right : ( right ) => ( { right } ) ,
546
- bottom : ( bottom ) => ( { bottom } ) ,
547
- left : ( left ) => ( { left } ) ,
548
- } ,
549
- options
550
- )
551
- }
520
+ export let inset = createUtilityPlugin ( 'inset' , [
521
+ [ 'inset' , [ 'top' , 'right' , 'bottom' , 'left' ] ] ,
522
+ [
523
+ [ 'inset-x' , [ 'left' , 'right' ] ] ,
524
+ [ 'inset-y' , [ 'top' , 'bottom' ] ] ,
525
+ ] ,
526
+ [
527
+ [ 'top' , [ 'top' ] ] ,
528
+ [ 'right' , [ 'right' ] ] ,
529
+ [ 'bottom' , [ 'bottom' ] ] ,
530
+ [ 'left' , [ 'left' ] ] ,
531
+ ] ,
532
+ ] )
552
533
553
534
export let isolation = ( { addUtilities } ) => {
554
535
addUtilities ( {
@@ -633,12 +614,15 @@ export let display = ({ addUtilities }) => {
633
614
}
634
615
635
616
export let aspectRatio = createUtilityPlugin ( 'aspectRatio' , [ [ 'aspect' , [ 'aspect-ratio' ] ] ] )
617
+
636
618
export let height = createUtilityPlugin ( 'height' , [ [ 'h' , [ 'height' ] ] ] )
637
619
export let maxHeight = createUtilityPlugin ( 'maxHeight' , [ [ 'max-h' , [ 'maxHeight' ] ] ] )
638
620
export let minHeight = createUtilityPlugin ( 'minHeight' , [ [ 'min-h' , [ 'minHeight' ] ] ] )
621
+
639
622
export let width = createUtilityPlugin ( 'width' , [ [ 'w' , [ 'width' ] ] ] )
640
623
export let minWidth = createUtilityPlugin ( 'minWidth' , [ [ 'min-w' , [ 'minWidth' ] ] ] )
641
624
export let maxWidth = createUtilityPlugin ( 'maxWidth' , [ [ 'max-w' , [ 'maxWidth' ] ] ] )
625
+
642
626
export let flex = createUtilityPlugin ( 'flex' )
643
627
export let flexShrink = createUtilityPlugin ( 'flexShrink' , [ [ 'flex-shrink' , [ 'flex-shrink' ] ] ] )
644
628
export let flexGrow = createUtilityPlugin ( 'flexGrow' , [ [ 'flex-grow' , [ 'flex-grow' ] ] ] )
@@ -992,7 +976,7 @@ export let space = ({ matchUtilities, addUtilities, theme }) => {
992
976
}
993
977
} ,
994
978
} ,
995
- { values : theme ( 'space' ) , type : 'any' }
979
+ { values : theme ( 'space' ) }
996
980
)
997
981
998
982
addUtilities ( {
@@ -1029,7 +1013,7 @@ export let divideWidth = ({ matchUtilities, addUtilities, theme }) => {
1029
1013
}
1030
1014
} ,
1031
1015
} ,
1032
- { values : theme ( 'divideWidth' ) , type : ' length' }
1016
+ { values : theme ( 'divideWidth' ) , type : [ 'line-width' , ' length'] }
1033
1017
)
1034
1018
1035
1019
addUtilities ( {
@@ -1089,7 +1073,7 @@ export let divideOpacity = ({ matchUtilities, theme }) => {
1089
1073
return { [ `& > :not([hidden]) ~ :not([hidden])` ] : { '--tw-divide-opacity' : value } }
1090
1074
} ,
1091
1075
} ,
1092
- { values : theme ( 'divideOpacity' ) , type : 'any' }
1076
+ { values : theme ( 'divideOpacity' ) }
1093
1077
)
1094
1078
}
1095
1079
@@ -1215,7 +1199,7 @@ export let borderWidth = createUtilityPlugin(
1215
1199
[ 'border-l' , [ [ '@defaults border-width' , { } ] , 'border-left-width' ] ] ,
1216
1200
] ,
1217
1201
] ,
1218
- { resolveArbitraryValue : asLength }
1202
+ { type : [ 'line-width' , 'length' ] }
1219
1203
)
1220
1204
1221
1205
export let borderStyle = ( { addUtilities } ) => {
@@ -1265,7 +1249,7 @@ export let borderColor = ({ addBase, matchUtilities, theme, corePlugins }) => {
1265
1249
} ,
1266
1250
{
1267
1251
values : ( ( { DEFAULT : _ , ...colors } ) => colors ) ( flattenColorPalette ( theme ( 'borderColor' ) ) ) ,
1268
- type : 'color' ,
1252
+ type : [ 'color' ] ,
1269
1253
}
1270
1254
)
1271
1255
@@ -1362,7 +1346,7 @@ export let backgroundOpacity = createUtilityPlugin('backgroundOpacity', [
1362
1346
export let backgroundImage = createUtilityPlugin (
1363
1347
'backgroundImage' ,
1364
1348
[ [ 'bg' , [ 'background-image' ] ] ] ,
1365
- { resolveArbitraryValue : [ asLookupValue , asURL ] }
1349
+ { type : [ 'lookup' , 'image' , 'url' ] }
1366
1350
)
1367
1351
export let gradientColorStops = ( ( ) => {
1368
1352
function transparentTo ( value ) {
@@ -1415,7 +1399,7 @@ export let boxDecorationBreak = ({ addUtilities }) => {
1415
1399
}
1416
1400
1417
1401
export let backgroundSize = createUtilityPlugin ( 'backgroundSize' , [ [ 'bg' , [ 'background-size' ] ] ] , {
1418
- resolveArbitraryValue : asLookupValue ,
1402
+ type : [ 'lookup' , 'length' , 'percentage' ] ,
1419
1403
} )
1420
1404
1421
1405
export let backgroundAttachment = ( { addUtilities } ) => {
@@ -1438,7 +1422,7 @@ export let backgroundClip = ({ addUtilities }) => {
1438
1422
export let backgroundPosition = createUtilityPlugin (
1439
1423
'backgroundPosition' ,
1440
1424
[ [ 'bg' , [ 'background-position' ] ] ] ,
1441
- { resolveArbitraryValue : asLookupValue }
1425
+ { type : [ 'lookup' , 'position' ] }
1442
1426
)
1443
1427
1444
1428
export let backgroundRepeat = ( { addUtilities } ) => {
@@ -1478,12 +1462,12 @@ export let stroke = ({ matchUtilities, theme }) => {
1478
1462
return { stroke : toColorValue ( value ) }
1479
1463
} ,
1480
1464
} ,
1481
- { values : flattenColorPalette ( theme ( 'stroke' ) ) , type : 'color' }
1465
+ { values : flattenColorPalette ( theme ( 'stroke' ) ) , type : [ 'color' , 'url' ] }
1482
1466
)
1483
1467
}
1484
1468
1485
1469
export let strokeWidth = createUtilityPlugin ( 'strokeWidth' , [ [ 'stroke' , [ 'stroke-width' ] ] ] , {
1486
- resolveArbitraryValue : [ asLength , asURL ] ,
1470
+ type : [ 'length' , 'number' , 'percentage' ] ,
1487
1471
} )
1488
1472
1489
1473
export let objectFit = ( { addUtilities } ) => {
@@ -1534,18 +1518,11 @@ export let verticalAlign = ({ addUtilities, matchUtilities }) => {
1534
1518
'.align-super' : { 'vertical-align' : 'super' } ,
1535
1519
} )
1536
1520
1537
- matchUtilities (
1538
- {
1539
- align : ( value ) => ( {
1540
- 'vertical-align' : value ,
1541
- } ) ,
1542
- } ,
1543
- { values : { } , type : 'any' }
1544
- )
1521
+ matchUtilities ( { align : ( value ) => ( { 'vertical-align' : value } ) } )
1545
1522
}
1546
1523
1547
1524
export let fontFamily = createUtilityPlugin ( 'fontFamily' , [ [ 'font' , [ 'fontFamily' ] ] ] , {
1548
- resolveArbitraryValue : asLookupValue ,
1525
+ type : [ 'lookup' , 'generic-name' , 'family-name' ] ,
1549
1526
} )
1550
1527
1551
1528
export let fontSize = ( { matchUtilities, theme } ) => {
@@ -1564,12 +1541,12 @@ export let fontSize = ({ matchUtilities, theme }) => {
1564
1541
}
1565
1542
} ,
1566
1543
} ,
1567
- { values : theme ( 'fontSize' ) , type : ' length' }
1544
+ { values : theme ( 'fontSize' ) , type : [ 'absolute-size' , 'relative-size' , ' length', 'percentage' ] }
1568
1545
)
1569
1546
}
1570
1547
1571
1548
export let fontWeight = createUtilityPlugin ( 'fontWeight' , [ [ 'font' , [ 'fontWeight' ] ] ] , {
1572
- resolveArbitraryValue : asLookupValue ,
1549
+ type : [ 'lookup' , 'number' ] ,
1573
1550
} )
1574
1551
1575
1552
export let textTransform = ( { addUtilities } ) => {
@@ -1691,7 +1668,7 @@ export let placeholderOpacity = ({ matchUtilities, theme }) => {
1691
1668
return { [ '&::placeholder' ] : { '--tw-placeholder-opacity' : value } }
1692
1669
} ,
1693
1670
} ,
1694
- { values : theme ( 'placeholderOpacity' ) , type : 'any' }
1671
+ { values : theme ( 'placeholderOpacity' ) }
1695
1672
)
1696
1673
}
1697
1674
@@ -1799,12 +1776,13 @@ export let outline = ({ matchUtilities, theme }) => {
1799
1776
matchUtilities (
1800
1777
{
1801
1778
outline : ( value ) => {
1779
+ value = Array . isArray ( value ) ? value : value . split ( ',' )
1802
1780
let [ outline , outlineOffset = '0' ] = Array . isArray ( value ) ? value : [ value ]
1803
1781
1804
1782
return { outline, 'outline-offset' : outlineOffset }
1805
1783
} ,
1806
1784
} ,
1807
- { values : theme ( 'outline' ) , type : 'any' }
1785
+ { values : theme ( 'outline' ) }
1808
1786
)
1809
1787
}
1810
1788
@@ -1881,7 +1859,7 @@ export let ringOpacity = createUtilityPlugin(
1881
1859
export let ringOffsetWidth = createUtilityPlugin (
1882
1860
'ringOffsetWidth' ,
1883
1861
[ [ 'ring-offset' , [ '--tw-ring-offset-width' ] ] ] ,
1884
- { resolveArbitraryValue : asLength }
1862
+ { type : 'length' }
1885
1863
)
1886
1864
1887
1865
export let ringOffsetColor = ( { matchUtilities, theme } ) => {
@@ -1908,7 +1886,7 @@ export let blur = ({ matchUtilities, theme }) => {
1908
1886
}
1909
1887
} ,
1910
1888
} ,
1911
- { values : theme ( 'blur' ) , type : 'any' }
1889
+ { values : theme ( 'blur' ) }
1912
1890
)
1913
1891
}
1914
1892
@@ -1923,7 +1901,7 @@ export let brightness = ({ matchUtilities, theme }) => {
1923
1901
}
1924
1902
} ,
1925
1903
} ,
1926
- { values : theme ( 'brightness' ) , type : 'any' }
1904
+ { values : theme ( 'brightness' ) }
1927
1905
)
1928
1906
}
1929
1907
@@ -1938,7 +1916,7 @@ export let contrast = ({ matchUtilities, theme }) => {
1938
1916
}
1939
1917
} ,
1940
1918
} ,
1941
- { values : theme ( 'contrast' ) , type : 'any' }
1919
+ { values : theme ( 'contrast' ) }
1942
1920
)
1943
1921
}
1944
1922
@@ -1970,7 +1948,7 @@ export let grayscale = ({ matchUtilities, theme }) => {
1970
1948
}
1971
1949
} ,
1972
1950
} ,
1973
- { values : theme ( 'grayscale' ) , type : 'any' }
1951
+ { values : theme ( 'grayscale' ) }
1974
1952
)
1975
1953
}
1976
1954
@@ -1985,7 +1963,7 @@ export let hueRotate = ({ matchUtilities, theme }) => {
1985
1963
}
1986
1964
} ,
1987
1965
} ,
1988
- { values : theme ( 'hueRotate' ) , type : 'any' }
1966
+ { values : theme ( 'hueRotate' ) }
1989
1967
)
1990
1968
}
1991
1969
@@ -2000,7 +1978,7 @@ export let invert = ({ matchUtilities, theme }) => {
2000
1978
}
2001
1979
} ,
2002
1980
} ,
2003
- { values : theme ( 'invert' ) , type : 'any' }
1981
+ { values : theme ( 'invert' ) }
2004
1982
)
2005
1983
}
2006
1984
@@ -2015,7 +1993,7 @@ export let saturate = ({ matchUtilities, theme }) => {
2015
1993
}
2016
1994
} ,
2017
1995
} ,
2018
- { values : theme ( 'saturate' ) , type : 'any' }
1996
+ { values : theme ( 'saturate' ) }
2019
1997
)
2020
1998
}
2021
1999
@@ -2030,7 +2008,7 @@ export let sepia = ({ matchUtilities, theme }) => {
2030
2008
}
2031
2009
} ,
2032
2010
} ,
2033
- { values : theme ( 'sepia' ) , type : 'any' }
2011
+ { values : theme ( 'sepia' ) }
2034
2012
)
2035
2013
}
2036
2014
@@ -2076,7 +2054,7 @@ export let backdropBlur = ({ matchUtilities, theme }) => {
2076
2054
}
2077
2055
} ,
2078
2056
} ,
2079
- { values : theme ( 'backdropBlur' ) , type : 'any' }
2057
+ { values : theme ( 'backdropBlur' ) }
2080
2058
)
2081
2059
}
2082
2060
@@ -2091,7 +2069,7 @@ export let backdropBrightness = ({ matchUtilities, theme }) => {
2091
2069
}
2092
2070
} ,
2093
2071
} ,
2094
- { values : theme ( 'backdropBrightness' ) , type : 'any' }
2072
+ { values : theme ( 'backdropBrightness' ) }
2095
2073
)
2096
2074
}
2097
2075
@@ -2106,7 +2084,7 @@ export let backdropContrast = ({ matchUtilities, theme }) => {
2106
2084
}
2107
2085
} ,
2108
2086
} ,
2109
- { values : theme ( 'backdropContrast' ) , type : 'any' }
2087
+ { values : theme ( 'backdropContrast' ) }
2110
2088
)
2111
2089
}
2112
2090
@@ -2121,7 +2099,7 @@ export let backdropGrayscale = ({ matchUtilities, theme }) => {
2121
2099
}
2122
2100
} ,
2123
2101
} ,
2124
- { values : theme ( 'backdropGrayscale' ) , type : 'any' }
2102
+ { values : theme ( 'backdropGrayscale' ) }
2125
2103
)
2126
2104
}
2127
2105
@@ -2136,7 +2114,7 @@ export let backdropHueRotate = ({ matchUtilities, theme }) => {
2136
2114
}
2137
2115
} ,
2138
2116
} ,
2139
- { values : theme ( 'backdropHueRotate' ) , type : 'any' }
2117
+ { values : theme ( 'backdropHueRotate' ) }
2140
2118
)
2141
2119
}
2142
2120
@@ -2151,7 +2129,7 @@ export let backdropInvert = ({ matchUtilities, theme }) => {
2151
2129
}
2152
2130
} ,
2153
2131
} ,
2154
- { values : theme ( 'backdropInvert' ) , type : 'any' }
2132
+ { values : theme ( 'backdropInvert' ) }
2155
2133
)
2156
2134
}
2157
2135
@@ -2166,7 +2144,7 @@ export let backdropOpacity = ({ matchUtilities, theme }) => {
2166
2144
}
2167
2145
} ,
2168
2146
} ,
2169
- { values : theme ( 'backdropOpacity' ) , type : 'any' }
2147
+ { values : theme ( 'backdropOpacity' ) }
2170
2148
)
2171
2149
}
2172
2150
@@ -2181,7 +2159,7 @@ export let backdropSaturate = ({ matchUtilities, theme }) => {
2181
2159
}
2182
2160
} ,
2183
2161
} ,
2184
- { values : theme ( 'backdropSaturate' ) , type : 'any' }
2162
+ { values : theme ( 'backdropSaturate' ) }
2185
2163
)
2186
2164
}
2187
2165
@@ -2196,7 +2174,7 @@ export let backdropSepia = ({ matchUtilities, theme }) => {
2196
2174
}
2197
2175
} ,
2198
2176
} ,
2199
- { values : theme ( 'backdropSepia' ) , type : 'any' }
2177
+ { values : theme ( 'backdropSepia' ) }
2200
2178
)
2201
2179
}
2202
2180
@@ -2252,7 +2230,7 @@ export let transitionProperty = ({ matchUtilities, theme }) => {
2252
2230
}
2253
2231
} ,
2254
2232
} ,
2255
- { values : theme ( 'transitionProperty' ) , type : 'any' }
2233
+ { values : theme ( 'transitionProperty' ) }
2256
2234
)
2257
2235
}
2258
2236
0 commit comments