@mgcrea/react-native-tailwind 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.LETTER_SPACING_SCALE=exports.FONT_SIZES=void 0;exports.parseTypography=parseTypography;var FONT_SIZES=exports.FONT_SIZES={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128};var LETTER_SPACING_SCALE=exports.LETTER_SPACING_SCALE={tighter:-0.8,tight:-0.4,normal:0,wide:0.4,wider:0.8,widest:1.6};var FONT_WEIGHT_MAP={"font-thin":{fontWeight:"100"},"font-extralight":{fontWeight:"200"},"font-light":{fontWeight:"300"},"font-normal":{fontWeight:"400"},"font-medium":{fontWeight:"500"},"font-semibold":{fontWeight:"600"},"font-bold":{fontWeight:"700"},"font-extrabold":{fontWeight:"800"},"font-black":{fontWeight:"900"}};var FONT_STYLE_MAP={italic:{fontStyle:"italic"},"not-italic":{fontStyle:"normal"}};var TEXT_ALIGN_MAP={"text-left":{textAlign:"left"},"text-center":{textAlign:"center"},"text-right":{textAlign:"right"},"text-justify":{textAlign:"justify"}};var TEXT_DECORATION_MAP={underline:{textDecorationLine:"underline"},"line-through":{textDecorationLine:"line-through"},"no-underline":{textDecorationLine:"none"}};var TEXT_TRANSFORM_MAP={uppercase:{textTransform:"uppercase"},lowercase:{textTransform:"lowercase"},capitalize:{textTransform:"capitalize"},"normal-case":{textTransform:"none"}};var LINE_HEIGHT_MAP={"leading-none":{lineHeight:16},"leading-tight":{lineHeight:20},"leading-snug":{lineHeight:22},"leading-normal":{lineHeight:24},"leading-relaxed":{lineHeight:28},"leading-loose":{lineHeight:32}};var TRACKING_MAP={"tracking-tighter":{letterSpacing:-0.8},"tracking-tight":{letterSpacing:-0.4},"tracking-normal":{letterSpacing:0},"tracking-wide":{letterSpacing:0.4},"tracking-wider":{letterSpacing:0.8},"tracking-widest":{letterSpacing:1.6}};function parseArbitraryFontSize(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary font size value: ${value}. Only px values are supported (e.g., [18px] or [18]).`);}return null;}return null;}function parseArbitraryLineHeight(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary line height value: ${value}. Only px values are supported (e.g., [24px] or [24]).`);}return null;}return null;}function parseTypography(cls){var _ref,_ref2,_ref3,_ref4,_ref5,_ref6,_FONT_WEIGHT_MAP$cls;if(cls.startsWith("text-")){var sizeKey=cls.substring(5);var arbitraryValue=parseArbitraryFontSize(sizeKey);if(arbitraryValue!==null){return{fontSize:arbitraryValue};}var fontSize=FONT_SIZES[sizeKey];if(fontSize!==undefined){return{fontSize:fontSize};}}if(cls.startsWith("leading-")){var heightKey=cls.substring(8);var _arbitraryValue=parseArbitraryLineHeight(heightKey);if(_arbitraryValue!==null){return{lineHeight:_arbitraryValue};}}return(_ref=(_ref2=(_ref3=(_ref4=(_ref5=(_ref6=(_FONT_WEIGHT_MAP$cls=FONT_WEIGHT_MAP[cls])!=null?_FONT_WEIGHT_MAP$cls:FONT_STYLE_MAP[cls])!=null?_ref6:TEXT_ALIGN_MAP[cls])!=null?_ref5:TEXT_DECORATION_MAP[cls])!=null?_ref4:TEXT_TRANSFORM_MAP[cls])!=null?_ref3:LINE_HEIGHT_MAP[cls])!=null?_ref2:TRACKING_MAP[cls])!=null?_ref:null;}
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.LETTER_SPACING_SCALE=exports.FONT_SIZES=void 0;exports.parseTypography=parseTypography;var FONT_SIZES=exports.FONT_SIZES={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128};var LETTER_SPACING_SCALE=exports.LETTER_SPACING_SCALE={tighter:-0.8,tight:-0.4,normal:0,wide:0.4,wider:0.8,widest:1.6};var FONT_FAMILY_MAP={"font-sans":{fontFamily:"System"},"font-serif":{fontFamily:"serif"},"font-mono":{fontFamily:"Courier"}};var FONT_WEIGHT_MAP={"font-thin":{fontWeight:"100"},"font-extralight":{fontWeight:"200"},"font-light":{fontWeight:"300"},"font-normal":{fontWeight:"400"},"font-medium":{fontWeight:"500"},"font-semibold":{fontWeight:"600"},"font-bold":{fontWeight:"700"},"font-extrabold":{fontWeight:"800"},"font-black":{fontWeight:"900"}};var FONT_STYLE_MAP={italic:{fontStyle:"italic"},"not-italic":{fontStyle:"normal"}};var TEXT_ALIGN_MAP={"text-left":{textAlign:"left"},"text-center":{textAlign:"center"},"text-right":{textAlign:"right"},"text-justify":{textAlign:"justify"}};var TEXT_DECORATION_MAP={underline:{textDecorationLine:"underline"},"line-through":{textDecorationLine:"line-through"},"no-underline":{textDecorationLine:"none"}};var TEXT_TRANSFORM_MAP={uppercase:{textTransform:"uppercase"},lowercase:{textTransform:"lowercase"},capitalize:{textTransform:"capitalize"},"normal-case":{textTransform:"none"}};var LINE_HEIGHT_MAP={"leading-none":{lineHeight:16},"leading-tight":{lineHeight:20},"leading-snug":{lineHeight:22},"leading-normal":{lineHeight:24},"leading-relaxed":{lineHeight:28},"leading-loose":{lineHeight:32}};var TRACKING_MAP={"tracking-tighter":{letterSpacing:-0.8},"tracking-tight":{letterSpacing:-0.4},"tracking-normal":{letterSpacing:0},"tracking-wide":{letterSpacing:0.4},"tracking-wider":{letterSpacing:0.8},"tracking-widest":{letterSpacing:1.6}};function parseArbitraryFontSize(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary font size value: ${value}. Only px values are supported (e.g., [18px] or [18]).`);}return null;}return null;}function parseArbitraryLineHeight(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary line height value: ${value}. Only px values are supported (e.g., [24px] or [24]).`);}return null;}return null;}function parseTypography(cls){var _ref,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7,_FONT_FAMILY_MAP$cls;if(cls.startsWith("text-")){var sizeKey=cls.substring(5);var arbitraryValue=parseArbitraryFontSize(sizeKey);if(arbitraryValue!==null){return{fontSize:arbitraryValue};}var fontSize=FONT_SIZES[sizeKey];if(fontSize!==undefined){return{fontSize:fontSize};}}if(cls.startsWith("leading-")){var heightKey=cls.substring(8);var _arbitraryValue=parseArbitraryLineHeight(heightKey);if(_arbitraryValue!==null){return{lineHeight:_arbitraryValue};}}return(_ref=(_ref2=(_ref3=(_ref4=(_ref5=(_ref6=(_ref7=(_FONT_FAMILY_MAP$cls=FONT_FAMILY_MAP[cls])!=null?_FONT_FAMILY_MAP$cls:FONT_WEIGHT_MAP[cls])!=null?_ref7:FONT_STYLE_MAP[cls])!=null?_ref6:TEXT_ALIGN_MAP[cls])!=null?_ref5:TEXT_DECORATION_MAP[cls])!=null?_ref4:TEXT_TRANSFORM_MAP[cls])!=null?_ref3:LINE_HEIGHT_MAP[cls])!=null?_ref2:TRACKING_MAP[cls])!=null?_ref:null;}
@@ -1 +1 @@
1
- var _vitest=require("vitest");var _typography=require("./typography");(0,_vitest.describe)("FONT_SIZES",function(){(0,_vitest.it)("should export complete font size scale",function(){(0,_vitest.expect)(_typography.FONT_SIZES).toMatchSnapshot();});});(0,_vitest.describe)("LETTER_SPACING_SCALE",function(){(0,_vitest.it)("should export complete letter spacing scale",function(){(0,_vitest.expect)(_typography.LETTER_SPACING_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("parseTypography - font size",function(){(0,_vitest.it)("should parse font size with preset values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-xs")).toEqual({fontSize:12});(0,_vitest.expect)((0,_typography.parseTypography)("text-sm")).toEqual({fontSize:14});(0,_vitest.expect)((0,_typography.parseTypography)("text-base")).toEqual({fontSize:16});(0,_vitest.expect)((0,_typography.parseTypography)("text-lg")).toEqual({fontSize:18});(0,_vitest.expect)((0,_typography.parseTypography)("text-xl")).toEqual({fontSize:20});(0,_vitest.expect)((0,_typography.parseTypography)("text-2xl")).toEqual({fontSize:24});(0,_vitest.expect)((0,_typography.parseTypography)("text-3xl")).toEqual({fontSize:30});(0,_vitest.expect)((0,_typography.parseTypography)("text-4xl")).toEqual({fontSize:36});(0,_vitest.expect)((0,_typography.parseTypography)("text-5xl")).toEqual({fontSize:48});(0,_vitest.expect)((0,_typography.parseTypography)("text-6xl")).toEqual({fontSize:60});(0,_vitest.expect)((0,_typography.parseTypography)("text-7xl")).toEqual({fontSize:72});(0,_vitest.expect)((0,_typography.parseTypography)("text-8xl")).toEqual({fontSize:96});(0,_vitest.expect)((0,_typography.parseTypography)("text-9xl")).toEqual({fontSize:128});});(0,_vitest.it)("should parse font size with arbitrary pixel values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[13px]")).toEqual({fontSize:13});(0,_vitest.expect)((0,_typography.parseTypography)("text-[13]")).toEqual({fontSize:13});(0,_vitest.expect)((0,_typography.parseTypography)("text-[18px]")).toEqual({fontSize:18});(0,_vitest.expect)((0,_typography.parseTypography)("text-[18]")).toEqual({fontSize:18});(0,_vitest.expect)((0,_typography.parseTypography)("text-[22px]")).toEqual({fontSize:22});(0,_vitest.expect)((0,_typography.parseTypography)("text-[22]")).toEqual({fontSize:22});(0,_vitest.expect)((0,_typography.parseTypography)("text-[100px]")).toEqual({fontSize:100});});});(0,_vitest.describe)("parseTypography - font weight",function(){(0,_vitest.it)("should parse font weight values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("font-thin")).toEqual({fontWeight:"100"});(0,_vitest.expect)((0,_typography.parseTypography)("font-extralight")).toEqual({fontWeight:"200"});(0,_vitest.expect)((0,_typography.parseTypography)("font-light")).toEqual({fontWeight:"300"});(0,_vitest.expect)((0,_typography.parseTypography)("font-normal")).toEqual({fontWeight:"400"});(0,_vitest.expect)((0,_typography.parseTypography)("font-medium")).toEqual({fontWeight:"500"});(0,_vitest.expect)((0,_typography.parseTypography)("font-semibold")).toEqual({fontWeight:"600"});(0,_vitest.expect)((0,_typography.parseTypography)("font-bold")).toEqual({fontWeight:"700"});(0,_vitest.expect)((0,_typography.parseTypography)("font-extrabold")).toEqual({fontWeight:"800"});(0,_vitest.expect)((0,_typography.parseTypography)("font-black")).toEqual({fontWeight:"900"});});});(0,_vitest.describe)("parseTypography - font style",function(){(0,_vitest.it)("should parse font style values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("italic")).toEqual({fontStyle:"italic"});(0,_vitest.expect)((0,_typography.parseTypography)("not-italic")).toEqual({fontStyle:"normal"});});});(0,_vitest.describe)("parseTypography - text alignment",function(){(0,_vitest.it)("should parse text alignment values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-left")).toEqual({textAlign:"left"});(0,_vitest.expect)((0,_typography.parseTypography)("text-center")).toEqual({textAlign:"center"});(0,_vitest.expect)((0,_typography.parseTypography)("text-right")).toEqual({textAlign:"right"});(0,_vitest.expect)((0,_typography.parseTypography)("text-justify")).toEqual({textAlign:"justify"});});});(0,_vitest.describe)("parseTypography - text decoration",function(){(0,_vitest.it)("should parse text decoration values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("underline")).toEqual({textDecorationLine:"underline"});(0,_vitest.expect)((0,_typography.parseTypography)("line-through")).toEqual({textDecorationLine:"line-through"});(0,_vitest.expect)((0,_typography.parseTypography)("no-underline")).toEqual({textDecorationLine:"none"});});});(0,_vitest.describe)("parseTypography - text transform",function(){(0,_vitest.it)("should parse text transform values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("uppercase")).toEqual({textTransform:"uppercase"});(0,_vitest.expect)((0,_typography.parseTypography)("lowercase")).toEqual({textTransform:"lowercase"});(0,_vitest.expect)((0,_typography.parseTypography)("capitalize")).toEqual({textTransform:"capitalize"});(0,_vitest.expect)((0,_typography.parseTypography)("normal-case")).toEqual({textTransform:"none"});});});(0,_vitest.describe)("parseTypography - line height",function(){(0,_vitest.it)("should parse line height with preset values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("leading-none")).toEqual({lineHeight:16});(0,_vitest.expect)((0,_typography.parseTypography)("leading-tight")).toEqual({lineHeight:20});(0,_vitest.expect)((0,_typography.parseTypography)("leading-snug")).toEqual({lineHeight:22});(0,_vitest.expect)((0,_typography.parseTypography)("leading-normal")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("leading-relaxed")).toEqual({lineHeight:28});(0,_vitest.expect)((0,_typography.parseTypography)("leading-loose")).toEqual({lineHeight:32});});(0,_vitest.it)("should parse line height with arbitrary pixel values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("leading-[24px]")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[24]")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[30px]")).toEqual({lineHeight:30});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[30]")).toEqual({lineHeight:30});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[50px]")).toEqual({lineHeight:50});});});(0,_vitest.describe)("parseTypography - letter spacing",function(){(0,_vitest.it)("should parse letter spacing with preset values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("tracking-tighter")).toEqual({letterSpacing:-0.8});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-tight")).toEqual({letterSpacing:-0.4});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-normal")).toEqual({letterSpacing:0});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-wide")).toEqual({letterSpacing:0.4});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-wider")).toEqual({letterSpacing:0.8});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-widest")).toEqual({letterSpacing:1.6});});});(0,_vitest.describe)("parseTypography - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_typography.parseTypography)("invalid")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("font")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("tracking")).toBeNull();});(0,_vitest.it)("should return null for invalid font size values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-invalid")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-10xl")).toBeNull();});(0,_vitest.it)("should return null for invalid font weight values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("font-invalid")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("font-100")).toBeNull();});(0,_vitest.it)("should return null for arbitrary values with unsupported units",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[16rem]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-[2em]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-[2rem]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-[1.5em]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[16")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-16]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-[]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-[24")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-24]")).toBeNull();});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_typography.parseTypography)("mytext-lg")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("font-bold-extra")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("italic-text")).toBeNull();});});(0,_vitest.describe)("parseTypography - comprehensive coverage",function(){(0,_vitest.it)("should handle all typography categories independently",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-base")).toEqual({fontSize:16});(0,_vitest.expect)((0,_typography.parseTypography)("font-bold")).toEqual({fontWeight:"700"});(0,_vitest.expect)((0,_typography.parseTypography)("italic")).toEqual({fontStyle:"italic"});(0,_vitest.expect)((0,_typography.parseTypography)("text-center")).toEqual({textAlign:"center"});(0,_vitest.expect)((0,_typography.parseTypography)("underline")).toEqual({textDecorationLine:"underline"});(0,_vitest.expect)((0,_typography.parseTypography)("uppercase")).toEqual({textTransform:"uppercase"});(0,_vitest.expect)((0,_typography.parseTypography)("leading-normal")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-wide")).toEqual({letterSpacing:0.4});});(0,_vitest.it)("should handle arbitrary values for font size and line height",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[19px]")).toEqual({fontSize:19});(0,_vitest.expect)((0,_typography.parseTypography)("text-[19]")).toEqual({fontSize:19});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[26px]")).toEqual({lineHeight:26});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[26]")).toEqual({lineHeight:26});});(0,_vitest.it)("should handle edge case values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-xs")).toEqual({fontSize:12});(0,_vitest.expect)((0,_typography.parseTypography)("text-9xl")).toEqual({fontSize:128});(0,_vitest.expect)((0,_typography.parseTypography)("leading-none")).toEqual({lineHeight:16});(0,_vitest.expect)((0,_typography.parseTypography)("leading-loose")).toEqual({lineHeight:32});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-tighter")).toEqual({letterSpacing:-0.8});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-widest")).toEqual({letterSpacing:1.6});});});
1
+ var _vitest=require("vitest");var _typography=require("./typography");(0,_vitest.describe)("FONT_SIZES",function(){(0,_vitest.it)("should export complete font size scale",function(){(0,_vitest.expect)(_typography.FONT_SIZES).toMatchSnapshot();});});(0,_vitest.describe)("LETTER_SPACING_SCALE",function(){(0,_vitest.it)("should export complete letter spacing scale",function(){(0,_vitest.expect)(_typography.LETTER_SPACING_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("parseTypography - font size",function(){(0,_vitest.it)("should parse font size with preset values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-xs")).toEqual({fontSize:12});(0,_vitest.expect)((0,_typography.parseTypography)("text-sm")).toEqual({fontSize:14});(0,_vitest.expect)((0,_typography.parseTypography)("text-base")).toEqual({fontSize:16});(0,_vitest.expect)((0,_typography.parseTypography)("text-lg")).toEqual({fontSize:18});(0,_vitest.expect)((0,_typography.parseTypography)("text-xl")).toEqual({fontSize:20});(0,_vitest.expect)((0,_typography.parseTypography)("text-2xl")).toEqual({fontSize:24});(0,_vitest.expect)((0,_typography.parseTypography)("text-3xl")).toEqual({fontSize:30});(0,_vitest.expect)((0,_typography.parseTypography)("text-4xl")).toEqual({fontSize:36});(0,_vitest.expect)((0,_typography.parseTypography)("text-5xl")).toEqual({fontSize:48});(0,_vitest.expect)((0,_typography.parseTypography)("text-6xl")).toEqual({fontSize:60});(0,_vitest.expect)((0,_typography.parseTypography)("text-7xl")).toEqual({fontSize:72});(0,_vitest.expect)((0,_typography.parseTypography)("text-8xl")).toEqual({fontSize:96});(0,_vitest.expect)((0,_typography.parseTypography)("text-9xl")).toEqual({fontSize:128});});(0,_vitest.it)("should parse font size with arbitrary pixel values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[13px]")).toEqual({fontSize:13});(0,_vitest.expect)((0,_typography.parseTypography)("text-[13]")).toEqual({fontSize:13});(0,_vitest.expect)((0,_typography.parseTypography)("text-[18px]")).toEqual({fontSize:18});(0,_vitest.expect)((0,_typography.parseTypography)("text-[18]")).toEqual({fontSize:18});(0,_vitest.expect)((0,_typography.parseTypography)("text-[22px]")).toEqual({fontSize:22});(0,_vitest.expect)((0,_typography.parseTypography)("text-[22]")).toEqual({fontSize:22});(0,_vitest.expect)((0,_typography.parseTypography)("text-[100px]")).toEqual({fontSize:100});});});(0,_vitest.describe)("parseTypography - font family",function(){(0,_vitest.it)("should parse font family values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("font-sans")).toEqual({fontFamily:"System"});(0,_vitest.expect)((0,_typography.parseTypography)("font-serif")).toEqual({fontFamily:"serif"});(0,_vitest.expect)((0,_typography.parseTypography)("font-mono")).toEqual({fontFamily:"Courier"});});});(0,_vitest.describe)("parseTypography - font weight",function(){(0,_vitest.it)("should parse font weight values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("font-thin")).toEqual({fontWeight:"100"});(0,_vitest.expect)((0,_typography.parseTypography)("font-extralight")).toEqual({fontWeight:"200"});(0,_vitest.expect)((0,_typography.parseTypography)("font-light")).toEqual({fontWeight:"300"});(0,_vitest.expect)((0,_typography.parseTypography)("font-normal")).toEqual({fontWeight:"400"});(0,_vitest.expect)((0,_typography.parseTypography)("font-medium")).toEqual({fontWeight:"500"});(0,_vitest.expect)((0,_typography.parseTypography)("font-semibold")).toEqual({fontWeight:"600"});(0,_vitest.expect)((0,_typography.parseTypography)("font-bold")).toEqual({fontWeight:"700"});(0,_vitest.expect)((0,_typography.parseTypography)("font-extrabold")).toEqual({fontWeight:"800"});(0,_vitest.expect)((0,_typography.parseTypography)("font-black")).toEqual({fontWeight:"900"});});});(0,_vitest.describe)("parseTypography - font style",function(){(0,_vitest.it)("should parse font style values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("italic")).toEqual({fontStyle:"italic"});(0,_vitest.expect)((0,_typography.parseTypography)("not-italic")).toEqual({fontStyle:"normal"});});});(0,_vitest.describe)("parseTypography - text alignment",function(){(0,_vitest.it)("should parse text alignment values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-left")).toEqual({textAlign:"left"});(0,_vitest.expect)((0,_typography.parseTypography)("text-center")).toEqual({textAlign:"center"});(0,_vitest.expect)((0,_typography.parseTypography)("text-right")).toEqual({textAlign:"right"});(0,_vitest.expect)((0,_typography.parseTypography)("text-justify")).toEqual({textAlign:"justify"});});});(0,_vitest.describe)("parseTypography - text decoration",function(){(0,_vitest.it)("should parse text decoration values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("underline")).toEqual({textDecorationLine:"underline"});(0,_vitest.expect)((0,_typography.parseTypography)("line-through")).toEqual({textDecorationLine:"line-through"});(0,_vitest.expect)((0,_typography.parseTypography)("no-underline")).toEqual({textDecorationLine:"none"});});});(0,_vitest.describe)("parseTypography - text transform",function(){(0,_vitest.it)("should parse text transform values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("uppercase")).toEqual({textTransform:"uppercase"});(0,_vitest.expect)((0,_typography.parseTypography)("lowercase")).toEqual({textTransform:"lowercase"});(0,_vitest.expect)((0,_typography.parseTypography)("capitalize")).toEqual({textTransform:"capitalize"});(0,_vitest.expect)((0,_typography.parseTypography)("normal-case")).toEqual({textTransform:"none"});});});(0,_vitest.describe)("parseTypography - line height",function(){(0,_vitest.it)("should parse line height with preset values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("leading-none")).toEqual({lineHeight:16});(0,_vitest.expect)((0,_typography.parseTypography)("leading-tight")).toEqual({lineHeight:20});(0,_vitest.expect)((0,_typography.parseTypography)("leading-snug")).toEqual({lineHeight:22});(0,_vitest.expect)((0,_typography.parseTypography)("leading-normal")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("leading-relaxed")).toEqual({lineHeight:28});(0,_vitest.expect)((0,_typography.parseTypography)("leading-loose")).toEqual({lineHeight:32});});(0,_vitest.it)("should parse line height with arbitrary pixel values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("leading-[24px]")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[24]")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[30px]")).toEqual({lineHeight:30});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[30]")).toEqual({lineHeight:30});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[50px]")).toEqual({lineHeight:50});});});(0,_vitest.describe)("parseTypography - letter spacing",function(){(0,_vitest.it)("should parse letter spacing with preset values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("tracking-tighter")).toEqual({letterSpacing:-0.8});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-tight")).toEqual({letterSpacing:-0.4});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-normal")).toEqual({letterSpacing:0});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-wide")).toEqual({letterSpacing:0.4});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-wider")).toEqual({letterSpacing:0.8});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-widest")).toEqual({letterSpacing:1.6});});});(0,_vitest.describe)("parseTypography - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_typography.parseTypography)("invalid")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("font")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("tracking")).toBeNull();});(0,_vitest.it)("should return null for invalid font size values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-invalid")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-10xl")).toBeNull();});(0,_vitest.it)("should return null for invalid font weight values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("font-invalid")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("font-100")).toBeNull();});(0,_vitest.it)("should return null for arbitrary values with unsupported units",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[16rem]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-[2em]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-[2rem]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-[1.5em]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[16")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-16]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("text-[]")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-[24")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("leading-24]")).toBeNull();});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_typography.parseTypography)("mytext-lg")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("font-bold-extra")).toBeNull();(0,_vitest.expect)((0,_typography.parseTypography)("italic-text")).toBeNull();});});(0,_vitest.describe)("parseTypography - comprehensive coverage",function(){(0,_vitest.it)("should handle all typography categories independently",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-base")).toEqual({fontSize:16});(0,_vitest.expect)((0,_typography.parseTypography)("font-mono")).toEqual({fontFamily:"Courier"});(0,_vitest.expect)((0,_typography.parseTypography)("font-bold")).toEqual({fontWeight:"700"});(0,_vitest.expect)((0,_typography.parseTypography)("italic")).toEqual({fontStyle:"italic"});(0,_vitest.expect)((0,_typography.parseTypography)("text-center")).toEqual({textAlign:"center"});(0,_vitest.expect)((0,_typography.parseTypography)("underline")).toEqual({textDecorationLine:"underline"});(0,_vitest.expect)((0,_typography.parseTypography)("uppercase")).toEqual({textTransform:"uppercase"});(0,_vitest.expect)((0,_typography.parseTypography)("leading-normal")).toEqual({lineHeight:24});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-wide")).toEqual({letterSpacing:0.4});});(0,_vitest.it)("should handle arbitrary values for font size and line height",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-[19px]")).toEqual({fontSize:19});(0,_vitest.expect)((0,_typography.parseTypography)("text-[19]")).toEqual({fontSize:19});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[26px]")).toEqual({lineHeight:26});(0,_vitest.expect)((0,_typography.parseTypography)("leading-[26]")).toEqual({lineHeight:26});});(0,_vitest.it)("should handle edge case values",function(){(0,_vitest.expect)((0,_typography.parseTypography)("text-xs")).toEqual({fontSize:12});(0,_vitest.expect)((0,_typography.parseTypography)("text-9xl")).toEqual({fontSize:128});(0,_vitest.expect)((0,_typography.parseTypography)("leading-none")).toEqual({lineHeight:16});(0,_vitest.expect)((0,_typography.parseTypography)("leading-loose")).toEqual({lineHeight:32});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-tighter")).toEqual({letterSpacing:-0.8});(0,_vitest.expect)((0,_typography.parseTypography)("tracking-widest")).toEqual({letterSpacing:1.6});});});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgcrea/react-native-tailwind",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Compile-time Tailwind CSS for React Native with zero runtime overhead",
5
5
  "author": "Olivier Louvignes <olivier@mgcrea.io> (https://github.com/mgcrea)",
6
6
  "homepage": "https://github.com/mgcrea/react-native-tailwind#readme",
@@ -21,6 +21,7 @@ export type PressableProps = Omit<RNPressableProps, "style"> & {
21
21
  * Style can be a static style object/array or a function that receives Pressable state + disabled
22
22
  */
23
23
  style?: StyleProp<ViewStyle> | ((state: EnhancedPressableState) => StyleProp<ViewStyle>);
24
+ className?: string; // compile-time only
24
25
  };
25
26
 
26
27
  /**
@@ -30,6 +30,7 @@ export type TextInputProps = Omit<RNTextInputProps, "style"> & {
30
30
  style?:
31
31
  | RNTextInputProps["style"]
32
32
  | ((state: { focused: boolean; disabled: boolean }) => RNTextInputProps["style"]);
33
+ className?: string; // compile-time only
33
34
  /**
34
35
  * Convenience prop for disabled state (overrides editable if provided)
35
36
  * When true, sets editable to false
@@ -0,0 +1,304 @@
1
+ export type TailwindPalette = {
2
+ "50": string;
3
+ "100": string;
4
+ "200": string;
5
+ "300": string;
6
+ "400": string;
7
+ "500": string;
8
+ "600": string;
9
+ "700": string;
10
+ "800": string;
11
+ "900": string;
12
+ "950": string;
13
+ };
14
+
15
+ export const TAILWIND_PALETTES = {
16
+ red: {
17
+ "50": "#fef2f2",
18
+ "100": "#ffe2e2",
19
+ "200": "#ffc9c9",
20
+ "300": "#ffa2a2",
21
+ "400": "#ff6467",
22
+ "500": "#fb2c36",
23
+ "600": "#e7000b",
24
+ "700": "#c10007",
25
+ "800": "#9f0712",
26
+ "900": "#82181a",
27
+ "950": "#460809",
28
+ },
29
+ orange: {
30
+ "50": "#fff7ed",
31
+ "100": "#ffedd4",
32
+ "200": "#ffd6a7",
33
+ "300": "#ffb86a",
34
+ "400": "#ff8904",
35
+ "500": "#ff6900",
36
+ "600": "#f54900",
37
+ "700": "#ca3500",
38
+ "800": "#9f2d00",
39
+ "900": "#7e2a0c",
40
+ "950": "#441306",
41
+ },
42
+ amber: {
43
+ "50": "#fffbeb",
44
+ "100": "#fef3c6",
45
+ "200": "#fee685",
46
+ "300": "#ffd230",
47
+ "400": "#ffb900",
48
+ "500": "#fe9a00",
49
+ "600": "#e17100",
50
+ "700": "#bb4d00",
51
+ "800": "#973c00",
52
+ "900": "#7b3306",
53
+ "950": "#461901",
54
+ },
55
+ yellow: {
56
+ "50": "#fefce8",
57
+ "100": "#fef9c2",
58
+ "200": "#fff085",
59
+ "300": "#ffdf20",
60
+ "400": "#fdc700",
61
+ "500": "#f0b100",
62
+ "600": "#d08700",
63
+ "700": "#a65f00",
64
+ "800": "#894b00",
65
+ "900": "#733e0a",
66
+ "950": "#432004",
67
+ },
68
+ lime: {
69
+ "50": "#f7fee7",
70
+ "100": "#ecfcca",
71
+ "200": "#d8f999",
72
+ "300": "#bbf451",
73
+ "400": "#9ae600",
74
+ "500": "#7ccf00",
75
+ "600": "#5ea500",
76
+ "700": "#497d00",
77
+ "800": "#3c6300",
78
+ "900": "#35530e",
79
+ "950": "#192e03",
80
+ },
81
+ green: {
82
+ "50": "#f0fdf4",
83
+ "100": "#dcfce7",
84
+ "200": "#b9f8cf",
85
+ "300": "#7bf1a8",
86
+ "400": "#05df72",
87
+ "500": "#00c950",
88
+ "600": "#00a63e",
89
+ "700": "#008236",
90
+ "800": "#016630",
91
+ "900": "#0d542b",
92
+ "950": "#032e15",
93
+ },
94
+ emerald: {
95
+ "50": "#ecfdf5",
96
+ "100": "#d0fae5",
97
+ "200": "#a4f4cf",
98
+ "300": "#5ee9b5",
99
+ "400": "#00d492",
100
+ "500": "#00bc7d",
101
+ "600": "#009966",
102
+ "700": "#007a55",
103
+ "800": "#006045",
104
+ "900": "#004f3b",
105
+ "950": "#002c22",
106
+ },
107
+ teal: {
108
+ "50": "#f0fdfa",
109
+ "100": "#cbfbf1",
110
+ "200": "#96f7e4",
111
+ "300": "#46ecd5",
112
+ "400": "#00d5be",
113
+ "500": "#00bba7",
114
+ "600": "#009689",
115
+ "700": "#00786f",
116
+ "800": "#005f5a",
117
+ "900": "#0b4f4a",
118
+ "950": "#022f2e",
119
+ },
120
+ cyan: {
121
+ "50": "#ecfeff",
122
+ "100": "#cefafe",
123
+ "200": "#a2f4fd",
124
+ "300": "#53eafd",
125
+ "400": "#00d3f2",
126
+ "500": "#00b8db",
127
+ "600": "#0092b8",
128
+ "700": "#007595",
129
+ "800": "#005f78",
130
+ "900": "#104e64",
131
+ "950": "#053345",
132
+ },
133
+ sky: {
134
+ "50": "#f0f9ff",
135
+ "100": "#dff2fe",
136
+ "200": "#b8e6fe",
137
+ "300": "#74d4ff",
138
+ "400": "#00bcff",
139
+ "500": "#00a6f4",
140
+ "600": "#0084d1",
141
+ "700": "#0069a8",
142
+ "800": "#00598a",
143
+ "900": "#024a70",
144
+ "950": "#052f4a",
145
+ },
146
+ blue: {
147
+ "50": "#eff6ff",
148
+ "100": "#dbeafe",
149
+ "200": "#bedbff",
150
+ "300": "#8ec5ff",
151
+ "400": "#51a2ff",
152
+ "500": "#2b7fff",
153
+ "600": "#155dfc",
154
+ "700": "#1447e6",
155
+ "800": "#193cb8",
156
+ "900": "#1c398e",
157
+ "950": "#162456",
158
+ },
159
+ indigo: {
160
+ "50": "#eef2ff",
161
+ "100": "#e0e7ff",
162
+ "200": "#c6d2ff",
163
+ "300": "#a3b3ff",
164
+ "400": "#7c86ff",
165
+ "500": "#615fff",
166
+ "600": "#4f39f6",
167
+ "700": "#432dd7",
168
+ "800": "#372aac",
169
+ "900": "#312c85",
170
+ "950": "#1e1a4d",
171
+ },
172
+ violet: {
173
+ "50": "#f5f3ff",
174
+ "100": "#ede9fe",
175
+ "200": "#ddd6ff",
176
+ "300": "#c4b4ff",
177
+ "400": "#a684ff",
178
+ "500": "#8e51ff",
179
+ "600": "#7f22fe",
180
+ "700": "#7008e7",
181
+ "800": "#5d0ec0",
182
+ "900": "#4d179a",
183
+ "950": "#2f0d68",
184
+ },
185
+ purple: {
186
+ "50": "#faf5ff",
187
+ "100": "#f3e8ff",
188
+ "200": "#e9d4ff",
189
+ "300": "#dab2ff",
190
+ "400": "#c27aff",
191
+ "500": "#ad46ff",
192
+ "600": "#9810fa",
193
+ "700": "#8200db",
194
+ "800": "#6e11b0",
195
+ "900": "#59168b",
196
+ "950": "#3c0366",
197
+ },
198
+ fuchsia: {
199
+ "50": "#fdf4ff",
200
+ "100": "#fae8ff",
201
+ "200": "#f6cfff",
202
+ "300": "#f4a8ff",
203
+ "400": "#ed6aff",
204
+ "500": "#e12afb",
205
+ "600": "#c800de",
206
+ "700": "#a800b7",
207
+ "800": "#8a0194",
208
+ "900": "#721378",
209
+ "950": "#4b004f",
210
+ },
211
+ pink: {
212
+ "50": "#fdf2f8",
213
+ "100": "#fce7f3",
214
+ "200": "#fccee8",
215
+ "300": "#fda5d5",
216
+ "400": "#fb64b6",
217
+ "500": "#f6339a",
218
+ "600": "#e60076",
219
+ "700": "#c6005c",
220
+ "800": "#a3004c",
221
+ "900": "#861043",
222
+ "950": "#510424",
223
+ },
224
+ rose: {
225
+ "50": "#fff1f2",
226
+ "100": "#ffe4e6",
227
+ "200": "#ffccd3",
228
+ "300": "#ffa1ad",
229
+ "400": "#ff637e",
230
+ "500": "#ff2056",
231
+ "600": "#ec003f",
232
+ "700": "#c70036",
233
+ "800": "#a50036",
234
+ "900": "#8b0836",
235
+ "950": "#4d0218",
236
+ },
237
+ slate: {
238
+ "50": "#f8fafc",
239
+ "100": "#f1f5f9",
240
+ "200": "#e2e8f0",
241
+ "300": "#cad5e2",
242
+ "400": "#90a1b9",
243
+ "500": "#62748e",
244
+ "600": "#45556c",
245
+ "700": "#314158",
246
+ "800": "#1d293d",
247
+ "900": "#0f172b",
248
+ "950": "#020618",
249
+ },
250
+ gray: {
251
+ "50": "#f9fafb",
252
+ "100": "#f3f4f6",
253
+ "200": "#e5e7eb",
254
+ "300": "#d1d5dc",
255
+ "400": "#99a1af",
256
+ "500": "#6a7282",
257
+ "600": "#4a5565",
258
+ "700": "#364153",
259
+ "800": "#1e2939",
260
+ "900": "#101828",
261
+ "950": "#030712",
262
+ },
263
+ zinc: {
264
+ "50": "#fafafa",
265
+ "100": "#f4f4f5",
266
+ "200": "#e4e4e7",
267
+ "300": "#d4d4d8",
268
+ "400": "#9f9fa9",
269
+ "500": "#71717b",
270
+ "600": "#52525c",
271
+ "700": "#3f3f46",
272
+ "800": "#27272a",
273
+ "900": "#18181b",
274
+ "950": "#09090b",
275
+ },
276
+ neutral: {
277
+ "50": "#fafafa",
278
+ "100": "#f5f5f5",
279
+ "200": "#e5e5e5",
280
+ "300": "#d4d4d4",
281
+ "400": "#a1a1a1",
282
+ "500": "#737373",
283
+ "600": "#525252",
284
+ "700": "#404040",
285
+ "800": "#262626",
286
+ "900": "#171717",
287
+ "950": "#0a0a0a",
288
+ },
289
+ stone: {
290
+ "50": "#fafaf9",
291
+ "100": "#f5f5f4",
292
+ "200": "#e7e5e4",
293
+ "300": "#d6d3d1",
294
+ "400": "#a6a09b",
295
+ "500": "#79716b",
296
+ "600": "#57534d",
297
+ "700": "#44403b",
298
+ "800": "#292524",
299
+ "900": "#1c1917",
300
+ "950": "#0c0a09",
301
+ },
302
+ } satisfies Record<string, TailwindPalette>;
303
+
304
+ export type TailwindColor = keyof typeof TAILWIND_PALETTES;
@@ -1,6 +1,22 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import { COLORS, parseColor } from "./colors";
3
3
 
4
+ // Helper to apply opacity to hex color for testing
5
+ function applyOpacity(hex: string, opacity: number): string {
6
+ if (hex === "transparent") return "transparent";
7
+ const cleanHex = hex.replace(/^#/, "");
8
+ const fullHex =
9
+ cleanHex.length === 3
10
+ ? cleanHex
11
+ .split("")
12
+ .map((char) => char + char)
13
+ .join("")
14
+ : cleanHex;
15
+ const alpha = Math.round((opacity / 100) * 255);
16
+ const alphaHex = alpha.toString(16).padStart(2, "0").toUpperCase();
17
+ return `#${fullHex.toUpperCase()}${alphaHex}`;
18
+ }
19
+
4
20
  describe("COLORS", () => {
5
21
  it("should export complete color palette", () => {
6
22
  expect(COLORS).toMatchSnapshot();
@@ -9,10 +25,10 @@ describe("COLORS", () => {
9
25
 
10
26
  describe("parseColor - background colors", () => {
11
27
  it("should parse background colors with preset values", () => {
12
- expect(parseColor("bg-blue-500")).toEqual({ backgroundColor: "#3B82F6" });
13
- expect(parseColor("bg-red-500")).toEqual({ backgroundColor: "#EF4444" });
14
- expect(parseColor("bg-green-500")).toEqual({ backgroundColor: "#22C55E" });
15
- expect(parseColor("bg-gray-300")).toEqual({ backgroundColor: "#D1D5DB" });
28
+ expect(parseColor("bg-blue-500")).toEqual({ backgroundColor: COLORS["blue-500"] });
29
+ expect(parseColor("bg-red-500")).toEqual({ backgroundColor: COLORS["red-500"] });
30
+ expect(parseColor("bg-green-500")).toEqual({ backgroundColor: COLORS["green-500"] });
31
+ expect(parseColor("bg-gray-300")).toEqual({ backgroundColor: COLORS["gray-300"] });
16
32
  });
17
33
 
18
34
  it("should parse background colors with basic values", () => {
@@ -57,10 +73,10 @@ describe("parseColor - background colors", () => {
57
73
 
58
74
  describe("parseColor - text colors", () => {
59
75
  it("should parse text colors with preset values", () => {
60
- expect(parseColor("text-blue-500")).toEqual({ color: "#3B82F6" });
61
- expect(parseColor("text-red-500")).toEqual({ color: "#EF4444" });
62
- expect(parseColor("text-green-500")).toEqual({ color: "#22C55E" });
63
- expect(parseColor("text-gray-700")).toEqual({ color: "#374151" });
76
+ expect(parseColor("text-blue-500")).toEqual({ color: COLORS["blue-500"] });
77
+ expect(parseColor("text-red-500")).toEqual({ color: COLORS["red-500"] });
78
+ expect(parseColor("text-green-500")).toEqual({ color: COLORS["green-500"] });
79
+ expect(parseColor("text-gray-700")).toEqual({ color: COLORS["gray-700"] });
64
80
  });
65
81
 
66
82
  it("should parse text colors with basic values", () => {
@@ -88,10 +104,10 @@ describe("parseColor - text colors", () => {
88
104
 
89
105
  describe("parseColor - border colors", () => {
90
106
  it("should parse border colors with preset values", () => {
91
- expect(parseColor("border-blue-500")).toEqual({ borderColor: "#3B82F6" });
92
- expect(parseColor("border-red-500")).toEqual({ borderColor: "#EF4444" });
93
- expect(parseColor("border-green-500")).toEqual({ borderColor: "#22C55E" });
94
- expect(parseColor("border-gray-200")).toEqual({ borderColor: "#E5E7EB" });
107
+ expect(parseColor("border-blue-500")).toEqual({ borderColor: COLORS["blue-500"] });
108
+ expect(parseColor("border-red-500")).toEqual({ borderColor: COLORS["red-500"] });
109
+ expect(parseColor("border-green-500")).toEqual({ borderColor: COLORS["green-500"] });
110
+ expect(parseColor("border-gray-200")).toEqual({ borderColor: COLORS["gray-200"] });
95
111
  });
96
112
 
97
113
  it("should parse border colors with basic values", () => {
@@ -153,7 +169,7 @@ describe("parseColor - custom colors", () => {
153
169
  });
154
170
 
155
171
  it("should fallback to preset colors when custom color not found", () => {
156
- expect(parseColor("bg-red-500", customColors)).toEqual({ backgroundColor: "#EF4444" });
172
+ expect(parseColor("bg-red-500", customColors)).toEqual({ backgroundColor: COLORS["red-500"] });
157
173
  });
158
174
  });
159
175
 
@@ -220,9 +236,9 @@ describe("parseColor - edge cases", () => {
220
236
 
221
237
  describe("parseColor - comprehensive coverage", () => {
222
238
  it("should parse all color types with same preset color", () => {
223
- expect(parseColor("bg-blue-500")).toEqual({ backgroundColor: "#3B82F6" });
224
- expect(parseColor("text-blue-500")).toEqual({ color: "#3B82F6" });
225
- expect(parseColor("border-blue-500")).toEqual({ borderColor: "#3B82F6" });
239
+ expect(parseColor("bg-blue-500")).toEqual({ backgroundColor: COLORS["blue-500"] });
240
+ expect(parseColor("text-blue-500")).toEqual({ color: COLORS["blue-500"] });
241
+ expect(parseColor("border-blue-500")).toEqual({ borderColor: COLORS["blue-500"] });
226
242
  });
227
243
 
228
244
  it("should parse all color types with same arbitrary hex", () => {
@@ -261,23 +277,23 @@ describe("parseColor - comprehensive coverage", () => {
261
277
 
262
278
  describe("parseColor - opacity modifiers", () => {
263
279
  it("should parse background colors with opacity modifiers", () => {
264
- expect(parseColor("bg-black/50")).toEqual({ backgroundColor: "#00000080" });
265
- expect(parseColor("bg-white/50")).toEqual({ backgroundColor: "#FFFFFF80" });
266
- expect(parseColor("bg-blue-500/80")).toEqual({ backgroundColor: "#3B82F6CC" });
267
- expect(parseColor("bg-red-500/30")).toEqual({ backgroundColor: "#EF44444D" });
280
+ expect(parseColor("bg-black/50")).toEqual({ backgroundColor: applyOpacity(COLORS.black, 50) });
281
+ expect(parseColor("bg-white/50")).toEqual({ backgroundColor: applyOpacity(COLORS.white, 50) });
282
+ expect(parseColor("bg-blue-500/80")).toEqual({ backgroundColor: applyOpacity(COLORS["blue-500"], 80) });
283
+ expect(parseColor("bg-red-500/30")).toEqual({ backgroundColor: applyOpacity(COLORS["red-500"], 30) });
268
284
  });
269
285
 
270
286
  it("should parse text colors with opacity modifiers", () => {
271
- expect(parseColor("text-black/80")).toEqual({ color: "#000000CC" });
272
- expect(parseColor("text-white/90")).toEqual({ color: "#FFFFFFE6" });
273
- expect(parseColor("text-gray-900/70")).toEqual({ color: "#111827B3" });
274
- expect(parseColor("text-blue-500/50")).toEqual({ color: "#3B82F680" });
287
+ expect(parseColor("text-black/80")).toEqual({ color: applyOpacity(COLORS.black, 80) });
288
+ expect(parseColor("text-white/90")).toEqual({ color: applyOpacity(COLORS.white, 90) });
289
+ expect(parseColor("text-gray-900/70")).toEqual({ color: applyOpacity(COLORS["gray-900"], 70) });
290
+ expect(parseColor("text-blue-500/50")).toEqual({ color: applyOpacity(COLORS["blue-500"], 50) });
275
291
  });
276
292
 
277
293
  it("should parse border colors with opacity modifiers", () => {
278
- expect(parseColor("border-black/25")).toEqual({ borderColor: "#00000040" });
279
- expect(parseColor("border-red-500/60")).toEqual({ borderColor: "#EF444499" });
280
- expect(parseColor("border-gray-200/40")).toEqual({ borderColor: "#E5E7EB66" });
294
+ expect(parseColor("border-black/25")).toEqual({ borderColor: applyOpacity(COLORS.black, 25) });
295
+ expect(parseColor("border-red-500/60")).toEqual({ borderColor: applyOpacity(COLORS["red-500"], 60) });
296
+ expect(parseColor("border-gray-200/40")).toEqual({ borderColor: applyOpacity(COLORS["gray-200"], 40) });
281
297
  });
282
298
 
283
299
  it("should handle opacity modifier with arbitrary hex colors", () => {
@@ -293,13 +309,13 @@ describe("parseColor - opacity modifiers", () => {
293
309
  });
294
310
 
295
311
  it("should handle opacity 0 (fully transparent)", () => {
296
- expect(parseColor("bg-black/0")).toEqual({ backgroundColor: "#00000000" });
297
- expect(parseColor("text-red-500/0")).toEqual({ color: "#EF444400" });
312
+ expect(parseColor("bg-black/0")).toEqual({ backgroundColor: applyOpacity(COLORS.black, 0) });
313
+ expect(parseColor("text-red-500/0")).toEqual({ color: applyOpacity(COLORS["red-500"], 0) });
298
314
  });
299
315
 
300
316
  it("should handle opacity 100 (fully opaque)", () => {
301
- expect(parseColor("bg-black/100")).toEqual({ backgroundColor: "#000000FF" });
302
- expect(parseColor("text-blue-500/100")).toEqual({ color: "#3B82F6FF" });
317
+ expect(parseColor("bg-black/100")).toEqual({ backgroundColor: applyOpacity(COLORS.black, 100) });
318
+ expect(parseColor("text-blue-500/100")).toEqual({ color: applyOpacity(COLORS["blue-500"], 100) });
303
319
  });
304
320
 
305
321
  it("should handle transparent color with opacity modifier", () => {