Spaces:
Running
Running
File size: 33,619 Bytes
9c7adc0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zero-Latency HTML Component Builder</title>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- JSZip & FileSaver for downloads -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<!-- Marked.js for Markdown parsing -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<!-- Highlight.js for code syntax highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/atom-one-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
'display': ['Outfit', 'sans-serif'],
'body': ['Inter', 'sans-serif'],
'mono': ['"IBM Plex Mono"', 'monospace'],
},
colors: {
brand: {
50: '#f5f1ff',
100: '#ebe5ff',
200: '#d9ceff',
300: '#bdaaff',
400: '#9e7cff',
500: '#8248ff',
600: '#7c3aed',
700: '#6d28d9',
800: '#5b21b6',
900: '#4c1d95',
},
slate: {
850: '#1a1f2e',
900: '#111827',
950: '#0b0f19',
}
},
boxShadow: {
'glow': '0 0 40px -10px rgba(124, 58, 237, 0.3)',
'glow-sm': '0 0 20px -5px rgba(124, 58, 237, 0.2)',
'card': '0 8px 32px -8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04)',
'panel': '0 4px 24px -4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04)',
'panel-inset': 'inset 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.03)',
}
}
}
}
</script>
<style>
/* ========== Custom Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124, 58, 237, 0.3); }
/* ========== Smooth Selection ========== */
::selection { background: rgba(124, 58, 237, 0.25); color: #e2e8f0; }
/* ========== Editor Specific ========== */
.editor-line {
position: absolute;
left: 0;
right: 0;
pointer-events: none;
color: #4b5563;
font-family: 'IBM Plex Mono', monospace;
font-size: 13px;
line-height: 24px;
padding-left: 16px;
padding-right: 16px;
white-space: pre-wrap;
word-break: break-all;
overflow: hidden;
border-left: 3px solid transparent;
transition: border-color 0.15s ease, background-color 0.15s ease;
}
.editor-line.active {
background: rgba(124, 58, 237, 0.06);
border-left-color: #8248ff;
}
/* ========== Syntax Highlighting (Custom Override) ========== */
.token-keyword { color: #c084fc; font-weight: 500; }
.token-string { color: #86efac; }
.token-number { color: #67e8f9; }
.token-comment { color: #6b7280; font-style: italic; }
.token-tag { color: #f472b6; }
.token-attr { color: #60a5fa; }
.token-func { color: #fbbf24; }
/* ========== Animations ========== */
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-glow { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-slide-up { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-slide-down { animation: slideDown 0.4s ease-out forwards; }
.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-breathe { animation: breathe 4s ease-in-out infinite; }
.animate-spin-slow { animation: spin-slow 8s linear infinite; }
/* ========== Glass Morphism ========== */
.glass {
background: rgba(17, 24, 39, 0.7);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
}
.glass-light {
background: rgba(255, 255, 255, 0.03);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
/* ========== Preview Iframe ========== */
.preview-frame {
width: 100%;
height: 100%;
border: none;
background: #ffffff;
}
.dark-mode .preview-frame {
background: #0f172a;
filter: invert(1) hue-rotate(180deg);
}
/* ========== Toast ========== */
.toast-enter { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.toast-exit { animation: slideDown 0.3s ease-in forwards; }
/* ========== Resize Handle ========== */
.resize-handle {
cursor: col-resize;
width: 6px;
background: transparent;
transition: background 0.2s;
}
.resize-handle:hover, .resize-handle:active {
background: rgba(124, 58, 237, 0.4);
}
/* ========== Misc ========== */
.no-select { user-select: none; -webkit-user-select: none; }
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
/* Preview Document styles */
.preview-container {
background: #f8fafc;
background-image:
linear-gradient(rgba(226, 232, 240, 0.4) 1px, transparent 1px),
linear-gradient(90deg, rgba(226, 232, 240, 0.4) 1px, transparent 1px);
background-size: 20px 20px;
}
/* Dark checker pattern for dark mode */
.dark-mode .preview-container {
background: #0f172a;
background-image:
linear-gradient(rgba(30, 41, 59, 0.6) 1px, transparent 1px),
linear-gradient(90deg, rgba(30, 41, 59, 0.6) 1px, transparent 1px);
}
</style>
</head>
<body class="bg-slate-950 text-slate-300 font-body overflow-hidden antialiased">
<div id="app" class="h-screen w-full flex flex-col">
<!-- ═══════════ HEADER ═══════════ -->
<header class="glass relative z-50 flex-shrink-0 border-b border-white/[0.04]">
<!-- Top Bar -->
<div class="flex items-center justify-between px-5 py-3">
<div class="flex items-center gap-4">
<div class="relative group">
<div class="absolute inset-0 bg-gradient-to-br from-brand-500 to-purple-400 rounded-xl blur opacity-40 group-hover:opacity-60 transition-opacity duration-300"></div>
<div class="relative w-10 h-10 bg-gradient-to-br from-brand-600 to-brand-500 rounded-xl flex items-center justify-center shadow-glow-sm cursor-pointer transform hover:scale-105 transition-all duration-300">
<i class="fa-solid fa-code text-white text-sm"></i>
</div>
</div>
<div class="flex flex-col">
<h1 class="font-display font-bold text-white text-base tracking-tight leading-tight">VibeBuilder <span class="text-brand-400 text-xs font-medium ml-1 align-top">v2.0</span></h1>
<p class="text-[11px] text-slate-500 font-medium tracking-wide uppercase">Zero-Latency Component Engine</p>
</div>
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="ml-4 px-3 py-1.5 text-[11px] font-medium text-slate-400 hover:text-brand-300 bg-white/[0.03] hover:bg-brand-500/10 border border-white/[0.05] hover:border-brand-500/20 rounded-lg transition-all duration-300">
<i class="fa-solid fa-bolt mr-1.5 text-brand-400"></i>Built with anycoder
</a>
</div>
<div class="flex items-center gap-2">
<!-- Preview Link -->
<button id="btn-preview-link" onclick="generatePreviewLink()" class="group flex items-center gap-2 px-4 py-2 text-xs font-semibold text-slate-300 bg-white/[0.03] hover:bg-white/[0.06] border border-white/[0.06] hover:border-white/[0.1] rounded-lg transition-all duration-200 active:scale-95">
<i class="fa-solid fa-link text-[10px] text-slate-500 group-hover:text-brand-400 transition-colors"></i>
<span>Copy Link</span>
</button>
<!-- Download Dropdown -->
<div class="relative" id="download-dropdown">
<button onclick="toggleDownloadDropdown()" class="flex items-center gap-2 px-4 py-2 text-xs font-semibold text-white bg-gradient-to-r from-brand-600 to-purple-600 hover:from-brand-500 hover:to-purple-500 rounded-lg shadow-glow-sm hover:shadow-glow transition-all duration-300 active:scale-95 border border-white/10">
<i class="fa-solid fa-cloud-arrow-down"></i>
<span>Export</span>
<i class="fa-solid fa-chevron-down text-[10px] opacity-60"></i>
</button>
<div id="download-menu" class="hidden absolute right-0 top-full mt-2 w-56 bg-slate-900/95 backdrop-blur-xl border border-white/[0.06] rounded-xl shadow-2xl overflow-hidden z-50 animate-slide-down">
<div class="px-4 py-3 border-b border-white/[0.04]">
<p class="text-[10px] font-semibold text-slate-500 uppercase tracking-wider">Export Options</p>
</div>
<button onclick="downloadFile('index.html')" class="w-full flex items-center gap-3 px-4 py-3 text-sm text-slate-300 hover:text-white hover:bg-white/[0.04] transition-colors text-left group">
<i class="fa-brands fa-html5 text-orange-400 group-hover:scale-110 transition-transform"></i>
<div>
<p class="font-medium">index.html</p>
<p class="text-[10px] text-slate-500">Single bundled file</p>
</div>
</button>
<button onclick="downloadFile('style.css')" class="w-full flex items-center gap-3 px-4 py-3 text-sm text-slate-300 hover:text-white hover:bg-white/[0.04] transition-colors text-left group">
<i class="fa-brands fa-css3-alt text-blue-400 group-hover:scale-110 transition-transform"></i>
<div>
<p class="font-medium">style.css</p>
<p class="text-[10px] text-slate-500">Stylesheet only</p>
</div>
</button>
<button onclick="downloadFile('script.js')" class="w-full flex items-center gap-3 px-4 py-3 text-sm text-slate-300 hover:text-white hover:bg-white/[0.04] transition-colors text-left group">
<i class="fa-brands fa-js text-yellow-400 group-hover:scale-110 transition-transform"></i>
<div>
<p class="font-medium">script.js</p>
<p class="text-[10px] text-slate-500">JavaScript only</p>
</div>
</button>
<div class="border-t border-white/[0.04]"></div>
<button onclick="downloadAll()" class="w-full flex items-center gap-3 px-4 py-3 text-sm text-brand-300 hover:text-brand-200 hover:bg-brand-500/10 transition-colors text-left group">
<i class="fa-solid fa-file-zipper text-brand-400 group-hover:scale-110 transition-transform"></i>
<div>
<p class="font-medium">Full Project (.zip)</p>
<p class="text-[10px] text-slate-500">All files + README</p>
</div>
</button>
</div>
</div>
</div>
</div>
<!-- Toolbar -->
<div class="flex items-center gap-2 px-5 py-2 bg-slate-950/50 border-t border-white/[0.03]">
<!-- File Tabs -->
<div id="file-tabs" class="flex items-center gap-1.5 flex-1 overflow-x-auto no-scrollbar">
<!-- Dynamic tabs injected here -->
</div>
<div class="flex items-center gap-1.5 ml-2 pl-2 border-l border-white/[0.06]">
<button onclick="addNewFile()" class="p-1.5 text-slate-500 hover:text-white hover:bg-white/[0.06] rounded-md transition-all text-xs" title="New File">
<i class="fa-solid fa-plus"></i>
</button>
<button onclick="toggleSplitView()" class="p-1.5 text-slate-500 hover:text-white hover:bg-white/[0.06] rounded-md transition-all text-xs" title="Toggle Split">
<i class="fa-solid fa-columns"></i>
</button>
<button onclick="toggleTheme()" class="p-1.5 text-slate-500 hover:text-yellow-400 hover:bg-white/[0.06] rounded-md transition-all text-xs" title="Toggle Theme">
<i class="fa-solid fa-sun"></i>
</button>
<button onclick="toggleSettings()" class="p-1.5 text-slate-500 hover:text-white hover:bg-white/[0.06] rounded-md transition-all text-xs" title="Settings">
<i class="fa-solid fa-gear"></i>
</button>
<div class="w-px h-4 bg-white/[0.06] mx-1"></div>
<button onclick="runCode()" class="px-3 py-1.5 text-xs font-semibold text-white bg-brand-600/80 hover:bg-brand-500 rounded-md transition-all shadow-glow-sm active:scale-95 flex items-center gap-1.5">
<i class="fa-solid fa-play text-[10px]"></i> Run
</button>
<button onclick="toggleAutoRefresh()" id="auto-refresh-btn" class="px-2 py-1.5 text-xs font-medium text-slate-500 hover:text-brand-400 bg-white/[0.03] hover:bg-brand-500/10 rounded-md transition-all border border-transparent hover:border-brand-500/20">
<i class="fa-solid fa-rotate text-[10px]"></i> Auto
</button>
</div>
</div>
</header>
<!-- ═══════════ MAIN WORKSPACE ═══════════ -->
<main id="workspace" class="flex-1 flex overflow-hidden relative">
<!-- Editor Panel -->
<div id="editor-panel" class="flex flex-col bg-[#0d1117] border-r border-white/[0.04] transition-all duration-300" style="width: 50%;">
<!-- Editor Toolbar -->
<div class="flex items-center justify-between px-4 py-2 bg-[#0a0e14] border-b border-white/[0.04]">
<div class="flex items-center gap-2">
<span id="current-file-label" class="text-[11px] font-mono text-brand-400 font-medium"></span>
<span class="text-[10px] text-slate-600 font-mono" id="cursor-position">Ln 1, Col 1</span>
</div>
<div class="flex items-center gap-1">
<button onclick="formatCode()" class="text-[10px] text-slate-500 hover:text-brand-400 px-2 py-0.5 rounded hover:bg-white/[0.04] transition-all" title="Format Code">
<i class="fa-solid fa-align-left mr-1"></i>Format
</button>
<button onclick="copyCode()" class="text-[10px] text-slate-500 hover:text-brand-400 px-2 py-0.5 rounded hover:bg-white/[0.04] transition-all" title="Copy">
<i class="fa-regular fa-copy mr-1"></i>Copy
</button>
<button onclick="clearEditor()" class="text-[10px] text-slate-500 hover:text-red-400 px-2 py-0.5 rounded hover:bg-white/[0.04] transition-all" title="Clear">
<i class="fa-solid fa-eraser mr-1"></i>Clear
</button>
</div>
</div>
<!-- Editor Area -->
<div class="flex-1 relative overflow-hidden group">
<div id="editor-container" class="absolute inset-0 overflow-auto font-mono text-[13px] leading-6">
<div id="editor-content" class="relative min-h-full pb-20"></div>
</div>
<!-- Floating Line Counter (right side) -->
<div class="absolute right-3 top-3 text-[10px] text-slate-600 font-mono opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none">
<span id="total-lines">0</span> lines
</div>
</div>
</div>
<!-- Resize Handle -->
<div class="resize-handle z-10 flex-shrink-0" id="resize-handle"></div>
<!-- Preview Panel -->
<div id="preview-panel" class="flex-1 flex flex-col relative preview-container transition-all duration-300">
<!-- Preview Toolbar -->
<div class="flex items-center justify-between px-4 py-2 glass border-b border-white/[0.04] z-10">
<div class="flex items-center gap-3">
<span class="text-[11px] font-semibold text-slate-400 uppercase tracking-wider">Live Preview</span>
<div id="preview-badge" class="flex items-center gap-1.5 px-2 py-0.5 bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 rounded-full text-[10px] font-medium opacity-0 transition-opacity duration-300">
<span class="w-1.5 h-1.5 bg-emerald-400 rounded-full animate-pulse"></span>
Live
</div>
</div>
<div class="flex items-center gap-1.5">
<button onclick="setPreviewDevice('desktop')" class="p-1.5 text-slate-500 hover:text-white rounded-md transition-all text-xs preview-device-btn active" data-device="desktop" title="Desktop">
<i class="fa-solid fa-desktop"></i>
</button>
<button onclick="setPreviewDevice('tablet')" class="p-1.5 text-slate-500 hover:text-white rounded-md transition-all text-xs preview-device-btn" data-device="tablet" title="Tablet">
<i class="fa-solid fa-tablet-screen-button"></i>
</button>
<button onclick="setPreviewDevice('mobile')" class="p-1.5 text-slate-500 hover:text-white rounded-md transition-all text-xs preview-device-btn" data-device="mobile" title="Mobile">
<i class="fa-solid fa-mobile-screen-button"></i>
</button>
<div class="w-px h-4 bg-white/[0.06] mx-1"></div>
<button onclick="openFullscreen()" class="p-1.5 text-slate-500 hover:text-white rounded-md transition-all text-xs" title="Fullscreen">
<i class="fa-solid fa-expand"></i>
</button>
<button onclick="refreshPreview()" class="p-1.5 text-slate-500 hover:text-brand-400 rounded-md transition-all text-xs" title="Refresh">
<i class="fa-solid fa-rotate-right"></i>
</button>
</div>
</div>
<!-- Preview Content -->
<div class="flex-1 overflow-auto relative">
<div id="preview-wrapper" class="w-full h-full p-6 flex justify-center items-start transition-all duration-500">
<iframe id="preview-frame" class="preview-frame rounded-xl shadow-2xl transition-all duration-500" sandbox="allow-scripts allow-same-origin allow-forms allow-modals allow-popups"></iframe>
</div>
</div>
</div>
</main>
<!-- ═══════════ FILE LIST SIDEBAR (Collapsible) ═══════════ -->
<div id="file-sidebar" class="fixed left-0 top-[104px] bottom-0 w-56 bg-slate-900/95 backdrop-blur-xl border-r border-white/[0.04] z-40 transform -translate-x-full transition-transform duration-300 shadow-2xl flex flex-col">
<div class="p-4 border-b border-white/[0.04]">
<h3 class="text-[11px] font-semibold text-slate-500 uppercase tracking-wider">Project Files</h3>
</div>
<div id="file-list" class="flex-1 overflow-y-auto py-2">
<!-- File list items injected here -->
</div>
<div class="p-3 border-t border-white/[0.04]">
<button onclick="addNewFile()" class="w-full flex items-center justify-center gap-2 px-3 py-2 text-xs font-medium text-brand-300 hover:text-brand-200 bg-brand-500/10 hover:bg-brand-500/15 border border-brand-500/20 rounded-lg transition-all">
<i class="fa-solid fa-plus text-[10px]"></i> New File
</button>
</div>
</div>
<!-- ═══════════ TOAST NOTIFICATIONS ═══════════ -->
<div id="toast-container" class="fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none"></div>
<!-- ═══════════ MODALS ═══════════ -->
<!-- New File Modal -->
<div id="new-file-modal" class="hidden fixed inset-0 z-[60] flex items-center justify-center bg-black/60 backdrop-blur-sm animate-fade-in">
<div class="bg-slate-900 border border-white/[0.08] rounded-2xl shadow-2xl w-96 overflow-hidden transform transition-all animate-slide-up">
<div class="p-5 border-b border-white/[0.04]">
<h3 class="text-base font-display font-bold text-white">New File</h3>
<p class="text-xs text-slate-500 mt-1">Create a new file in your project</p>
</div>
<div class="p-5 space-y-4">
<div>
<label class="block text-[11px] font-semibold text-slate-400 uppercase tracking-wider mb-2">File Name</label>
<input type="text" id="new-file-name" class="w-full bg-slate-950 border border-white/[0.08] rounded-lg px-3 py-2.5 text-sm text-white placeholder-slate-600 focus:border-brand-500 focus:ring-1 focus:ring-brand-500/20 outline-none transition-all font-mono" placeholder="component.html" onkeydown="if(event.key==='Enter') confirmNewFile()">
<p class="text-[10px] text-slate-500 mt-1.5">Supported: .html, .css, .js, .md, .json, .txt</p>
</div>
</div>
<div class="flex items-center gap-2 p-5 border-t border-white/[0.04] bg-slate-950/30">
<button onclick="closeModal('new-file-modal')" class="flex-1 px-4 py-2 text-xs font-medium text-slate-400 hover:text-white bg-white/[0.03] hover:bg-white/[0.06] rounded-lg transition-all">Cancel</button>
<button onclick="confirmNewFile()" class="flex-1 px-4 py-2 text-xs font-semibold text-white bg-brand-600 hover:bg-brand-500 rounded-lg transition-all shadow-glow-sm">Create File</button>
</div>
</div>
</div>
<!-- Preview Link Modal -->
<div id="link-modal" class="hidden fixed inset-0 z-[60] flex items-center justify-center bg-black/60 backdrop-blur-sm animate-fade-in">
<div class="bg-slate-900 border border-white/[0.08] rounded-2xl shadow-2xl w-[480px] overflow-hidden transform transition-all animate-slide-up">
<div class="p-5 border-b border-white/[0.04] flex items-center justify-between">
<div>
<h3 class="text-base font-display font-bold text-white">Share Preview</h3>
<p class="text-xs text-slate-500 mt-1">Generate a shareable preview link</p>
</div>
<button onclick="closeModal('link-modal')" class="text-slate-500 hover:text-white transition-colors">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="p-5 space-y-4">
<div>
<label class="block text-[11px] font-semibold text-slate-400 uppercase tracking-wider mb-2">Preview URL</label>
<div class="flex gap-2">
<input type="text" id="preview-url" readonly class="flex-1 bg-slate-950 border border-white/[0.08] rounded-lg px-3 py-2.5 text-xs text-slate-400 font-mono focus:border-brand-500 outline-none transition-all" value="">
<button onclick="copyPreviewUrl()" class="px-3 py-2 text-xs font-medium text-brand-300 hover:text-brand-200 bg-brand-500/10 hover:bg-brand-500/15 border border-brand-500/20 rounded-lg transition-all">
<i class="fa-regular fa-copy"></i>
</button>
</div>
</div>
<div class="bg-slate-950/50 rounded-lg p-4 border border-white/[0.04]">
<p class="text-[11px] text-slate-500 leading-relaxed">
<i class="fa-solid fa-circle-info text-brand-400 mr-1.5"></i>
This link contains a Base64-encoded version of your code. Anyone with this link can view your preview. The link is generated locally in your browser - no data is sent to any server.
</p>
</div>
</div>
</div>
</div>
<!-- Settings Modal -->
<div id="settings-modal" class="hidden fixed inset-0 z-[60] flex items-center justify-center bg-black/60 backdrop-blur-sm animate-fade-in">
<div class="bg-slate-900 border border-white/[0.08] rounded-2xl shadow-2xl w-96 overflow-hidden transform transition-all animate-slide-up">
<div class="p-5 border-b border-white/[0.04]">
<h3 class="text-base font-display font-bold text-white">Editor Settings</h3>
</div>
<div class="p-5 space-y-4">
<div class="flex items-center justify-between">
<label class="text-sm text-slate-300">Auto Refresh</label>
<button onclick="toggleSetting('autoRefresh')" id="setting-auto-refresh" class="w-10 h-5 bg-brand-600 rounded-full relative transition-all">
<span class="absolute right-1 top-0.5 w-4 h-4 bg-white rounded-full shadow transition-all"></span>
</button>
</div>
<div class="flex items-center justify-between">
<label class="text-sm text-slate-300">Line Numbers</label>
<button onclick="toggleSetting('lineNumbers')" id="setting-line-numbers" class="w-10 h-5 bg-brand-600 rounded-full relative transition-all">
<span class="absolute right-1 top-0.5 w-4 h-4 bg-white rounded-full shadow transition-all"></span>
</button>
</div>
<div class="flex items-center justify-between">
<label class="text-sm text-slate-300">Dark Preview</label>
<button onclick="toggleSetting('darkPreview')" id="setting-dark-preview" class="w-10 h-5 bg-slate-700 rounded-full relative transition-all">
<span class="absolute left-1 top-0.5 w-4 h-4 bg-white rounded-full shadow transition-all"></span>
</button>
</div>
<div class="flex items-center justify-between">
<label class="text-sm text-slate-300">Font Size</label>
<div class="flex items-center gap-2">
<button onclick="changeFontSize(-1)" class="w-7 h-7 flex items-center justify-center text-xs text-slate-400 hover:text-white bg-white/[0.04] hover:bg-white/[0.08] rounded-md transition-all">-</button>
<span id="font-size-display" class="text-xs font-mono text-slate-400 w-8 text-center">13</span>
<button onclick="changeFontSize(1)" class="w-7 h-7 flex items-center justify-center text-xs text-slate-400 hover:text-white bg-white/[0.04] hover:bg-white/[0.08] rounded-md transition-all">+</button>
</div>
</div>
</div>
<div class="p-5 border-t border-white/[0.04] bg-slate-950/30">
<button onclick="closeModal('settings-modal')" class="w-full px-4 py-2 text-xs font-semibold text-white bg-brand-600 hover:bg-brand-500 rounded-lg transition-all shadow-glow-sm">Done</button>
</div>
</div>
</div>
</div>
<script>
|