@@ -374,7 +374,7 @@ export function createUtilities(theme: Theme) {
374
374
375
375
function spacingUtility (
376
376
name : string ,
377
- themeNamespace : ThemeKey | ThemeKey [ ] ,
377
+ themeKeys : ThemeKey [ ] ,
378
378
handle : ( value : string ) => AstNode [ ] | undefined ,
379
379
{
380
380
supportsNegative = false ,
@@ -388,7 +388,6 @@ export function createUtilities(theme: Theme) {
388
388
utilities . static ( `-${ name } -px` , ( ) => handle ( '-1px' ) )
389
389
}
390
390
utilities . static ( `${ name } -px` , ( ) => handle ( '1px' ) )
391
- let themeKeys = ( [ ] as ThemeKey [ ] ) . concat ( themeNamespace , '--spacing' )
392
391
functionalUtility ( name , {
393
392
themeKeys,
394
393
supportsFractions,
@@ -522,7 +521,7 @@ export function createUtilities(theme: Theme) {
522
521
staticUtility ( `${ name } -auto` , [ [ property , 'auto' ] ] )
523
522
staticUtility ( `${ name } -full` , [ [ property , '100%' ] ] )
524
523
staticUtility ( `-${ name } -full` , [ [ property , '-100%' ] ] )
525
- spacingUtility ( name , '--inset' , ( value ) => [ decl ( property , value ) ] , {
524
+ spacingUtility ( name , [ '--inset' , '--spacing' ] , ( value ) => [ decl ( property , value ) ] , {
526
525
supportsNegative : true ,
527
526
supportsFractions : true ,
528
527
} )
@@ -751,7 +750,7 @@ export function createUtilities(theme: Theme) {
751
750
[ 'ml' , 'margin-left' ] ,
752
751
] as const ) {
753
752
staticUtility ( `${ namespace } -auto` , [ [ property , 'auto' ] ] )
754
- spacingUtility ( namespace , '--margin' , ( value ) => [ decl ( property , value ) ] , {
753
+ spacingUtility ( namespace , [ '--margin' , '--spacing' ] , ( value ) => [ decl ( property , value ) ] , {
755
754
supportsNegative : true ,
756
755
} )
757
756
}
@@ -890,20 +889,20 @@ export function createUtilities(theme: Theme) {
890
889
891
890
spacingUtility (
892
891
'size' ,
893
- [ '--size' ] ,
892
+ [ '--size' , '--spacing' ] ,
894
893
( value ) => [ decl ( '--tw-sort' , 'size' ) , decl ( 'width' , value ) , decl ( 'height' , value ) ] ,
895
894
{
896
895
supportsFractions : true ,
897
896
} ,
898
897
)
899
898
900
899
for ( let [ name , namespaces , property ] of [
901
- [ 'w' , [ '--width' , '--container' ] , 'width' ] ,
902
- [ 'min-w' , [ '--min-width' , '--container' ] , 'min-width' ] ,
903
- [ 'max-w' , [ '--max-width' , '--container' ] , 'max-width' ] ,
904
- [ 'h' , [ '--height' ] , 'height' ] ,
905
- [ 'min-h' , [ '--min-height' , '--height' ] , 'min-height' ] ,
906
- [ 'max-h' , [ '--max-height' , '--height' ] , 'max-height' ] ,
900
+ [ 'w' , [ '--width' , '--spacing' , '-- container'] , 'width' ] ,
901
+ [ 'min-w' , [ '--min-width' , '--spacing' , '-- container'] , 'min-width' ] ,
902
+ [ 'max-w' , [ '--max-width' , '--spacing' , '-- container'] , 'max-width' ] ,
903
+ [ 'h' , [ '--height' , '--spacing' ] , 'height' ] ,
904
+ [ 'min-h' , [ '--min-height' , '--height' , '--spacing' ] , 'min-height' ] ,
905
+ [ 'max-h' , [ '--max-height' , '--height' , '--spacing' ] , 'max-height' ] ,
907
906
] as [ string , ThemeKey [ ] , string ] [ ] ) {
908
907
spacingUtility ( name , namespaces , ( value ) => [ decl ( property , value ) ] , {
909
908
supportsFractions : true ,
@@ -997,9 +996,14 @@ export function createUtilities(theme: Theme) {
997
996
*/
998
997
staticUtility ( 'basis-auto' , [ [ 'flex-basis' , 'auto' ] ] )
999
998
staticUtility ( 'basis-full' , [ [ 'flex-basis' , '100%' ] ] )
1000
- spacingUtility ( 'basis' , [ '--flex-basis' , '--container' ] , ( value ) => [ decl ( 'flex-basis' , value ) ] , {
1001
- supportsFractions : true ,
1002
- } )
999
+ spacingUtility (
1000
+ 'basis' ,
1001
+ [ '--flex-basis' , '--spacing' , '--container' ] ,
1002
+ ( value ) => [ decl ( 'flex-basis' , value ) ] ,
1003
+ {
1004
+ supportsFractions : true ,
1005
+ } ,
1006
+ )
1003
1007
1004
1008
/**
1005
1009
* @css `table-layout`
@@ -1028,20 +1032,20 @@ export function createUtilities(theme: Theme) {
1028
1032
/**
1029
1033
* @css `border-spacing`
1030
1034
*/
1031
- spacingUtility ( 'border-spacing' , [ '--border-spacing' ] , ( value ) => [
1035
+ spacingUtility ( 'border-spacing' , [ '--border-spacing' , '--spacing' ] , ( value ) => [
1032
1036
borderSpacingProperties ( ) ,
1033
1037
decl ( '--tw-border-spacing-x' , value ) ,
1034
1038
decl ( '--tw-border-spacing-y' , value ) ,
1035
1039
decl ( 'border-spacing' , 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)' ) ,
1036
1040
] )
1037
1041
1038
- spacingUtility ( 'border-spacing-x' , [ '--border-spacing' ] , ( value ) => [
1042
+ spacingUtility ( 'border-spacing-x' , [ '--border-spacing' , '--spacing' ] , ( value ) => [
1039
1043
borderSpacingProperties ( ) ,
1040
1044
decl ( '--tw-border-spacing-x' , value ) ,
1041
1045
decl ( 'border-spacing' , 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)' ) ,
1042
1046
] )
1043
1047
1044
- spacingUtility ( 'border-spacing-y' , [ '--border-spacing' ] , ( value ) => [
1048
+ spacingUtility ( 'border-spacing-y' , [ '--border-spacing' , '--spacing' ] , ( value ) => [
1045
1049
borderSpacingProperties ( ) ,
1046
1050
decl ( '--tw-border-spacing-y' , value ) ,
1047
1051
decl ( 'border-spacing' , 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)' ) ,
@@ -1113,7 +1117,7 @@ export function createUtilities(theme: Theme) {
1113
1117
1114
1118
spacingUtility (
1115
1119
'translate' ,
1116
- [ '--translate' ] ,
1120
+ [ '--translate' , '--spacing' ] ,
1117
1121
( value ) => [
1118
1122
translateProperties ( ) ,
1119
1123
decl ( '--tw-translate-x' , value ) ,
@@ -1136,7 +1140,7 @@ export function createUtilities(theme: Theme) {
1136
1140
] )
1137
1141
spacingUtility (
1138
1142
`translate-${ axis } ` ,
1139
- [ '--translate' ] ,
1143
+ [ '--translate' , '--spacing' ] ,
1140
1144
( value ) => [
1141
1145
translateProperties ( ) ,
1142
1146
decl ( `--tw-translate-${ axis } ` , value ) ,
@@ -1151,7 +1155,7 @@ export function createUtilities(theme: Theme) {
1151
1155
1152
1156
spacingUtility (
1153
1157
`translate-z` ,
1154
- [ '--translate' ] ,
1158
+ [ '--translate' , '--spacing' ] ,
1155
1159
( value ) => [
1156
1160
translateProperties ( ) ,
1157
1161
decl ( `--tw-translate-z` , value ) ,
@@ -1615,9 +1619,14 @@ export function createUtilities(theme: Theme) {
1615
1619
[ 'scroll-mb' , 'scroll-margin-bottom' ] ,
1616
1620
[ 'scroll-ml' , 'scroll-margin-left' ] ,
1617
1621
] as const ) {
1618
- spacingUtility ( namespace , '--scroll-margin' , ( value ) => [ decl ( property , value ) ] , {
1619
- supportsNegative : true ,
1620
- } )
1622
+ spacingUtility (
1623
+ namespace ,
1624
+ [ '--scroll-margin' , '--spacing' ] ,
1625
+ ( value ) => [ decl ( property , value ) ] ,
1626
+ {
1627
+ supportsNegative : true ,
1628
+ } ,
1629
+ )
1621
1630
}
1622
1631
1623
1632
/**
@@ -1634,7 +1643,7 @@ export function createUtilities(theme: Theme) {
1634
1643
[ 'scroll-pb' , 'scroll-padding-bottom' ] ,
1635
1644
[ 'scroll-pl' , 'scroll-padding-left' ] ,
1636
1645
] as const ) {
1637
- spacingUtility ( namespace , '--scroll-padding' , ( value ) => [ decl ( property , value ) ] )
1646
+ spacingUtility ( namespace , [ '--scroll-padding' , '--spacing' ] , ( value ) => [ decl ( property , value ) ] )
1638
1647
}
1639
1648
1640
1649
staticUtility ( 'list-inside' , [ [ 'list-style-position' , 'inside' ] ] )
@@ -1816,13 +1825,13 @@ export function createUtilities(theme: Theme) {
1816
1825
staticUtility ( 'justify-items-end' , [ [ 'justify-items' , 'end' ] ] )
1817
1826
staticUtility ( 'justify-items-stretch' , [ [ 'justify-items' , 'stretch' ] ] )
1818
1827
1819
- spacingUtility ( 'gap' , [ '--gap' ] , ( value ) => [ decl ( 'gap' , value ) ] )
1820
- spacingUtility ( 'gap-x' , [ '--gap' ] , ( value ) => [ decl ( 'column-gap' , value ) ] )
1821
- spacingUtility ( 'gap-y' , [ '--gap' ] , ( value ) => [ decl ( 'row-gap' , value ) ] )
1828
+ spacingUtility ( 'gap' , [ '--gap' , '--spacing' ] , ( value ) => [ decl ( 'gap' , value ) ] )
1829
+ spacingUtility ( 'gap-x' , [ '--gap' , '--spacing' ] , ( value ) => [ decl ( 'column-gap' , value ) ] )
1830
+ spacingUtility ( 'gap-y' , [ '--gap' , '--spacing' ] , ( value ) => [ decl ( 'row-gap' , value ) ] )
1822
1831
1823
1832
spacingUtility (
1824
1833
'space-x' ,
1825
- [ '--space' ] ,
1834
+ [ '--space' , '--spacing' ] ,
1826
1835
( value ) => [
1827
1836
atRoot ( [ property ( '--tw-space-x-reverse' , '0' , '<number>' ) ] ) ,
1828
1837
@@ -1838,7 +1847,7 @@ export function createUtilities(theme: Theme) {
1838
1847
1839
1848
spacingUtility (
1840
1849
'space-y' ,
1841
- [ '--space' ] ,
1850
+ [ '--space' , '--spacing' ] ,
1842
1851
( value ) => [
1843
1852
atRoot ( [ property ( '--tw-space-y-reverse' , '0' , '<number>' ) ] ) ,
1844
1853
styleRule ( ':where(& > :not(:last-child))' , [
@@ -2822,7 +2831,7 @@ export function createUtilities(theme: Theme) {
2822
2831
[ 'pb' , 'padding-bottom' ] ,
2823
2832
[ 'pl' , 'padding-left' ] ,
2824
2833
] as const ) {
2825
- spacingUtility ( name , '--padding' , ( value ) => [ decl ( property , value ) ] )
2834
+ spacingUtility ( name , [ '--padding' , '--spacing' ] , ( value ) => [ decl ( property , value ) ] )
2826
2835
}
2827
2836
2828
2837
staticUtility ( 'text-left' , [ [ 'text-align' , 'left' ] ] )
@@ -2832,9 +2841,14 @@ export function createUtilities(theme: Theme) {
2832
2841
staticUtility ( 'text-start' , [ [ 'text-align' , 'start' ] ] )
2833
2842
staticUtility ( 'text-end' , [ [ 'text-align' , 'end' ] ] )
2834
2843
2835
- spacingUtility ( 'indent' , [ '--text-indent' ] , ( value ) => [ decl ( 'text-indent' , value ) ] , {
2836
- supportsNegative : true ,
2837
- } )
2844
+ spacingUtility (
2845
+ 'indent' ,
2846
+ [ '--text-indent' , '--spacing' ] ,
2847
+ ( value ) => [ decl ( 'text-indent' , value ) ] ,
2848
+ {
2849
+ supportsNegative : true ,
2850
+ } ,
2851
+ )
2838
2852
2839
2853
staticUtility ( 'align-baseline' , [ [ 'vertical-align' , 'baseline' ] ] )
2840
2854
staticUtility ( 'align-top' , [ [ 'vertical-align' , 'top' ] ] )
@@ -3727,7 +3741,7 @@ export function createUtilities(theme: Theme) {
3727
3741
[ '--tw-leading' , '1' ] ,
3728
3742
[ 'line-height' , '1' ] ,
3729
3743
] )
3730
- spacingUtility ( 'leading' , [ '--leading' ] , ( value ) => [
3744
+ spacingUtility ( 'leading' , [ '--leading' , '--spacing' ] , ( value ) => [
3731
3745
atRoot ( [ property ( '--tw-leading' ) ] ) ,
3732
3746
decl ( '--tw-leading' , value ) ,
3733
3747
decl ( 'line-height' , value ) ,
0 commit comments