@mgcrea/react-native-tailwind 0.15.3 → 0.15.5
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.
- package/dist/babel/index.cjs +136 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/parser/colors.d.ts +2 -1
- package/dist/parser/colors.js +1 -1
- package/dist/parser/colors.test.js +1 -1
- package/dist/parser/index.d.ts +1 -0
- package/dist/parser/index.js +1 -1
- package/dist/parser/outline.d.ts +9 -0
- package/dist/parser/outline.js +1 -0
- package/dist/parser/outline.test.js +1 -0
- package/dist/parser/shadows.d.ts +7 -2
- package/dist/parser/shadows.js +1 -1
- package/dist/parser/shadows.test.js +1 -1
- package/dist/parser/sizing.js +1 -1
- package/dist/parser/sizing.test.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.cjs.map +4 -4
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +4 -4
- package/dist/utils/colorUtils.d.ts +30 -0
- package/dist/utils/colorUtils.js +1 -0
- package/dist/utils/colorUtils.test.js +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/parser/colors.test.ts +1 -16
- package/src/parser/colors.ts +34 -77
- package/src/parser/index.ts +4 -1
- package/src/parser/outline.test.ts +57 -0
- package/src/parser/outline.ts +101 -0
- package/src/parser/shadows.test.ts +109 -2
- package/src/parser/shadows.ts +20 -4
- package/src/parser/sizing.test.ts +82 -0
- package/src/parser/sizing.ts +28 -0
- package/src/utils/colorUtils.test.ts +193 -0
- package/src/utils/colorUtils.ts +115 -0
package/dist/babel/index.cjs
CHANGED
|
@@ -662,10 +662,9 @@ var TAILWIND_COLORS = {
|
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
664
|
|
|
665
|
-
// src/
|
|
665
|
+
// src/utils/colorUtils.ts
|
|
666
666
|
var COLORS = {
|
|
667
667
|
...flattenColors(TAILWIND_COLORS),
|
|
668
|
-
// Add basic colors
|
|
669
668
|
white: "#FFFFFF",
|
|
670
669
|
black: "#000000",
|
|
671
670
|
transparent: "transparent"
|
|
@@ -690,16 +689,37 @@ function parseArbitraryColor(value) {
|
|
|
690
689
|
}
|
|
691
690
|
return `#${hex}`;
|
|
692
691
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
694
|
+
function parseColorValue(colorKey, customColors) {
|
|
695
|
+
const getColor = (key) => {
|
|
696
|
+
return customColors?.[key] ?? COLORS[key];
|
|
697
|
+
};
|
|
698
|
+
const opacityMatch = colorKey.match(/^(.+)\/(\d+)$/);
|
|
699
|
+
if (opacityMatch) {
|
|
700
|
+
const baseColorKey = opacityMatch[1];
|
|
701
|
+
const opacity = Number.parseInt(opacityMatch[2], 10);
|
|
702
|
+
if (opacity < 0 || opacity > 100) {
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
const arbitraryColor2 = parseArbitraryColor(baseColorKey);
|
|
706
|
+
if (arbitraryColor2 !== null) {
|
|
707
|
+
return applyOpacity(arbitraryColor2, opacity);
|
|
708
|
+
}
|
|
709
|
+
const color = getColor(baseColorKey);
|
|
710
|
+
if (color) {
|
|
711
|
+
return applyOpacity(color, opacity);
|
|
698
712
|
}
|
|
699
713
|
return null;
|
|
700
714
|
}
|
|
701
|
-
|
|
715
|
+
const arbitraryColor = parseArbitraryColor(colorKey);
|
|
716
|
+
if (arbitraryColor !== null) {
|
|
717
|
+
return arbitraryColor;
|
|
718
|
+
}
|
|
719
|
+
return getColor(colorKey) ?? null;
|
|
702
720
|
}
|
|
721
|
+
|
|
722
|
+
// src/parser/colors.ts
|
|
703
723
|
function parseColor(cls, customColors) {
|
|
704
724
|
const getColor = (key) => {
|
|
705
725
|
return customColors?.[key] ?? COLORS[key];
|
|
@@ -731,6 +751,14 @@ function parseColor(cls, customColors) {
|
|
|
731
751
|
if (arbitraryColor !== null) {
|
|
732
752
|
return arbitraryColor;
|
|
733
753
|
}
|
|
754
|
+
if (colorKey.startsWith("[") && colorKey.endsWith("]")) {
|
|
755
|
+
if (process.env.NODE_ENV !== "production") {
|
|
756
|
+
console.warn(
|
|
757
|
+
`[react-native-tailwind] Unsupported arbitrary color value: ${colorKey}. Only hex colors are supported (e.g., [#ff0000], [#f00], or [#ff0000aa]).`
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
734
762
|
return getColor(colorKey) ?? null;
|
|
735
763
|
};
|
|
736
764
|
if (cls.startsWith("bg-")) {
|
|
@@ -763,6 +791,19 @@ function parseColor(cls, customColors) {
|
|
|
763
791
|
return { borderColor: color };
|
|
764
792
|
}
|
|
765
793
|
}
|
|
794
|
+
if (cls.startsWith("outline-") && !cls.match(/^outline-[0-9]/) && !cls.startsWith("outline-offset-")) {
|
|
795
|
+
const colorKey = cls.substring(8);
|
|
796
|
+
if (["solid", "dashed", "dotted", "none"].includes(colorKey)) {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
if (colorKey.startsWith("[") && !colorKey.startsWith("[#")) {
|
|
800
|
+
return null;
|
|
801
|
+
}
|
|
802
|
+
const color = parseColorWithOpacity(colorKey);
|
|
803
|
+
if (color) {
|
|
804
|
+
return { outlineColor: color };
|
|
805
|
+
}
|
|
806
|
+
}
|
|
766
807
|
const dirBorderMatch = cls.match(/^border-([trblxy])-(.+)$/);
|
|
767
808
|
if (dirBorderMatch) {
|
|
768
809
|
const dir = dirBorderMatch[1];
|
|
@@ -1408,6 +1449,65 @@ function parseLayout(cls, customSpacing) {
|
|
|
1408
1449
|
return DISPLAY_MAP[cls] ?? FLEX_DIRECTION_MAP[cls] ?? FLEX_WRAP_MAP[cls] ?? FLEX_MAP[cls] ?? GROW_SHRINK_MAP[cls] ?? JUSTIFY_CONTENT_MAP[cls] ?? ALIGN_ITEMS_MAP[cls] ?? ALIGN_SELF_MAP[cls] ?? ALIGN_CONTENT_MAP[cls] ?? POSITION_MAP[cls] ?? OVERFLOW_MAP[cls] ?? OPACITY_MAP[cls] ?? null;
|
|
1409
1450
|
}
|
|
1410
1451
|
|
|
1452
|
+
// src/parser/outline.ts
|
|
1453
|
+
function parseArbitraryOutlineValue(value) {
|
|
1454
|
+
const pxMatch = value.match(/^\[(\d+)(?:px)?\]$/);
|
|
1455
|
+
if (pxMatch) {
|
|
1456
|
+
return parseInt(pxMatch[1], 10);
|
|
1457
|
+
}
|
|
1458
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
1459
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1460
|
+
console.warn(
|
|
1461
|
+
`[react-native-tailwind] Unsupported arbitrary outline value: ${value}. Only px values are supported (e.g., [8px] or [8]).`
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
return null;
|
|
1465
|
+
}
|
|
1466
|
+
return null;
|
|
1467
|
+
}
|
|
1468
|
+
function parseOutline(cls) {
|
|
1469
|
+
if (cls === "outline") {
|
|
1470
|
+
return { outlineWidth: 1, outlineStyle: "solid" };
|
|
1471
|
+
}
|
|
1472
|
+
if (cls === "outline-none") {
|
|
1473
|
+
return { outlineWidth: 0 };
|
|
1474
|
+
}
|
|
1475
|
+
if (cls === "outline-solid") return { outlineStyle: "solid" };
|
|
1476
|
+
if (cls === "outline-dotted") return { outlineStyle: "dotted" };
|
|
1477
|
+
if (cls === "outline-dashed") return { outlineStyle: "dashed" };
|
|
1478
|
+
if (cls.startsWith("outline-offset-")) {
|
|
1479
|
+
const valueStr = cls.substring(15);
|
|
1480
|
+
if (valueStr.startsWith("[")) {
|
|
1481
|
+
const arbitraryValue = parseArbitraryOutlineValue(valueStr);
|
|
1482
|
+
if (arbitraryValue !== null) {
|
|
1483
|
+
return { outlineOffset: arbitraryValue };
|
|
1484
|
+
}
|
|
1485
|
+
return null;
|
|
1486
|
+
}
|
|
1487
|
+
const scaleValue = BORDER_WIDTH_SCALE[valueStr];
|
|
1488
|
+
if (scaleValue !== void 0) {
|
|
1489
|
+
return { outlineOffset: scaleValue };
|
|
1490
|
+
}
|
|
1491
|
+
return null;
|
|
1492
|
+
}
|
|
1493
|
+
const widthMatch = cls.match(/^outline-(\d+)$/);
|
|
1494
|
+
if (widthMatch) {
|
|
1495
|
+
const value = BORDER_WIDTH_SCALE[widthMatch[1]];
|
|
1496
|
+
if (value !== void 0) {
|
|
1497
|
+
return { outlineWidth: value };
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
const arbMatch = cls.match(/^outline-(\[.+\])$/);
|
|
1501
|
+
if (arbMatch) {
|
|
1502
|
+
const arbitraryValue = parseArbitraryOutlineValue(arbMatch[1]);
|
|
1503
|
+
if (arbitraryValue !== null) {
|
|
1504
|
+
return { outlineWidth: arbitraryValue };
|
|
1505
|
+
}
|
|
1506
|
+
return null;
|
|
1507
|
+
}
|
|
1508
|
+
return null;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1411
1511
|
// src/parser/shadows.ts
|
|
1412
1512
|
var SHADOW_SCALE = {
|
|
1413
1513
|
"shadow-sm": {
|
|
@@ -1460,10 +1560,17 @@ var SHADOW_SCALE = {
|
|
|
1460
1560
|
elevation: 0
|
|
1461
1561
|
}
|
|
1462
1562
|
};
|
|
1463
|
-
function parseShadow(cls) {
|
|
1563
|
+
function parseShadow(cls, customColors) {
|
|
1464
1564
|
if (cls in SHADOW_SCALE) {
|
|
1465
1565
|
return SHADOW_SCALE[cls];
|
|
1466
1566
|
}
|
|
1567
|
+
if (cls.startsWith("shadow-")) {
|
|
1568
|
+
const colorPart = cls.substring(7);
|
|
1569
|
+
const shadowColor = parseColorValue(colorPart, customColors);
|
|
1570
|
+
if (shadowColor) {
|
|
1571
|
+
return { shadowColor };
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1467
1574
|
return null;
|
|
1468
1575
|
}
|
|
1469
1576
|
|
|
@@ -1546,6 +1653,24 @@ function parseArbitrarySize(value) {
|
|
|
1546
1653
|
}
|
|
1547
1654
|
function parseSizing(cls, customSpacing) {
|
|
1548
1655
|
const sizeMap = customSpacing ? { ...SIZE_SCALE, ...customSpacing } : SIZE_SCALE;
|
|
1656
|
+
if (cls.startsWith("size-")) {
|
|
1657
|
+
const sizeKey = cls.substring(5);
|
|
1658
|
+
const arbitrarySize = parseArbitrarySize(sizeKey);
|
|
1659
|
+
if (arbitrarySize !== null) {
|
|
1660
|
+
return { width: arbitrarySize, height: arbitrarySize };
|
|
1661
|
+
}
|
|
1662
|
+
const percentage = SIZE_PERCENTAGES[sizeKey];
|
|
1663
|
+
if (percentage) {
|
|
1664
|
+
return { width: percentage, height: percentage };
|
|
1665
|
+
}
|
|
1666
|
+
const numericSize = sizeMap[sizeKey];
|
|
1667
|
+
if (numericSize !== void 0) {
|
|
1668
|
+
return { width: numericSize, height: numericSize };
|
|
1669
|
+
}
|
|
1670
|
+
if (sizeKey === "auto") {
|
|
1671
|
+
return { width: "auto", height: "auto" };
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1549
1674
|
if (cls.startsWith("w-")) {
|
|
1550
1675
|
const sizeKey = cls.substring(2);
|
|
1551
1676
|
if (sizeKey === "screen") {
|
|
@@ -2414,11 +2539,12 @@ function parseClass(cls, customTheme) {
|
|
|
2414
2539
|
const parsers = [
|
|
2415
2540
|
(cls2) => parseSpacing(cls2, customTheme?.spacing),
|
|
2416
2541
|
(cls2) => parseBorder(cls2, customTheme?.colors),
|
|
2542
|
+
parseOutline,
|
|
2417
2543
|
(cls2) => parseColor(cls2, customTheme?.colors),
|
|
2418
2544
|
(cls2) => parseLayout(cls2, customTheme?.spacing),
|
|
2419
2545
|
(cls2) => parseTypography(cls2, customTheme?.fontFamily, customTheme?.fontSize),
|
|
2420
2546
|
(cls2) => parseSizing(cls2, customTheme?.spacing),
|
|
2421
|
-
parseShadow,
|
|
2547
|
+
(cls2) => parseShadow(cls2, customTheme?.colors),
|
|
2422
2548
|
parseAspectRatio,
|
|
2423
2549
|
(cls2) => parseTransform(cls2, customTheme?.spacing)
|
|
2424
2550
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { generateStyleKey } from "./utils/styleKey";
|
|
|
10
10
|
export type { StyleObject } from "./types/core";
|
|
11
11
|
export type { NativeStyle, TwStyle } from "./types/runtime";
|
|
12
12
|
export { TAILWIND_COLORS } from "./config/tailwind";
|
|
13
|
-
export { parseAspectRatio, parseBorder, parseColor, parseLayout, parsePlaceholderClass, parsePlaceholderClasses, parseShadow, parseSizing, parseSpacing, parseTypography, } from "./parser";
|
|
13
|
+
export { parseAspectRatio, parseBorder, parseColor, parseLayout, parseOutline, parsePlaceholderClass, parsePlaceholderClasses, parseShadow, parseSizing, parseSpacing, parseTypography, } from "./parser";
|
|
14
14
|
export { ASPECT_RATIO_PRESETS } from "./parser/aspectRatio";
|
|
15
15
|
export { COLORS } from "./parser/colors";
|
|
16
16
|
export { INSET_SCALE, Z_INDEX_SCALE } from "./parser/layout";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={tw:true,twStyle:true,parseClass:true,parseClassName:true,parseAspectRatio:true,parseBorder:true,parseColor:true,parseLayout:true,parsePlaceholderClass:true,parsePlaceholderClasses:true,parseShadow:true,parseSizing:true,parseSpacing:true,parseTypography:true,flattenColors:true,mergeStyles:true,generateStyleKey:true,TAILWIND_COLORS:true,ASPECT_RATIO_PRESETS:true,COLORS:true,INSET_SCALE:true,Z_INDEX_SCALE:true,SHADOW_SCALE:true,SIZE_PERCENTAGES:true,SIZE_SCALE:true,SPACING_SCALE:true,FONT_SIZES:true,LETTER_SPACING_SCALE:true};Object.defineProperty(exports,"ASPECT_RATIO_PRESETS",{enumerable:true,get:function get(){return _aspectRatio.ASPECT_RATIO_PRESETS;}});Object.defineProperty(exports,"COLORS",{enumerable:true,get:function get(){return _colors.COLORS;}});Object.defineProperty(exports,"FONT_SIZES",{enumerable:true,get:function get(){return _typography.FONT_SIZES;}});Object.defineProperty(exports,"INSET_SCALE",{enumerable:true,get:function get(){return _layout.INSET_SCALE;}});Object.defineProperty(exports,"LETTER_SPACING_SCALE",{enumerable:true,get:function get(){return _typography.LETTER_SPACING_SCALE;}});Object.defineProperty(exports,"SHADOW_SCALE",{enumerable:true,get:function get(){return _shadows.SHADOW_SCALE;}});Object.defineProperty(exports,"SIZE_PERCENTAGES",{enumerable:true,get:function get(){return _sizing.SIZE_PERCENTAGES;}});Object.defineProperty(exports,"SIZE_SCALE",{enumerable:true,get:function get(){return _sizing.SIZE_SCALE;}});Object.defineProperty(exports,"SPACING_SCALE",{enumerable:true,get:function get(){return _spacing.SPACING_SCALE;}});Object.defineProperty(exports,"TAILWIND_COLORS",{enumerable:true,get:function get(){return _tailwind.TAILWIND_COLORS;}});Object.defineProperty(exports,"Z_INDEX_SCALE",{enumerable:true,get:function get(){return _layout.Z_INDEX_SCALE;}});Object.defineProperty(exports,"flattenColors",{enumerable:true,get:function get(){return _flattenColors.flattenColors;}});Object.defineProperty(exports,"generateStyleKey",{enumerable:true,get:function get(){return _styleKey.generateStyleKey;}});Object.defineProperty(exports,"mergeStyles",{enumerable:true,get:function get(){return _mergeStyles.mergeStyles;}});Object.defineProperty(exports,"parseAspectRatio",{enumerable:true,get:function get(){return _parser.parseAspectRatio;}});Object.defineProperty(exports,"parseBorder",{enumerable:true,get:function get(){return _parser.parseBorder;}});Object.defineProperty(exports,"parseClass",{enumerable:true,get:function get(){return _parser.parseClass;}});Object.defineProperty(exports,"parseClassName",{enumerable:true,get:function get(){return _parser.parseClassName;}});Object.defineProperty(exports,"parseColor",{enumerable:true,get:function get(){return _parser.parseColor;}});Object.defineProperty(exports,"parseLayout",{enumerable:true,get:function get(){return _parser.parseLayout;}});Object.defineProperty(exports,"parsePlaceholderClass",{enumerable:true,get:function get(){return _parser.parsePlaceholderClass;}});Object.defineProperty(exports,"parsePlaceholderClasses",{enumerable:true,get:function get(){return _parser.parsePlaceholderClasses;}});Object.defineProperty(exports,"parseShadow",{enumerable:true,get:function get(){return _parser.parseShadow;}});Object.defineProperty(exports,"parseSizing",{enumerable:true,get:function get(){return _parser.parseSizing;}});Object.defineProperty(exports,"parseSpacing",{enumerable:true,get:function get(){return _parser.parseSpacing;}});Object.defineProperty(exports,"parseTypography",{enumerable:true,get:function get(){return _parser.parseTypography;}});Object.defineProperty(exports,"tw",{enumerable:true,get:function get(){return _tw.tw;}});Object.defineProperty(exports,"twStyle",{enumerable:true,get:function get(){return _tw.twStyle;}});var _tw=require("./stubs/tw");var _parser=require("./parser");var _flattenColors=require("./utils/flattenColors");var _mergeStyles=require("./utils/mergeStyles");var _styleKey=require("./utils/styleKey");var _tailwind=require("./config/tailwind");var _aspectRatio=require("./parser/aspectRatio");var _colors=require("./parser/colors");var _layout=require("./parser/layout");var _shadows=require("./parser/shadows");var _sizing=require("./parser/sizing");var _spacing=require("./parser/spacing");var _typography=require("./parser/typography");var _components=require("./components");Object.keys(_components).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_components[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _components[key];}});});
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={tw:true,twStyle:true,parseClass:true,parseClassName:true,parseAspectRatio:true,parseBorder:true,parseColor:true,parseLayout:true,parseOutline:true,parsePlaceholderClass:true,parsePlaceholderClasses:true,parseShadow:true,parseSizing:true,parseSpacing:true,parseTypography:true,flattenColors:true,mergeStyles:true,generateStyleKey:true,TAILWIND_COLORS:true,ASPECT_RATIO_PRESETS:true,COLORS:true,INSET_SCALE:true,Z_INDEX_SCALE:true,SHADOW_SCALE:true,SIZE_PERCENTAGES:true,SIZE_SCALE:true,SPACING_SCALE:true,FONT_SIZES:true,LETTER_SPACING_SCALE:true};Object.defineProperty(exports,"ASPECT_RATIO_PRESETS",{enumerable:true,get:function get(){return _aspectRatio.ASPECT_RATIO_PRESETS;}});Object.defineProperty(exports,"COLORS",{enumerable:true,get:function get(){return _colors.COLORS;}});Object.defineProperty(exports,"FONT_SIZES",{enumerable:true,get:function get(){return _typography.FONT_SIZES;}});Object.defineProperty(exports,"INSET_SCALE",{enumerable:true,get:function get(){return _layout.INSET_SCALE;}});Object.defineProperty(exports,"LETTER_SPACING_SCALE",{enumerable:true,get:function get(){return _typography.LETTER_SPACING_SCALE;}});Object.defineProperty(exports,"SHADOW_SCALE",{enumerable:true,get:function get(){return _shadows.SHADOW_SCALE;}});Object.defineProperty(exports,"SIZE_PERCENTAGES",{enumerable:true,get:function get(){return _sizing.SIZE_PERCENTAGES;}});Object.defineProperty(exports,"SIZE_SCALE",{enumerable:true,get:function get(){return _sizing.SIZE_SCALE;}});Object.defineProperty(exports,"SPACING_SCALE",{enumerable:true,get:function get(){return _spacing.SPACING_SCALE;}});Object.defineProperty(exports,"TAILWIND_COLORS",{enumerable:true,get:function get(){return _tailwind.TAILWIND_COLORS;}});Object.defineProperty(exports,"Z_INDEX_SCALE",{enumerable:true,get:function get(){return _layout.Z_INDEX_SCALE;}});Object.defineProperty(exports,"flattenColors",{enumerable:true,get:function get(){return _flattenColors.flattenColors;}});Object.defineProperty(exports,"generateStyleKey",{enumerable:true,get:function get(){return _styleKey.generateStyleKey;}});Object.defineProperty(exports,"mergeStyles",{enumerable:true,get:function get(){return _mergeStyles.mergeStyles;}});Object.defineProperty(exports,"parseAspectRatio",{enumerable:true,get:function get(){return _parser.parseAspectRatio;}});Object.defineProperty(exports,"parseBorder",{enumerable:true,get:function get(){return _parser.parseBorder;}});Object.defineProperty(exports,"parseClass",{enumerable:true,get:function get(){return _parser.parseClass;}});Object.defineProperty(exports,"parseClassName",{enumerable:true,get:function get(){return _parser.parseClassName;}});Object.defineProperty(exports,"parseColor",{enumerable:true,get:function get(){return _parser.parseColor;}});Object.defineProperty(exports,"parseLayout",{enumerable:true,get:function get(){return _parser.parseLayout;}});Object.defineProperty(exports,"parseOutline",{enumerable:true,get:function get(){return _parser.parseOutline;}});Object.defineProperty(exports,"parsePlaceholderClass",{enumerable:true,get:function get(){return _parser.parsePlaceholderClass;}});Object.defineProperty(exports,"parsePlaceholderClasses",{enumerable:true,get:function get(){return _parser.parsePlaceholderClasses;}});Object.defineProperty(exports,"parseShadow",{enumerable:true,get:function get(){return _parser.parseShadow;}});Object.defineProperty(exports,"parseSizing",{enumerable:true,get:function get(){return _parser.parseSizing;}});Object.defineProperty(exports,"parseSpacing",{enumerable:true,get:function get(){return _parser.parseSpacing;}});Object.defineProperty(exports,"parseTypography",{enumerable:true,get:function get(){return _parser.parseTypography;}});Object.defineProperty(exports,"tw",{enumerable:true,get:function get(){return _tw.tw;}});Object.defineProperty(exports,"twStyle",{enumerable:true,get:function get(){return _tw.twStyle;}});var _tw=require("./stubs/tw");var _parser=require("./parser");var _flattenColors=require("./utils/flattenColors");var _mergeStyles=require("./utils/mergeStyles");var _styleKey=require("./utils/styleKey");var _tailwind=require("./config/tailwind");var _aspectRatio=require("./parser/aspectRatio");var _colors=require("./parser/colors");var _layout=require("./parser/layout");var _shadows=require("./parser/shadows");var _sizing=require("./parser/sizing");var _spacing=require("./parser/spacing");var _typography=require("./parser/typography");var _components=require("./components");Object.keys(_components).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_components[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _components[key];}});});
|
package/dist/parser/colors.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Color utilities (background, text, border colors)
|
|
3
3
|
*/
|
|
4
4
|
import type { StyleObject } from "../types";
|
|
5
|
-
|
|
5
|
+
import { COLORS } from "../utils/colorUtils";
|
|
6
|
+
export { COLORS };
|
|
6
7
|
/**
|
|
7
8
|
* Parse color classes (background, text, border)
|
|
8
9
|
* Supports opacity modifier: bg-blue-500/50, text-black/80, border-red-500/30
|
package/dist/parser/colors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.COLORS
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"COLORS",{enumerable:true,get:function get(){return _colorUtils.COLORS;}});exports.parseColor=parseColor;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _colorUtils=require("../utils/colorUtils");function parseColor(cls,customColors){var getColor=function getColor(key){var _customColors$key;return(_customColors$key=customColors==null?void 0:customColors[key])!=null?_customColors$key:_colorUtils.COLORS[key];};var parseColorWithOpacity=function parseColorWithOpacity(colorKey){var _getColor;var opacityMatch=colorKey.match(/^(.+)\/(\d+)$/);if(opacityMatch){var baseColorKey=opacityMatch[1];var opacity=Number.parseInt(opacityMatch[2],10);if(opacity<0||opacity>100){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Invalid opacity value: ${opacity}. Opacity must be between 0 and 100.`);}return null;}var _arbitraryColor=(0,_colorUtils.parseArbitraryColor)(baseColorKey);if(_arbitraryColor!==null){return(0,_colorUtils.applyOpacity)(_arbitraryColor,opacity);}var color=getColor(baseColorKey);if(color){return(0,_colorUtils.applyOpacity)(color,opacity);}return null;}var arbitraryColor=(0,_colorUtils.parseArbitraryColor)(colorKey);if(arbitraryColor!==null){return arbitraryColor;}if(colorKey.startsWith("[")&&colorKey.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary color value: ${colorKey}. Only hex colors are supported (e.g., [#ff0000], [#f00], or [#ff0000aa]).`);}return null;}return(_getColor=getColor(colorKey))!=null?_getColor:null;};if(cls.startsWith("bg-")){var colorKey=cls.substring(3);if(colorKey.startsWith("[")&&!colorKey.startsWith("[#")){return null;}var color=parseColorWithOpacity(colorKey);if(color){return{backgroundColor:color};}}if(cls.startsWith("text-")){var _colorKey=cls.substring(5);if(_colorKey.startsWith("[")&&!_colorKey.startsWith("[#")){return null;}var _color=parseColorWithOpacity(_colorKey);if(_color){return{color:_color};}}if(cls.startsWith("border-")&&!cls.match(/^border-[0-9]/)){var _colorKey2=cls.substring(7);if(_colorKey2.startsWith("[")&&!_colorKey2.startsWith("[#")){return null;}var _color2=parseColorWithOpacity(_colorKey2);if(_color2){return{borderColor:_color2};}}if(cls.startsWith("outline-")&&!cls.match(/^outline-[0-9]/)&&!cls.startsWith("outline-offset-")){var _colorKey3=cls.substring(8);if(["solid","dashed","dotted","none"].includes(_colorKey3)){return null;}if(_colorKey3.startsWith("[")&&!_colorKey3.startsWith("[#")){return null;}var _color3=parseColorWithOpacity(_colorKey3);if(_color3){return{outlineColor:_color3};}}var dirBorderMatch=cls.match(/^border-([trblxy])-(.+)$/);if(dirBorderMatch){var dir=dirBorderMatch[1];var _colorKey4=dirBorderMatch[2];if(_colorKey4.startsWith("[")&&!_colorKey4.startsWith("[#")){return null;}var _color4=parseColorWithOpacity(_colorKey4);if(_color4){if(dir==="x"){return{borderLeftColor:_color4,borderRightColor:_color4};}if(dir==="y"){return{borderTopColor:_color4,borderBottomColor:_color4};}var propMap={t:"borderTopColor",r:"borderRightColor",b:"borderBottomColor",l:"borderLeftColor"};return(0,_defineProperty2.default)({},propMap[dir],_color4);}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _vitest=require("vitest");var _colors=require("./colors");function applyOpacity(hex,opacity){if(hex==="transparent")return"transparent";var cleanHex=hex.replace(/^#/,"");var fullHex=cleanHex.length===3?cleanHex.split("").map(function(char){return char+char;}).join(""):cleanHex;var alpha=Math.round(opacity/100*255);var alphaHex=alpha.toString(16).padStart(2,"0").toUpperCase();return`#${fullHex.toUpperCase()}${alphaHex}`;}(0,_vitest.describe)("COLORS",function(){(0,_vitest.it)("should export complete color palette",function(){(0,_vitest.expect)(_colors.COLORS).toMatchSnapshot();});});(0,_vitest.describe)("parseColor - background colors",function(){(0,_vitest.it)("should parse background colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500")).toEqual({backgroundColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-green-500")).toEqual({backgroundColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-gray-300")).toEqual({backgroundColor:_colors.COLORS["gray-300"]});});(0,_vitest.it)("should parse background colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-white")).toEqual({backgroundColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should parse background colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F6]")).toEqual({backgroundColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#000000]")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#123]")).toEqual({backgroundColor:"#112233"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F680]")).toEqual({backgroundColor:"#3B82F680"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#00000000]")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFFFF]")).toEqual({backgroundColor:"#FFFFFFFF"});});(0,_vitest.it)("should handle case-insensitive hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FF0000]")).toEqual({backgroundColor:"#FF0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#Ff0000]")).toEqual({backgroundColor:"#Ff0000"});});(0,_vitest.it)("should prefer arbitrary values over preset colors",function(){var customColors={"[#ff0000]":"#00ff00"};(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]",customColors)).toEqual({backgroundColor:"#ff0000"});});});(0,_vitest.describe)("parseColor - text colors",function(){(0,_vitest.it)("should parse text colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500")).toEqual({color:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-green-500")).toEqual({color:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-700")).toEqual({color:_colors.COLORS["gray-700"]});});(0,_vitest.it)("should parse text colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-white")).toEqual({color:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("text-black")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]")).toEqual({color:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#333333]")).toEqual({color:"#333333"});});(0,_vitest.it)("should parse text colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#f00]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#000]")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#00000080]")).toEqual({color:"#00000080"});});});(0,_vitest.describe)("parseColor - border colors",function(){(0,_vitest.it)("should parse border colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500")).toEqual({borderColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-green-500")).toEqual({borderColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200")).toEqual({borderColor:_colors.COLORS["gray-200"]});});(0,_vitest.it)("should parse border colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-white")).toEqual({borderColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-black")).toEqual({borderColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-transparent")).toEqual({borderColor:"transparent"});});(0,_vitest.it)("should parse border colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#3B82F6]")).toEqual({borderColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#cccccc]")).toEqual({borderColor:"#cccccc"});});(0,_vitest.it)("should parse border colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#f00]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#999]")).toEqual({borderColor:"#999999"});});(0,_vitest.it)("should parse border colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#0000FF50]")).toEqual({borderColor:"#0000FF50"});});(0,_vitest.it)("should not match border width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-0")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-4")).toBeNull();});});(0,_vitest.describe)("parseColor - custom colors",function(){var customColors={"brand-primary":"#FF6B6B","brand-secondary":"#4ECDC4",accent:"#FFE66D"};(0,_vitest.it)("should support custom background colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary",customColors)).toEqual({backgroundColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-secondary",customColors)).toEqual({backgroundColor:"#4ECDC4"});(0,_vitest.expect)((0,_colors.parseColor)("bg-accent",customColors)).toEqual({backgroundColor:"#FFE66D"});});(0,_vitest.it)("should support custom text colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary",customColors)).toEqual({color:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-secondary",customColors)).toEqual({color:"#4ECDC4"});});(0,_vitest.it)("should support custom border colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-brand-primary",customColors)).toEqual({borderColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("border-accent",customColors)).toEqual({borderColor:"#FFE66D"});});(0,_vitest.it)("should allow custom colors to override preset colors",function(){var overrideColors={"blue-500":"#FF0000"};(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500",overrideColors)).toEqual({backgroundColor:"#FF0000"});});(0,_vitest.it)("should support custom colors with DEFAULT key from tailwind.config",function(){var customColorsWithDefault={primary:"#1bacb5","primary-50":"#eefdfd","primary-100":"#d4f9f9","primary-500":"#1bacb5","primary-900":"#1e4f5b"};(0,_vitest.expect)((0,_colors.parseColor)("bg-primary",customColorsWithDefault)).toEqual({backgroundColor:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("bg-primary-50",customColorsWithDefault)).toEqual({backgroundColor:"#eefdfd"});(0,_vitest.expect)((0,_colors.parseColor)("text-primary",customColorsWithDefault)).toEqual({color:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("border-primary",customColorsWithDefault)).toEqual({borderColor:"#1bacb5"});});(0,_vitest.it)("should fallback to preset colors when custom color not found",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500",customColors)).toEqual({backgroundColor:_colors.COLORS["red-500"]});});});(0,_vitest.describe)("parseColor - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border")).toBeNull();});(0,_vitest.it)("should return null for invalid color values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-notacolor")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-xyz")).toBeNull();});(0,_vitest.it)("should return null for invalid arbitrary hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffffff]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-#ff0000]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[ff0000]")).toBeNull();});(0,_vitest.it)("should return null for non-hex arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#gggggg]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#zzzzzz]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[rgb(255,0,0)]")).toBeNull();});(0,_vitest.it)("should return null for non-color arbitrary values (to let other parsers handle them)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[13px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[18px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[24]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[100%]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[50px]")).toBeNull();});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_colors.parseColor)("background-blue-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("textcolor-red-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-color-blue-500")).toBeNull();});(0,_vitest.it)("should handle all color scale variants",function(){var scales=["50","100","200","300","400","500","600","700","800","900"];scales.forEach(function(scale){(0,_vitest.expect)((0,_colors.parseColor)(`bg-blue-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-red-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-green-${scale}`)).toBeTruthy();});});});(0,_vitest.describe)("parseColor - comprehensive coverage",function(){(0,_vitest.it)("should parse all color types with same preset color",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});});(0,_vitest.it)("should parse all color types with same arbitrary hex",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});});(0,_vitest.it)("should handle all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500`)).toBeTruthy();});});(0,_vitest.it)("should handle arbitrary values with mixed case",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#AbCdEf]")).toEqual({backgroundColor:"#AbCdEf"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#aBcDeF]")).toEqual({color:"#aBcDeF"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ABCDEF]")).toEqual({borderColor:"#ABCDEF"});});(0,_vitest.it)("should expand 3-digit hex consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});});(0,_vitest.it)("should handle alpha channel consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});});});(0,_vitest.describe)("parseColor - opacity modifiers",function(){(0,_vitest.it)("should parse background colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-white/50")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.white,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500/80")).toEqual({backgroundColor:applyOpacity(_colors.COLORS["blue-500"],80)});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500/30")).toEqual({backgroundColor:applyOpacity(_colors.COLORS["red-500"],30)});});(0,_vitest.it)("should parse text colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-black/80")).toEqual({color:applyOpacity(_colors.COLORS.black,80)});(0,_vitest.expect)((0,_colors.parseColor)("text-white/90")).toEqual({color:applyOpacity(_colors.COLORS.white,90)});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-900/70")).toEqual({color:applyOpacity(_colors.COLORS["gray-900"],70)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/50")).toEqual({color:applyOpacity(_colors.COLORS["blue-500"],50)});});(0,_vitest.it)("should parse border colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-black/25")).toEqual({borderColor:applyOpacity(_colors.COLORS.black,25)});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500/60")).toEqual({borderColor:applyOpacity(_colors.COLORS["red-500"],60)});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200/40")).toEqual({borderColor:applyOpacity(_colors.COLORS["gray-200"],40)});});(0,_vitest.it)("should handle opacity modifier with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]/80")).toEqual({color:"#3B82F6CC"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]/60")).toEqual({borderColor:"#AABBCC99"});});(0,_vitest.it)("should handle opacity modifier with custom colors",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary/50",customColors)).toEqual({backgroundColor:"#FF6B6B80"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary/75",customColors)).toEqual({color:"#FF6B6BBF"});});(0,_vitest.it)("should handle opacity 0 (fully transparent)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,0)});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500/0")).toEqual({color:applyOpacity(_colors.COLORS["red-500"],0)});});(0,_vitest.it)("should handle opacity 100 (fully opaque)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,100)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/100")).toEqual({color:applyOpacity(_colors.COLORS["blue-500"],100)});});(0,_vitest.it)("should handle transparent color with opacity modifier",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent/50")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should convert opacity percentage to correct hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/10")).toEqual({backgroundColor:"#0000001A"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/25")).toEqual({backgroundColor:"#00000040"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:"#00000080"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/75")).toEqual({backgroundColor:"#000000BF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:"#000000FF"});});(0,_vitest.it)("should return null for invalid opacity values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/101")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/-1")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/150")).toBeNull();});(0,_vitest.it)("should return null for malformed opacity syntax",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/abc")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50/")).toBeNull();});(0,_vitest.it)("should handle opacity with 3-digit hex expansion",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]/75")).toEqual({color:"#AABBCCBF"});});(0,_vitest.it)("should work with all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500/50`)).toBeTruthy();});});});(0,_vitest.describe)("parseColor - directional border colors",function(){(0,_vitest.it)("should parse directional border colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-red-500")).toEqual({borderTopColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500")).toEqual({borderRightColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-b-green-500")).toEqual({borderBottomColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-l-yellow-500")).toEqual({borderLeftColor:_colors.COLORS["yellow-500"]});});(0,_vitest.it)("should parse directional border colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-white")).toEqual({borderTopColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-black")).toEqual({borderRightColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-transparent")).toEqual({borderBottomColor:"transparent"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-white")).toEqual({borderLeftColor:"#FFFFFF"});});(0,_vitest.it)("should parse directional border colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000]")).toEqual({borderTopColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#3B82F6]")).toEqual({borderRightColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#00ff00]")).toEqual({borderBottomColor:"#00ff00"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#cccccc]")).toEqual({borderLeftColor:"#cccccc"});});(0,_vitest.it)("should parse directional border colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#f00]")).toEqual({borderTopColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#abc]")).toEqual({borderRightColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#123]")).toEqual({borderBottomColor:"#112233"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#999]")).toEqual({borderLeftColor:"#999999"});});(0,_vitest.it)("should parse directional border colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000aa]")).toEqual({borderTopColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#0000FF50]")).toEqual({borderRightColor:"#0000FF50"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#00FF0080]")).toEqual({borderBottomColor:"#00FF0080"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#FFFFFF00]")).toEqual({borderLeftColor:"#FFFFFF00"});});(0,_vitest.it)("should parse directional border colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-red-500/50")).toEqual({borderTopColor:applyOpacity(_colors.COLORS["red-500"],50)});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500/80")).toEqual({borderRightColor:applyOpacity(_colors.COLORS["blue-500"],80)});(0,_vitest.expect)((0,_colors.parseColor)("border-b-green-500/30")).toEqual({borderBottomColor:applyOpacity(_colors.COLORS["green-500"],30)});(0,_vitest.expect)((0,_colors.parseColor)("border-l-black/25")).toEqual({borderLeftColor:applyOpacity(_colors.COLORS.black,25)});});(0,_vitest.it)("should parse directional border colors with arbitrary hex and opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000]/50")).toEqual({borderTopColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#3B82F6]/80")).toEqual({borderRightColor:"#3B82F6CC"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#abc]/60")).toEqual({borderBottomColor:"#AABBCC99"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#000]/100")).toEqual({borderLeftColor:"#000000FF"});});(0,_vitest.it)("should parse directional border colors with custom colors",function(){var customColors={"brand-primary":"#FF6B6B","brand-secondary":"#4ECDC4",accent:"#FFE66D"};(0,_vitest.expect)((0,_colors.parseColor)("border-t-brand-primary",customColors)).toEqual({borderTopColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-brand-secondary",customColors)).toEqual({borderRightColor:"#4ECDC4"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-accent",customColors)).toEqual({borderBottomColor:"#FFE66D"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-brand-primary",customColors)).toEqual({borderLeftColor:"#FF6B6B"});});(0,_vitest.it)("should parse directional border colors with custom colors and opacity",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("border-t-brand-primary/50",customColors)).toEqual({borderTopColor:"#FF6B6B80"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-brand-primary/75",customColors)).toEqual({borderLeftColor:"#FF6B6BBF"});});(0,_vitest.it)("should not match border width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-4")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-8")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-0")).toBeNull();});(0,_vitest.it)("should not match border width arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[3px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-[8px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-[5]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-[10px]")).toBeNull();});(0,_vitest.it)("should return null for invalid directional border color values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-notacolor")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-xyz")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-wrongcolor")).toBeNull();});(0,_vitest.it)("should handle all directions with same color",function(){var color=_colors.COLORS["blue-500"];(0,_vitest.expect)((0,_colors.parseColor)("border-t-blue-500")).toEqual({borderTopColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500")).toEqual({borderRightColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-b-blue-500")).toEqual({borderBottomColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-l-blue-500")).toEqual({borderLeftColor:color});});(0,_vitest.it)("should handle all color families for directional borders",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`border-t-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-r-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-b-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-l-${family}-500`)).toBeTruthy();});});(0,_vitest.it)("should handle directional borders with all opacity levels",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/0")).toEqual({borderTopColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/25")).toEqual({borderTopColor:"#00000040"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/50")).toEqual({borderTopColor:"#00000080"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/75")).toEqual({borderTopColor:"#000000BF"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/100")).toEqual({borderTopColor:"#000000FF"});});});(0,_vitest.describe)("parseColor - border-x and border-y colors",function(){(0,_vitest.it)("should parse border-x colors (horizontal: left + right)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-red-500")).toEqual({borderLeftColor:_colors.COLORS["red-500"],borderRightColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-x-blue-500")).toEqual({borderLeftColor:_colors.COLORS["blue-500"],borderRightColor:_colors.COLORS["blue-500"]});});(0,_vitest.it)("should parse border-y colors (vertical: top + bottom)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-green-500")).toEqual({borderTopColor:_colors.COLORS["green-500"],borderBottomColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-y-yellow-500")).toEqual({borderTopColor:_colors.COLORS["yellow-500"],borderBottomColor:_colors.COLORS["yellow-500"]});});(0,_vitest.it)("should parse border-x with basic colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-white")).toEqual({borderLeftColor:"#FFFFFF",borderRightColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-x-black")).toEqual({borderLeftColor:"#000000",borderRightColor:"#000000"});});(0,_vitest.it)("should parse border-y with basic colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-white")).toEqual({borderTopColor:"#FFFFFF",borderBottomColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-y-transparent")).toEqual({borderTopColor:"transparent",borderBottomColor:"transparent"});});(0,_vitest.it)("should parse border-x with opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-red-500/50")).toEqual({borderLeftColor:applyOpacity(_colors.COLORS["red-500"],50),borderRightColor:applyOpacity(_colors.COLORS["red-500"],50)});});(0,_vitest.it)("should parse border-y with opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-blue-500/80")).toEqual({borderTopColor:applyOpacity(_colors.COLORS["blue-500"],80),borderBottomColor:applyOpacity(_colors.COLORS["blue-500"],80)});});(0,_vitest.it)("should parse border-x with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-[#ff0000]")).toEqual({borderLeftColor:"#ff0000",borderRightColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-x-[#abc]")).toEqual({borderLeftColor:"#aabbcc",borderRightColor:"#aabbcc"});});(0,_vitest.it)("should parse border-y with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-[#00ff00]")).toEqual({borderTopColor:"#00ff00",borderBottomColor:"#00ff00"});(0,_vitest.expect)((0,_colors.parseColor)("border-y-[#123]")).toEqual({borderTopColor:"#112233",borderBottomColor:"#112233"});});(0,_vitest.it)("should parse border-x with custom colors",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("border-x-brand-primary",customColors)).toEqual({borderLeftColor:"#FF6B6B",borderRightColor:"#FF6B6B"});});(0,_vitest.it)("should parse border-y with custom colors",function(){var customColors={accent:"#FFE66D"};(0,_vitest.expect)((0,_colors.parseColor)("border-y-accent",customColors)).toEqual({borderTopColor:"#FFE66D",borderBottomColor:"#FFE66D"});});(0,_vitest.it)("should not match border-x/border-y width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-4")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-x-0")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-8")).toBeNull();});(0,_vitest.it)("should not match border-x/border-y arbitrary width values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-[3px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-[5px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-x-[10]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-[8px]")).toBeNull();});});
|
|
1
|
+
var _vitest=require("vitest");var _colorUtils=require("../utils/colorUtils");var _colors=require("./colors");(0,_vitest.describe)("COLORS",function(){(0,_vitest.it)("should export complete color palette",function(){(0,_vitest.expect)(_colors.COLORS).toMatchSnapshot();});});(0,_vitest.describe)("parseColor - background colors",function(){(0,_vitest.it)("should parse background colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500")).toEqual({backgroundColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-green-500")).toEqual({backgroundColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-gray-300")).toEqual({backgroundColor:_colors.COLORS["gray-300"]});});(0,_vitest.it)("should parse background colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-white")).toEqual({backgroundColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should parse background colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F6]")).toEqual({backgroundColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#000000]")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#123]")).toEqual({backgroundColor:"#112233"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F680]")).toEqual({backgroundColor:"#3B82F680"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#00000000]")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFFFF]")).toEqual({backgroundColor:"#FFFFFFFF"});});(0,_vitest.it)("should handle case-insensitive hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FF0000]")).toEqual({backgroundColor:"#FF0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#Ff0000]")).toEqual({backgroundColor:"#Ff0000"});});(0,_vitest.it)("should prefer arbitrary values over preset colors",function(){var customColors={"[#ff0000]":"#00ff00"};(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]",customColors)).toEqual({backgroundColor:"#ff0000"});});});(0,_vitest.describe)("parseColor - text colors",function(){(0,_vitest.it)("should parse text colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500")).toEqual({color:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-green-500")).toEqual({color:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-700")).toEqual({color:_colors.COLORS["gray-700"]});});(0,_vitest.it)("should parse text colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-white")).toEqual({color:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("text-black")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]")).toEqual({color:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#333333]")).toEqual({color:"#333333"});});(0,_vitest.it)("should parse text colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#f00]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#000]")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#00000080]")).toEqual({color:"#00000080"});});});(0,_vitest.describe)("parseColor - border colors",function(){(0,_vitest.it)("should parse border colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500")).toEqual({borderColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-green-500")).toEqual({borderColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200")).toEqual({borderColor:_colors.COLORS["gray-200"]});});(0,_vitest.it)("should parse border colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-white")).toEqual({borderColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-black")).toEqual({borderColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-transparent")).toEqual({borderColor:"transparent"});});(0,_vitest.it)("should parse border colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#3B82F6]")).toEqual({borderColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#cccccc]")).toEqual({borderColor:"#cccccc"});});(0,_vitest.it)("should parse border colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#f00]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#999]")).toEqual({borderColor:"#999999"});});(0,_vitest.it)("should parse border colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#0000FF50]")).toEqual({borderColor:"#0000FF50"});});(0,_vitest.it)("should not match border width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-0")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-4")).toBeNull();});});(0,_vitest.describe)("parseColor - custom colors",function(){var customColors={"brand-primary":"#FF6B6B","brand-secondary":"#4ECDC4",accent:"#FFE66D"};(0,_vitest.it)("should support custom background colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary",customColors)).toEqual({backgroundColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-secondary",customColors)).toEqual({backgroundColor:"#4ECDC4"});(0,_vitest.expect)((0,_colors.parseColor)("bg-accent",customColors)).toEqual({backgroundColor:"#FFE66D"});});(0,_vitest.it)("should support custom text colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary",customColors)).toEqual({color:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-secondary",customColors)).toEqual({color:"#4ECDC4"});});(0,_vitest.it)("should support custom border colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-brand-primary",customColors)).toEqual({borderColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("border-accent",customColors)).toEqual({borderColor:"#FFE66D"});});(0,_vitest.it)("should allow custom colors to override preset colors",function(){var overrideColors={"blue-500":"#FF0000"};(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500",overrideColors)).toEqual({backgroundColor:"#FF0000"});});(0,_vitest.it)("should support custom colors with DEFAULT key from tailwind.config",function(){var customColorsWithDefault={primary:"#1bacb5","primary-50":"#eefdfd","primary-100":"#d4f9f9","primary-500":"#1bacb5","primary-900":"#1e4f5b"};(0,_vitest.expect)((0,_colors.parseColor)("bg-primary",customColorsWithDefault)).toEqual({backgroundColor:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("bg-primary-50",customColorsWithDefault)).toEqual({backgroundColor:"#eefdfd"});(0,_vitest.expect)((0,_colors.parseColor)("text-primary",customColorsWithDefault)).toEqual({color:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("border-primary",customColorsWithDefault)).toEqual({borderColor:"#1bacb5"});});(0,_vitest.it)("should fallback to preset colors when custom color not found",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500",customColors)).toEqual({backgroundColor:_colors.COLORS["red-500"]});});});(0,_vitest.describe)("parseColor - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border")).toBeNull();});(0,_vitest.it)("should return null for invalid color values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-notacolor")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-xyz")).toBeNull();});(0,_vitest.it)("should return null for invalid arbitrary hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffffff]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-#ff0000]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[ff0000]")).toBeNull();});(0,_vitest.it)("should return null for non-hex arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#gggggg]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#zzzzzz]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[rgb(255,0,0)]")).toBeNull();});(0,_vitest.it)("should return null for non-color arbitrary values (to let other parsers handle them)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[13px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[18px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[24]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[100%]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[50px]")).toBeNull();});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_colors.parseColor)("background-blue-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("textcolor-red-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-color-blue-500")).toBeNull();});(0,_vitest.it)("should handle all color scale variants",function(){var scales=["50","100","200","300","400","500","600","700","800","900"];scales.forEach(function(scale){(0,_vitest.expect)((0,_colors.parseColor)(`bg-blue-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-red-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-green-${scale}`)).toBeTruthy();});});});(0,_vitest.describe)("parseColor - comprehensive coverage",function(){(0,_vitest.it)("should parse all color types with same preset color",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});});(0,_vitest.it)("should parse all color types with same arbitrary hex",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});});(0,_vitest.it)("should handle all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500`)).toBeTruthy();});});(0,_vitest.it)("should handle arbitrary values with mixed case",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#AbCdEf]")).toEqual({backgroundColor:"#AbCdEf"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#aBcDeF]")).toEqual({color:"#aBcDeF"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ABCDEF]")).toEqual({borderColor:"#ABCDEF"});});(0,_vitest.it)("should expand 3-digit hex consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});});(0,_vitest.it)("should handle alpha channel consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});});});(0,_vitest.describe)("parseColor - opacity modifiers",function(){(0,_vitest.it)("should parse background colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:(0,_colorUtils.applyOpacity)(_colors.COLORS.black,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-white/50")).toEqual({backgroundColor:(0,_colorUtils.applyOpacity)(_colors.COLORS.white,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500/80")).toEqual({backgroundColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["blue-500"],80)});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500/30")).toEqual({backgroundColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["red-500"],30)});});(0,_vitest.it)("should parse text colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-black/80")).toEqual({color:(0,_colorUtils.applyOpacity)(_colors.COLORS.black,80)});(0,_vitest.expect)((0,_colors.parseColor)("text-white/90")).toEqual({color:(0,_colorUtils.applyOpacity)(_colors.COLORS.white,90)});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-900/70")).toEqual({color:(0,_colorUtils.applyOpacity)(_colors.COLORS["gray-900"],70)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/50")).toEqual({color:(0,_colorUtils.applyOpacity)(_colors.COLORS["blue-500"],50)});});(0,_vitest.it)("should parse border colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-black/25")).toEqual({borderColor:(0,_colorUtils.applyOpacity)(_colors.COLORS.black,25)});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500/60")).toEqual({borderColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["red-500"],60)});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200/40")).toEqual({borderColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["gray-200"],40)});});(0,_vitest.it)("should handle opacity modifier with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]/80")).toEqual({color:"#3B82F6CC"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]/60")).toEqual({borderColor:"#AABBCC99"});});(0,_vitest.it)("should handle opacity modifier with custom colors",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary/50",customColors)).toEqual({backgroundColor:"#FF6B6B80"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary/75",customColors)).toEqual({color:"#FF6B6BBF"});});(0,_vitest.it)("should handle opacity 0 (fully transparent)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:(0,_colorUtils.applyOpacity)(_colors.COLORS.black,0)});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500/0")).toEqual({color:(0,_colorUtils.applyOpacity)(_colors.COLORS["red-500"],0)});});(0,_vitest.it)("should handle opacity 100 (fully opaque)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:(0,_colorUtils.applyOpacity)(_colors.COLORS.black,100)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/100")).toEqual({color:(0,_colorUtils.applyOpacity)(_colors.COLORS["blue-500"],100)});});(0,_vitest.it)("should handle transparent color with opacity modifier",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent/50")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should convert opacity percentage to correct hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/10")).toEqual({backgroundColor:"#0000001A"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/25")).toEqual({backgroundColor:"#00000040"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:"#00000080"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/75")).toEqual({backgroundColor:"#000000BF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:"#000000FF"});});(0,_vitest.it)("should return null for invalid opacity values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/101")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/-1")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/150")).toBeNull();});(0,_vitest.it)("should return null for malformed opacity syntax",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/abc")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50/")).toBeNull();});(0,_vitest.it)("should handle opacity with 3-digit hex expansion",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]/75")).toEqual({color:"#AABBCCBF"});});(0,_vitest.it)("should work with all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500/50`)).toBeTruthy();});});});(0,_vitest.describe)("parseColor - directional border colors",function(){(0,_vitest.it)("should parse directional border colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-red-500")).toEqual({borderTopColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500")).toEqual({borderRightColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-b-green-500")).toEqual({borderBottomColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-l-yellow-500")).toEqual({borderLeftColor:_colors.COLORS["yellow-500"]});});(0,_vitest.it)("should parse directional border colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-white")).toEqual({borderTopColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-black")).toEqual({borderRightColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-transparent")).toEqual({borderBottomColor:"transparent"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-white")).toEqual({borderLeftColor:"#FFFFFF"});});(0,_vitest.it)("should parse directional border colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000]")).toEqual({borderTopColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#3B82F6]")).toEqual({borderRightColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#00ff00]")).toEqual({borderBottomColor:"#00ff00"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#cccccc]")).toEqual({borderLeftColor:"#cccccc"});});(0,_vitest.it)("should parse directional border colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#f00]")).toEqual({borderTopColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#abc]")).toEqual({borderRightColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#123]")).toEqual({borderBottomColor:"#112233"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#999]")).toEqual({borderLeftColor:"#999999"});});(0,_vitest.it)("should parse directional border colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000aa]")).toEqual({borderTopColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#0000FF50]")).toEqual({borderRightColor:"#0000FF50"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#00FF0080]")).toEqual({borderBottomColor:"#00FF0080"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#FFFFFF00]")).toEqual({borderLeftColor:"#FFFFFF00"});});(0,_vitest.it)("should parse directional border colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-red-500/50")).toEqual({borderTopColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["red-500"],50)});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500/80")).toEqual({borderRightColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["blue-500"],80)});(0,_vitest.expect)((0,_colors.parseColor)("border-b-green-500/30")).toEqual({borderBottomColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["green-500"],30)});(0,_vitest.expect)((0,_colors.parseColor)("border-l-black/25")).toEqual({borderLeftColor:(0,_colorUtils.applyOpacity)(_colors.COLORS.black,25)});});(0,_vitest.it)("should parse directional border colors with arbitrary hex and opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000]/50")).toEqual({borderTopColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#3B82F6]/80")).toEqual({borderRightColor:"#3B82F6CC"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#abc]/60")).toEqual({borderBottomColor:"#AABBCC99"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#000]/100")).toEqual({borderLeftColor:"#000000FF"});});(0,_vitest.it)("should parse directional border colors with custom colors",function(){var customColors={"brand-primary":"#FF6B6B","brand-secondary":"#4ECDC4",accent:"#FFE66D"};(0,_vitest.expect)((0,_colors.parseColor)("border-t-brand-primary",customColors)).toEqual({borderTopColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-brand-secondary",customColors)).toEqual({borderRightColor:"#4ECDC4"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-accent",customColors)).toEqual({borderBottomColor:"#FFE66D"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-brand-primary",customColors)).toEqual({borderLeftColor:"#FF6B6B"});});(0,_vitest.it)("should parse directional border colors with custom colors and opacity",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("border-t-brand-primary/50",customColors)).toEqual({borderTopColor:"#FF6B6B80"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-brand-primary/75",customColors)).toEqual({borderLeftColor:"#FF6B6BBF"});});(0,_vitest.it)("should not match border width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-4")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-8")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-0")).toBeNull();});(0,_vitest.it)("should not match border width arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[3px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-[8px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-[5]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-[10px]")).toBeNull();});(0,_vitest.it)("should return null for invalid directional border color values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-notacolor")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-xyz")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-wrongcolor")).toBeNull();});(0,_vitest.it)("should handle all directions with same color",function(){var color=_colors.COLORS["blue-500"];(0,_vitest.expect)((0,_colors.parseColor)("border-t-blue-500")).toEqual({borderTopColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500")).toEqual({borderRightColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-b-blue-500")).toEqual({borderBottomColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-l-blue-500")).toEqual({borderLeftColor:color});});(0,_vitest.it)("should handle all color families for directional borders",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`border-t-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-r-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-b-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-l-${family}-500`)).toBeTruthy();});});(0,_vitest.it)("should handle directional borders with all opacity levels",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/0")).toEqual({borderTopColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/25")).toEqual({borderTopColor:"#00000040"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/50")).toEqual({borderTopColor:"#00000080"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/75")).toEqual({borderTopColor:"#000000BF"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/100")).toEqual({borderTopColor:"#000000FF"});});});(0,_vitest.describe)("parseColor - border-x and border-y colors",function(){(0,_vitest.it)("should parse border-x colors (horizontal: left + right)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-red-500")).toEqual({borderLeftColor:_colors.COLORS["red-500"],borderRightColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-x-blue-500")).toEqual({borderLeftColor:_colors.COLORS["blue-500"],borderRightColor:_colors.COLORS["blue-500"]});});(0,_vitest.it)("should parse border-y colors (vertical: top + bottom)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-green-500")).toEqual({borderTopColor:_colors.COLORS["green-500"],borderBottomColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-y-yellow-500")).toEqual({borderTopColor:_colors.COLORS["yellow-500"],borderBottomColor:_colors.COLORS["yellow-500"]});});(0,_vitest.it)("should parse border-x with basic colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-white")).toEqual({borderLeftColor:"#FFFFFF",borderRightColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-x-black")).toEqual({borderLeftColor:"#000000",borderRightColor:"#000000"});});(0,_vitest.it)("should parse border-y with basic colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-white")).toEqual({borderTopColor:"#FFFFFF",borderBottomColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-y-transparent")).toEqual({borderTopColor:"transparent",borderBottomColor:"transparent"});});(0,_vitest.it)("should parse border-x with opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-red-500/50")).toEqual({borderLeftColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["red-500"],50),borderRightColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["red-500"],50)});});(0,_vitest.it)("should parse border-y with opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-blue-500/80")).toEqual({borderTopColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["blue-500"],80),borderBottomColor:(0,_colorUtils.applyOpacity)(_colors.COLORS["blue-500"],80)});});(0,_vitest.it)("should parse border-x with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-[#ff0000]")).toEqual({borderLeftColor:"#ff0000",borderRightColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-x-[#abc]")).toEqual({borderLeftColor:"#aabbcc",borderRightColor:"#aabbcc"});});(0,_vitest.it)("should parse border-y with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-[#00ff00]")).toEqual({borderTopColor:"#00ff00",borderBottomColor:"#00ff00"});(0,_vitest.expect)((0,_colors.parseColor)("border-y-[#123]")).toEqual({borderTopColor:"#112233",borderBottomColor:"#112233"});});(0,_vitest.it)("should parse border-x with custom colors",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("border-x-brand-primary",customColors)).toEqual({borderLeftColor:"#FF6B6B",borderRightColor:"#FF6B6B"});});(0,_vitest.it)("should parse border-y with custom colors",function(){var customColors={accent:"#FFE66D"};(0,_vitest.expect)((0,_colors.parseColor)("border-y-accent",customColors)).toEqual({borderTopColor:"#FFE66D",borderBottomColor:"#FFE66D"});});(0,_vitest.it)("should not match border-x/border-y width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-4")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-x-0")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-8")).toBeNull();});(0,_vitest.it)("should not match border-x/border-y arbitrary width values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-[3px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-[5px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-x-[10]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-[8px]")).toBeNull();});});
|
package/dist/parser/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export { parseAspectRatio } from "./aspectRatio";
|
|
|
30
30
|
export { parseBorder } from "./borders";
|
|
31
31
|
export { parseColor } from "./colors";
|
|
32
32
|
export { parseLayout } from "./layout";
|
|
33
|
+
export { parseOutline } from "./outline";
|
|
33
34
|
export { parsePlaceholderClass, parsePlaceholderClasses } from "./placeholder";
|
|
34
35
|
export { parseShadow } from "./shadows";
|
|
35
36
|
export { parseSizing } from "./sizing";
|
package/dist/parser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"expandSchemeModifier",{enumerable:true,get:function get(){return _modifiers.expandSchemeModifier;}});Object.defineProperty(exports,"hasModifier",{enumerable:true,get:function get(){return _modifiers.hasModifier;}});Object.defineProperty(exports,"isColorClass",{enumerable:true,get:function get(){return _modifiers.isColorClass;}});Object.defineProperty(exports,"isColorSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isColorSchemeModifier;}});Object.defineProperty(exports,"isDirectionalModifier",{enumerable:true,get:function get(){return _modifiers.isDirectionalModifier;}});Object.defineProperty(exports,"isPlatformModifier",{enumerable:true,get:function get(){return _modifiers.isPlatformModifier;}});Object.defineProperty(exports,"isSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isSchemeModifier;}});Object.defineProperty(exports,"isStateModifier",{enumerable:true,get:function get(){return _modifiers.isStateModifier;}});Object.defineProperty(exports,"parseAspectRatio",{enumerable:true,get:function get(){return _aspectRatio.parseAspectRatio;}});Object.defineProperty(exports,"parseBorder",{enumerable:true,get:function get(){return _borders.parseBorder;}});exports.parseClass=parseClass;exports.parseClassName=parseClassName;Object.defineProperty(exports,"parseColor",{enumerable:true,get:function get(){return _colors.parseColor;}});Object.defineProperty(exports,"parseLayout",{enumerable:true,get:function get(){return _layout.parseLayout;}});Object.defineProperty(exports,"parseModifier",{enumerable:true,get:function get(){return _modifiers.parseModifier;}});Object.defineProperty(exports,"parsePlaceholderClass",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClass;}});Object.defineProperty(exports,"parsePlaceholderClasses",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClasses;}});Object.defineProperty(exports,"parseShadow",{enumerable:true,get:function get(){return _shadows.parseShadow;}});Object.defineProperty(exports,"parseSizing",{enumerable:true,get:function get(){return _sizing.parseSizing;}});Object.defineProperty(exports,"parseSpacing",{enumerable:true,get:function get(){return _spacing.parseSpacing;}});Object.defineProperty(exports,"parseTransform",{enumerable:true,get:function get(){return _transforms.parseTransform;}});Object.defineProperty(exports,"parseTypography",{enumerable:true,get:function get(){return _typography.parseTypography;}});Object.defineProperty(exports,"splitModifierClasses",{enumerable:true,get:function get(){return _modifiers.splitModifierClasses;}});var _mergeStyles=require("../utils/mergeStyles");var _aspectRatio=require("./aspectRatio");var _borders=require("./borders");var _colors=require("./colors");var _layout=require("./layout");var _shadows=require("./shadows");var _sizing=require("./sizing");var _spacing=require("./spacing");var _transforms=require("./transforms");var _typography=require("./typography");var _placeholder=require("./placeholder");var _modifiers=require("./modifiers");function parseClassName(className,customTheme){var classes=className.split(/\s+/).filter(Boolean);var style={};for(var cls of classes){var parsedStyle=parseClass(cls,customTheme);(0,_mergeStyles.mergeStyles)(style,parsedStyle);}return style;}function parseClass(cls,customTheme){var parsers=[function(cls){return(0,_spacing.parseSpacing)(cls,customTheme==null?void 0:customTheme.spacing);},function(cls){return(0,_borders.parseBorder)(cls,customTheme==null?void 0:customTheme.colors);},function(cls){return(0,_colors.parseColor)(cls,customTheme==null?void 0:customTheme.colors);},function(cls){return(0,_layout.parseLayout)(cls,customTheme==null?void 0:customTheme.spacing);},function(cls){return(0,_typography.parseTypography)(cls,customTheme==null?void 0:customTheme.fontFamily,customTheme==null?void 0:customTheme.fontSize);},function(cls){return(0,_sizing.parseSizing)(cls,customTheme==null?void 0:customTheme.spacing);},_shadows.parseShadow,_aspectRatio.parseAspectRatio,function(cls){return(0,_transforms.parseTransform)(cls,customTheme==null?void 0:customTheme.spacing);}];for(var parser of parsers){var result=parser(cls);if(result!==null){return result;}}if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unknown class: "${cls}"`);}return{};}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"expandSchemeModifier",{enumerable:true,get:function get(){return _modifiers.expandSchemeModifier;}});Object.defineProperty(exports,"hasModifier",{enumerable:true,get:function get(){return _modifiers.hasModifier;}});Object.defineProperty(exports,"isColorClass",{enumerable:true,get:function get(){return _modifiers.isColorClass;}});Object.defineProperty(exports,"isColorSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isColorSchemeModifier;}});Object.defineProperty(exports,"isDirectionalModifier",{enumerable:true,get:function get(){return _modifiers.isDirectionalModifier;}});Object.defineProperty(exports,"isPlatformModifier",{enumerable:true,get:function get(){return _modifiers.isPlatformModifier;}});Object.defineProperty(exports,"isSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isSchemeModifier;}});Object.defineProperty(exports,"isStateModifier",{enumerable:true,get:function get(){return _modifiers.isStateModifier;}});Object.defineProperty(exports,"parseAspectRatio",{enumerable:true,get:function get(){return _aspectRatio.parseAspectRatio;}});Object.defineProperty(exports,"parseBorder",{enumerable:true,get:function get(){return _borders.parseBorder;}});exports.parseClass=parseClass;exports.parseClassName=parseClassName;Object.defineProperty(exports,"parseColor",{enumerable:true,get:function get(){return _colors.parseColor;}});Object.defineProperty(exports,"parseLayout",{enumerable:true,get:function get(){return _layout.parseLayout;}});Object.defineProperty(exports,"parseModifier",{enumerable:true,get:function get(){return _modifiers.parseModifier;}});Object.defineProperty(exports,"parseOutline",{enumerable:true,get:function get(){return _outline.parseOutline;}});Object.defineProperty(exports,"parsePlaceholderClass",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClass;}});Object.defineProperty(exports,"parsePlaceholderClasses",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClasses;}});Object.defineProperty(exports,"parseShadow",{enumerable:true,get:function get(){return _shadows.parseShadow;}});Object.defineProperty(exports,"parseSizing",{enumerable:true,get:function get(){return _sizing.parseSizing;}});Object.defineProperty(exports,"parseSpacing",{enumerable:true,get:function get(){return _spacing.parseSpacing;}});Object.defineProperty(exports,"parseTransform",{enumerable:true,get:function get(){return _transforms.parseTransform;}});Object.defineProperty(exports,"parseTypography",{enumerable:true,get:function get(){return _typography.parseTypography;}});Object.defineProperty(exports,"splitModifierClasses",{enumerable:true,get:function get(){return _modifiers.splitModifierClasses;}});var _mergeStyles=require("../utils/mergeStyles");var _aspectRatio=require("./aspectRatio");var _borders=require("./borders");var _colors=require("./colors");var _layout=require("./layout");var _outline=require("./outline");var _shadows=require("./shadows");var _sizing=require("./sizing");var _spacing=require("./spacing");var _transforms=require("./transforms");var _typography=require("./typography");var _placeholder=require("./placeholder");var _modifiers=require("./modifiers");function parseClassName(className,customTheme){var classes=className.split(/\s+/).filter(Boolean);var style={};for(var cls of classes){var parsedStyle=parseClass(cls,customTheme);(0,_mergeStyles.mergeStyles)(style,parsedStyle);}return style;}function parseClass(cls,customTheme){var parsers=[function(cls){return(0,_spacing.parseSpacing)(cls,customTheme==null?void 0:customTheme.spacing);},function(cls){return(0,_borders.parseBorder)(cls,customTheme==null?void 0:customTheme.colors);},_outline.parseOutline,function(cls){return(0,_colors.parseColor)(cls,customTheme==null?void 0:customTheme.colors);},function(cls){return(0,_layout.parseLayout)(cls,customTheme==null?void 0:customTheme.spacing);},function(cls){return(0,_typography.parseTypography)(cls,customTheme==null?void 0:customTheme.fontFamily,customTheme==null?void 0:customTheme.fontSize);},function(cls){return(0,_sizing.parseSizing)(cls,customTheme==null?void 0:customTheme.spacing);},function(cls){return(0,_shadows.parseShadow)(cls,customTheme==null?void 0:customTheme.colors);},_aspectRatio.parseAspectRatio,function(cls){return(0,_transforms.parseTransform)(cls,customTheme==null?void 0:customTheme.spacing);}];for(var parser of parsers){var result=parser(cls);if(result!==null){return result;}}if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unknown class: "${cls}"`);}return{};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.parseOutline=parseOutline;var _borders=require("./borders");function parseArbitraryOutlineValue(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 outline value: ${value}. Only px values are supported (e.g., [8px] or [8]).`);}return null;}return null;}function parseOutline(cls){if(cls==="outline"){return{outlineWidth:1,outlineStyle:"solid"};}if(cls==="outline-none"){return{outlineWidth:0};}if(cls==="outline-solid")return{outlineStyle:"solid"};if(cls==="outline-dotted")return{outlineStyle:"dotted"};if(cls==="outline-dashed")return{outlineStyle:"dashed"};if(cls.startsWith("outline-offset-")){var valueStr=cls.substring(15);if(valueStr.startsWith("[")){var arbitraryValue=parseArbitraryOutlineValue(valueStr);if(arbitraryValue!==null){return{outlineOffset:arbitraryValue};}return null;}var scaleValue=_borders.BORDER_WIDTH_SCALE[valueStr];if(scaleValue!==undefined){return{outlineOffset:scaleValue};}return null;}var widthMatch=cls.match(/^outline-(\d+)$/);if(widthMatch){var value=_borders.BORDER_WIDTH_SCALE[widthMatch[1]];if(value!==undefined){return{outlineWidth:value};}}var arbMatch=cls.match(/^outline-(\[.+\])$/);if(arbMatch){var _arbitraryValue=parseArbitraryOutlineValue(arbMatch[1]);if(_arbitraryValue!==null){return{outlineWidth:_arbitraryValue};}return null;}return null;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _vitest=require("vitest");var _outline=require("./outline");(0,_vitest.describe)("parseOutline",function(){(0,_vitest.it)("should parse outline shorthand",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline")).toEqual({outlineWidth:1,outlineStyle:"solid"});});(0,_vitest.it)("should parse outline-none",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-none")).toEqual({outlineWidth:0});});(0,_vitest.it)("should parse outline width with preset values",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-0")).toEqual({outlineWidth:0});(0,_vitest.expect)((0,_outline.parseOutline)("outline-2")).toEqual({outlineWidth:2});(0,_vitest.expect)((0,_outline.parseOutline)("outline-4")).toEqual({outlineWidth:4});(0,_vitest.expect)((0,_outline.parseOutline)("outline-8")).toEqual({outlineWidth:8});});(0,_vitest.it)("should parse outline width with arbitrary values",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-[5px]")).toEqual({outlineWidth:5});(0,_vitest.expect)((0,_outline.parseOutline)("outline-[10]")).toEqual({outlineWidth:10});});(0,_vitest.it)("should parse outline style",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-solid")).toEqual({outlineStyle:"solid"});(0,_vitest.expect)((0,_outline.parseOutline)("outline-dashed")).toEqual({outlineStyle:"dashed"});(0,_vitest.expect)((0,_outline.parseOutline)("outline-dotted")).toEqual({outlineStyle:"dotted"});});(0,_vitest.it)("should parse outline offset with preset values",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-offset-0")).toEqual({outlineOffset:0});(0,_vitest.expect)((0,_outline.parseOutline)("outline-offset-2")).toEqual({outlineOffset:2});(0,_vitest.expect)((0,_outline.parseOutline)("outline-offset-4")).toEqual({outlineOffset:4});(0,_vitest.expect)((0,_outline.parseOutline)("outline-offset-8")).toEqual({outlineOffset:8});});(0,_vitest.it)("should parse outline offset with arbitrary values",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-offset-[3px]")).toEqual({outlineOffset:3});(0,_vitest.expect)((0,_outline.parseOutline)("outline-offset-[5]")).toEqual({outlineOffset:5});});(0,_vitest.it)("should return null for invalid outline values",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-invalid")).toBeNull();(0,_vitest.expect)((0,_outline.parseOutline)("outline-3")).toBeNull();(0,_vitest.expect)((0,_outline.parseOutline)("outline-offset-3")).toBeNull();(0,_vitest.expect)((0,_outline.parseOutline)("outline-[5rem]")).toBeNull();});(0,_vitest.it)("should return null for outline colors (handled by parseColor)",function(){(0,_vitest.expect)((0,_outline.parseOutline)("outline-red-500")).toBeNull();(0,_vitest.expect)((0,_outline.parseOutline)("outline-[#ff0000]")).toBeNull();});});
|
package/dist/parser/shadows.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* iOS uses shadow* properties, Android uses elevation
|
|
4
4
|
*/
|
|
5
5
|
import type { StyleObject } from "../types";
|
|
6
|
+
import { COLORS } from "../utils/colorUtils";
|
|
6
7
|
/**
|
|
7
8
|
* Shadow scale definitions combining iOS and Android properties
|
|
8
9
|
* Based on Tailwind CSS shadow scale, adapted for React Native
|
|
@@ -15,8 +16,12 @@ import type { StyleObject } from "../types";
|
|
|
15
16
|
declare const SHADOW_SCALE: Record<string, StyleObject>;
|
|
16
17
|
/**
|
|
17
18
|
* Parse shadow classes
|
|
19
|
+
* Supports shadow size presets (shadow-sm, shadow-md, etc.) and
|
|
20
|
+
* shadow colors (shadow-red-500, shadow-blue-800/50, shadow-[#ff0000]/80)
|
|
21
|
+
*
|
|
18
22
|
* @param cls - Class name to parse
|
|
23
|
+
* @param customColors - Optional custom colors from tailwind.config
|
|
19
24
|
* @returns Style object or null if not a shadow class
|
|
20
25
|
*/
|
|
21
|
-
export declare function parseShadow(cls: string): StyleObject | null;
|
|
22
|
-
export { SHADOW_SCALE };
|
|
26
|
+
export declare function parseShadow(cls: string, customColors?: Record<string, string>): StyleObject | null;
|
|
27
|
+
export { COLORS as SHADOW_COLORS, SHADOW_SCALE };
|
package/dist/parser/shadows.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.SHADOW_SCALE=void 0;exports.parseShadow=parseShadow;var SHADOW_SCALE=exports.SHADOW_SCALE={"shadow-sm":{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:0.05,shadowRadius:1,elevation:1},shadow:{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:0.1,shadowRadius:2,elevation:2},"shadow-md":{shadowColor:"#000000",shadowOffset:{width:0,height:3},shadowOpacity:0.15,shadowRadius:4,elevation:4},"shadow-lg":{shadowColor:"#000000",shadowOffset:{width:0,height:6},shadowOpacity:0.2,shadowRadius:8,elevation:8},"shadow-xl":{shadowColor:"#000000",shadowOffset:{width:0,height:10},shadowOpacity:0.25,shadowRadius:12,elevation:12},"shadow-2xl":{shadowColor:"#000000",shadowOffset:{width:0,height:20},shadowOpacity:0.3,shadowRadius:24,elevation:16},"shadow-none":{shadowColor:"transparent",shadowOffset:{width:0,height:0},shadowOpacity:0,shadowRadius:0,elevation:0}};function parseShadow(cls){if(cls in SHADOW_SCALE){return SHADOW_SCALE[cls];}return null;}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"SHADOW_COLORS",{enumerable:true,get:function get(){return _colorUtils.COLORS;}});exports.SHADOW_SCALE=void 0;exports.parseShadow=parseShadow;var _colorUtils=require("../utils/colorUtils");var SHADOW_SCALE=exports.SHADOW_SCALE={"shadow-sm":{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:0.05,shadowRadius:1,elevation:1},shadow:{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:0.1,shadowRadius:2,elevation:2},"shadow-md":{shadowColor:"#000000",shadowOffset:{width:0,height:3},shadowOpacity:0.15,shadowRadius:4,elevation:4},"shadow-lg":{shadowColor:"#000000",shadowOffset:{width:0,height:6},shadowOpacity:0.2,shadowRadius:8,elevation:8},"shadow-xl":{shadowColor:"#000000",shadowOffset:{width:0,height:10},shadowOpacity:0.25,shadowRadius:12,elevation:12},"shadow-2xl":{shadowColor:"#000000",shadowOffset:{width:0,height:20},shadowOpacity:0.3,shadowRadius:24,elevation:16},"shadow-none":{shadowColor:"transparent",shadowOffset:{width:0,height:0},shadowOpacity:0,shadowRadius:0,elevation:0}};function parseShadow(cls,customColors){if(cls in SHADOW_SCALE){return SHADOW_SCALE[cls];}if(cls.startsWith("shadow-")){var colorPart=cls.substring(7);var shadowColor=(0,_colorUtils.parseColorValue)(colorPart,customColors);if(shadowColor){return{shadowColor:shadowColor};}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _vitest=require("vitest");var _shadows=require("./shadows");(0,_vitest.describe)("SHADOW_SCALE",function(){(0,_vitest.it)("should export complete shadow scale",function(){(0,_vitest.expect)(_shadows.SHADOW_SCALE).toMatchSnapshot();});(0,_vitest.it)("should have all shadow variants",function(){(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-sm");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-md");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-lg");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-xl");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-2xl");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-none");});});(0,_vitest.describe)("parseShadow - basic shadows",function(){(0,_vitest.it)("should parse shadow-sm",function(){var result=(0,_shadows.parseShadow)("shadow-sm");(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(result).toHaveProperty("shadowColor");(0,_vitest.expect)(result).toHaveProperty("shadowOffset");(0,_vitest.expect)(result).toHaveProperty("shadowOpacity");(0,_vitest.expect)(result).toHaveProperty("shadowRadius");});(0,_vitest.it)("should parse default shadow",function(){var result=(0,_shadows.parseShadow)("shadow");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-md",function(){var result=(0,_shadows.parseShadow)("shadow-md");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-lg",function(){var result=(0,_shadows.parseShadow)("shadow-lg");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-xl",function(){var result=(0,_shadows.parseShadow)("shadow-xl");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-2xl",function(){var result=(0,_shadows.parseShadow)("shadow-2xl");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-none",function(){var result=(0,_shadows.parseShadow)("shadow-none");(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(result).toMatchObject({shadowColor:"transparent",shadowOpacity:0,shadowRadius:0});});});(0,_vitest.describe)("parseShadow - shadow properties (iOS)",function(){(0,_vitest.it)("should have increasing shadow values for larger shadows",function(){var sm=(0,_shadows.parseShadow)("shadow-sm");var md=(0,_shadows.parseShadow)("shadow-md");var lg=(0,_shadows.parseShadow)("shadow-lg");var xl=(0,_shadows.parseShadow)("shadow-xl");var xxl=(0,_shadows.parseShadow)("shadow-2xl");(0,_vitest.expect)(md==null?void 0:md.shadowOpacity).toBeGreaterThan(sm==null?void 0:sm.shadowOpacity);(0,_vitest.expect)(lg==null?void 0:lg.shadowOpacity).toBeGreaterThan(md==null?void 0:md.shadowOpacity);(0,_vitest.expect)(md==null?void 0:md.shadowRadius).toBeGreaterThan(sm==null?void 0:sm.shadowRadius);(0,_vitest.expect)(lg==null?void 0:lg.shadowRadius).toBeGreaterThan(md==null?void 0:md.shadowRadius);(0,_vitest.expect)(xl==null?void 0:xl.shadowRadius).toBeGreaterThan(lg==null?void 0:lg.shadowRadius);(0,_vitest.expect)(xxl==null?void 0:xxl.shadowRadius).toBeGreaterThan(xl==null?void 0:xl.shadowRadius);});(0,_vitest.it)("should use consistent shadow color",function(){var shadows=["shadow-sm","shadow","shadow-md","shadow-lg","shadow-xl","shadow-2xl"];shadows.forEach(function(shadow){var result=(0,_shadows.parseShadow)(shadow);(0,_vitest.expect)(result==null?void 0:result.shadowColor).toBe("#000000");});});(0,_vitest.it)("should have proper shadowOffset structure",function(){var result=(0,_shadows.parseShadow)("shadow");var shadowOffset=result==null?void 0:result.shadowOffset;(0,_vitest.expect)(shadowOffset).toHaveProperty("width");(0,_vitest.expect)(shadowOffset).toHaveProperty("height");if(typeof shadowOffset==="object"&&shadowOffset!==null){(0,_vitest.expect)(typeof shadowOffset.width).toBe("number");(0,_vitest.expect)(typeof shadowOffset.height).toBe("number");}});(0,_vitest.it)("should include both iOS shadow and Android elevation properties",function(){var result=(0,_shadows.parseShadow)("shadow");(0,_vitest.expect)(result).toHaveProperty("shadowColor");(0,_vitest.expect)(result).toHaveProperty("shadowOffset");(0,_vitest.expect)(result).toHaveProperty("shadowOpacity");(0,_vitest.expect)(result).toHaveProperty("shadowRadius");(0,_vitest.expect)(result).toHaveProperty("elevation");});});(0,_vitest.describe)("parseShadow - shadow properties (Android)",function(){(0,_vitest.it)("should have increasing elevation values for larger shadows",function(){var sm=(0,_shadows.parseShadow)("shadow-sm");var md=(0,_shadows.parseShadow)("shadow-md");var lg=(0,_shadows.parseShadow)("shadow-lg");var xl=(0,_shadows.parseShadow)("shadow-xl");var xxl=(0,_shadows.parseShadow)("shadow-2xl");(0,_vitest.expect)(md==null?void 0:md.elevation).toBeGreaterThan(sm==null?void 0:sm.elevation);(0,_vitest.expect)(lg==null?void 0:lg.elevation).toBeGreaterThan(md==null?void 0:md.elevation);(0,_vitest.expect)(xl==null?void 0:xl.elevation).toBeGreaterThan(lg==null?void 0:lg.elevation);(0,_vitest.expect)(xxl==null?void 0:xxl.elevation).toBeGreaterThan(xl==null?void 0:xl.elevation);});(0,_vitest.it)("should include elevation property for Android",function(){var result=(0,_shadows.parseShadow)("shadow");(0,_vitest.expect)(result).toHaveProperty("elevation");(0,_vitest.expect)(typeof(result==null?void 0:result.elevation)).toBe("number");});});(0,_vitest.describe)("parseShadow - invalid classes",function(){(0,_vitest.it)("should return null for invalid shadow classes",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-invalid")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadows")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-small")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-3xl")).toBeNull();});(0,_vitest.it)("should return null for non-shadow classes",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("bg-blue-500")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("p-4")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("text-white")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("border-2")).toBeNull();});(0,_vitest.it)("should return null for empty or invalid input",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow123")).toBeNull();});});(0,_vitest.describe)("parseShadow - comprehensive coverage",function(){(0,_vitest.it)("should parse all shadow variants without errors",function(){var variants=["shadow-sm","shadow","shadow-md","shadow-lg","shadow-xl","shadow-2xl","shadow-none"];variants.forEach(function(variant){var result=(0,_shadows.parseShadow)(variant);(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(typeof result).toBe("object");});});(0,_vitest.it)("should return consistent results for same input",function(){var result1=(0,_shadows.parseShadow)("shadow-md");var result2=(0,_shadows.parseShadow)("shadow-md");(0,_vitest.expect)(result1).toEqual(result2);});(0,_vitest.it)("should handle case-sensitive class names",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("SHADOW")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("Shadow-md")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-MD")).toBeNull();});});
|
|
1
|
+
var _vitest=require("vitest");var _colorUtils=require("../utils/colorUtils");var _shadows=require("./shadows");(0,_vitest.describe)("SHADOW_SCALE",function(){(0,_vitest.it)("should export complete shadow scale",function(){(0,_vitest.expect)(_shadows.SHADOW_SCALE).toMatchSnapshot();});(0,_vitest.it)("should have all shadow variants",function(){(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-sm");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-md");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-lg");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-xl");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-2xl");(0,_vitest.expect)(_shadows.SHADOW_SCALE).toHaveProperty("shadow-none");});});(0,_vitest.describe)("parseShadow - basic shadows",function(){(0,_vitest.it)("should parse shadow-sm",function(){var result=(0,_shadows.parseShadow)("shadow-sm");(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(result).toHaveProperty("shadowColor");(0,_vitest.expect)(result).toHaveProperty("shadowOffset");(0,_vitest.expect)(result).toHaveProperty("shadowOpacity");(0,_vitest.expect)(result).toHaveProperty("shadowRadius");});(0,_vitest.it)("should parse default shadow",function(){var result=(0,_shadows.parseShadow)("shadow");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-md",function(){var result=(0,_shadows.parseShadow)("shadow-md");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-lg",function(){var result=(0,_shadows.parseShadow)("shadow-lg");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-xl",function(){var result=(0,_shadows.parseShadow)("shadow-xl");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-2xl",function(){var result=(0,_shadows.parseShadow)("shadow-2xl");(0,_vitest.expect)(result).toBeTruthy();});(0,_vitest.it)("should parse shadow-none",function(){var result=(0,_shadows.parseShadow)("shadow-none");(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(result).toMatchObject({shadowColor:"transparent",shadowOpacity:0,shadowRadius:0});});});(0,_vitest.describe)("parseShadow - shadow properties (iOS)",function(){(0,_vitest.it)("should have increasing shadow values for larger shadows",function(){var sm=(0,_shadows.parseShadow)("shadow-sm");var md=(0,_shadows.parseShadow)("shadow-md");var lg=(0,_shadows.parseShadow)("shadow-lg");var xl=(0,_shadows.parseShadow)("shadow-xl");var xxl=(0,_shadows.parseShadow)("shadow-2xl");(0,_vitest.expect)(md==null?void 0:md.shadowOpacity).toBeGreaterThan(sm==null?void 0:sm.shadowOpacity);(0,_vitest.expect)(lg==null?void 0:lg.shadowOpacity).toBeGreaterThan(md==null?void 0:md.shadowOpacity);(0,_vitest.expect)(md==null?void 0:md.shadowRadius).toBeGreaterThan(sm==null?void 0:sm.shadowRadius);(0,_vitest.expect)(lg==null?void 0:lg.shadowRadius).toBeGreaterThan(md==null?void 0:md.shadowRadius);(0,_vitest.expect)(xl==null?void 0:xl.shadowRadius).toBeGreaterThan(lg==null?void 0:lg.shadowRadius);(0,_vitest.expect)(xxl==null?void 0:xxl.shadowRadius).toBeGreaterThan(xl==null?void 0:xl.shadowRadius);});(0,_vitest.it)("should use consistent shadow color",function(){var shadows=["shadow-sm","shadow","shadow-md","shadow-lg","shadow-xl","shadow-2xl"];shadows.forEach(function(shadow){var result=(0,_shadows.parseShadow)(shadow);(0,_vitest.expect)(result==null?void 0:result.shadowColor).toBe("#000000");});});(0,_vitest.it)("should have proper shadowOffset structure",function(){var result=(0,_shadows.parseShadow)("shadow");var shadowOffset=result==null?void 0:result.shadowOffset;(0,_vitest.expect)(shadowOffset).toHaveProperty("width");(0,_vitest.expect)(shadowOffset).toHaveProperty("height");if(typeof shadowOffset==="object"&&shadowOffset!==null){(0,_vitest.expect)(typeof shadowOffset.width).toBe("number");(0,_vitest.expect)(typeof shadowOffset.height).toBe("number");}});(0,_vitest.it)("should include both iOS shadow and Android elevation properties",function(){var result=(0,_shadows.parseShadow)("shadow");(0,_vitest.expect)(result).toHaveProperty("shadowColor");(0,_vitest.expect)(result).toHaveProperty("shadowOffset");(0,_vitest.expect)(result).toHaveProperty("shadowOpacity");(0,_vitest.expect)(result).toHaveProperty("shadowRadius");(0,_vitest.expect)(result).toHaveProperty("elevation");});});(0,_vitest.describe)("parseShadow - shadow properties (Android)",function(){(0,_vitest.it)("should have increasing elevation values for larger shadows",function(){var sm=(0,_shadows.parseShadow)("shadow-sm");var md=(0,_shadows.parseShadow)("shadow-md");var lg=(0,_shadows.parseShadow)("shadow-lg");var xl=(0,_shadows.parseShadow)("shadow-xl");var xxl=(0,_shadows.parseShadow)("shadow-2xl");(0,_vitest.expect)(md==null?void 0:md.elevation).toBeGreaterThan(sm==null?void 0:sm.elevation);(0,_vitest.expect)(lg==null?void 0:lg.elevation).toBeGreaterThan(md==null?void 0:md.elevation);(0,_vitest.expect)(xl==null?void 0:xl.elevation).toBeGreaterThan(lg==null?void 0:lg.elevation);(0,_vitest.expect)(xxl==null?void 0:xxl.elevation).toBeGreaterThan(xl==null?void 0:xl.elevation);});(0,_vitest.it)("should include elevation property for Android",function(){var result=(0,_shadows.parseShadow)("shadow");(0,_vitest.expect)(result).toHaveProperty("elevation");(0,_vitest.expect)(typeof(result==null?void 0:result.elevation)).toBe("number");});});(0,_vitest.describe)("parseShadow - invalid classes",function(){(0,_vitest.it)("should return null for invalid shadow classes",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-invalidcolor")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadows")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-small")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-3xl")).toBeNull();});(0,_vitest.it)("should return null for non-shadow classes",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("bg-blue-500")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("p-4")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("text-white")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("border-2")).toBeNull();});(0,_vitest.it)("should return null for empty or invalid input",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow123")).toBeNull();});});(0,_vitest.describe)("parseShadow - comprehensive coverage",function(){(0,_vitest.it)("should parse all shadow variants without errors",function(){var variants=["shadow-sm","shadow","shadow-md","shadow-lg","shadow-xl","shadow-2xl","shadow-none"];variants.forEach(function(variant){var result=(0,_shadows.parseShadow)(variant);(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(typeof result).toBe("object");});});(0,_vitest.it)("should return consistent results for same input",function(){var result1=(0,_shadows.parseShadow)("shadow-md");var result2=(0,_shadows.parseShadow)("shadow-md");(0,_vitest.expect)(result1).toEqual(result2);});(0,_vitest.it)("should handle case-sensitive class names",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("SHADOW")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("Shadow-md")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-MD")).toBeNull();});});(0,_vitest.describe)("parseShadow - shadow colors",function(){(0,_vitest.it)("should parse shadow color with preset colors",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-500")).toEqual({shadowColor:_shadows.SHADOW_COLORS["red-500"]});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-blue-800")).toEqual({shadowColor:_shadows.SHADOW_COLORS["blue-800"]});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-green-600")).toEqual({shadowColor:_shadows.SHADOW_COLORS["green-600"]});});(0,_vitest.it)("should parse shadow color with basic colors",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-black")).toEqual({shadowColor:_shadows.SHADOW_COLORS.black});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-white")).toEqual({shadowColor:_shadows.SHADOW_COLORS.white});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-transparent")).toEqual({shadowColor:"transparent"});});(0,_vitest.it)("should parse shadow color with opacity modifier",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-500/50")).toEqual({shadowColor:(0,_colorUtils.applyOpacity)(_shadows.SHADOW_COLORS["red-500"],50)});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-blue-800/80")).toEqual({shadowColor:(0,_colorUtils.applyOpacity)(_shadows.SHADOW_COLORS["blue-800"],80)});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-black/25")).toEqual({shadowColor:(0,_colorUtils.applyOpacity)(_shadows.SHADOW_COLORS.black,25)});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-white/0")).toEqual({shadowColor:(0,_colorUtils.applyOpacity)(_shadows.SHADOW_COLORS.white,0)});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-green-500/100")).toEqual({shadowColor:(0,_colorUtils.applyOpacity)(_shadows.SHADOW_COLORS["green-500"],100)});});(0,_vitest.it)("should parse shadow color with arbitrary hex values",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#ff0000]")).toEqual({shadowColor:"#ff0000"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#00ff00]")).toEqual({shadowColor:"#00ff00"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#0000ff]")).toEqual({shadowColor:"#0000ff"});});(0,_vitest.it)("should parse shadow color with 3-digit hex values",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#f00]")).toEqual({shadowColor:"#ff0000"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#0f0]")).toEqual({shadowColor:"#00ff00"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#00f]")).toEqual({shadowColor:"#0000ff"});});(0,_vitest.it)("should parse shadow color with arbitrary hex and opacity",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#ff0000]/50")).toEqual({shadowColor:"#FF000080"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#00ff00]/25")).toEqual({shadowColor:"#00FF0040"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#0000ff]/80")).toEqual({shadowColor:"#0000FFCC"});});(0,_vitest.it)("should parse shadow color with 8-digit hex (with alpha)",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#ff000080]")).toEqual({shadowColor:"#ff000080"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-[#00ff00cc]")).toEqual({shadowColor:"#00ff00cc"});});(0,_vitest.it)("should handle transparent with opacity modifier",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-transparent/50")).toEqual({shadowColor:"transparent"});});(0,_vitest.it)("should return null for invalid opacity values",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-500/101")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-500/-1")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-500/abc")).toBeNull();});(0,_vitest.it)("should return null for invalid color names",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-notacolor")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-foobar-500")).toBeNull();(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-999")).toBeNull();});});(0,_vitest.describe)("parseShadow - shadow colors with custom colors",function(){var customColors={brand:"#FF5733","brand-primary":"#3498DB","brand-secondary":"#2ECC71"};(0,_vitest.it)("should parse shadow with custom colors",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-brand",customColors)).toEqual({shadowColor:"#FF5733"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-brand-primary",customColors)).toEqual({shadowColor:"#3498DB"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-brand-secondary",customColors)).toEqual({shadowColor:"#2ECC71"});});(0,_vitest.it)("should parse shadow with custom colors and opacity",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-brand/50",customColors)).toEqual({shadowColor:"#FF573380"});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-brand-primary/80",customColors)).toEqual({shadowColor:"#3498DBCC"});});(0,_vitest.it)("should still support preset colors with custom colors",function(){(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-500",customColors)).toEqual({shadowColor:_shadows.SHADOW_COLORS["red-500"]});(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-blue-800/50",customColors)).toEqual({shadowColor:(0,_colorUtils.applyOpacity)(_shadows.SHADOW_COLORS["blue-800"],50)});});(0,_vitest.it)("should allow custom colors to override presets",function(){var overrideColors={"red-500":"#CUSTOM1"};(0,_vitest.expect)((0,_shadows.parseShadow)("shadow-red-500",overrideColors)).toEqual({shadowColor:"#CUSTOM1"});});});
|