sonance-brand-mcp 1.3.69 → 1.3.71

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.
@@ -602,10 +602,11 @@ function searchFilesSmart(
602
602
  const VISION_SYSTEM_PROMPT = `You edit code. Return ONLY valid JSON - no explanation, no preamble, no markdown.
603
603
 
604
604
  RULES:
605
- 1. Copy code EXACTLY from the file - character for character
606
- 2. Make the SMALLEST possible change
607
- 3. For color changes, just change the className
608
- 4. Do not restructure or reorganize code
605
+ 1. Make ONLY the exact change the user requested. Do not modify unrelated properties.
606
+ 2. Copy code EXACTLY from the file - character for character
607
+ 3. Make the SMALLEST possible change
608
+ 4. For color changes, just change the className
609
+ 5. Do not restructure or reorganize code
609
610
 
610
611
  RESPOND WITH ONLY THIS JSON FORMAT (nothing else):
611
612
  {"modifications":[{"filePath":"path","patches":[{"search":"exact code","replace":"changed code"}]}]}`;
@@ -598,10 +598,11 @@ function searchFilesSmart(
598
598
  const VISION_SYSTEM_PROMPT = `You edit code. Return ONLY valid JSON - no explanation, no preamble, no markdown.
599
599
 
600
600
  RULES:
601
- 1. Copy code EXACTLY from the file - character for character
602
- 2. Make the SMALLEST possible change
603
- 3. For color changes, just change the className
604
- 4. Do not restructure or reorganize code
601
+ 1. Make ONLY the exact change the user requested. Do not modify unrelated properties.
602
+ 2. Copy code EXACTLY from the file - character for character
603
+ 3. Make the SMALLEST possible change
604
+ 4. For color changes, just change the className
605
+ 5. Do not restructure or reorganize code
605
606
 
606
607
  RESPOND WITH ONLY THIS JSON FORMAT (nothing else):
607
608
  {"modifications":[{"filePath":"path","patches":[{"search":"exact code","replace":"changed code"}]}]}`;
@@ -41,15 +41,18 @@ function extractClassNameChanges(diff: string): { removed: string[]; added: stri
41
41
 
42
42
  /**
43
43
  * Common Tailwind class to CSS mapping for preview
44
- * Only covers the most common styling classes for quick previews
44
+ * Covers styling classes for instant visual feedback
45
45
  */
46
46
  const TAILWIND_TO_CSS: Record<string, string> = {
47
- // Text colors
47
+ // Text colors - basic
48
48
  "text-white": "color: white !important;",
49
49
  "text-black": "color: black !important;",
50
50
  "text-gray-900": "color: rgb(17, 24, 39) !important;",
51
+ "text-gray-800": "color: rgb(31, 41, 55) !important;",
51
52
  "text-gray-700": "color: rgb(55, 65, 81) !important;",
53
+ "text-gray-600": "color: rgb(75, 85, 99) !important;",
52
54
  "text-gray-500": "color: rgb(107, 114, 128) !important;",
55
+ "text-gray-400": "color: rgb(156, 163, 175) !important;",
53
56
 
54
57
  // Sonance brand colors
55
58
  "text-sonance-charcoal": "color: #333F48 !important;",
@@ -59,23 +62,55 @@ const TAILWIND_TO_CSS: Record<string, string> = {
59
62
  "bg-sonance-charcoal": "background-color: #333F48 !important;",
60
63
  "bg-sonance-blue": "background-color: #00D3C8 !important;",
61
64
 
62
- // Semantic colors
65
+ // Semantic text colors
63
66
  "text-primary": "color: var(--primary) !important;",
64
67
  "text-primary-foreground": "color: var(--primary-foreground) !important;",
68
+ "text-secondary": "color: var(--secondary) !important;",
69
+ "text-secondary-foreground": "color: var(--secondary-foreground) !important;",
65
70
  "text-accent": "color: var(--accent) !important;",
66
71
  "text-accent-foreground": "color: var(--accent-foreground) !important;",
72
+ "text-foreground": "color: var(--foreground) !important;",
73
+ "text-muted": "color: var(--muted) !important;",
74
+ "text-muted-foreground": "color: var(--muted-foreground) !important;",
75
+ "text-destructive": "color: var(--destructive) !important;",
76
+ "text-destructive-foreground": "color: var(--destructive-foreground) !important;",
77
+
78
+ // Semantic backgrounds
67
79
  "bg-primary": "background-color: hsl(var(--primary)) !important;",
80
+ "bg-secondary": "background-color: hsl(var(--secondary)) !important;",
68
81
  "bg-accent": "background-color: hsl(var(--accent)) !important;",
82
+ "bg-muted": "background-color: hsl(var(--muted)) !important;",
83
+ "bg-destructive": "background-color: hsl(var(--destructive)) !important;",
84
+ "bg-success": "background-color: var(--success) !important;",
85
+ "bg-card": "background-color: hsl(var(--card)) !important;",
86
+ "bg-background": "background-color: hsl(var(--background)) !important;",
69
87
 
70
88
  // Common backgrounds
71
89
  "bg-white": "background-color: white !important;",
72
90
  "bg-black": "background-color: black !important;",
91
+ "bg-gray-50": "background-color: rgb(249, 250, 251) !important;",
73
92
  "bg-gray-100": "background-color: rgb(243, 244, 246) !important;",
74
93
  "bg-gray-200": "background-color: rgb(229, 231, 235) !important;",
94
+ "bg-gray-300": "background-color: rgb(209, 213, 219) !important;",
95
+ "bg-gray-800": "background-color: rgb(31, 41, 55) !important;",
96
+ "bg-gray-900": "background-color: rgb(17, 24, 39) !important;",
97
+
98
+ // Status colors
99
+ "bg-green-500": "background-color: rgb(34, 197, 94) !important;",
100
+ "bg-green-600": "background-color: rgb(22, 163, 74) !important;",
101
+ "bg-blue-500": "background-color: rgb(59, 130, 246) !important;",
102
+ "bg-blue-600": "background-color: rgb(37, 99, 235) !important;",
103
+ "bg-red-500": "background-color: rgb(239, 68, 68) !important;",
104
+ "bg-red-600": "background-color: rgb(220, 38, 38) !important;",
105
+ "bg-yellow-500": "background-color: rgb(234, 179, 8) !important;",
106
+ "bg-orange-500": "background-color: rgb(249, 115, 22) !important;",
75
107
 
76
108
  // Borders
77
109
  "border-gray-200": "border-color: rgb(229, 231, 235) !important;",
78
110
  "border-gray-300": "border-color: rgb(209, 213, 219) !important;",
111
+ "border-primary": "border-color: hsl(var(--primary)) !important;",
112
+ "border-accent": "border-color: hsl(var(--accent)) !important;",
113
+ "border-destructive": "border-color: hsl(var(--destructive)) !important;",
79
114
  };
80
115
 
81
116
  /**
@@ -255,18 +290,17 @@ export function ApplyFirstPreview({
255
290
  }
256
291
  }, [session]);
257
292
 
258
- // CSS Preview injection for preview mode
293
+ // CSS Preview injection for ALL modes (preview AND applied)
294
+ // This ensures the user can always see visual changes immediately
259
295
  useEffect(() => {
260
- const isPreviewMode = session.isPreview === true;
261
-
262
- if (isPreviewMode && cssPreviewEnabled) {
263
- // Generate and inject preview CSS
296
+ if (cssPreviewEnabled && session.modifications.length > 0) {
297
+ // Generate and inject preview CSS to show visual changes immediately
264
298
  const previewCSS = generatePreviewCSS(session.modifications);
265
299
  if (previewCSS) {
266
300
  injectPreviewCSS(previewCSS);
267
301
  }
268
302
  } else {
269
- // Remove preview CSS when not in preview mode or disabled
303
+ // Remove preview CSS when disabled
270
304
  removePreviewCSS();
271
305
  }
272
306
 
@@ -322,22 +356,20 @@ export function ApplyFirstPreview({
322
356
  </span>
323
357
  </div>
324
358
  <div className="flex items-center gap-2">
325
- {/* CSS Preview Toggle (only in preview mode) */}
326
- {isPreviewMode && (
327
- <button
328
- onClick={toggleCssPreview}
329
- className={cn(
330
- "flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded transition-colors",
331
- cssPreviewEnabled
332
- ? "bg-blue-200 text-blue-700"
333
- : "bg-gray-200 text-gray-500"
334
- )}
335
- title={cssPreviewEnabled ? "Hide CSS preview" : "Show CSS preview"}
336
- >
337
- {cssPreviewEnabled ? <Eye className="h-3 w-3" /> : <EyeOff className="h-3 w-3" />}
338
- CSS
339
- </button>
340
- )}
359
+ {/* CSS Preview Toggle - show for all modes to ensure visual changes are visible */}
360
+ <button
361
+ onClick={toggleCssPreview}
362
+ className={cn(
363
+ "flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded transition-colors",
364
+ cssPreviewEnabled
365
+ ? isPreviewMode ? "bg-blue-200 text-blue-700" : "bg-green-200 text-green-700"
366
+ : "bg-gray-200 text-gray-500"
367
+ )}
368
+ title={cssPreviewEnabled ? "Hide visual preview" : "Show visual preview"}
369
+ >
370
+ {cssPreviewEnabled ? <Eye className="h-3 w-3" /> : <EyeOff className="h-3 w-3" />}
371
+ Preview
372
+ </button>
341
373
  <HMRStatusBadge status={status} />
342
374
  </div>
343
375
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonance-brand-mcp",
3
- "version": "1.3.69",
3
+ "version": "1.3.71",
4
4
  "description": "MCP Server for Sonance Brand Guidelines and Component Library - gives Claude instant access to brand colors, typography, and UI components.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",