@mgcrea/react-native-tailwind 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,426 @@
1
+ import { parseSync } from "@babel/core";
2
+ import * as t from "@babel/types";
3
+ import { describe, expect, it } from "vitest";
4
+ import { getComponentModifierSupport, getStatePropertyForModifier } from "./componentSupport";
5
+
6
+ /**
7
+ * Helper to create a JSXOpeningElement from JSX code
8
+ */
9
+ function createJSXElement(code: string): t.JSXOpeningElement {
10
+ const ast = parseSync(code, {
11
+ sourceType: "module",
12
+ plugins: [["@babel/plugin-syntax-jsx", {}]],
13
+ filename: "test.tsx",
14
+ configFile: false,
15
+ babelrc: false,
16
+ });
17
+
18
+ if (!ast) {
19
+ throw new Error(`Failed to parse: ${code}`);
20
+ }
21
+
22
+ // Find the JSXOpeningElement in the AST
23
+ let element: t.JSXOpeningElement | null = null;
24
+
25
+ const traverse = (node: t.Node) => {
26
+ if (t.isJSXOpeningElement(node)) {
27
+ element = node;
28
+ return;
29
+ }
30
+ for (const key in node) {
31
+ // @ts-expect-error - Dynamic key access
32
+ if (node[key] && typeof node[key] === "object") {
33
+ // @ts-expect-error - Dynamic key access
34
+ traverse(node[key] as t.Node);
35
+ }
36
+ }
37
+ };
38
+
39
+ traverse(ast);
40
+
41
+ if (!element) {
42
+ throw new Error(`Could not find JSXOpeningElement in: ${code}`);
43
+ }
44
+
45
+ return element;
46
+ }
47
+
48
+ describe("getComponentModifierSupport", () => {
49
+ describe("Supported components", () => {
50
+ it("should recognize Pressable component", () => {
51
+ const element = createJSXElement("<Pressable />");
52
+ const result = getComponentModifierSupport(element, t);
53
+
54
+ expect(result).toEqual({
55
+ component: "Pressable",
56
+ supportedModifiers: ["active", "hover", "focus", "disabled"],
57
+ });
58
+ });
59
+
60
+ it("should recognize TextInput component", () => {
61
+ const element = createJSXElement("<TextInput />");
62
+ const result = getComponentModifierSupport(element, t);
63
+
64
+ expect(result).toEqual({
65
+ component: "TextInput",
66
+ supportedModifiers: ["focus", "disabled", "placeholder"],
67
+ });
68
+ });
69
+
70
+ it("should recognize Pressable with attributes", () => {
71
+ const element = createJSXElement('<Pressable className="m-4" onPress={handlePress} />');
72
+ const result = getComponentModifierSupport(element, t);
73
+
74
+ expect(result).toEqual({
75
+ component: "Pressable",
76
+ supportedModifiers: ["active", "hover", "focus", "disabled"],
77
+ });
78
+ });
79
+
80
+ it("should recognize TextInput with attributes", () => {
81
+ const element = createJSXElement('<TextInput className="border" placeholder="Email" />');
82
+ const result = getComponentModifierSupport(element, t);
83
+
84
+ expect(result).toEqual({
85
+ component: "TextInput",
86
+ supportedModifiers: ["focus", "disabled", "placeholder"],
87
+ });
88
+ });
89
+ });
90
+
91
+ describe("Member expressions", () => {
92
+ it("should recognize ReactNative.Pressable", () => {
93
+ const element = createJSXElement("<ReactNative.Pressable />");
94
+ const result = getComponentModifierSupport(element, t);
95
+
96
+ expect(result).toEqual({
97
+ component: "Pressable",
98
+ supportedModifiers: ["active", "hover", "focus", "disabled"],
99
+ });
100
+ });
101
+
102
+ it("should recognize RN.TextInput", () => {
103
+ const element = createJSXElement("<RN.TextInput />");
104
+ const result = getComponentModifierSupport(element, t);
105
+
106
+ expect(result).toEqual({
107
+ component: "TextInput",
108
+ supportedModifiers: ["focus", "disabled", "placeholder"],
109
+ });
110
+ });
111
+
112
+ it("should recognize nested member expressions", () => {
113
+ const element = createJSXElement("<Components.Input.TextInput />");
114
+ const result = getComponentModifierSupport(element, t);
115
+
116
+ // Should extract "TextInput" from the rightmost property
117
+ expect(result).toEqual({
118
+ component: "TextInput",
119
+ supportedModifiers: ["focus", "disabled", "placeholder"],
120
+ });
121
+ });
122
+
123
+ it("should recognize Pressable in namespaced imports", () => {
124
+ const element = createJSXElement("<UI.Pressable />");
125
+ const result = getComponentModifierSupport(element, t);
126
+
127
+ expect(result).toEqual({
128
+ component: "Pressable",
129
+ supportedModifiers: ["active", "hover", "focus", "disabled"],
130
+ });
131
+ });
132
+ });
133
+
134
+ describe("Unsupported components", () => {
135
+ it("should return null for View", () => {
136
+ const element = createJSXElement("<View />");
137
+ const result = getComponentModifierSupport(element, t);
138
+
139
+ expect(result).toBeNull();
140
+ });
141
+
142
+ it("should return null for TouchableOpacity", () => {
143
+ const element = createJSXElement("<TouchableOpacity />");
144
+ const result = getComponentModifierSupport(element, t);
145
+
146
+ expect(result).toBeNull();
147
+ });
148
+
149
+ it("should return null for custom components", () => {
150
+ const element = createJSXElement("<CustomButton />");
151
+ const result = getComponentModifierSupport(element, t);
152
+
153
+ expect(result).toBeNull();
154
+ });
155
+
156
+ it("should return null for Text", () => {
157
+ const element = createJSXElement("<Text />");
158
+ const result = getComponentModifierSupport(element, t);
159
+
160
+ expect(result).toBeNull();
161
+ });
162
+
163
+ it("should return null for Image", () => {
164
+ const element = createJSXElement("<Image />");
165
+ const result = getComponentModifierSupport(element, t);
166
+
167
+ expect(result).toBeNull();
168
+ });
169
+ });
170
+
171
+ describe("Edge cases", () => {
172
+ it("should be case-sensitive", () => {
173
+ // lowercase "pressable" should not match
174
+ const element = createJSXElement("<pressable />");
175
+ const result = getComponentModifierSupport(element, t);
176
+
177
+ expect(result).toBeNull();
178
+ });
179
+
180
+ it("should not match similar names", () => {
181
+ const element1 = createJSXElement("<PressableButton />");
182
+ const result1 = getComponentModifierSupport(element1, t);
183
+ expect(result1).toBeNull();
184
+
185
+ const element2 = createJSXElement("<MyPressable />");
186
+ const result2 = getComponentModifierSupport(element2, t);
187
+ expect(result2).toBeNull();
188
+
189
+ const element3 = createJSXElement("<TextInputField />");
190
+ const result3 = getComponentModifierSupport(element3, t);
191
+ expect(result3).toBeNull();
192
+ });
193
+
194
+ it("should handle self-closing tags", () => {
195
+ const element = createJSXElement("<Pressable />");
196
+ const result = getComponentModifierSupport(element, t);
197
+
198
+ expect(result).not.toBeNull();
199
+ expect(result?.component).toBe("Pressable");
200
+ });
201
+
202
+ it("should return null for non-JSXOpeningElement nodes", () => {
203
+ // Test with a random node type
204
+ const identifier = t.identifier("foo");
205
+ const result = getComponentModifierSupport(identifier, t);
206
+
207
+ expect(result).toBeNull();
208
+ });
209
+
210
+ it("should return null for JSXFragment", () => {
211
+ // JSXFragment doesn't have a JSXOpeningElement, so create a mock fragment
212
+ const fragment = {
213
+ type: "JSXFragment",
214
+ openingFragment: {},
215
+ closingFragment: {},
216
+ children: [],
217
+ };
218
+
219
+ const result = getComponentModifierSupport(fragment as t.Node, t);
220
+ expect(result).toBeNull();
221
+ });
222
+ });
223
+
224
+ describe("Modifier support differences", () => {
225
+ it("should show Pressable supports active modifier but TextInput does not", () => {
226
+ const pressable = createJSXElement("<Pressable />");
227
+ const textInput = createJSXElement("<TextInput />");
228
+
229
+ const pressableResult = getComponentModifierSupport(pressable, t);
230
+ const textInputResult = getComponentModifierSupport(textInput, t);
231
+
232
+ expect(pressableResult?.supportedModifiers).toContain("active");
233
+ expect(textInputResult?.supportedModifiers).not.toContain("active");
234
+ });
235
+
236
+ it("should show both support focus modifier", () => {
237
+ const pressable = createJSXElement("<Pressable />");
238
+ const textInput = createJSXElement("<TextInput />");
239
+
240
+ const pressableResult = getComponentModifierSupport(pressable, t);
241
+ const textInputResult = getComponentModifierSupport(textInput, t);
242
+
243
+ expect(pressableResult?.supportedModifiers).toContain("focus");
244
+ expect(textInputResult?.supportedModifiers).toContain("focus");
245
+ });
246
+
247
+ it("should show TextInput supports placeholder but Pressable does not", () => {
248
+ const pressable = createJSXElement("<Pressable />");
249
+ const textInput = createJSXElement("<TextInput />");
250
+
251
+ const pressableResult = getComponentModifierSupport(pressable, t);
252
+ const textInputResult = getComponentModifierSupport(textInput, t);
253
+
254
+ expect(pressableResult?.supportedModifiers).not.toContain("placeholder");
255
+ expect(textInputResult?.supportedModifiers).toContain("placeholder");
256
+ });
257
+
258
+ it("should show both support disabled modifier", () => {
259
+ const pressable = createJSXElement("<Pressable />");
260
+ const textInput = createJSXElement("<TextInput />");
261
+
262
+ const pressableResult = getComponentModifierSupport(pressable, t);
263
+ const textInputResult = getComponentModifierSupport(textInput, t);
264
+
265
+ expect(pressableResult?.supportedModifiers).toContain("disabled");
266
+ expect(textInputResult?.supportedModifiers).toContain("disabled");
267
+ });
268
+ });
269
+ });
270
+
271
+ describe("getStatePropertyForModifier", () => {
272
+ it("should map active to pressed", () => {
273
+ expect(getStatePropertyForModifier("active")).toBe("pressed");
274
+ });
275
+
276
+ it("should map hover to hovered", () => {
277
+ expect(getStatePropertyForModifier("hover")).toBe("hovered");
278
+ });
279
+
280
+ it("should map focus to focused", () => {
281
+ expect(getStatePropertyForModifier("focus")).toBe("focused");
282
+ });
283
+
284
+ it("should map disabled to disabled", () => {
285
+ expect(getStatePropertyForModifier("disabled")).toBe("disabled");
286
+ });
287
+
288
+ it("should return pressed as fallback for unknown modifiers", () => {
289
+ // @ts-expect-error - Testing fallback with invalid modifier
290
+ expect(getStatePropertyForModifier("unknown")).toBe("pressed");
291
+
292
+ // @ts-expect-error - Testing fallback with invalid modifier
293
+ expect(getStatePropertyForModifier("invalid")).toBe("pressed");
294
+
295
+ // @ts-expect-error - Testing fallback with invalid modifier
296
+ expect(getStatePropertyForModifier("")).toBe("pressed");
297
+ });
298
+
299
+ it("should handle all Pressable modifier states", () => {
300
+ // Pressable supports: active, hover, focus, disabled
301
+ const pressableModifiers: Array<"active" | "hover" | "focus" | "disabled"> = [
302
+ "active",
303
+ "hover",
304
+ "focus",
305
+ "disabled",
306
+ ];
307
+
308
+ const expectedMapping = {
309
+ active: "pressed",
310
+ hover: "hovered",
311
+ focus: "focused",
312
+ disabled: "disabled",
313
+ };
314
+
315
+ for (const modifier of pressableModifiers) {
316
+ expect(getStatePropertyForModifier(modifier)).toBe(expectedMapping[modifier]);
317
+ }
318
+ });
319
+
320
+ it("should handle all TextInput modifier states", () => {
321
+ // TextInput supports: focus, disabled, placeholder
322
+ // Note: placeholder doesn't have a state property (it's a prop, not state)
323
+ const textInputModifiers: Array<"focus" | "disabled"> = ["focus", "disabled"];
324
+
325
+ const expectedMapping = {
326
+ focus: "focused",
327
+ disabled: "disabled",
328
+ };
329
+
330
+ for (const modifier of textInputModifiers) {
331
+ expect(getStatePropertyForModifier(modifier)).toBe(expectedMapping[modifier]);
332
+ }
333
+ });
334
+ });
335
+
336
+ describe("Integration - Real-world scenarios", () => {
337
+ it("should correctly identify modifiers for a Pressable button", () => {
338
+ const element = createJSXElement(
339
+ '<Pressable className="active:bg-blue-700 hover:bg-blue-600 disabled:bg-gray-300" />',
340
+ );
341
+ const result = getComponentModifierSupport(element, t);
342
+
343
+ expect(result).not.toBeNull();
344
+ expect(result?.component).toBe("Pressable");
345
+
346
+ // Verify all used modifiers are supported
347
+ expect(result?.supportedModifiers).toContain("active");
348
+ expect(result?.supportedModifiers).toContain("hover");
349
+ expect(result?.supportedModifiers).toContain("disabled");
350
+ });
351
+
352
+ it("should correctly identify modifiers for a TextInput field", () => {
353
+ const element = createJSXElement(
354
+ '<TextInput className="focus:border-blue-500 disabled:bg-gray-100 placeholder:text-gray-400" />',
355
+ );
356
+ const result = getComponentModifierSupport(element, t);
357
+
358
+ expect(result).not.toBeNull();
359
+ expect(result?.component).toBe("TextInput");
360
+
361
+ // Verify all used modifiers are supported
362
+ expect(result?.supportedModifiers).toContain("focus");
363
+ expect(result?.supportedModifiers).toContain("disabled");
364
+ expect(result?.supportedModifiers).toContain("placeholder");
365
+ });
366
+
367
+ it("should handle namespaced components from imports", () => {
368
+ const element = createJSXElement('<RN.Pressable className="active:opacity-80" />');
369
+ const result = getComponentModifierSupport(element, t);
370
+
371
+ expect(result).not.toBeNull();
372
+ expect(result?.component).toBe("Pressable");
373
+ expect(result?.supportedModifiers).toContain("active");
374
+ });
375
+
376
+ it("should return null for unsupported components with modifiers", () => {
377
+ const element = createJSXElement('<View className="hover:bg-blue-500" />');
378
+ const result = getComponentModifierSupport(element, t);
379
+
380
+ // View doesn't support modifiers
381
+ expect(result).toBeNull();
382
+ });
383
+
384
+ it("should map all Pressable modifiers to correct state properties", () => {
385
+ const element = createJSXElement("<Pressable />");
386
+ const result = getComponentModifierSupport(element, t);
387
+
388
+ expect(result).not.toBeNull();
389
+
390
+ // Test each supported modifier maps correctly
391
+ const modifiers = result?.supportedModifiers as Array<"active" | "hover" | "focus" | "disabled">;
392
+ for (const modifier of modifiers) {
393
+ const stateProp = getStatePropertyForModifier(modifier);
394
+ expect(stateProp).toBeTruthy();
395
+ expect(typeof stateProp).toBe("string");
396
+ }
397
+
398
+ // Verify the mappings
399
+ expect(getStatePropertyForModifier("active")).toBe("pressed");
400
+ expect(getStatePropertyForModifier("hover")).toBe("hovered");
401
+ expect(getStatePropertyForModifier("focus")).toBe("focused");
402
+ expect(getStatePropertyForModifier("disabled")).toBe("disabled");
403
+ });
404
+
405
+ it("should map all TextInput modifiers to correct state properties", () => {
406
+ const element = createJSXElement("<TextInput />");
407
+ const result = getComponentModifierSupport(element, t);
408
+
409
+ expect(result).not.toBeNull();
410
+
411
+ // Filter out placeholder as it doesn't have a state property
412
+ const stateModifiers = result?.supportedModifiers.filter((m) => m !== "placeholder") as Array<
413
+ "focus" | "disabled"
414
+ >;
415
+
416
+ for (const modifier of stateModifiers) {
417
+ const stateProp = getStatePropertyForModifier(modifier);
418
+ expect(stateProp).toBeTruthy();
419
+ expect(typeof stateProp).toBe("string");
420
+ }
421
+
422
+ // Verify the mappings
423
+ expect(getStatePropertyForModifier("focus")).toBe("focused");
424
+ expect(getStatePropertyForModifier("disabled")).toBe("disabled");
425
+ });
426
+ });
@@ -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 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();});});});
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();});});});