webtool / index.html
MarcRyan's picture
Add 2 files
7b894c1 verified
Raw History Blame Contribute Delete
64.6 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>DeepSeek Visual Builder with APWB & DeepCoder Integration</title> <script src="https://cdn.tailwindcss.com"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap'); :root { --primary: #6366f1; --primary-dark: #4f46e5; --secondary: #f43f5e; --dark: #1e293b; --light: #f8fafc; } body { font-family: 'Inter', sans-serif; @apply bg-gray-50 text-gray-800; } .component { transition: all 0.2s ease; cursor: grab; @apply hover:shadow-md hover:border-primary/50; } .component:active { cursor: grabbing; } .droppable { min-height: calc(100vh - 180px); transition: background-color 0.3s; background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%), linear-gradient(-45deg, #f1f5f9 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f1f5f9 75%), linear-gradient(-45deg, transparent 75%, #f1f5f9 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px; } .droppable.highlight { @apply bg-primary/5 border-2 border-dashed border-primary; animation: pulse 1.5s infinite; } .canvas-component { @apply relative rounded-lg mb-4 overflow-hidden group transition-all duration-200; box-shadow: 0 1px 3px rgba(0,0,0,0.1); } .canvas-component:hover { @apply shadow-lg; } .canvas-component.selected { @apply ring-2 ring-primary ring-offset-2; } .component-toolbar { @apply absolute top-0 left-0 right-0 bg-gray-800 flex items-center justify-between px-2 h-8 opacity-0 group-hover:opacity-100 transition-opacity duration-200; } .component-handle { @apply text-white/80 hover:text-white cursor-move flex items-center; } .component-actions { @apply flex items-center space-x-2; } .component-action-btn { @apply text-white/60 hover:text-white p-1; } .properties-panel { scrollbar-width: thin; scrollbar-color: var(--primary) transparent; } .properties-panel::-webkit-scrollbar { width: 6px; } .properties-panel::-webkit-scrollbar-thumb { @apply bg-primary/30 rounded-full; } .properties-panel::-webkit-scrollbar-thumb:hover { @apply bg-primary/50; } @keyframes pulse { 0%, 100% { background-color: rgba(99, 102, 241, 0.05); } 50% { background-color: rgba(99, 102, 241, 0.1); } } .color-option { @apply w-6 h-6 rounded-full cursor-pointer border border-gray-200; transition: transform 0.2s; } .color-option:hover { transform: scale(1.1); } .color-option.selected { @apply ring-2 ring-offset-2 ring-gray-400; transform: scale(1.1); } .tab-btn { @apply px-4 py-2 font-medium text-sm rounded-md transition-colors; } .tab-btn.active { @apply bg-primary text-white; } .tab-btn:not(.active) { @apply text-gray-500 hover:text-gray-700 hover:bg-gray-100; } .preview-frame-container { background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%), linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e2e8f0 75%), linear-gradient(-45deg, transparent 75%, #e2e8f0 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px; } .toast { @apply fixed bottom-4 right-4 px-4 py-2 rounded-md shadow-lg text-white font-medium flex items-center; background-color: var(--primary); animation: slideIn 0.3s, fadeOut 0.5s 2.5s forwards; } @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes fadeOut { to { opacity: 0; } } .resize-handle { @apply absolute right-0 bottom-0 w-3 h-3 bg-primary rounded-tl-md cursor-nwse-resize opacity-0 group-hover:opacity-100 transition-opacity; } .resize-handle:hover { @apply bg-primary-dark; } /* AI Prompt Modal Styles */ .ai-modal { @apply fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4; } .ai-modal-content { @apply bg-white rounded-lg w-full max-w-2xl flex flex-col overflow-hidden shadow-xl; } .ai-modal-header { @apply p-4 border-b flex justify-between items-center bg-gray-50; } .ai-modal-body { @apply p-4 flex-1 overflow-auto; } .ai-modal-footer { @apply p-4 border-t flex justify-end space-x-3; } .ai-prompt-textarea { @apply w-full p-3 border rounded-md text-sm h-32 focus:ring-2 focus:ring-primary focus:border-transparent; } .ai-response { @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap; } .ai-loading { @apply flex items-center justify-center py-4; } .ai-loading-spinner { @apply animate-spin h-5 w-5 text-primary; } .ai-generated-component { @apply border-l-4 border-primary pl-3 my-2; } /* APWB Integration Styles */ .apwb-container { @apply border rounded-lg overflow-hidden; } .apwb-header { @apply bg-gray-100 p-3 border-b flex justify-between items-center; } .apwb-body { @apply p-4; } .apwb-input { @apply w-full p-2 border rounded-md text-sm mb-2; } .apwb-button { @apply bg-blue-500 hover:bg-blue-600 text-white px-3 py-1.5 rounded-md text-sm font-medium; } .apwb-response { @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap; } /* DeepCoder AI Assistant Styles */ .deepcoder-container { @apply border rounded-lg overflow-hidden; } .deepcoder-header { @apply bg-gray-100 p-3 border-b flex justify-between items-center; } .deepcoder-body { @apply p-4; } .deepcoder-input { @apply w-full p-2 border rounded-md text-sm mb-2; } .deepcoder-button { @apply bg-purple-600 hover:bg-purple-700 text-white px-3 py-1.5 rounded-md text-sm font-medium; } .deepcoder-response { @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap; } .deepcoder-tabs { @apply flex border-b; } .deepcoder-tab { @apply px-4 py-2 text-sm font-medium cursor-pointer; } .deepcoder-tab.active { @apply border-b-2 border-purple-600 text-purple-600; } .deepcoder-code { @apply w-full h-64 p-2 border rounded-md text-sm font-mono; } .model-selector { @apply flex items-center space-x-2 bg-gray-100 rounded-md px-3 py-1.5; } .model-selector select { @apply bg-transparent border-none focus:ring-0 text-sm; } /* Split view layout */ .split-container { @apply flex flex-1 overflow-hidden; } .split-panel { @apply flex-1 overflow-auto; } .split-divider { @apply w-1 bg-gray-200 cursor-col-resize; } /* Tabs */ .tab-content { @apply hidden; } .tab-content.active { @apply block; } /* Code editor styles */ .code-editor { @apply border rounded-md overflow-hidden; } .code-toolbar { @apply bg-gray-100 p-2 flex justify-between items-center; } .code-area { @apply w-full h-64 p-3 font-mono text-sm bg-gray-900 text-gray-100; } /* Terminal styles */ .terminal { @apply bg-gray-900 text-gray-100 font-mono text-sm p-3 rounded-b-md; height: 200px; overflow-y: auto; } .terminal-line { @apply mb-1; } .terminal-prompt { @apply text-green-400; } .terminal-command { @apply text-white; } .terminal-output { @apply text-gray-300; } /* Rosebud AI Styles */ .rosebud-container { @apply border rounded-lg overflow-hidden; } .rosebud-header { @apply bg-gray-100 p-3 border-b flex justify-between items-center; } .rosebud-body { @apply p-4; } .rosebud-input { @apply w-full p-2 border rounded-md text-sm mb-2; } .rosebud-button { @apply bg-pink-600 hover:bg-pink-700 text-white px-3 py-1.5 rounded-md text-sm font-medium; } .rosebud-response { @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap; } .rosebud-image-container { @apply grid grid-cols-2 gap-4 mt-4; } .rosebud-image { @apply rounded-lg border border-gray-200 cursor-pointer transition-all hover:shadow-md; } .rosebud-image.selected { @apply ring-2 ring-pink-500; } .rosebud-controls { @apply flex items-center space-x-2 mt-4; } .rosebud-control-btn { @apply bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm; } .rosebud-slider { @apply w-full; } .rosebud-edit-tools { @apply grid grid-cols-4 gap-2 mt-4; } .rosebud-tool-btn { @apply p-2 border rounded-md text-center cursor-pointer hover:bg-gray-100; } .rosebud-tool-btn.active { @apply bg-pink-100 border-pink-500; } /* Image Editor Styles */ .image-editor-container { @apply relative overflow-hidden; } .image-editor-tools { @apply absolute top-0 left-0 right-0 bg-gray-800 text-white p-2 flex space-x-2; } .image-editor-tool { @apply p-1 rounded cursor-pointer hover:bg-gray-700; } .image-editor-canvas { @apply w-full h-full; } /* Style Transfer Styles */ .style-transfer-container { @apply grid grid-cols-2 gap-4 mt-4; } .style-transfer-image { @apply rounded-lg border border-gray-200 cursor-pointer; } .style-transfer-btn { @apply bg-purple-600 hover:bg-purple-700 text-white px-3 py-1.5 rounded-md text-sm font-medium w-full mt-2; } </style> </head> <body class="h-screen flex flex-col overflow-hidden"> <!-- Header --> <header class="bg-gradient-to-r from-primary to-primary-dark text-white shadow-md"> <div class="container mx-auto flex justify-between items-center px-4 py-3"> <div class="flex items-center space-x-2"> <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" /> </svg> <h1 class="text-xl font-bold">DeepSeek + APWB + DeepCoder + Rosebud</h1> </div> <div class="flex items-center space-x-3"> <button id="aiPromptBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors"> <i class="fas fa-robot"></i> <span>AI Builder</span> </button> <button id="deepcoderBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors"> <i class="fas fa-code"></i> <span>DeepCoder</span> </button> <button id="rosebudBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors"> <i class="fas fa-magic"></i> <span>Rosebud AI</span> </button> <button id="saveBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors"> <i class="fas fa-save"></i> <span>Save</span> </button> <button id="previewBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors"> <i class="fas fa-eye"></i> <span>Preview</span> </button> <button id="exportBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors"> <i class="fas fa-file-export"></i> <span>Export</span> </button> </div> </div> </header> <!-- Main Content --> <div class="split-container"> <!-- Left Panel - Components & APWB Integration --> <div class="split-panel w-64 bg-white border-r border-gray-200 flex flex-col"> <div class="p-3 border-b border-gray-200"> <div class="flex items-center justify-between"> <h2 class="text-lg font-semibold text-gray-800">Tools</h2> <div class="model-selector"> <span>Model:</span> <select id="modelSelector"> <option value="apwb">APWB</option> <option value="deepseek">DeepSeek</option> <option value="deepcoder">DeepCoder</option> <option value="rosebud">Rosebud</option> </select> </div> </div> <div class="mt-2 flex space-x-1"> <button class="tab-btn active" data-tab="components">Components</button> <button class="tab-btn" data-tab="apwb">APWB</button> <button class="tab-btn" data-tab="deepcoder">DeepCoder</button> <button class="tab-btn" data-tab="rosebud">Rosebud</button> </div> </div> <!-- Components Tab --> <div id="componentsTab" class="tab-content active flex-1 overflow-y-auto p-3 space-y-3"> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="header"> <div class="flex items-center space-x-3"> <div class="bg-primary/10 text-primary p-2 rounded-lg"> <i class="fas fa-header"></i> </div> <div> <h3 class="font-medium text-sm">Header</h3> <p class="text-xs text-gray-500">Navigation with logo</p> </div> </div> </div> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="hero"> <div class="flex items-center space-x-3"> <div class="bg-blue-100 text-blue-500 p-2 rounded-lg"> <i class="fas fa-star"></i> </div> <div> <h3 class="font-medium text-sm">Hero Section</h3> <p class="text-xs text-gray-500">Banner with CTA</p> </div> </div> </div> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="features"> <div class="flex items-center space-x-3"> <div class="bg-green-100 text-green-500 p-2 rounded-lg"> <i class="fas fa-th-large"></i> </div> <div> <h3 class="font-medium text-sm">Features</h3> <p class="text-xs text-gray-500">Card grid layout</p> </div> </div> </div> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="text"> <div class="flex items-center space-x-3"> <div class="bg-purple-100 text-purple-500 p-2 rounded-lg"> <i class="fas fa-align-left"></i> </div> <div> <h3 class="font-medium text-sm">Text Block</h3> <p class="text-xs text-gray-500">Rich text content</p> </div> </div> </div> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="image"> <div class="flex items-center space-x-3"> <div class="bg-yellow-100 text-yellow-500 p-2 rounded-lg"> <i class="fas fa-image"></i> </div> <div> <h3 class="font-medium text-sm">Image</h3> <p class="text-xs text-gray-500">Single image</p> </div> </div> </div> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="cta"> <div class="flex items-center space-x-3"> <div class="bg-red-100 text-red-500 p-2 rounded-lg"> <i class="fas fa-bullhorn"></i> </div> <div> <h3 class="font-medium text-sm">Call to Action</h3> <p class="text-xs text-gray-500">Button with text</p> </div> </div> </div> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="footer"> <div class="flex items-center space-x-3"> <div class="bg-gray-100 text-gray-500 p-2 rounded-lg"> <i class="fas fa-window-minimize"></i> </div> <div> <h3 class="font-medium text-sm">Footer</h3> <p class="text-xs text-gray-500">Page footer</p> </div> </div> </div> <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="ai-image"> <div class="flex items-center space-x-3"> <div class="bg-pink-100 text-pink-500 p-2 rounded-lg"> <i class="fas fa-magic"></i> </div> <div> <h3 class="font-medium text-sm">AI Image</h3> <p class="text-xs text-gray-500">Generated with Rosebud</p> </div> </div> </div> </div> <!-- APWB Tab --> <div id="apwbTab" class="tab-content flex-1 overflow-y-auto p-3"> <div class="apwb-container"> <div class="apwb-header"> <h3 class="text-sm font-medium">APWB AI Assistant</h3> <i class="fas fa-info-circle text-gray-500"></i> </div> <div class="apwb-body"> <textarea id="apwbPrompt" class="apwb-input" placeholder="Describe what you want to create..."></textarea> <button id="apwbSubmit" class="apwb-button w-full"> <i class="fas fa-paper-plane mr-1"></i> Generate </button> <div id="apwbResponse" class="apwb-response hidden"></div> <div id="apwbLoading" class="ai-loading hidden"> <i class="ai-loading-spinner fas fa-spinner"></i> <span class="ml-2">Generating with APWB...</span> </div> </div> </div> </div> <!-- DeepCoder Tab --> <div id="deepcoderTab" class="tab-content flex-1 overflow-y-auto p-3"> <div class="deepcoder-container"> <div class="deepcoder-header"> <h3 class="text-sm font-medium">DeepCoder AI Assistant</h3> <i class="fas fa-info-circle text-gray-500"></i> </div> <div class="deepcoder-body"> <textarea id="deepcoderPrompt" class="deepcoder-input" placeholder="Describe the code you want to generate..."></textarea> <button id="deepcoderSubmit" class="deepcoder-button w-full"> <i class="fas fa-code mr-1"></i> Generate Code </button> <div id="deepcoderResponse" class="deepcoder-response hidden"></div> <div id="deepcoderLoading" class="ai-loading hidden"> <i class="ai-loading-spinner fas fa-spinner"></i> <span class="ml-2">Generating with DeepCoder...</span> </div> </div> </div> </div> <!-- Rosebud Tab --> <div id="rosebudTab" class="tab-content flex-1 overflow-y-auto p-3"> <div class="rosebud-container"> <div class="rosebud-header"> <h3 class="text-sm font-medium">Rosebud AI</h3> <i class="fas fa-info-circle text-gray-500"></i> </div> <div class="rosebud-body"> <textarea id="rosebudPrompt" class="rosebud-input" placeholder="Describe the image you want to generate..."></textarea> <div class="flex items-center space-x-2"> <select id="rosebudStyle" class="rosebud-input flex-1"> <option value="realistic">Realistic</option> <option value="cartoon">Cartoon</option> <option value="anime">Anime</option> <option value="fantasy">Fantasy</option> <option value="watercolor">Watercolor</option> </select> <select id="rosebudRatio" class="rosebud-input flex-1"> <option value="1:1">Square (1:1)</option> <option value="4:3">Standard (4:3)</option> <option value="16:9">Widescreen (16:9)</option> <option value="9:16">Portrait (9:16)</option> </select> </div> <button id="rosebudSubmit" class="rosebud-button w-full mt-2"> <i class="fas fa-magic mr-1"></i> Generate Image </button> <div id="rosebudResponse" class="rosebud-response hidden"></div> <div id="rosebudLoading" class="ai-loading hidden"> <i class="ai-loading-spinner fas fa-spinner"></i> <span class="ml-2">Generating with Rosebud...</span> </div> <div id="rosebudImages" class="rosebud-image-container hidden"></div> <div id="rosebudEditControls" class="rosebud-controls hidden"> <button id="rosebudEditBtn" class="rosebud-control-btn"> <i class="fas fa-edit mr-1"></i> Edit </button> <button id="rosebudDownloadBtn" class="rosebud-control-btn"> <i class="fas fa-download mr-1"></i> Download </button> <button id="rosebudAddToCanvasBtn" class="rosebud-control-btn"> <i class="fas fa-plus mr-1"></i> Add to Canvas </button> </div> </div> </div> </div> </div> <!-- Divider --> <div class="split-divider"></div> <!-- Center Panel - Canvas --> <div class="split-panel bg-gray-100 overflow-auto p-6"> <div id="canvas" class="droppable bg-white mx-auto w-full max-w-4xl min-h-full rounded-lg shadow-sm relative"> <div class="absolute inset-0 flex items-center justify-center" id="emptyState"> <div class="text-center p-6 max-w-md"> <div class="bg-gray-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4"> <i class="fas fa-plus text-gray-400 text-2xl"></i> </div> <h3 class="text-lg font-medium text-gray-700 mb-1">Drag components here</h3> <p class="text-gray-500 text-sm">Start building your page by dragging components or using the AI tools</p> </div> </div> </div> </div> <!-- Divider --> <div class="split-divider"></div> <!-- Right Panel - Properties --> <div class="split-panel w-72 bg-white border-l border-gray-200 flex flex-col"> <div class="p-3 border-b border-gray-200"> <h2 class="text-lg font-semibold text-gray-800">Properties</h2> </div> <div id="propertiesPanel" class="flex-1 overflow-y-auto properties-panel p-4"> <div class="text-center text-gray-500 py-10"> <i class="fas fa-mouse-pointer text-3xl mb-3 text-gray-300"></i> <p>Select a component to edit its properties</p> </div> </div> </div> </div> <!-- Preview Modal --> <div id="previewModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4"> <div class="bg-white rounded-lg w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden shadow-xl"> <div class="p-4 border-b flex justify-between items-center bg-gray-50"> <h3 class="text-lg font-semibold">Live Preview</h3> <div class="flex items-center space-x-3"> <div class="flex items-center space-x-1 text-sm bg-gray-100 rounded-md px-2 py-1"> <span>Device:</span> <select id="deviceSelector" class="bg-transparent border-none focus:ring-0 text-sm"> <option value="desktop">Desktop</option> <option value="tablet">Tablet</option> <option value="mobile">Mobile</option> </select> </div> <button id="closePreview" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-times"></i> </button> </div> </div> <div class="flex-1 overflow-hidden p-4 bg-gray-100 flex items-center justify-center"> <div id="previewContainer" class="w-full h-full preview-frame-container rounded overflow-hidden"> <iframe id="previewFrame" class="w-full h-full bg-white border-none"></iframe> </div> </div> </div> </div> <!-- Export Modal --> <div id="exportModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4"> <div class="bg-white rounded-lg w-full max-w-2xl flex flex-col overflow-hidden shadow-xl"> <div class="p-4 border-b flex justify-between items-center bg-gray-50"> <h3 class="text-lg font-semibold">Export HTML</h3> <button id="closeExport" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-times"></i> </button> </div> <div class="p-4 flex-1 overflow-auto"> <div class="flex space-x-2 mb-4"> <button id="copyCodeBtn" class="bg-primary hover:bg-primary-dark text-white px-3 py-1.5 rounded-md text-sm font-medium"> <i class="fas fa-copy mr-1"></i> Copy Code </button> <button id="downloadBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1.5 rounded-md text-sm font-medium"> <i class="fas fa-download mr-1"></i> Download </button> </div> <pre id="exportCode" class="bg-gray-100 p-3 rounded-md text-sm overflow-x-auto max-h-[60vh]"></pre> </div> </div> </div> <!-- AI Prompt Modal --> <div id="aiModal" class="ai-modal hidden"> <div class="ai-modal-content"> <div class="ai-modal-header"> <h3 class="text-lg font-semibold">AI Builder</h3> <button id="closeAIModal" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-times"></i> </button> </div> <div class="ai-modal-body"> <p class="text-sm text-gray-600 mb-3">Describe the component or page you want to create. The AI will generate it for you.</p> <textarea id="aiPrompt" class="ai-prompt-textarea" placeholder="Example: Create a hero section with a dark background, centered text, a headline, a subheadline, and a primary button that says 'Get Started'"></textarea> <div id="aiResponse" class="ai-response hidden"></div> <div id="aiLoading" class="ai-loading hidden"> <i class="ai-loading-spinner fas fa-spinner"></i> <span class="ml-2">Generating your component...</span> </div> <div id="aiGeneratedComponents" class="mt-4 hidden"> <h4 class="font-medium mb-2">Generated Components:</h4> <div id="aiComponentsList"></div> </div> </div> <div class="ai-modal-footer"> <button id="cancelAIBtn" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-200 rounded-md hover:bg-gray-300"> Cancel </button> <button id="generateAIBtn" class="px-4 py-2 text-sm font-medium text-white bg-primary rounded-md hover:bg-primary-dark"> Generate </button> </div> </div> </div> <!-- DeepCoder Modal --> <div id="deepcoderModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4"> <div class="bg-white rounded-lg w-full max-w-4xl h-[80vh] flex flex-col overflow-hidden shadow-xl"> <div class="p-4 border-b flex justify-between items-center bg-gray-50"> <h3 class="text-lg font-semibold">DeepCoder AI Assistant</h3> <button id="closeDeepcoderModal" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-times"></i> </button> </div> <div class="flex-1 overflow-hidden flex flex-col"> <div class="deepcoder-tabs"> <div class="deepcoder-tab active" data-tab="code">Code Editor</div> <div class="deepcoder-tab" data-tab="terminal">Terminal</div> </div> <div class="flex-1 overflow-auto"> <div id="deepcoderCodeTab" class="tab-content active h-full"> <div class="code-editor h-full flex flex-col"> <div class="code-toolbar"> <div class="flex space-x-2"> <button id="runCodeBtn" class="bg-green-600 hover:bg-green-700 text-white px-3 py-1 rounded text-sm"> <i class="fas fa-play mr-1"></i> Run </button> <button id="clearCodeBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm"> <i class="fas fa-trash-alt mr-1"></i> Clear </button> </div> </div> <textarea id="deepcoderCode" class="code-area flex-1" placeholder="Write your code here or generate it with AI..."></textarea> </div> </div> <div id="deepcoderTerminalTab" class="tab-content h-full"> <div class="terminal"> <div id="terminalContent"> <div class="terminal-line"> <span class="terminal-prompt">$</span> <span class="terminal-command">Welcome to DeepCoder Terminal</span> </div> <div class="terminal-line"> <span class="terminal-prompt">$</span> <span class="terminal-command">Type 'help' for available commands</span> </div> </div> <div class="terminal-input flex items-center mt-2"> <span class="terminal-prompt mr-2">$</span> <input type="text" id="terminalCommand" class="bg-transparent border-none text-white flex-1 focus:ring-0" placeholder="Enter command..."> </div> </div> </div> </div> </div> <div class="p-4 border-t"> <div class="flex items-center space-x-3"> <textarea id="deepcoderAIPrompt" class="flex-1 p-2 border rounded-md text-sm" placeholder="Ask DeepCoder to generate or modify code..."></textarea> <button id="deepcoderAISubmit" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-md text-sm"> <i class="fas fa-code mr-1"></i> Ask AI </button> </div> <div id="deepcoderAIResponse" class="deepcoder-response hidden mt-2"></div> <div id="deepcoderAILoading" class="ai-loading hidden"> <i class="ai-loading-spinner fas fa-spinner"></i> <span class="ml-2">DeepCoder is thinking...</span> </div> </div> </div> </div> <!-- Rosebud AI Modal --> <div id="rosebudModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4"> <div class="bg-white rounded-lg w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden shadow-xl"> <div class="p-4 border-b flex justify-between items-center bg-gray-50"> <h3 class="text-lg font-semibold">Rosebud AI - Advanced Image Generation</h3> <button id="closeRosebudModal" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-times"></i> </button> </div> <div class="flex-1 overflow-hidden flex"> <!-- Left Panel - Generation Controls --> <div class="w-1/3 border-r p-4 overflow-y-auto"> <div class="mb-4"> <label class="block text-sm font-medium text-gray-700 mb-1">Prompt</label> <textarea id="rosebudAdvancedPrompt" class="rosebud-input h-24" placeholder="Describe the image you want to generate..."></textarea> </div> <div class="grid grid-cols-2 gap-4 mb-4"> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Style</label> <select id="rosebudAdvancedStyle" class="rosebud-input w-full"> <option value="realistic">Realistic</option> <option value="cartoon">Cartoon</option> <option value="anime">Anime</option> <option value="fantasy">Fantasy</option> <option value="watercolor">Watercolor</option> <option value="oil-painting">Oil Painting</option> <option value="pixel-art">Pixel Art</option> <option value="cyberpunk">Cyberpunk</option> </select> </div> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Aspect Ratio</label> <select id="rosebudAdvancedRatio" class="rosebud-input w-full"> <option value="1:1">Square (1:1)</option> <option value="4:3">Standard (4:3)</option> <option value="16:9">Widescreen (16:9)</option> <option value="9:16">Portrait (9:16)</option> <option value="2:3">Portrait (2:3)</option> <option value="3:2">Landscape (3:2)</option> </select> </div> </div> <div class="mb-4"> <label class="block text-sm font-medium text-gray-700 mb-1">Quality</label> <input type="range" id="rosebudQuality" class="rosebud-slider" min="1" max="10" value="7"> <div class="flex justify-between text-xs text-gray-500 mt-1"> <span>Fast</span> <span>Balanced</span> <span>High Quality</span> </div> </div> <div class="mb-4"> <label class="block text-sm font-medium text-gray-700 mb-1">Creativity</label> <input type="range" id="rosebudCreativity" class="rosebud-slider" min="1" max="10" value="5"> <div class="flex justify-between text-xs text-gray-500 mt-1"> <span>Precise</span> <span>Balanced</span> <span>Creative</span> </div> </div> <div class="mb-4"> <label class="block text-sm font-medium text-gray-700 mb-1">Negative Prompt</label> <textarea id="rosebudNegativePrompt" class="rosebud-input h-16" placeholder="What you don't want in the image..."></textarea> </div> <button id="rosebudAdvancedSubmit" class="rosebud-button w-full"> <i class="fas fa-magic mr-1"></i> Generate Image </button> <div id="rosebudAdvancedResponse" class="rosebud-response hidden mt-4"></div> <div id="rosebudAdvancedLoading" class="ai-loading hidden"> <i class="ai-loading-spinner fas fa-spinner"></i> <span class="ml-2">Generating with Rosebud...</span> </div> </div> <!-- Right Panel - Image Display & Editing --> <div class="w-2/3 flex flex-col"> <div class="border-b p-4"> <div class="flex justify-between items-center"> <h4 class="text-sm font-medium">Generated Images</h4> <div class="flex space-x-2"> <button id="rosebudUpscaleBtn" class="rosebud-control-btn"> <i class="fas fa-expand mr-1"></i> Upscale </button> <button id="rosebudVariationsBtn" class="rosebud-control-btn"> <i class="fas fa-copy mr-1"></i> Variations </button> </div> </div> </div> <div id="rosebudAdvancedImages" class="rosebud-image-container p-4 grid grid-cols-2 gap-4 overflow-y-auto flex-1"> <!-- Images will be inserted here --> </div> <div class="border-t p-4"> <h4 class="text-sm font-medium mb-2">Image Editing Tools</h4> <div class="rosebud-edit-tools"> <button class="rosebud-tool-btn" data-tool="crop"> <i class="fas fa-crop"></i> <div class="text-xs mt-1">Crop</div> </button> <button class="rosebud-tool-btn" data-tool="adjust"> <i class="fas fa-sliders-h"></i> <div class="text-xs mt-1">Adjust</div> </button> <button class="rosebud-tool-btn" data-tool="filter"> <i class="fas fa-filter"></i> <div class="text-xs mt-1">Filter</div> </button> <button class="rosebud-tool-btn" data-tool="text"> <i class="fas fa-font"></i> <div class="text-xs mt-1">Text</div> </button> <button class="rosebud-tool-btn" data-tool="draw"> <i class="fas fa-pencil-alt"></i> <div class="text-xs mt-1">Draw</div> </button> <button class="rosebud-tool-btn" data-tool="erase"> <i class="fas fa-eraser"></i> <div class="text-xs mt-1">Erase</div> </button> <button class="rosebud-tool-btn" data-tool="style"> <i class="fas fa-paint-brush"></i> <div class="text-xs mt-1">Style</div> </button> <button class="rosebud-tool-btn" data-tool="enhance"> <i class="fas fa-sparkles"></i> <div class="text-xs mt-1">Enhance</div> </button> </div> <div id="rosebudToolOptions" class="hidden mt-4 p-3 bg-gray-50 rounded-md"> <!-- Tool options will be inserted here --> </div> <div class="flex justify-end space-x-2 mt-4"> <button id="rosebudAdvancedDownloadBtn" class="rosebud-control-btn"> <i class="fas fa-download mr-1"></i> Download </button> <button id="rosebudAdvancedAddToCanvasBtn" class="rosebud-control-btn bg-pink-600 hover:bg-pink-700 text-white"> <i class="fas fa-plus mr-1"></i> Add to Canvas </button> </div> </div> </div> </div> </div> </div> <!-- Image Editor Modal --> <div id="imageEditorModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4"> <div class="bg-white rounded-lg w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden shadow-xl"> <div class="p-4 border-b flex justify-between items-center bg-gray-50"> <h3 class="text-lg font-semibold">Image Editor</h3> <div class="flex items-center space-x-3"> <button id="imageEditorUndoBtn" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-undo"></i> </button> <button id="imageEditorRedoBtn" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-redo"></i> </button> <button id="closeImageEditor" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-times"></i> </button> </div> </div> <div class="flex-1 overflow-hidden flex"> <!-- Left Panel - Tools --> <div class="w-16 border-r bg-gray-100 flex flex-col items-center py-4 space-y-4"> <button class="image-editor-tool active" data-tool="select" title="Select"> <i class="fas fa-mouse-pointer"></i> </button> <button class="image-editor-tool" data-tool="crop" title="Crop"> <i class="fas fa-crop"></i> </button> <button class="image-editor-tool" data-tool="adjust" title="Adjust"> <i class="fas fa-sliders-h"></i> </button> <button class="image-editor-tool" data-tool="filter" title="Filter"> <i class="fas fa-filter"></i> </button> <button class="image-editor-tool" data-tool="text" title="Text"> <i class="fas fa-font"></i> </button> <button class="image-editor-tool" data-tool="draw" title="Draw"> <i class="fas fa-pencil-alt"></i> </button> <button class="image-editor-tool" data-tool="erase" title="Erase"> <i class="fas fa-eraser"></i> </button> <button class="image-editor-tool" data-tool="shapes" title="Shapes"> <i class="fas fa-shapes"></i> </button> </div> <!-- Center Panel - Canvas --> <div class="flex-1 relative"> <div class="image-editor-tools"> <div class="flex space-x-2"> <button id="imageEditorZoomIn" class="image-editor-tool"> <i class="fas fa-search-plus"></i> </button> <button id="imageEditorZoomOut" class="image-editor-tool"> <i class="fas fa-search-minus"></i> </button> <button id="imageEditorResetZoom" class="image-editor-tool"> <i class="fas fa-expand-arrows-alt"></i> </button> </div> </div> <canvas id="imageEditorCanvas" class="image-editor-canvas"></canvas> </div> <!-- Right Panel - Properties --> <div class="w-64 border-l p-4 overflow-y-auto"> <div id="imageEditorProperties"> <h4 class="text-sm font-medium mb-2">Tool Properties</h4> <div class="space-y-4"> <div> <label class="block text-xs text-gray-500 mb-1">Brush Size</label> <input type="range" class="w-full" min="1" max="50" value="5"> </div> <div> <label class="block text-xs text-gray-500 mb-1">Opacity</label> <input type="range" class="w-full" min="0" max="100" value="100"> </div> <div> <label class="block text-xs text-gray-500 mb-1">Color</label> <input type="color" class="w-full h-8" value="#000000"> </div> </div> <div class="mt-6"> <h4 class="text-sm font-medium mb-2">Filters</h4> <div class="grid grid-cols-3 gap-2"> <button class="p-2 border rounded text-xs hover:bg-gray-100">Brightness</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Contrast</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Saturation</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Blur</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Sharpen</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Grayscale</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Sepia</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Invert</button> <button class="p-2 border rounded text-xs hover:bg-gray-100">Vintage</button> </div> </div> </div> </div> </div> <div class="p-4 border-t flex justify-end space-x-3"> <button id="imageEditorCancelBtn" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-200 rounded-md hover:bg-gray-300"> Cancel </button> <button id="imageEditorSaveBtn" class="px-4 py-2 text-sm font-medium text-white bg-primary rounded-md hover:bg-primary-dark"> Save Changes </button> </div> </div> </div> <!-- Style Transfer Modal --> <div id="styleTransferModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4"> <div class="bg-white rounded-lg w-full max-w-4xl flex flex-col overflow-hidden shadow-xl"> <div class="p-4 border-b flex justify-between items-center bg-gray-50"> <h3 class="text-lg font-semibold">Style Transfer</h3> <button id="closeStyleTransferModal" class="text-gray-500 hover:text-gray-700"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <p class="text-sm text-gray-600 mb-4">Upload a content image and select a style to apply.</p> <div class="style-transfer-container"> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Content Image</label> <div class="border-2 border-dashed border-gray-300 rounded-lg p-4 flex items-center justify-center"> <div id="styleTransferContentPreview" class="hidden"></div> <div id="styleTransferContentUpload" class="text-center"> <i class="fas fa-image text-4xl text-gray-400 mb-2"></i> <p class="text-sm text-gray-500">Drag & drop or click to upload</p> <input type="file" id="styleTransferContentInput" class="hidden" accept="image/*"> <button id="styleTransferContentBtn" class="mt-2 bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm"> Select Image </button> </div> </div> </div> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Style Image</label> <div class="border-2 border-dashed border-gray-300 rounded-lg p-4 flex items-center justify-center"> <div id="styleTransferStylePreview" class="hidden"></div> <div id="styleTransferStyleUpload" class="text-center"> <i class="fas fa-paint-brush text-4xl text-gray-400 mb-2"></i> <p class="text-sm text-gray-500">Drag & drop or click to upload</p> <input type="file" id="styleTransferStyleInput" class="hidden" accept="image/*"> <button id="styleTransferStyleBtn" class="mt-2 bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm"> Select Style </button> </div> </div> </div> </div> <div class="mt-4"> <label class="block text-sm font-medium text-gray-700 mb-1">Style Strength</label> <input type="range" id="styleTransferStrength" class="w-full" min="0" max="100" value="50"> <div class="flex justify-between text-xs text-gray-500 mt-1"> <span>Subtle</span> <span>Balanced</span> <span>Strong</span> </div> </div> <button id="styleTransferSubmit" class="style-transfer-btn mt-4"> <i class="fas fa-magic mr-1"></i> Apply Style Transfer </button> <div id="styleTransferResult" class="hidden mt-6"> <label class="block text-sm font-medium text-gray-700 mb-2">Result</label> <div id="styleTransferResultImage" class="border rounded-lg overflow-hidden"></div> <div class="flex justify-end space-x-2 mt-4"> <button id="styleTransferDownloadBtn" class="rosebud-control-btn"> <i class="fas fa-download mr-1"></i> Download </button> <button id="styleTransferAddToCanvasBtn" class="rosebud-control-btn bg-purple-600 hover:bg-purple-700 text-white"> <i class="fas fa-plus mr-1"></i> Add to Canvas </button> </div> </div> <div id="styleTransferLoading" class="ai-loading hidden"> <i class="ai-loading-spinner fas fa-spinner"></i> <span class="ml-2">Applying style transfer...</span> </div> </div> </div> </div> <script> document.addEventListener('DOMContentLoaded', function() { // Global variables let draggedItem = null; let selectedComponent = null; let components = []; let componentCounter = 0; let isResizing = false; let startX, startY, startWidth, startHeight; let isDraggingDivider = false; let activeModel = 'apwb'; // Default to APWB model let selectedRosebudImage = null; let selectedStyleTransferImage = null; let imageEditor = null; // DOM elements const canvas = document.getElementById('canvas'); const emptyState = document.getElementById('emptyState'); const propertiesPanel = document.getElementById('propertiesPanel'); const previewModal = document.getElementById('previewModal'); const previewFrame = document.getElementById('previewFrame'); const previewContainer = document.getElementById('previewContainer'); const deviceSelector = document.getElementById('deviceSelector'); const previewBtn = document.getElementById('previewBtn'); const closePreview = document.getElementById('closePreview'); const saveBtn = document.getElementById('saveBtn'); const exportBtn = document.getElementById('exportBtn'); const exportModal = document.getElementById('exportModal'); const exportCode = document.getElementById('exportCode'); const copyCodeBtn = document.getElementById('copyCodeBtn'); const downloadBtn = document.getElementById('downloadBtn'); const closeExport = document.getElementById('closeExport'); const tabBtns = document.querySelectorAll('[data-tab]'); const tabsContent = document.querySelectorAll('.tab-content'); const modelSelector = document.getElementById('modelSelector'); // AI Modal elements const aiPromptBtn = document.getElementById('aiPromptBtn'); const aiModal = document.getElementById('aiModal'); const aiPrompt = document.getElementById('aiPrompt'); const aiResponse = document.getElementById('aiResponse'); const aiLoading = document.getElementById('aiLoading'); const aiGeneratedComponents = document.getElementById('aiGeneratedComponents'); const aiComponentsList = document.getElementById('aiComponentsList'); const generateAIBtn = document.getElementById('generateAIBtn'); const cancelAIBtn = document.getElementById('cancelAIBtn'); const closeAIModal = document.getElementById('closeAIModal'); // APWB elements const apwbTab = document.getElementById('apwbTab'); const apwbPrompt = document.getElementById('apwbPrompt'); const apwbSubmit = document.getElementById('apwbSubmit'); const apwbResponse = document.getElementById('apwbResponse'); const apwbLoading = document.getElementById('apwbLoading'); // DeepCoder elements const deepcoderBtn = document.getElementById('deepcoderBtn'); const deepcoderModal = document.getElementById('deepcoderModal'); const closeDeepcoderModal = document.getElementById('closeDeepcoderModal'); const deepcoderTabs = document.querySelectorAll('.deepcoder-tab'); const deepcoderCodeTab = document.getElementById('deepcoderCodeTab'); const deepcoderTerminalTab = document.getElementById('deepcoderTerminalTab'); const deepcoderCode = document.getElementById('deepcoderCode'); const runCodeBtn = document.getElementById('runCodeBtn'); const clearCodeBtn = document.getElementById('clearCodeBtn'); const terminalContent = document.getElementById('terminalContent'); const terminalCommand = document.getElementById('terminalCommand'); const deepcoderAIPrompt = document.getElementById('deepcoderAIPrompt'); const deepcoderAISubmit = document.getElementById('deepcoderAISubmit'); const deepcoderAIResponse = document.getElementById('deepcoderAIResponse'); const deepcoderAILoading = document.getElementById('deepcoderAILoading'); // Rosebud elements const rosebudBtn = document.getElementById('rosebudBtn'); const rosebudModal = document.getElementById('rosebudModal'); const closeRosebudModal = document.getElementById('closeRosebudModal'); const rosebudPrompt = document.getElementById('rosebudPrompt'); const rosebudStyle = document.getElementById('rosebudStyle'); const rosebudRatio = document.getElementById('rosebudRatio'); const rosebudSubmit = document.getElementById('rosebudSubmit'); const rosebudResponse = document.getElementById('rosebudResponse'); const rosebudLoading = document.getElementById('rosebudLoading'); const rosebudImages = document.getElementById('rosebudImages'); const rosebudEditBtn = document.getElementById('rosebudEditBtn'); const rosebudDownloadBtn = document.getElementById('rosebudDownloadBtn'); const rosebudAddToCanvasBtn = document.getElementById('rosebudAddToCanvasBtn'); const rosebudEditControls = document.getElementById('rosebudEditControls'); // Rosebud Advanced elements const rosebudAdvancedPrompt = document.getElementById('rosebudAdvancedPrompt'); const rosebudAdvancedStyle = document.getElementById('rosebudAdvancedStyle'); const rosebudAdvancedRatio = document.getElementById('rosebudAdvancedRatio'); const rosebudQuality = document.getElementById('rosebudQuality'); const rosebudCreativity = document.getElementById('rosebudCreativity'); const rosebudNegativePrompt = document.getElementById('rosebudNegativePrompt'); const rosebudAdvancedSubmit = document.getElementById('rosebudAdvancedSubmit'); const rosebudAdvancedResponse = document.getElementById('rosebudAdvancedResponse'); const rosebudAdvancedLoading = document.getElementById('rosebudAdvancedLoading'); const rosebudAdvancedImages = document.getElementById('rosebudAdvancedImages'); const rosebudUpscaleBtn = document.getElementById('rosebudUpscaleBtn'); const rosebudVariationsBtn = document.getElementById('rosebudVariationsBtn'); const rosebudAdvancedDownloadBtn = document.getElementById('rosebudAdvancedDownloadBtn'); const rosebudAdvancedAddToCanvasBtn = document.getElementById('rosebudAdvancedAddToCanvasBtn'); const rosebudToolOptions = document.getElementById('rosebudToolOptions'); // Image Editor elements const imageEditorModal = document.getElementById('imageEditorModal'); const imageEditorCanvas = document.getElementById('imageEditorCanvas'); const imageEditorUndoBtn = document.getElementById('imageEditorUndoBtn'); const imageEditorRedoBtn = document.getElementById('imageEditorRedoBtn'); const closeImageEditor = document.getElementById('closeImageEditor'); const imageEditorZoomIn = document.getElementById('imageEditorZoomIn'); const imageEditorZoomOut = document.getElementById('imageEditorZoomOut'); const imageEditorResetZoom = document.getElementById('imageEditorResetZoom'); const imageEditorProperties = document.getElementById('imageEditorProperties'); const imageEditorCancelBtn = document.getElementById('imageEditorCancelBtn'); const imageEditorSaveBtn = document.getElementById('imageEditorSaveBtn'); // Style Transfer elements const styleTransferModal = document.getElementById('styleTransferModal'); const closeStyleTransferModal = document.getElementById('closeStyleTransferModal'); const styleTransferContentPreview = document.getElementById('styleTransferContentPreview'); const styleTransferContentUpload = document.getElementById('styleTransferContentUpload'); const styleTransferContentInput = document.getElementById('styleTransferContentInput'); const styleTransferContentBtn = document.getElementById('styleTransferContentBtn'); const styleTransferStylePreview = document.getElementById('styleTransferStylePreview'); const styleTransferStyleUpload = document.getElementById('styleTransferStyleUpload'); const styleTransferStyleInput = document.getElementById('styleTransferStyleInput'); const styleTransferStyleBtn = document.getElementById('styleTransferStyleBtn'); const styleTransferStrength = document.getElementById('styleTransferStrength'); const styleTransferSubmit = document.getElementById('styleTransferSubmit'); const styleTransferResult = document.getElementById('styleTransferResult'); const styleTransferResultImage = document.getElementById('styleTransferResultImage'); const styleTransferDownloadBtn = document.getElementById('styleTransferDownloadBtn'); const styleTransferAddToCanvasBtn = document.getElementById('styleTransferAddToCanvasBtn'); const styleTransferLoading = document.getElementById('styleTransferLoading'); // Split view elements const splitContainer = document.querySelector('.split-container'); const leftPanel = document.querySelector('.split-panel:first-child'); const rightPanel = document.querySelector('.split-panel:last-child'); const dividers = document.querySelectorAll('.split-divider'); // Initialize the builder function initBuilder() { initDragAndDrop(); initEventListeners(); initAIEventListeners(); initAPWBEventListeners(); initDeepCoderEventListeners(); initRosebudEventListeners(); initImageEditor(); initStyleTransfer(); initSplitView(); loadFromLocalStorage(); } // Initialize drag and drop function initDragAndDrop() { // Add event listeners to all components document.querySelectorAll('.component').forEach(item => { item.addEventListener('dragstart', handleDragStart); item.addEventListener('dragend', handleDragEnd); }); // Canvas drop events canvas.addEventListener('dragover', handleDragOver); canvas.addEventListener('dragleave', handleDragLeave); canvas.addEventListener('drop', handleDrop); } // Initialize event listeners function initEventListeners() { // Preview button previewBtn.addEventListener('click', showPreview); closePreview.addEventListener('click', hidePreview); // Save button saveBtn.addEventListener('click', saveToLocalStorage); // Export button exportBtn.addEventListener('click', showExportModal); closeExport.addEventListener('click', hideExportModal); copyCodeBtn.addEventListener('click', copyExportCode); downloadBtn.addEventListener('click', downloadHTML; // Device selector deviceSelector.addEventListener('change', updatePreviewDevice); // Tab buttons tabBtns.forEach(btn => { btn.addEventListener('click', () => { const tabId = btn.dataset.tab; tabBtns.forEach(b => b.classList.remove('active')); btn.classList.add('active'); tabsContent.forEach(content => content.classList.remove('active')); document.getElementById(`${tabId}Tab`).classList.add('active'); }); }); // Model selector modelSelector.addEventListener('change', (e) => { activeModel = e.target.value; showToast(`Switched to ${activeModel === 'apwb' ? 'APWB' : activeModel === 'deepcoder' ? 'DeepCoder' : activeModel === 'rosebud' ? 'Rosebud' : 'DeepSeek'} model`); }); } // Initialize AI event listeners function initAIEventListeners() { // AI Prompt button aiPromptBtn.addEventListener('click', showAIModal); closeAIModal.addEventListener('click', hideAIModal); cancelAIBtn.addEventListener('click', hideAIModal); // Generate AI button generateAIBtn.addEventListener('click', generateAIComponents); } // Initialize APWB event listeners function initAPWBEventListeners() { apwbSubmit.addEventListener('click', generateWithAPWB); // Allow pressing Enter in the APWB prompt apwbPrompt.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); generateWithAPWB(); } }); } // Initialize DeepCoder event listeners function initDeepCoderEventListeners() { // DeepCoder button deepcoderBtn.addEventListener('click', showDeepcoderModal); closeDeepcoderModal.addEventListener('click', hideDeepcoderModal); // DeepCoder tabs deepcoderTabs.forEach(tab => { tab.addEventListener('click', () => { const tabId = tab.dataset.tab; deepcoderTabs.forEach(t => t.classList.remove('active')); tab.classList.add('active'); document.querySelectorAll('.tab-content').forEach(content => { content.classList.remove('active'); }); document.getElementById(`deepcoder${tabId.charAt(0).toUpperCase() + tabId.slice(1)}Tab`).classList.add('active'); }); }); // Run code button runCodeBtn.addEventListener('click', runCode); // Clear code button clearCodeBtn.addEventListener('click', clearCode); // Terminal command input terminalCommand.addEventListener('keydown', (e) => { if (e.key === 'Enter') { executeTerminalCommand(); } }); // DeepCoder AI submit deepcoderAISubmit.addEventListener('click', generateWithDeepCoder); // Allow pressing Enter in the DeepCoder prompt deepcoderAIPrompt.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); generateWithDeepCoder(); } }); } // Initialize Rosebud event listeners function initRosebudEventListeners() { // Rosebud button rosebudBtn.addEventListener('click', showRosebudModal); closeRosebudModal.addEventListener('click', hideRosebudModal); // Rosebud submit rosebudSubmit.addEventListener('click', generateWithRosebud); // Rosebud advanced submit rosebudAdvancedSubmit.addEventListener('click', generateWithRosebudAdvanced); // Rosebud image selection rosebudImages.addEventListener('click', (e) => { if (e.target.classList.contains('rosebud-image')) { document.querySelectorAll('.rosebud-image').forEach(img => { img.classList.remove('selected'); }); e.target.classList.add('selected'); selectedRosebudImage = e.target.src; rosebudEditControls.classList.remove('hidden'); } }); // Rosebud advanced image selection rosebudAdvancedImages.addEventListener('click', (e) => { if (e.target.classList.contains('rosebud-image')) { document.querySelectorAll('.rosebud-image').forEach(img => { img.classList.remove('selected'); }); e.target.classList.add('selected'); selectedRosebudImage = e.target.src; } }); // Rosebud edit button rosebudEditBtn.addEventListener('click', () => { if (selectedRosebudImage) { openImageEditor(selectedRosebudImage); } }); // Rosebud download button rosebudDownloadBtn.addEventListener('click', () => { if (selectedRosebudImage) { downloadImage(selectedRosebudImage, 'rosebud-image.png'); } }); // Rosebud add to canvas button </html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DeepSeek Visual Builder with APWB & DeepCoder Integration</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
:root {
--primary: #6366f1;
--primary-dark: #4f46e5;
--secondary: #f43f5e;
--dark: #1e293b;
--light: #f8fafc;
}
body {
font-family: 'Inter', sans-serif;
@apply bg-gray-50 text-gray-800;
}
.component {
transition: all 0.2s ease;
cursor: grab;
@apply hover:shadow-md hover:border-primary/50;
}
.component:active {
cursor: grabbing;
}
.droppable {
min-height: calc(100vh - 180px);
transition: background-color 0.3s;
background-image:
linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
background-size: 20px 20px;
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.droppable.highlight {
@apply bg-primary/5 border-2 border-dashed border-primary;
animation: pulse 1.5s infinite;
}
.canvas-component {
@apply relative rounded-lg mb-4 overflow-hidden group transition-all duration-200;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.canvas-component:hover {
@apply shadow-lg;
}
.canvas-component.selected {
@apply ring-2 ring-primary ring-offset-2;
}
.component-toolbar {
@apply absolute top-0 left-0 right-0 bg-gray-800 flex items-center justify-between px-2 h-8 opacity-0 group-hover:opacity-100 transition-opacity duration-200;
}
.component-handle {
@apply text-white/80 hover:text-white cursor-move flex items-center;
}
.component-actions {
@apply flex items-center space-x-2;
}
.component-action-btn {
@apply text-white/60 hover:text-white p-1;
}
.properties-panel {
scrollbar-width: thin;
scrollbar-color: var(--primary) transparent;
}
.properties-panel::-webkit-scrollbar {
width: 6px;
}
.properties-panel::-webkit-scrollbar-thumb {
@apply bg-primary/30 rounded-full;
}
.properties-panel::-webkit-scrollbar-thumb:hover {
@apply bg-primary/50;
}
@keyframes pulse {
0%, 100% { background-color: rgba(99, 102, 241, 0.05); }
50% { background-color: rgba(99, 102, 241, 0.1); }