@@ -237,8 +237,13 @@ export const INSET_SCALE: Record<string, number> = {
237237
238238/**
239239 * Parse layout classes
240+ * @param cls - The class name to parse
241+ * @param customSpacing - Optional custom spacing values from tailwind.config (for inset utilities)
240242 */
241- export function parseLayout ( cls : string ) : StyleObject | null {
243+ export function parseLayout ( cls : string , customSpacing ?: Record < string , number > ) : StyleObject | null {
244+ // Merge custom spacing with defaults for inset utilities
245+ const insetMap = customSpacing ? { ...INSET_SCALE , ...customSpacing } : INSET_SCALE ;
246+
242247 // Z-index: z-0, z-10, z-20, z-[999], etc.
243248 if ( cls . startsWith ( "z-" ) ) {
244249 const zKey = cls . substring ( 2 ) ;
@@ -270,7 +275,7 @@ export function parseLayout(cls: string): StyleObject | null {
270275 return { top : arbitraryTop } ;
271276 }
272277
273- const topValue = INSET_SCALE [ topKey ] ;
278+ const topValue = insetMap [ topKey ] ;
274279 if ( topValue !== undefined ) {
275280 return { top : topValue } ;
276281 }
@@ -291,7 +296,7 @@ export function parseLayout(cls: string): StyleObject | null {
291296 return { right : arbitraryRight } ;
292297 }
293298
294- const rightValue = INSET_SCALE [ rightKey ] ;
299+ const rightValue = insetMap [ rightKey ] ;
295300 if ( rightValue !== undefined ) {
296301 return { right : rightValue } ;
297302 }
@@ -312,7 +317,7 @@ export function parseLayout(cls: string): StyleObject | null {
312317 return { bottom : arbitraryBottom } ;
313318 }
314319
315- const bottomValue = INSET_SCALE [ bottomKey ] ;
320+ const bottomValue = insetMap [ bottomKey ] ;
316321 if ( bottomValue !== undefined ) {
317322 return { bottom : bottomValue } ;
318323 }
@@ -333,7 +338,7 @@ export function parseLayout(cls: string): StyleObject | null {
333338 return { left : arbitraryLeft } ;
334339 }
335340
336- const leftValue = INSET_SCALE [ leftKey ] ;
341+ const leftValue = insetMap [ leftKey ] ;
337342 if ( leftValue !== undefined ) {
338343 return { left : leftValue } ;
339344 }
@@ -364,7 +369,7 @@ export function parseLayout(cls: string): StyleObject | null {
364369 return { start : arbitraryStart } ;
365370 }
366371
367- const startValue = INSET_SCALE [ startKey ] ;
372+ const startValue = insetMap [ startKey ] ;
368373 if ( startValue !== undefined ) {
369374 return { start : isNegative ? - startValue : startValue } ;
370375 }
@@ -395,7 +400,7 @@ export function parseLayout(cls: string): StyleObject | null {
395400 return { end : arbitraryEnd } ;
396401 }
397402
398- const endValue = INSET_SCALE [ endKey ] ;
403+ const endValue = insetMap [ endKey ] ;
399404 if ( endValue !== undefined ) {
400405 return { end : isNegative ? - endValue : endValue } ;
401406 }
@@ -411,7 +416,7 @@ export function parseLayout(cls: string): StyleObject | null {
411416 return { left : arbitraryInset , right : arbitraryInset } ;
412417 }
413418
414- const insetValue = INSET_SCALE [ insetKey ] ;
419+ const insetValue = insetMap [ insetKey ] ;
415420 if ( insetValue !== undefined ) {
416421 return { left : insetValue , right : insetValue } ;
417422 }
@@ -427,7 +432,7 @@ export function parseLayout(cls: string): StyleObject | null {
427432 return { top : arbitraryInset , bottom : arbitraryInset } ;
428433 }
429434
430- const insetValue = INSET_SCALE [ insetKey ] ;
435+ const insetValue = insetMap [ insetKey ] ;
431436 if ( insetValue !== undefined ) {
432437 return { top : insetValue , bottom : insetValue } ;
433438 }
@@ -443,7 +448,7 @@ export function parseLayout(cls: string): StyleObject | null {
443448 return { start : arbitraryInset } ;
444449 }
445450
446- const insetValue = INSET_SCALE [ insetKey ] ;
451+ const insetValue = insetMap [ insetKey ] ;
447452 if ( insetValue !== undefined ) {
448453 return { start : insetValue } ;
449454 }
@@ -459,7 +464,7 @@ export function parseLayout(cls: string): StyleObject | null {
459464 return { end : arbitraryInset } ;
460465 }
461466
462- const insetValue = INSET_SCALE [ insetKey ] ;
467+ const insetValue = insetMap [ insetKey ] ;
463468 if ( insetValue !== undefined ) {
464469 return { end : insetValue } ;
465470 }
@@ -475,7 +480,7 @@ export function parseLayout(cls: string): StyleObject | null {
475480 return { top : arbitraryInset , right : arbitraryInset , bottom : arbitraryInset , left : arbitraryInset } ;
476481 }
477482
478- const insetValue = INSET_SCALE [ insetKey ] ;
483+ const insetValue = insetMap [ insetKey ] ;
479484 if ( insetValue !== undefined ) {
480485 return { top : insetValue , right : insetValue , bottom : insetValue , left : insetValue } ;
481486 }
0 commit comments