gradio-pr-bot commited on
Commit
67a31e8
·
verified ·
1 Parent(s): 907c601

Upload folder using huggingface_hub

Browse files
6.3.1/vibeeditor/Index.svelte ADDED
@@ -0,0 +1,764 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { Client } from "@gradio/client";
3
+ import { onMount, tick } from "svelte";
4
+ import { BaseCode } from "@gradio/code";
5
+ import { BaseMarkdown } from "@gradio/markdown";
6
+
7
+ export let app: Client;
8
+ export let root: string;
9
+ let prompt = "";
10
+ let editorWidth = 350;
11
+ let isResizing = false;
12
+ let editorElement: HTMLDivElement;
13
+ let activeTab: "chat" | "code" = "chat";
14
+
15
+ let codeValue = "";
16
+ let diffStats: { lines_added: number; lines_removed: number } | null = null;
17
+
18
+ interface Message {
19
+ text: string;
20
+ isBot: boolean;
21
+ isPending?: boolean;
22
+ hash?: string;
23
+ }
24
+
25
+ let message_history: Message[] = [];
26
+
27
+ let history_elem: HTMLDivElement;
28
+
29
+ const scroll_to_bottom = (behavior: "smooth" | "auto" = "smooth"): void => {
30
+ if (!history_elem) return;
31
+ history_elem.scrollTo({
32
+ top: history_elem.scrollHeight,
33
+ behavior: behavior
34
+ });
35
+ };
36
+
37
+ let starterQueries: string[] = [];
38
+
39
+ const fetchStarterQueries = async (): Promise<void> => {
40
+ const post = app.post_data(`${root}/gradio_api/vibe-starter-queries/`, {});
41
+ post
42
+ .then(async ([response, status_code]) => {
43
+ if (status_code !== 200) {
44
+ throw new Error(`Error: ${status_code}`);
45
+ }
46
+ const responseData = response as {
47
+ starter_queries: string[];
48
+ };
49
+ starterQueries = responseData.starter_queries;
50
+ })
51
+ .catch(async (error) => {
52
+ console.error("Failed to fetch starter queries:", error);
53
+ });
54
+ };
55
+
56
+ fetchStarterQueries();
57
+
58
+ const submit = async (queryText?: string): Promise<void> => {
59
+ const textToSubmit = queryText || prompt;
60
+ if (textToSubmit.trim() === "") return;
61
+
62
+ // Clear diff stats when submitting new prompt
63
+ diffStats = null;
64
+
65
+ const userMessageIndex = message_history.length;
66
+ message_history = [
67
+ ...message_history,
68
+ { text: textToSubmit, isBot: false }
69
+ ];
70
+
71
+ const botMessageIndex = message_history.length;
72
+ message_history = [
73
+ ...message_history,
74
+ { text: "Working...", isBot: true, isPending: true }
75
+ ];
76
+
77
+ await tick();
78
+ scroll_to_bottom();
79
+
80
+ const userPrompt = textToSubmit;
81
+ if (!queryText) {
82
+ prompt = "";
83
+ }
84
+
85
+ const post = app.post_data(`${root}/gradio_api/vibe-edit/`, {
86
+ prompt: userPrompt
87
+ });
88
+ post
89
+ .then(async ([response, status_code]) => {
90
+ if (status_code !== 200) {
91
+ throw new Error(`Error: ${status_code}`);
92
+ }
93
+
94
+ const responseData = response as {
95
+ hash: string;
96
+ diff_stats: { lines_added: number; lines_removed: number };
97
+ reasoning: string;
98
+ };
99
+
100
+ // Update diff stats from response
101
+ diffStats = responseData.diff_stats;
102
+
103
+ message_history = message_history.map((msg, index) => {
104
+ return index === userMessageIndex
105
+ ? { ...msg, hash: responseData.hash }
106
+ : msg;
107
+ });
108
+
109
+ message_history = message_history.map((msg, index) =>
110
+ index === botMessageIndex
111
+ ? {
112
+ text: responseData.reasoning ? responseData.reasoning : "Done.",
113
+ isBot: true,
114
+ isPending: false
115
+ }
116
+ : msg
117
+ );
118
+ await tick();
119
+ scroll_to_bottom();
120
+ })
121
+ .catch(async (error) => {
122
+ message_history = message_history.map((msg, index) =>
123
+ index === botMessageIndex
124
+ ? { text: "Error occurred.", isBot: true, isPending: false }
125
+ : msg
126
+ );
127
+ await tick();
128
+ scroll_to_bottom();
129
+ });
130
+ };
131
+
132
+ const handleStarterQuery = async (query: string): Promise<void> => {
133
+ await submit(query);
134
+ };
135
+
136
+ const undoMessage = async (
137
+ hash: string,
138
+ messageIndex: number
139
+ ): Promise<void> => {
140
+ try {
141
+ await app.post_data(`${root}/gradio_api/undo-vibe-edit/`, { hash });
142
+
143
+ // Clear diff stats when undoing
144
+ diffStats = null;
145
+
146
+ const messageToUndo = message_history[messageIndex];
147
+ prompt = messageToUndo.text;
148
+
149
+ message_history = message_history.slice(0, messageIndex);
150
+ } catch (error) {
151
+ console.error("Failed to undo:", error);
152
+ }
153
+ };
154
+
155
+ const handleResizeStart = (e: MouseEvent): void => {
156
+ e.preventDefault();
157
+ isResizing = true;
158
+ document.addEventListener("mousemove", handleResizeMove);
159
+ document.addEventListener("mouseup", handleResizeEnd);
160
+ document.body.style.cursor = "col-resize";
161
+ document.body.style.userSelect = "none";
162
+ };
163
+
164
+ const handleResizeMove = (e: MouseEvent): void => {
165
+ if (!isResizing) return;
166
+
167
+ const minWidth = 250;
168
+ const maxWidth = Math.min(800, window.innerWidth * 0.5);
169
+ const newWidth = window.innerWidth - e.clientX;
170
+
171
+ editorWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));
172
+
173
+ // Dispatch custom event to update the main content margin
174
+ window.dispatchEvent(
175
+ new CustomEvent("vibeEditorResize", {
176
+ detail: { width: editorWidth }
177
+ })
178
+ );
179
+ };
180
+
181
+ const handleResizeEnd = (): void => {
182
+ isResizing = false;
183
+ document.removeEventListener("mousemove", handleResizeMove);
184
+ document.removeEventListener("mouseup", handleResizeEnd);
185
+ document.body.style.cursor = "";
186
+ document.body.style.userSelect = "";
187
+ };
188
+
189
+ const fetchCode = async (): Promise<void> => {
190
+ try {
191
+ const response = await fetch(`${root}/gradio_api/vibe-code/`, {
192
+ method: "GET",
193
+ headers: {
194
+ "Content-Type": "application/json"
195
+ }
196
+ });
197
+ if (response.ok) {
198
+ const data = await response.json();
199
+ codeValue = data.code;
200
+ }
201
+ } catch (error) {
202
+ console.error("Failed to fetch code:", error);
203
+ }
204
+ };
205
+
206
+ let code_updated = false;
207
+
208
+ const updateCode = async (): Promise<void> => {
209
+ try {
210
+ await app.post_data(`${root}/gradio_api/vibe-code/`, {
211
+ code: codeValue
212
+ });
213
+ code_updated = true;
214
+ setTimeout(() => {
215
+ code_updated = false;
216
+ }, 1000);
217
+ } catch (error) {
218
+ console.error("Failed to update code:", error);
219
+ }
220
+ };
221
+
222
+ $: (app, fetchCode());
223
+
224
+ $: if (activeTab === "chat") {
225
+ tick().then(() => scroll_to_bottom("auto"));
226
+ }
227
+
228
+ $: code_updated;
229
+
230
+ function create_spaces_url(): void {
231
+ const base_URL = "https://huggingface.co/new-space";
232
+ const params = new URLSearchParams({
233
+ name: "new-space",
234
+ sdk: "gradio"
235
+ });
236
+ const encoded_content = codeValue.trimStart();
237
+ params.append("files[0][path]", "app.py");
238
+ params.append("files[0][content]", encoded_content);
239
+ window.open(`${base_URL}?${params.toString()}`, "_blank")?.focus();
240
+ }
241
+
242
+ onMount(() => {
243
+ return () => {
244
+ document.removeEventListener("mousemove", handleResizeMove);
245
+ document.removeEventListener("mouseup", handleResizeEnd);
246
+ };
247
+ });
248
+
249
+ $: starterQueries;
250
+ </script>
251
+
252
+ <div
253
+ class="vibe-editor"
254
+ bind:this={editorElement}
255
+ style="width: {editorWidth}px;"
256
+ >
257
+ <button
258
+ class="resize-handle"
259
+ aria-label="Resize sidebar"
260
+ on:mousedown={handleResizeStart}
261
+ ></button>
262
+ <div class="tab-header">
263
+ <button
264
+ class="tab-button"
265
+ class:active={activeTab === "chat"}
266
+ on:click={() => (activeTab = "chat")}
267
+ >
268
+ Chat
269
+ </button>
270
+ <button
271
+ class="tab-button"
272
+ class:active={activeTab === "code"}
273
+ on:click={() => (activeTab = "code")}
274
+ >
275
+ Code
276
+ {#if diffStats && (diffStats.lines_added > 0 || diffStats.lines_removed > 0)}
277
+ <span class="diff-stats">
278
+ {#if diffStats.lines_added > 0}
279
+ <span class="added">+{diffStats.lines_added}</span>
280
+ {/if}
281
+ {#if diffStats.lines_removed > 0}
282
+ <span class="removed">-{diffStats.lines_removed}</span>
283
+ {/if}
284
+ </span>
285
+ {/if}
286
+ </button>
287
+ </div>
288
+
289
+ <div class="tab-content">
290
+ {#if activeTab === "chat"}
291
+ <div class="message-history" bind:this={history_elem}>
292
+ {#each message_history as message, index}
293
+ <div
294
+ class="message-item"
295
+ class:bot-message={message.isBot}
296
+ class:user-message={!message.isBot}
297
+ >
298
+ <div class="message-content">
299
+ <span class="message-text">
300
+ <BaseMarkdown
301
+ value={message.text}
302
+ latex_delimiters={[]}
303
+ theme_mode="system"
304
+ />
305
+ </span>
306
+ {#if !message.isBot && message.hash && !message.isPending}
307
+ <button
308
+ class="undo-button"
309
+ on:click={() => undoMessage(message.hash || "", index)}
310
+ title="Undo this change"
311
+ >
312
+ Undo
313
+ </button>
314
+ {/if}
315
+ </div>
316
+ </div>
317
+ {/each}
318
+
319
+ {#if message_history.length === 0}
320
+ <div class="no-messages">No messages yet</div>
321
+ {/if}
322
+
323
+ {#if message_history.length === 0}
324
+ <div class="starter-queries-container">
325
+ <div class="starter-queries">
326
+ {#each starterQueries as query}
327
+ <button
328
+ class="starter-query-button"
329
+ on:click={() => handleStarterQuery(query)}
330
+ >
331
+ {query}
332
+ </button>
333
+ {/each}
334
+ </div>
335
+ </div>
336
+ {/if}
337
+ </div>
338
+ {:else if activeTab === "code"}
339
+ <div class="code-content">
340
+ <div class="code-editor-container">
341
+ <BaseCode
342
+ bind:value={codeValue}
343
+ language="python"
344
+ lines={10}
345
+ dark_mode={false}
346
+ basic={true}
347
+ readonly={false}
348
+ placeholder="Enter your code here..."
349
+ wrap_lines={true}
350
+ />
351
+ </div>
352
+ <button
353
+ class:updating={code_updated}
354
+ class="update-code-button"
355
+ on:click={updateCode}
356
+ >
357
+ {#if code_updated}
358
+ Updated!
359
+ {:else}
360
+ Update Code
361
+ {/if}
362
+ </button>
363
+ <button
364
+ class="deploy-to-spaces-button"
365
+ on:click={() => create_spaces_url()}
366
+ >
367
+ <span class="button-content">
368
+ Deploy to
369
+ <svg
370
+ class="spaces-logo"
371
+ xmlns="http://www.w3.org/2000/svg"
372
+ xmlns:xlink="http://www.w3.org/1999/xlink"
373
+ aria-hidden="true"
374
+ focusable="false"
375
+ role="img"
376
+ preserveAspectRatio="xMidYMid meet"
377
+ viewBox="0 0 39 40"
378
+ ><path
379
+ d="M6.3712 2.04427C3.7183 2.04427 1.56771 4.19486 1.56771 6.84776V18.3546V18.6544V32.7341C1.56771 35.3868 3.71818 37.5377 6.3712 37.5377H17.878H20.7507H32.2575C34.9104 37.5377 37.0612 35.387 37.0612 32.7341V21.6204C37.0612 20.177 36.4252 18.8839 35.4189 18.004C36.4576 16.3895 37.0612 14.4666 37.0612 12.4046C37.0612 6.68274 32.4225 2.04427 26.7007 2.04427C24.6388 2.04427 22.7159 2.64776 21.1014 3.68647C20.2214 2.6802 18.9282 2.04427 17.4849 2.04427H6.3712Z"
380
+ fill="black"
381
+ class="stroke-white dark:stroke-white/10"
382
+ stroke-width="3.07552"
383
+ ></path><path
384
+ d="M9.56855 23.5001C8.8406 23.5001 8.25047 24.0902 8.25047 24.8182V29.5361C8.25047 30.2641 8.8406 30.8542 9.56855 30.8542H14.2864C15.0144 30.8542 15.6045 30.2641 15.6045 29.5361V24.8182C15.6045 24.0902 15.0143 23.5001 14.2864 23.5001H9.56855Z"
385
+ fill="#FF3270"
386
+ ></path><path
387
+ d="M24.3409 23.5001C23.613 23.5001 23.0228 24.0902 23.0228 24.8182V29.5361C23.0228 30.2641 23.613 30.8542 24.3409 30.8542H29.0588C29.7868 30.8542 30.3769 30.2641 30.3769 29.5361V24.8182C30.3769 24.0902 29.7868 23.5001 29.0588 23.5001H24.3409Z"
388
+ fill="#861FFF"
389
+ ></path><path
390
+ d="M9.56855 8.72815C8.8406 8.72815 8.25047 9.31827 8.25047 10.0462V14.7641C8.25047 15.4921 8.8406 16.0822 9.56855 16.0822H14.2864C15.0144 16.0822 15.6045 15.4921 15.6045 14.7641V10.0462C15.6045 9.31827 15.0143 8.72815 14.2864 8.72815H9.56855Z"
391
+ fill="#097EFF"
392
+ ></path><path
393
+ d="M26.6999 8.72815C24.6692 8.72815 23.0228 10.3744 23.0228 12.4052C23.0228 14.4359 24.6692 16.0822 26.6999 16.0822C28.7306 16.0822 30.3769 14.4359 30.3769 12.4052C30.3769 10.3744 28.7306 8.72815 26.6999 8.72815Z"
394
+ fill="#FFD702"
395
+ ></path></svg
396
+ >
397
+ <span style="font-weight: 600;">Spaces</span>
398
+ </span>
399
+ </button>
400
+ </div>
401
+ {/if}
402
+ </div>
403
+
404
+ <div class="input-section">
405
+ <div class="powered-by">Powered by: <code>gpt-oss</code></div>
406
+ <textarea
407
+ on:keydown={(e) => {
408
+ if (e.key === "Enter" && !e.shiftKey) {
409
+ e.preventDefault();
410
+ submit();
411
+ }
412
+ }}
413
+ bind:value={prompt}
414
+ placeholder="What can I add or change?"
415
+ class="prompt-input"
416
+ />
417
+ <button
418
+ on:click={() => submit()}
419
+ class="submit-button"
420
+ disabled={prompt.trim() === ""}
421
+ >
422
+ Send
423
+ </button>
424
+ </div>
425
+ </div>
426
+
427
+ <style>
428
+ .vibe-editor {
429
+ position: fixed;
430
+ top: 0;
431
+ right: 0;
432
+ height: 100vh;
433
+ background: var(--background-fill-primary);
434
+ border-left: 1px solid var(--border-color-primary);
435
+ display: flex;
436
+ flex-direction: column;
437
+ z-index: 100;
438
+ box-shadow: var(--shadow-drop-lg);
439
+ overflow: hidden;
440
+ }
441
+
442
+ .resize-handle {
443
+ position: absolute;
444
+ left: 0;
445
+ top: 0;
446
+ width: 4px;
447
+ height: 100%;
448
+ cursor: col-resize;
449
+ background: transparent;
450
+ border: none;
451
+ border-left: 2px solid transparent;
452
+ transition: border-color 0.2s ease;
453
+ z-index: 101;
454
+ padding: 0;
455
+ }
456
+
457
+ .resize-handle:hover {
458
+ border-left-color: var(--color-accent);
459
+ }
460
+
461
+ .resize-handle:active {
462
+ border-left-color: var(--color-accent);
463
+ background: rgba(var(--color-accent-soft), 0.1);
464
+ }
465
+
466
+ .tab-header {
467
+ display: flex;
468
+ border-bottom: 1px solid var(--border-color-primary);
469
+ background: var(--background-fill-secondary);
470
+ }
471
+
472
+ .tab-button {
473
+ flex: 1;
474
+ padding: 12px 16px;
475
+ background: transparent;
476
+ border: none;
477
+ border-bottom: 2px solid transparent;
478
+ font-size: 14px;
479
+ font-weight: 500;
480
+ color: var(--body-text-color-subdued);
481
+ cursor: pointer;
482
+ transition: all 0.2s ease;
483
+ }
484
+
485
+ .tab-button:hover {
486
+ color: var(--body-text-color);
487
+ background: var(--background-fill-primary);
488
+ }
489
+
490
+ .tab-button.active {
491
+ color: var(--color-accent);
492
+ border-bottom-color: var(--color-accent);
493
+ background: var(--background-fill-primary);
494
+ }
495
+
496
+ .tab-content {
497
+ flex: 1;
498
+ display: flex;
499
+ flex-direction: column;
500
+ overflow: hidden;
501
+ }
502
+
503
+ .code-content {
504
+ flex: 1;
505
+ display: flex;
506
+ flex-direction: column;
507
+ padding: 16px;
508
+ gap: 12px;
509
+ overflow: hidden;
510
+ }
511
+
512
+ .code-editor-container {
513
+ flex: 1;
514
+ overflow-y: auto;
515
+ overflow-x: hidden;
516
+ min-height: 0; /* Allow flex child to shrink below content size */
517
+ }
518
+
519
+ .update-code-button {
520
+ background: var(--button-primary-background-fill);
521
+ color: var(--button-primary-text-color);
522
+ border: none;
523
+ border-radius: var(--button-large-radius);
524
+ padding: 8px 16px;
525
+ font-weight: 600;
526
+ cursor: pointer;
527
+ transition: background-color 0.2s;
528
+ align-self: flex-start;
529
+ width: 100%;
530
+ }
531
+
532
+ .update-code-button.updating {
533
+ background: var(--button-secondary-background-fill);
534
+ color: var(--button-secondary-text-color);
535
+ }
536
+
537
+ .update-code-button:hover {
538
+ background: var(--button-primary-background-fill-hover);
539
+ }
540
+
541
+ .update-code-button.updating:hover {
542
+ background: var(--button-secondary-background-fill);
543
+ }
544
+
545
+ .deploy-to-spaces-button {
546
+ background: var(--button-secondary-background-fill);
547
+ color: var(--button-secondary-text-color);
548
+ border: none;
549
+ border-radius: var(--button-large-radius);
550
+ padding: 8px 16px;
551
+ font-weight: 600;
552
+ cursor: pointer;
553
+ transition: background-color 0.2s;
554
+ align-self: flex-start;
555
+ width: 100%;
556
+ }
557
+
558
+ .deploy-to-spaces-button:hover {
559
+ background: var(--button-secondary-background-fill-hover);
560
+ }
561
+
562
+ .button-content {
563
+ display: flex;
564
+ align-items: center;
565
+ justify-content: center;
566
+ gap: 4px;
567
+ font-weight: 200;
568
+ }
569
+
570
+ .spaces-logo {
571
+ width: 1em;
572
+ height: 1em;
573
+ vertical-align: middle;
574
+ display: inline-block;
575
+ margin-right: -3px;
576
+ }
577
+
578
+ .message-history {
579
+ flex: 1;
580
+ overflow-y: auto;
581
+ padding: 16px;
582
+ display: flex;
583
+ flex-direction: column;
584
+ gap: 12px;
585
+ position: relative;
586
+ }
587
+
588
+ .message-item {
589
+ position: relative;
590
+ padding: 12px;
591
+ border-radius: var(--radius-md);
592
+ border: 1px solid var(--border-color-primary);
593
+ word-wrap: break-word;
594
+ line-height: 1.4;
595
+ border-color: var(--border-color-primary);
596
+ }
597
+
598
+ .user-message {
599
+ margin-left: 20px;
600
+ padding: 12px 64px 12px 12px;
601
+ }
602
+
603
+ .bot-message {
604
+ margin-right: 20px;
605
+ }
606
+
607
+ .message-content {
608
+ display: block;
609
+ }
610
+
611
+ .message-text {
612
+ color: var(--body-text-color);
613
+ word-wrap: break-word;
614
+ line-height: 1.4;
615
+ flex: 1;
616
+ }
617
+
618
+ .undo-button {
619
+ position: absolute;
620
+ top: 8px;
621
+ right: 8px;
622
+ background: var(--button-secondary-background-fill);
623
+ color: var(--button-secondary-text-color);
624
+ border: 1px solid var(--border-color-primary);
625
+ border-radius: var(--radius-sm);
626
+ padding: var(--button-small-padding);
627
+ font-size: 12px;
628
+ font-weight: 500;
629
+ cursor: pointer;
630
+ transition: all 0.2s;
631
+ }
632
+
633
+ .undo-button:active {
634
+ transform: translateY(0);
635
+ }
636
+
637
+ .no-messages {
638
+ text-align: center;
639
+ color: var(--body-text-color-subdued);
640
+ font-style: italic;
641
+ padding: 24px;
642
+ }
643
+
644
+ .input-section {
645
+ padding: 16px;
646
+ border-top: 1px solid var(--border-color-primary);
647
+ background: var(--background-fill-secondary);
648
+ display: flex;
649
+ flex-direction: column;
650
+ gap: 12px;
651
+ }
652
+
653
+ .prompt-input {
654
+ width: 100%;
655
+ min-height: 80px;
656
+ background: var(--input-background-fill);
657
+ border: 1px solid var(--border-color-primary);
658
+ border-radius: var(--input-radius);
659
+ padding: 12px;
660
+ resize: vertical;
661
+ outline: none;
662
+ font-family: inherit;
663
+ font-size: 14px;
664
+ color: var(--body-text-color);
665
+ }
666
+
667
+ .prompt-input:focus {
668
+ border-color: var(--color-accent);
669
+ }
670
+
671
+ .submit-button {
672
+ background: var(--button-primary-background-fill);
673
+ color: var(--button-primary-text-color);
674
+ border: none;
675
+ border-radius: var(--button-large-radius);
676
+ padding: 10px 20px;
677
+ font-weight: 600;
678
+ cursor: pointer;
679
+ transition: background-color 0.2s;
680
+ }
681
+
682
+ .submit-button:hover:not(:disabled) {
683
+ background: var(--button-primary-background-fill-hover);
684
+ }
685
+
686
+ .submit-button:disabled {
687
+ background: var(--button-secondary-background-fill);
688
+ color: var(--button-secondary-text-color);
689
+ cursor: not-allowed;
690
+ }
691
+
692
+ .powered-by {
693
+ text-align: right;
694
+ font-size: 12px;
695
+ color: var(--body-text-color-subdued);
696
+ }
697
+
698
+ .diff-stats {
699
+ margin-left: 8px;
700
+ display: inline-flex;
701
+ gap: 4px;
702
+ font-size: 11px;
703
+ font-weight: 600;
704
+ }
705
+
706
+ .diff-stats .added {
707
+ color: #22c55e;
708
+ }
709
+
710
+ .diff-stats .removed {
711
+ color: #ef4444;
712
+ }
713
+
714
+ .starter-queries-container {
715
+ position: absolute;
716
+ bottom: 16px;
717
+ left: 50%;
718
+ transform: translateX(-50%);
719
+ display: flex;
720
+ flex-direction: column;
721
+ align-items: center;
722
+ padding: 16px;
723
+ gap: 12px;
724
+ width: calc(100% - 32px);
725
+ max-width: 500px;
726
+ }
727
+
728
+ .starter-queries {
729
+ display: grid;
730
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
731
+ gap: var(--spacing-md);
732
+ width: 100%;
733
+ }
734
+
735
+ .starter-query-button {
736
+ display: flex;
737
+ flex-direction: column;
738
+ align-items: flex-start;
739
+ padding: var(--spacing-lg);
740
+ border: none;
741
+ border-radius: var(--radius-lg);
742
+ background-color: var(--block-background-fill);
743
+ cursor: pointer;
744
+ transition: all 150ms ease-in-out;
745
+ width: 100%;
746
+ gap: var(--spacing-sm);
747
+ border: var(--block-border-width) solid var(--block-border-color);
748
+ transform: translateY(0px);
749
+ text-align: left;
750
+ line-height: 1.4;
751
+ word-wrap: break-word;
752
+ white-space: normal;
753
+ font-size: var(--text-md);
754
+ }
755
+
756
+ .starter-query-button:hover {
757
+ transform: translateY(-2px);
758
+ background-color: var(--color-accent-soft);
759
+ }
760
+
761
+ .starter-query-button:active {
762
+ transform: translateY(0);
763
+ }
764
+ </style>
6.3.1/vibeeditor/package.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@gradio/vibeeditor",
3
+ "version": "0.3.2",
4
+ "description": "Gradio VibeEditor component",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "main": "Index.svelte",
11
+ "exports": {
12
+ ".": {
13
+ "gradio": "./Index.svelte",
14
+ "svelte": "./dist/Index.svelte",
15
+ "types": "./dist/Index.svelte.d.ts",
16
+ "default": "./dist/Index.svelte"
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
20
+ "dependencies": {
21
+ "@gradio/client": "workspace:^",
22
+ "@gradio/atoms": "workspace:^",
23
+ "@gradio/statustracker": "workspace:^",
24
+ "@gradio/utils": "workspace:^"
25
+ },
26
+ "devDependencies": {
27
+ "@gradio/preview": "workspace:^"
28
+ },
29
+ "peerDependencies": {
30
+ "svelte": "^5.43.4"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/gradio-app/gradio.git",
35
+ "directory": "js/vibeeditor"
36
+ }
37
+ }