@@ -89,14 +89,17 @@ export const gridRowRule: UtilityRule = (parsed) => {
8989}
9090
9191export const gridAutoFlowRule : UtilityRule = ( parsed ) => {
92- const flows : Record < string , string > = {
93- 'grid-flow-row' : 'row' ,
94- 'grid-flow-col' : 'column' ,
95- 'grid-flow-dense' : 'dense' ,
96- 'grid-flow-row-dense' : 'row dense' ,
97- 'grid-flow-col-dense' : 'column dense' ,
98- }
99- return flows [ parsed . raw ] ? { 'grid-auto-flow' : flows [ parsed . raw ] } : undefined
92+ if ( parsed . utility === 'grid-flow' && parsed . value ) {
93+ const flows : Record < string , string > = {
94+ 'row' : 'row' ,
95+ 'col' : 'column' ,
96+ 'dense' : 'dense' ,
97+ 'row-dense' : 'row dense' ,
98+ 'col-dense' : 'column dense' ,
99+ }
100+ return flows [ parsed . value ] ? { 'grid-auto-flow' : flows [ parsed . value ] } : undefined
101+ }
102+ return undefined
100103}
101104
102105export const gridAutoColumnsRule : UtilityRule = ( parsed ) => {
@@ -136,37 +139,49 @@ export const gapRule: UtilityRule = (parsed, config) => {
136139}
137140
138141export const placeContentRule : UtilityRule = ( parsed ) => {
139- const values : Record < string , string > = {
140- 'place-content-center' : 'center' ,
141- 'place-content-start' : 'start' ,
142- 'place-content-end' : 'end' ,
143- 'place-content-between' : 'space-between' ,
144- 'place-content-around' : 'space-around' ,
145- 'place-content-evenly' : 'space-evenly' ,
146- 'place-content-stretch' : 'stretch' ,
147- }
148- return values [ parsed . raw ] ? { 'place-content' : values [ parsed . raw ] } : undefined
142+ if ( parsed . utility === 'place' && parsed . value && parsed . value . startsWith ( 'content-' ) ) {
143+ const val = parsed . value . replace ( 'content-' , '' )
144+ const values : Record < string , string > = {
145+ 'center' : 'center' ,
146+ 'start' : 'start' ,
147+ 'end' : 'end' ,
148+ 'between' : 'space-between' ,
149+ 'around' : 'space-around' ,
150+ 'evenly' : 'space-evenly' ,
151+ 'stretch' : 'stretch' ,
152+ }
153+ return values [ val ] ? { 'place-content' : values [ val ] } : undefined
154+ }
155+ return undefined
149156}
150157
151158export const placeItemsRule : UtilityRule = ( parsed ) => {
152- const values : Record < string , string > = {
153- 'place-items-start' : 'start' ,
154- 'place-items-end' : 'end' ,
155- 'place-items-center' : 'center' ,
156- 'place-items-stretch' : 'stretch' ,
159+ if ( parsed . utility === 'place' && parsed . value && parsed . value . startsWith ( 'items-' ) ) {
160+ const val = parsed . value . replace ( 'items-' , '' )
161+ const values : Record < string , string > = {
162+ 'start' : 'start' ,
163+ 'end' : 'end' ,
164+ 'center' : 'center' ,
165+ 'stretch' : 'stretch' ,
166+ }
167+ return values [ val ] ? { 'place-items' : values [ val ] } : undefined
157168 }
158- return values [ parsed . raw ] ? { 'place-items' : values [ parsed . raw ] } : undefined
169+ return undefined
159170}
160171
161172export const placeSelfRule : UtilityRule = ( parsed ) => {
162- const values : Record < string , string > = {
163- 'place-self-auto' : 'auto' ,
164- 'place-self-start' : 'start' ,
165- 'place-self-end' : 'end' ,
166- 'place-self-center' : 'center' ,
167- 'place-self-stretch' : 'stretch' ,
168- }
169- return values [ parsed . raw ] ? { 'place-self' : values [ parsed . raw ] } : undefined
173+ if ( parsed . utility === 'place' && parsed . value && parsed . value . startsWith ( 'self-' ) ) {
174+ const val = parsed . value . replace ( 'self-' , '' )
175+ const values : Record < string , string > = {
176+ 'auto' : 'auto' ,
177+ 'start' : 'start' ,
178+ 'end' : 'end' ,
179+ 'center' : 'center' ,
180+ 'stretch' : 'stretch' ,
181+ }
182+ return values [ val ] ? { 'place-self' : values [ val ] } : undefined
183+ }
184+ return undefined
170185}
171186
172187export const gridRules : UtilityRule [ ] = [
0 commit comments