sonance-brand-mcp 1.3.24 → 1.3.26
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.
|
@@ -57,6 +57,7 @@ export function ChatInterface({
|
|
|
57
57
|
const [input, setInput] = useState("");
|
|
58
58
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
59
59
|
const messagesEndRef = useRef<HTMLDivElement>(null);
|
|
60
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
60
61
|
|
|
61
62
|
// Scroll to bottom when messages change
|
|
62
63
|
useEffect(() => {
|
|
@@ -126,6 +127,7 @@ export function ChatInterface({
|
|
|
126
127
|
|
|
127
128
|
setMessages((prev) => [...prev, userMessage]);
|
|
128
129
|
setInput("");
|
|
130
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
129
131
|
setIsProcessing(true);
|
|
130
132
|
|
|
131
133
|
try {
|
|
@@ -216,11 +218,14 @@ export function ChatInterface({
|
|
|
216
218
|
};
|
|
217
219
|
|
|
218
220
|
const handleSend = async (prompt: string) => {
|
|
219
|
-
if (
|
|
221
|
+
// Fallback: read from DOM if React state is empty (browser automation compatibility)
|
|
222
|
+
const actualPrompt = prompt || inputRef.current?.value || "";
|
|
223
|
+
|
|
224
|
+
if (!actualPrompt.trim() || isProcessing) return;
|
|
220
225
|
|
|
221
226
|
// Use vision mode handler if vision mode is active
|
|
222
227
|
if (visionMode) {
|
|
223
|
-
return handleVisionEdit(
|
|
228
|
+
return handleVisionEdit(actualPrompt);
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
// If no component is selected, intercept the request
|
|
@@ -228,11 +233,12 @@ export function ChatInterface({
|
|
|
228
233
|
const userMessage: ChatMessage = {
|
|
229
234
|
id: `msg-${Date.now()}`,
|
|
230
235
|
role: "user",
|
|
231
|
-
content:
|
|
236
|
+
content: actualPrompt,
|
|
232
237
|
timestamp: new Date(),
|
|
233
238
|
};
|
|
234
239
|
setMessages((prev) => [...prev, userMessage]);
|
|
235
240
|
setInput("");
|
|
241
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
236
242
|
|
|
237
243
|
setTimeout(() => {
|
|
238
244
|
const assistantMessage: ChatMessage = {
|
|
@@ -249,12 +255,13 @@ export function ChatInterface({
|
|
|
249
255
|
const userMessage: ChatMessage = {
|
|
250
256
|
id: `msg-${Date.now()}`,
|
|
251
257
|
role: "user",
|
|
252
|
-
content:
|
|
258
|
+
content: actualPrompt,
|
|
253
259
|
timestamp: new Date(),
|
|
254
260
|
};
|
|
255
261
|
|
|
256
262
|
setMessages((prev) => [...prev, userMessage]);
|
|
257
263
|
setInput("");
|
|
264
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
258
265
|
setIsProcessing(true);
|
|
259
266
|
|
|
260
267
|
try {
|
|
@@ -285,7 +292,7 @@ export function ChatInterface({
|
|
|
285
292
|
componentType,
|
|
286
293
|
filePath,
|
|
287
294
|
currentCode: sourceData.content,
|
|
288
|
-
userRequest:
|
|
295
|
+
userRequest: actualPrompt,
|
|
289
296
|
// Variant-scoped editing context
|
|
290
297
|
editScope,
|
|
291
298
|
variantId: editScope === "variant" ? variantId : undefined,
|
|
@@ -390,13 +397,14 @@ export function ChatInterface({
|
|
|
390
397
|
{/* Input */}
|
|
391
398
|
<div className="flex gap-2">
|
|
392
399
|
<input
|
|
400
|
+
ref={inputRef}
|
|
393
401
|
type="text"
|
|
394
402
|
value={input}
|
|
395
403
|
onChange={(e) => setInput(e.target.value)}
|
|
396
404
|
onKeyDown={(e) => {
|
|
397
405
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
398
406
|
e.preventDefault();
|
|
399
|
-
handleSend(input);
|
|
407
|
+
handleSend(input || inputRef.current?.value || "");
|
|
400
408
|
}
|
|
401
409
|
}}
|
|
402
410
|
placeholder={
|
|
@@ -418,8 +426,8 @@ export function ChatInterface({
|
|
|
418
426
|
)}
|
|
419
427
|
/>
|
|
420
428
|
<button
|
|
421
|
-
onClick={() => handleSend(input)}
|
|
422
|
-
disabled={isProcessing
|
|
429
|
+
onClick={() => handleSend(input || inputRef.current?.value || "")}
|
|
430
|
+
disabled={isProcessing}
|
|
423
431
|
className={cn(
|
|
424
432
|
"px-3 py-2 rounded transition-colors",
|
|
425
433
|
visionMode
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonance-brand-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
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",
|