gradio-pr-bot commited on
Commit
6e9bfe1
·
verified ·
1 Parent(s): 168589a

Upload folder using huggingface_hub

Browse files
6.0.0-dev.6/vibeeditor/Index.svelte ADDED
@@ -0,0 +1,765 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ console.log(index, userMessageIndex, responseData.hash);
105
+ return index === userMessageIndex
106
+ ? { ...msg, hash: responseData.hash }
107
+ : msg;
108
+ });
109
+
110
+ message_history = message_history.map((msg, index) =>
111
+ index === botMessageIndex
112
+ ? {
113
+ text: responseData.reasoning ? responseData.reasoning : "Done.",
114
+ isBot: true,
115
+ isPending: false
116
+ }
117
+ : msg
118
+ );
119
+ await tick();
120
+ scroll_to_bottom();
121
+ })
122
+ .catch(async (error) => {
123
+ message_history = message_history.map((msg, index) =>
124
+ index === botMessageIndex
125
+ ? { text: "Error occurred.", isBot: true, isPending: false }
126
+ : msg
127
+ );
128
+ await tick();
129
+ scroll_to_bottom();
130
+ });
131
+ };
132
+
133
+ const handleStarterQuery = async (query: string): Promise<void> => {
134
+ await submit(query);
135
+ };
136
+
137
+ const undoMessage = async (
138
+ hash: string,
139
+ messageIndex: number
140
+ ): Promise<void> => {
141
+ try {
142
+ await app.post_data(`${root}/gradio_api/undo-vibe-edit/`, { hash });
143
+
144
+ // Clear diff stats when undoing
145
+ diffStats = null;
146
+
147
+ const messageToUndo = message_history[messageIndex];
148
+ prompt = messageToUndo.text;
149
+
150
+ message_history = message_history.slice(0, messageIndex);
151
+ } catch (error) {
152
+ console.error("Failed to undo:", error);
153
+ }
154
+ };
155
+
156
+ const handleResizeStart = (e: MouseEvent): void => {
157
+ e.preventDefault();
158
+ isResizing = true;
159
+ document.addEventListener("mousemove", handleResizeMove);
160
+ document.addEventListener("mouseup", handleResizeEnd);
161
+ document.body.style.cursor = "col-resize";
162
+ document.body.style.userSelect = "none";
163
+ };
164
+
165
+ const handleResizeMove = (e: MouseEvent): void => {
166
+ if (!isResizing) return;
167
+
168
+ const minWidth = 250;
169
+ const maxWidth = Math.min(800, window.innerWidth * 0.5);
170
+ const newWidth = window.innerWidth - e.clientX;
171
+
172
+ editorWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));
173
+
174
+ // Dispatch custom event to update the main content margin
175
+ window.dispatchEvent(
176
+ new CustomEvent("vibeEditorResize", {
177
+ detail: { width: editorWidth }
178
+ })
179
+ );
180
+ };
181
+
182
+ const handleResizeEnd = (): void => {
183
+ isResizing = false;
184
+ document.removeEventListener("mousemove", handleResizeMove);
185
+ document.removeEventListener("mouseup", handleResizeEnd);
186
+ document.body.style.cursor = "";
187
+ document.body.style.userSelect = "";
188
+ };
189
+
190
+ const fetchCode = async (): Promise<void> => {
191
+ try {
192
+ const response = await fetch(`${root}/gradio_api/vibe-code/`, {
193
+ method: "GET",
194
+ headers: {
195
+ "Content-Type": "application/json"
196
+ }
197
+ });
198
+ if (response.ok) {
199
+ const data = await response.json();
200
+ codeValue = data.code;
201
+ }
202
+ } catch (error) {
203
+ console.error("Failed to fetch code:", error);
204
+ }
205
+ };
206
+
207
+ let code_updated = false;
208
+
209
+ const updateCode = async (): Promise<void> => {
210
+ try {
211
+ await app.post_data(`${root}/gradio_api/vibe-code/`, {
212
+ code: codeValue
213
+ });
214
+ code_updated = true;
215
+ setTimeout(() => {
216
+ code_updated = false;
217
+ }, 1000);
218
+ } catch (error) {
219
+ console.error("Failed to update code:", error);
220
+ }
221
+ };
222
+
223
+ $: (app, fetchCode());
224
+
225
+ $: if (activeTab === "chat") {
226
+ tick().then(() => scroll_to_bottom("auto"));
227
+ }
228
+
229
+ $: code_updated;
230
+
231
+ function create_spaces_url(): void {
232
+ const base_URL = "https://huggingface.co/new-space";
233
+ const params = new URLSearchParams({
234
+ name: "new-space",
235
+ sdk: "gradio"
236
+ });
237
+ const encoded_content = codeValue.trimStart();
238
+ params.append("files[0][path]", "app.py");
239
+ params.append("files[0][content]", encoded_content);
240
+ window.open(`${base_URL}?${params.toString()}`, "_blank")?.focus();
241
+ }
242
+
243
+ onMount(() => {
244
+ return () => {
245
+ document.removeEventListener("mousemove", handleResizeMove);
246
+ document.removeEventListener("mouseup", handleResizeEnd);
247
+ };
248
+ });
249
+
250
+ $: starterQueries;
251
+ </script>
252
+
253
+ <div
254
+ class="vibe-editor"
255
+ bind:this={editorElement}
256
+ style="width: {editorWidth}px;"
257
+ >
258
+ <button
259
+ class="resize-handle"
260
+ aria-label="Resize sidebar"
261
+ on:mousedown={handleResizeStart}
262
+ ></button>
263
+ <div class="tab-header">
264
+ <button
265
+ class="tab-button"
266
+ class:active={activeTab === "chat"}
267
+ on:click={() => (activeTab = "chat")}
268
+ >
269
+ Chat
270
+ </button>
271
+ <button
272
+ class="tab-button"
273
+ class:active={activeTab === "code"}
274
+ on:click={() => (activeTab = "code")}
275
+ >
276
+ Code
277
+ {#if diffStats && (diffStats.lines_added > 0 || diffStats.lines_removed > 0)}
278
+ <span class="diff-stats">
279
+ {#if diffStats.lines_added > 0}
280
+ <span class="added">+{diffStats.lines_added}</span>
281
+ {/if}
282
+ {#if diffStats.lines_removed > 0}
283
+ <span class="removed">-{diffStats.lines_removed}</span>
284
+ {/if}
285
+ </span>
286
+ {/if}
287
+ </button>
288
+ </div>
289
+
290
+ <div class="tab-content">
291
+ {#if activeTab === "chat"}
292
+ <div class="message-history" bind:this={history_elem}>
293
+ {#each message_history as message, index}
294
+ <div
295
+ class="message-item"
296
+ class:bot-message={message.isBot}
297
+ class:user-message={!message.isBot}
298
+ >
299
+ <div class="message-content">
300
+ <span class="message-text">
301
+ <BaseMarkdown
302
+ value={message.text}
303
+ latex_delimiters={[]}
304
+ theme_mode="system"
305
+ />
306
+ </span>
307
+ {#if !message.isBot && message.hash && !message.isPending}
308
+ <button
309
+ class="undo-button"
310
+ on:click={() => undoMessage(message.hash || "", index)}
311
+ title="Undo this change"
312
+ >
313
+ Undo
314
+ </button>
315
+ {/if}
316
+ </div>
317
+ </div>
318
+ {/each}
319
+
320
+ {#if message_history.length === 0}
321
+ <div class="no-messages">No messages yet</div>
322
+ {/if}
323
+
324
+ {#if message_history.length === 0}
325
+ <div class="starter-queries-container">
326
+ <div class="starter-queries">
327
+ {#each starterQueries as query}
328
+ <button
329
+ class="starter-query-button"
330
+ on:click={() => handleStarterQuery(query)}
331
+ >
332
+ {query}
333
+ </button>
334
+ {/each}
335
+ </div>
336
+ </div>
337
+ {/if}
338
+ </div>
339
+ {:else if activeTab === "code"}
340
+ <div class="code-content">
341
+ <div class="code-editor-container">
342
+ <BaseCode
343
+ bind:value={codeValue}
344
+ language="python"
345
+ lines={10}
346
+ dark_mode={false}
347
+ basic={true}
348
+ readonly={false}
349
+ placeholder="Enter your code here..."
350
+ wrap_lines={true}
351
+ />
352
+ </div>
353
+ <button
354
+ class:updating={code_updated}
355
+ class="update-code-button"
356
+ on:click={updateCode}
357
+ >
358
+ {#if code_updated}
359
+ Updated!
360
+ {:else}
361
+ Update Code
362
+ {/if}
363
+ </button>
364
+ <button
365
+ class="deploy-to-spaces-button"
366
+ on:click={() => create_spaces_url()}
367
+ >
368
+ <span class="button-content">
369
+ Deploy to
370
+ <svg
371
+ class="spaces-logo"
372
+ xmlns="http://www.w3.org/2000/svg"
373
+ xmlns:xlink="http://www.w3.org/1999/xlink"
374
+ aria-hidden="true"
375
+ focusable="false"
376
+ role="img"
377
+ preserveAspectRatio="xMidYMid meet"
378
+ viewBox="0 0 39 40"
379
+ ><path
380
+ 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"
381
+ fill="black"
382
+ class="stroke-white dark:stroke-white/10"
383
+ stroke-width="3.07552"
384
+ ></path><path
385
+ 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"
386
+ fill="#FF3270"
387
+ ></path><path
388
+ 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"
389
+ fill="#861FFF"
390
+ ></path><path
391
+ 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"
392
+ fill="#097EFF"
393
+ ></path><path
394
+ 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"
395
+ fill="#FFD702"
396
+ ></path></svg
397
+ >
398
+ <span style="font-weight: 600;">Spaces</span>
399
+ </span>
400
+ </button>
401
+ </div>
402
+ {/if}
403
+ </div>
404
+
405
+ <div class="input-section">
406
+ <div class="powered-by">Powered by: <code>gpt-oss</code></div>
407
+ <textarea
408
+ on:keydown={(e) => {
409
+ if (e.key === "Enter" && !e.shiftKey) {
410
+ e.preventDefault();
411
+ submit();
412
+ }
413
+ }}
414
+ bind:value={prompt}
415
+ placeholder="What can I add or change?"
416
+ class="prompt-input"
417
+ />
418
+ <button
419
+ on:click={() => submit()}
420
+ class="submit-button"
421
+ disabled={prompt.trim() === ""}
422
+ >
423
+ Send
424
+ </button>
425
+ </div>
426
+ </div>
427
+
428
+ <style>
429
+ .vibe-editor {
430
+ position: fixed;
431
+ top: 0;
432
+ right: 0;
433
+ height: 100vh;
434
+ background: var(--background-fill-primary);
435
+ border-left: 1px solid var(--border-color-primary);
436
+ display: flex;
437
+ flex-direction: column;
438
+ z-index: 100;
439
+ box-shadow: var(--shadow-drop-lg);
440
+ overflow: hidden;
441
+ }
442
+
443
+ .resize-handle {
444
+ position: absolute;
445
+ left: 0;
446
+ top: 0;
447
+ width: 4px;
448
+ height: 100%;
449
+ cursor: col-resize;
450
+ background: transparent;
451
+ border: none;
452
+ border-left: 2px solid transparent;
453
+ transition: border-color 0.2s ease;
454
+ z-index: 101;
455
+ padding: 0;
456
+ }
457
+
458
+ .resize-handle:hover {
459
+ border-left-color: var(--color-accent);
460
+ }
461
+
462
+ .resize-handle:active {
463
+ border-left-color: var(--color-accent);
464
+ background: rgba(var(--color-accent-soft), 0.1);
465
+ }
466
+
467
+ .tab-header {
468
+ display: flex;
469
+ border-bottom: 1px solid var(--border-color-primary);
470
+ background: var(--background-fill-secondary);
471
+ }
472
+
473
+ .tab-button {
474
+ flex: 1;
475
+ padding: 12px 16px;
476
+ background: transparent;
477
+ border: none;
478
+ border-bottom: 2px solid transparent;
479
+ font-size: 14px;
480
+ font-weight: 500;
481
+ color: var(--body-text-color-subdued);
482
+ cursor: pointer;
483
+ transition: all 0.2s ease;
484
+ }
485
+
486
+ .tab-button:hover {
487
+ color: var(--body-text-color);
488
+ background: var(--background-fill-primary);
489
+ }
490
+
491
+ .tab-button.active {
492
+ color: var(--color-accent);
493
+ border-bottom-color: var(--color-accent);
494
+ background: var(--background-fill-primary);
495
+ }
496
+
497
+ .tab-content {
498
+ flex: 1;
499
+ display: flex;
500
+ flex-direction: column;
501
+ overflow: hidden;
502
+ }
503
+
504
+ .code-content {
505
+ flex: 1;
506
+ display: flex;
507
+ flex-direction: column;
508
+ padding: 16px;
509
+ gap: 12px;
510
+ overflow: hidden;
511
+ }
512
+
513
+ .code-editor-container {
514
+ flex: 1;
515
+ overflow-y: auto;
516
+ overflow-x: hidden;
517
+ min-height: 0; /* Allow flex child to shrink below content size */
518
+ }
519
+
520
+ .update-code-button {
521
+ background: var(--button-primary-background-fill);
522
+ color: var(--button-primary-text-color);
523
+ border: none;
524
+ border-radius: var(--button-large-radius);
525
+ padding: 8px 16px;
526
+ font-weight: 600;
527
+ cursor: pointer;
528
+ transition: background-color 0.2s;
529
+ align-self: flex-start;
530
+ width: 100%;
531
+ }
532
+
533
+ .update-code-button.updating {
534
+ background: var(--button-secondary-background-fill);
535
+ color: var(--button-secondary-text-color);
536
+ }
537
+
538
+ .update-code-button:hover {
539
+ background: var(--button-primary-background-fill-hover);
540
+ }
541
+
542
+ .update-code-button.updating:hover {
543
+ background: var(--button-secondary-background-fill);
544
+ }
545
+
546
+ .deploy-to-spaces-button {
547
+ background: var(--button-secondary-background-fill);
548
+ color: var(--button-secondary-text-color);
549
+ border: none;
550
+ border-radius: var(--button-large-radius);
551
+ padding: 8px 16px;
552
+ font-weight: 600;
553
+ cursor: pointer;
554
+ transition: background-color 0.2s;
555
+ align-self: flex-start;
556
+ width: 100%;
557
+ }
558
+
559
+ .deploy-to-spaces-button:hover {
560
+ background: var(--button-secondary-background-fill-hover);
561
+ }
562
+
563
+ .button-content {
564
+ display: flex;
565
+ align-items: center;
566
+ justify-content: center;
567
+ gap: 4px;
568
+ font-weight: 200;
569
+ }
570
+
571
+ .spaces-logo {
572
+ width: 1em;
573
+ height: 1em;
574
+ vertical-align: middle;
575
+ display: inline-block;
576
+ margin-right: -3px;
577
+ }
578
+
579
+ .message-history {
580
+ flex: 1;
581
+ overflow-y: auto;
582
+ padding: 16px;
583
+ display: flex;
584
+ flex-direction: column;
585
+ gap: 12px;
586
+ position: relative;
587
+ }
588
+
589
+ .message-item {
590
+ position: relative;
591
+ padding: 12px;
592
+ border-radius: var(--radius-md);
593
+ border: 1px solid var(--border-color-primary);
594
+ word-wrap: break-word;
595
+ line-height: 1.4;
596
+ border-color: var(--border-color-primary);
597
+ }
598
+
599
+ .user-message {
600
+ margin-left: 20px;
601
+ padding: 12px 64px 12px 12px;
602
+ }
603
+
604
+ .bot-message {
605
+ margin-right: 20px;
606
+ }
607
+
608
+ .message-content {
609
+ display: block;
610
+ }
611
+
612
+ .message-text {
613
+ color: var(--body-text-color);
614
+ word-wrap: break-word;
615
+ line-height: 1.4;
616
+ flex: 1;
617
+ }
618
+
619
+ .undo-button {
620
+ position: absolute;
621
+ top: 8px;
622
+ right: 8px;
623
+ background: var(--button-secondary-background-fill);
624
+ color: var(--button-secondary-text-color);
625
+ border: 1px solid var(--border-color-primary);
626
+ border-radius: var(--radius-sm);
627
+ padding: var(--button-small-padding);
628
+ font-size: 12px;
629
+ font-weight: 500;
630
+ cursor: pointer;
631
+ transition: all 0.2s;
632
+ }
633
+
634
+ .undo-button:active {
635
+ transform: translateY(0);
636
+ }
637
+
638
+ .no-messages {
639
+ text-align: center;
640
+ color: var(--body-text-color-subdued);
641
+ font-style: italic;
642
+ padding: 24px;
643
+ }
644
+
645
+ .input-section {
646
+ padding: 16px;
647
+ border-top: 1px solid var(--border-color-primary);
648
+ background: var(--background-fill-secondary);
649
+ display: flex;
650
+ flex-direction: column;
651
+ gap: 12px;
652
+ }
653
+
654
+ .prompt-input {
655
+ width: 100%;
656
+ min-height: 80px;
657
+ background: var(--input-background-fill);
658
+ border: 1px solid var(--border-color-primary);
659
+ border-radius: var(--input-radius);
660
+ padding: 12px;
661
+ resize: vertical;
662
+ outline: none;
663
+ font-family: inherit;
664
+ font-size: 14px;
665
+ color: var(--body-text-color);
666
+ }
667
+
668
+ .prompt-input:focus {
669
+ border-color: var(--color-accent);
670
+ }
671
+
672
+ .submit-button {
673
+ background: var(--button-primary-background-fill);
674
+ color: var(--button-primary-text-color);
675
+ border: none;
676
+ border-radius: var(--button-large-radius);
677
+ padding: 10px 20px;
678
+ font-weight: 600;
679
+ cursor: pointer;
680
+ transition: background-color 0.2s;
681
+ }
682
+
683
+ .submit-button:hover:not(:disabled) {
684
+ background: var(--button-primary-background-fill-hover);
685
+ }
686
+
687
+ .submit-button:disabled {
688
+ background: var(--button-secondary-background-fill);
689
+ color: var(--button-secondary-text-color);
690
+ cursor: not-allowed;
691
+ }
692
+
693
+ .powered-by {
694
+ text-align: right;
695
+ font-size: 12px;
696
+ color: var(--body-text-color-subdued);
697
+ }
698
+
699
+ .diff-stats {
700
+ margin-left: 8px;
701
+ display: inline-flex;
702
+ gap: 4px;
703
+ font-size: 11px;
704
+ font-weight: 600;
705
+ }
706
+
707
+ .diff-stats .added {
708
+ color: #22c55e;
709
+ }
710
+
711
+ .diff-stats .removed {
712
+ color: #ef4444;
713
+ }
714
+
715
+ .starter-queries-container {
716
+ position: absolute;
717
+ bottom: 16px;
718
+ left: 50%;
719
+ transform: translateX(-50%);
720
+ display: flex;
721
+ flex-direction: column;
722
+ align-items: center;
723
+ padding: 16px;
724
+ gap: 12px;
725
+ width: calc(100% - 32px);
726
+ max-width: 500px;
727
+ }
728
+
729
+ .starter-queries {
730
+ display: grid;
731
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
732
+ gap: var(--spacing-md);
733
+ width: 100%;
734
+ }
735
+
736
+ .starter-query-button {
737
+ display: flex;
738
+ flex-direction: column;
739
+ align-items: flex-start;
740
+ padding: var(--spacing-lg);
741
+ border: none;
742
+ border-radius: var(--radius-lg);
743
+ background-color: var(--block-background-fill);
744
+ cursor: pointer;
745
+ transition: all 150ms ease-in-out;
746
+ width: 100%;
747
+ gap: var(--spacing-sm);
748
+ border: var(--block-border-width) solid var(--block-border-color);
749
+ transform: translateY(0px);
750
+ text-align: left;
751
+ line-height: 1.4;
752
+ word-wrap: break-word;
753
+ white-space: normal;
754
+ font-size: var(--text-md);
755
+ }
756
+
757
+ .starter-query-button:hover {
758
+ transform: translateY(-2px);
759
+ background-color: var(--color-accent-soft);
760
+ }
761
+
762
+ .starter-query-button:active {
763
+ transform: translateY(0);
764
+ }
765
+ </style>
6.0.0-dev.6/vibeeditor/package.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@gradio/vibeeditor",
3
+ "version": "0.3.1-dev.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
+ }