@@ -99,22 +99,36 @@ export const borderStyleRule: UtilityRule = (parsed) => {
9999}
100100
101101export const outlineRule : UtilityRule = ( parsed , config ) => {
102- if ( parsed . utility === 'outline' ) {
103- if ( ! parsed . value ) {
104- return { 'outline-width' : '1px' }
105- }
106- const widths : Record < string , string > = {
102+ // Outline offset
103+ if ( parsed . utility === 'outline-offset' && parsed . value ) {
104+ const offsets : Record < string , string > = {
107105 0 : '0px' ,
108106 1 : '1px' ,
109107 2 : '2px' ,
110108 4 : '4px' ,
111109 8 : '8px' ,
112110 }
113- return { 'outline-width' : widths [ parsed . value ] || parsed . value }
111+ return { 'outline-offset' : offsets [ parsed . value ] || parsed . value }
112+ }
113+
114+ // Outline styles
115+ const outlineStyles : Record < string , string > = {
116+ 'outline-none' : 'none' ,
117+ 'outline-solid' : 'solid' ,
118+ 'outline-dashed' : 'dashed' ,
119+ 'outline-dotted' : 'dotted' ,
120+ 'outline-double' : 'double' ,
121+ }
122+ if ( parsed . raw . startsWith ( 'outline-' ) && outlineStyles [ parsed . raw ] ) {
123+ return { 'outline-style' : outlineStyles [ parsed . raw ] }
114124 }
115125
116- // Outline colors
117- if ( parsed . utility === 'outline' && parsed . value ) {
126+ if ( parsed . utility === 'outline' ) {
127+ if ( ! parsed . value ) {
128+ return { 'outline-width' : '1px' }
129+ }
130+
131+ // Check for colors first (e.g., outline-blue-500)
118132 const parts = parsed . value . split ( '-' )
119133 if ( parts . length === 2 ) {
120134 const [ colorName , shade ] = parts
@@ -123,34 +137,27 @@ export const outlineRule: UtilityRule = (parsed, config) => {
123137 return { 'outline-color' : colorValue [ shade ] }
124138 }
125139 }
126- // Direct color
140+
141+ // Direct color (e.g., outline-black)
127142 const directColor = config . theme . colors [ parsed . value ]
128143 if ( typeof directColor === 'string' ) {
129144 return { 'outline-color' : directColor }
130145 }
131- }
132146
133- // Outline offset
134- if ( parsed . utility === 'outline-offset' && parsed . value ) {
135- const offsets : Record < string , string > = {
147+ // Check for width values
148+ const widths : Record < string , string > = {
136149 0 : '0px' ,
137150 1 : '1px' ,
138151 2 : '2px' ,
139152 4 : '4px' ,
140153 8 : '8px' ,
141154 }
142- return { 'outline-offset' : offsets [ parsed . value ] || parsed . value }
143- }
155+ if ( widths [ parsed . value ] ) {
156+ return { 'outline-width' : widths [ parsed . value ] }
157+ }
144158
145- const outlineStyles : Record < string , string > = {
146- 'outline-none' : 'none' ,
147- 'outline-solid' : 'solid' ,
148- 'outline-dashed' : 'dashed' ,
149- 'outline-dotted' : 'dotted' ,
150- 'outline-double' : 'double' ,
151- }
152- if ( parsed . raw . startsWith ( 'outline-' ) && outlineStyles [ parsed . raw ] ) {
153- return { 'outline-style' : outlineStyles [ parsed . raw ] }
159+ // Fallback to raw value as width
160+ return { 'outline-width' : parsed . value }
154161 }
155162}
156163
0 commit comments