@@ -26,6 +26,7 @@ function directionSizeRTL(
2626 const matcher = directionSize ( propertyPrefix )
2727 return ( args , context ) => {
2828 const [ match , direction , size ] = args
29+ if ( ! size ) return undefined
2930 const defaultMap = { l : 'is' , r : 'ie' }
3031 const map = prefixMap || defaultMap
3132 const replacement = map [ direction as 'l' | 'r' ]
@@ -41,19 +42,21 @@ function handlerRounded(
4142 [ , a = '' , s = 'DEFAULT' ] : string [ ] ,
4243 { theme } : RuleContext < any > ,
4344) : CSSEntries | undefined {
44- if ( a in cornerMap ) {
45- if ( s === 'full' ) return cornerMap [ a ] . map ( i => [ `border ${ i } -radius` , 'calc(infinity * 1px)' ] )
45+ const corners = cornerMap [ a ]
46+ if ( ! corners ) return undefined
4647
47- const _v = theme . radius ?. [ s ] ?? h . bracket . cssvar . global . fraction . rem ( s )
48- if ( _v != null ) {
49- return cornerMap [ a ] . map ( i => [ `border${ i } -radius` , _v ] )
50- }
48+ if ( s === 'full' ) return corners . map ( i => [ `border${ i } -radius` , 'calc(infinity * 1px)' ] )
49+
50+ const _v = theme . radius ?. [ s ] ?? h . bracket ?. cssvar ?. global ?. fraction ?. rem ?.( s )
51+ if ( _v != null ) {
52+ return corners . map ( i => [ `border${ i } -radius` , _v ] )
5153 }
5254}
5355
5456function handlerBorderSize ( [ , a = '' , b = '1' ] : string [ ] ) : CSSEntries | undefined {
55- const v = h . bracket . cssvar . global . px ( b )
56- if ( a in directionMap && v != null ) return directionMap [ a ] . map ( i => [ `border${ i } -width` , v ] )
57+ const v = h . bracket ?. cssvar ?. global ?. px ?.( b )
58+ const directions = directionMap [ a ]
59+ if ( directions && v != null ) return directions . map ( i => [ `border${ i } -width` , v ] )
5760}
5861
5962/**
@@ -78,6 +81,7 @@ export function presetRtl(): Preset {
7881 [
7982 / ^ (?: p o s i t i o n - | p o s - ) ? ( l e f t | r i g h t ) - ( .+ ) $ / ,
8083 ( [ , direction , size ] , context ) => {
84+ if ( ! size ) return undefined
8185 const replacement = direction === 'left' ? 'inset-is' : 'inset-ie'
8286 // oxlint-disable-next-line no-console -- warn logging
8387 console . warn (
@@ -101,16 +105,18 @@ export function presetRtl(): Preset {
101105 / ^ r o u n d e d - ( [ r l ] ) (?: - ( .+ ) ) ? $ / ,
102106 ( args , context ) => {
103107 const [ _ , direction , size ] = args
108+ if ( ! direction ) return undefined
104109 const replacementMap : Record < string , string > = {
105110 l : 'is' ,
106111 r : 'ie' ,
107112 }
108113 const replacement = replacementMap [ direction ]
114+ if ( ! replacement ) return undefined
109115 // oxlint-disable-next-line no-console -- warn logging
110116 console . warn (
111117 `[RTL] Avoid using 'rounded-${ direction } '. Use 'rounded-${ replacement } ' instead.` ,
112118 )
113- return handlerRounded ( [ '' , replacement , size ] , context )
119+ return handlerRounded ( [ '' , replacement , size ?? 'DEFAULT' ] , context )
114120 } ,
115121 ] ,
116122 [
0 commit comments