Commit 289c25f
authored
This PR updates all of our x/y named utilities (like `px-*`, `my-*`,
`inset-y-*`, `scroll-px-*`, etc.) to use logical properties like
`padding-inline` instead of separate `padding-left` and `padding-right`
properties.
We held off on this originally for a while because `inline` doesn't
really mean _horizontal_ like the "x" in `px-*` implies, but I think in
practice this change is fine — I'm comfortable with "x" meaning "in the
inline direction" and "y" meaning "in the block direction" in Tailwind.
This is technically a breaking change if anyone was depending on the
fact that `px-*` for instance was always explicitly setting
`padding-left` and `padding-right` even when building something in a
vertical writing mode, but I kinda doubt there's a single real project
on the internet that will actually be affected, so not too worried about
it.
If someone _really_ wants to set `padding-left` and `padding-right` they
can always use `pl-4 pr-4` instead of `px-4`.
Nice thing about this change is it produces quite a bit less CSS.
To test this change, I re-generated all of the snapshots and made sure
none of the generated utilities changed position or anything in the
output (initially they did before I updated `property-order.ts` to add
some missing properties).
I also created a little demo locally in the Vite playground to test
things manually and make sure I didn't make any obvious typos or
anything that could slip through the snapshots:
<img width="1223" alt="image"
src="https://github.com/user-attachments/assets/0e9854ba-2b5b-4c8c-87b6-6eb7b7da84f2">
<details>
<summary>Show code for playground demo</summary>
```jsx
import React from 'react'
export function App() {
return (
<div className="p-12 gap-10 grid grid-cols-2 items-start">
<div className="grid grid-cols-1 gap-10 justify-start">
<div className="space-y-6">
<p className="font-semibold mb-6">Border Width</p>
<div className="border-x w-48 h-12 flex items-center justify-center">border-x</div>
<div className="border-y w-48 h-12 flex items-center justify-center">border-y</div>
</div>
<div className="space-y-6">
<p className="font-semibold mb-6">Border Color</p>
<div className="border-2 border-x-red-500 w-48 h-12 flex items-center justify-center">
border-x-red-500
</div>
<div className="border-2 border-y-red-500 w-48 h-12 flex items-center justify-center">
border-y-red-500
</div>
</div>
<div className="space-y-6">
<p className="font-semibold mb-6">Padding</p>
<div>
<div className="px-8 bg-yellow-300 inline-flex items-center justify-center">px-8</div>
</div>
<div>
<div className="py-8 bg-yellow-300 inline-flex items-center justify-center">py-8</div>
</div>
</div>
</div>
<div className="grid grid-cols-1 gap-10 justify-start">
<div className="space-y-6">
<p className="font-semibold mb-6">Margin</p>
<div>
<div className="bg-red-400 inline-flex">
<div className="mx-8 bg-yellow-300 inline-flex items-center justify-center">mx-8</div>
</div>
</div>
<div>
<div className="bg-red-400 inline-flex">
<div className="my-8 bg-yellow-300 inline-flex items-center justify-center">my-8</div>
</div>
</div>
</div>
<div className="space-y-6">
<p className="font-semibold mb-6">Inset</p>
<div className="relative bg-red-400 w-48 h-48">
<div className="inset-x-8 absolute bg-yellow-300 inline-flex items-center justify-center">
inset-x-8
</div>
</div>
<div className="relative bg-red-400 w-48 h-48">
<div className="inset-y-8 absolute bg-yellow-300 inline-flex items-center justify-center">
inset-y-8
</div>
</div>
</div>
</div>
</div>
)
}
```
</details>
I didn't manually test the scroll padding or scroll margin utilities
because they are more annoying to set up, but I probably should.
---------
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
1 parent e14ab1f commit 289c25f
File tree
6 files changed
+163
-312
lines changed- packages/tailwindcss/src
- __snapshots__
6 files changed
+163
-312
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
Lines changed: 64 additions & 128 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
| 859 | + | |
| 860 | + | |
863 | 861 | | |
864 | 862 | | |
865 | 863 | | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
| 864 | + | |
| 865 | + | |
870 | 866 | | |
871 | 867 | | |
872 | 868 | | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
| 869 | + | |
| 870 | + | |
877 | 871 | | |
878 | 872 | | |
879 | 873 | | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
| 874 | + | |
| 875 | + | |
884 | 876 | | |
885 | 877 | | |
886 | 878 | | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
| 879 | + | |
| 880 | + | |
891 | 881 | | |
892 | 882 | | |
893 | 883 | | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
| 884 | + | |
| 885 | + | |
898 | 886 | | |
899 | 887 | | |
900 | 888 | | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
| 889 | + | |
| 890 | + | |
905 | 891 | | |
906 | 892 | | |
907 | 893 | | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
| 894 | + | |
| 895 | + | |
912 | 896 | | |
913 | 897 | | |
914 | 898 | | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
| 899 | + | |
| 900 | + | |
919 | 901 | | |
920 | 902 | | |
921 | 903 | | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
| 904 | + | |
| 905 | + | |
926 | 906 | | |
927 | 907 | | |
928 | 908 | | |
929 | | - | |
930 | | - | |
| 909 | + | |
931 | 910 | | |
932 | 911 | | |
933 | 912 | | |
934 | | - | |
935 | | - | |
| 913 | + | |
936 | 914 | | |
937 | 915 | | |
938 | 916 | | |
939 | | - | |
940 | | - | |
| 917 | + | |
941 | 918 | | |
942 | 919 | | |
943 | 920 | | |
944 | | - | |
945 | | - | |
| 921 | + | |
946 | 922 | | |
947 | 923 | | |
948 | 924 | | |
949 | | - | |
950 | | - | |
| 925 | + | |
951 | 926 | | |
952 | 927 | | |
953 | 928 | | |
954 | | - | |
955 | | - | |
| 929 | + | |
956 | 930 | | |
957 | 931 | | |
958 | 932 | | |
959 | | - | |
960 | | - | |
| 933 | + | |
961 | 934 | | |
962 | 935 | | |
963 | 936 | | |
964 | | - | |
965 | | - | |
| 937 | + | |
966 | 938 | | |
967 | 939 | | |
968 | 940 | | |
969 | | - | |
970 | | - | |
| 941 | + | |
971 | 942 | | |
972 | 943 | | |
973 | 944 | | |
974 | | - | |
975 | | - | |
| 945 | + | |
976 | 946 | | |
977 | 947 | | |
978 | 948 | | |
979 | | - | |
980 | | - | |
| 949 | + | |
981 | 950 | | |
982 | 951 | | |
983 | 952 | | |
984 | | - | |
985 | | - | |
| 953 | + | |
986 | 954 | | |
987 | 955 | | |
988 | 956 | | |
| |||
1009 | 977 | | |
1010 | 978 | | |
1011 | 979 | | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
| 980 | + | |
| 981 | + | |
1016 | 982 | | |
1017 | 983 | | |
1018 | 984 | | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
| 985 | + | |
| 986 | + | |
1023 | 987 | | |
1024 | 988 | | |
1025 | 989 | | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
| 990 | + | |
| 991 | + | |
1030 | 992 | | |
1031 | 993 | | |
1032 | 994 | | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
| 995 | + | |
| 996 | + | |
1037 | 997 | | |
1038 | 998 | | |
1039 | 999 | | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
| 1000 | + | |
| 1001 | + | |
1044 | 1002 | | |
1045 | 1003 | | |
1046 | 1004 | | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
| 1005 | + | |
| 1006 | + | |
1051 | 1007 | | |
1052 | 1008 | | |
1053 | 1009 | | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
| 1010 | + | |
| 1011 | + | |
1058 | 1012 | | |
1059 | 1013 | | |
1060 | 1014 | | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
| 1015 | + | |
| 1016 | + | |
1065 | 1017 | | |
1066 | 1018 | | |
1067 | 1019 | | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
| 1020 | + | |
| 1021 | + | |
1072 | 1022 | | |
1073 | 1023 | | |
1074 | 1024 | | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
| 1025 | + | |
| 1026 | + | |
1079 | 1027 | | |
1080 | 1028 | | |
1081 | 1029 | | |
1082 | | - | |
1083 | | - | |
| 1030 | + | |
1084 | 1031 | | |
1085 | 1032 | | |
1086 | 1033 | | |
1087 | | - | |
1088 | | - | |
| 1034 | + | |
1089 | 1035 | | |
1090 | 1036 | | |
1091 | 1037 | | |
1092 | | - | |
1093 | | - | |
| 1038 | + | |
1094 | 1039 | | |
1095 | 1040 | | |
1096 | 1041 | | |
1097 | | - | |
1098 | | - | |
| 1042 | + | |
1099 | 1043 | | |
1100 | 1044 | | |
1101 | 1045 | | |
1102 | | - | |
1103 | | - | |
| 1046 | + | |
1104 | 1047 | | |
1105 | 1048 | | |
1106 | 1049 | | |
1107 | | - | |
1108 | | - | |
| 1050 | + | |
1109 | 1051 | | |
1110 | 1052 | | |
1111 | 1053 | | |
1112 | | - | |
1113 | | - | |
| 1054 | + | |
1114 | 1055 | | |
1115 | 1056 | | |
1116 | 1057 | | |
1117 | | - | |
1118 | | - | |
| 1058 | + | |
1119 | 1059 | | |
1120 | 1060 | | |
1121 | 1061 | | |
1122 | | - | |
1123 | | - | |
| 1062 | + | |
1124 | 1063 | | |
1125 | 1064 | | |
1126 | 1065 | | |
1127 | | - | |
1128 | | - | |
| 1066 | + | |
1129 | 1067 | | |
1130 | 1068 | | |
1131 | 1069 | | |
1132 | | - | |
1133 | | - | |
| 1070 | + | |
1134 | 1071 | | |
1135 | 1072 | | |
1136 | 1073 | | |
1137 | | - | |
1138 | | - | |
| 1074 | + | |
1139 | 1075 | | |
1140 | 1076 | | |
1141 | 1077 | | |
| |||
0 commit comments